diff --git a/.classpath b/.classpath new file mode 100644 index 000000000..71e8cc144 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 000000000..0b76a40ba --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + processing-head + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..ef277e5a2 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,263 @@ +#Thu Jan 10 10:50:38 PST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +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=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +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.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=false +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_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=true +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.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +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=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_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_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_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_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_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.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=false +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_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..677b9819b --- /dev/null +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Thu Jan 10 10:50:38 PST 2008 +eclipse.preferences.version=1 +formatter_settings_version=11 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/app/.classpath b/app/.classpath new file mode 100644 index 000000000..26775c499 --- /dev/null +++ b/app/.classpath @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/.classpath_macosx b/app/.classpath_macosx new file mode 100644 index 000000000..26775c499 --- /dev/null +++ b/app/.classpath_macosx @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/.classpath_vista b/app/.classpath_vista new file mode 100755 index 000000000..c7ec5acb9 --- /dev/null +++ b/app/.classpath_vista @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/.project b/app/.project new file mode 100644 index 000000000..69a82c3d0 --- /dev/null +++ b/app/.project @@ -0,0 +1,17 @@ + + + processing + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/app/.settings/org.eclipse.jdt.core.prefs b/app/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..d6676cc6b --- /dev/null +++ b/app/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,320 @@ +#Wed Jun 04 15:47:46 EDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +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.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +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=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +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_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.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=true +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.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +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=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_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_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_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_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_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.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=false +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_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/app/.settings/org.eclipse.jdt.ui.prefs b/app/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..4ce979da4 --- /dev/null +++ b/app/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Tue Jun 03 17:00:03 EDT 2008 +eclipse.preferences.version=1 +formatter_profile=_two spaces no tabs +formatter_settings_version=11 diff --git a/app/lib/antlr.jar b/app/lib/antlr.jar new file mode 100644 index 000000000..42f25e540 Binary files /dev/null and b/app/lib/antlr.jar differ diff --git a/app/lib/apple.jar b/app/lib/apple.jar new file mode 100755 index 000000000..160d62b66 Binary files /dev/null and b/app/lib/apple.jar differ diff --git a/app/lib/ecj.jar b/app/lib/ecj.jar new file mode 100644 index 000000000..878a32cfc Binary files /dev/null and b/app/lib/ecj.jar differ diff --git a/app/lib/jna.jar b/app/lib/jna.jar new file mode 100644 index 000000000..5c669aff6 Binary files /dev/null and b/app/lib/jna.jar differ diff --git a/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java b/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java new file mode 100644 index 000000000..d997f0be8 --- /dev/null +++ b/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java @@ -0,0 +1,132 @@ +package antlr; + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/RIGHTS.html + * + * $Id: ExtendedCommonASTWithHiddenTokens.java 3419 2007-07-16 14:02:05Z fry $ + */ + +import java.io.*; +//import antlr.*; +import antlr.collections.*; +//import antlr.collections.impl.*; + +/** A CommonAST whose initialization copies hidden token + * information from the Token used to create a node. + */ +public class ExtendedCommonASTWithHiddenTokens + extends CommonASTWithHiddenTokens { + + public ExtendedCommonASTWithHiddenTokens() { + super(); + } + + public ExtendedCommonASTWithHiddenTokens(Token tok) { + super(tok); + } + + public void initialize(AST ast) { + ExtendedCommonASTWithHiddenTokens a = + (ExtendedCommonASTWithHiddenTokens)ast; + super.initialize(a); + hiddenBefore = a.getHiddenBefore(); + hiddenAfter = a.getHiddenAfter(); + } + + public String getHiddenAfterString() { + + CommonHiddenStreamToken t; + StringBuffer hiddenAfterString = new StringBuffer(100); + + for ( t = hiddenAfter ; t != null ; t = t.getHiddenAfter() ) { + hiddenAfterString.append(t.getText()); + } + + return hiddenAfterString.toString(); + } + + public String getHiddenBeforeString() { + + antlr.CommonHiddenStreamToken + child = null, + parent = hiddenBefore; + + // if there aren't any hidden tokens here, quietly return + // + if (parent == null) { + return ""; + } + + // traverse back to the head of the list of tokens before this node + do { + child = parent; + parent = child.getHiddenBefore(); + } while (parent != null); + + // dump that list + + StringBuffer hiddenBeforeString = new StringBuffer(100); + + for ( CommonHiddenStreamToken t = child; t != null ; + t = t.getHiddenAfter() ) { + hiddenBeforeString.append(t.getText()); + } + + return hiddenBeforeString.toString(); + } + + public void xmlSerializeNode(Writer out) + throws IOException { + StringBuffer buf = new StringBuffer(100); + buf.append("<"); + buf.append(getClass().getName() + " "); + + buf.append("hiddenBeforeString=\"" + + encode(getHiddenBeforeString()) + + "\" text=\"" + encode(getText()) + "\" type=\"" + + getType() + "\" hiddenAfterString=\"" + + encode(getHiddenAfterString()) + "\"/>"); + out.write(buf.toString()); + } + + public void xmlSerializeRootOpen(Writer out) + throws IOException { + StringBuffer buf = new StringBuffer(100); + buf.append("<"); + buf.append(getClass().getName() + " "); + buf.append("hiddenBeforeString=\"" + + encode(getHiddenBeforeString()) + + "\" text=\"" + encode(getText()) + "\" type=\"" + + getType() + "\" hiddenAfterString=\"" + + encode(getHiddenAfterString()) + "\">\n"); + out.write(buf.toString()); + } + + public void xmlSerializeRootClose(Writer out) + throws IOException { + out.write("\n"); + } + + public void xmlSerialize(Writer out) throws IOException { + // print out this node and all siblings + for (AST node = this; + node != null; + node = node.getNextSibling()) { + if (node.getFirstChild() == null) { + // print guts (class name, attributes) + ((BaseAST)node).xmlSerializeNode(out); + } + else { + ((BaseAST)node).xmlSerializeRootOpen(out); + + // print children + ((BaseAST)node.getFirstChild()).xmlSerialize(out); + + // print end tag + ((BaseAST)node).xmlSerializeRootClose(out); + } + } + } + +} diff --git a/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java b/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java new file mode 100644 index 000000000..cd3306aed --- /dev/null +++ b/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java @@ -0,0 +1,221 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +package antlr; +//package processing.app.preproc; + + +//import antlr.*; +import antlr.collections.impl.BitSet; + +/** + * This class provides TokenStreamHiddenTokenFilters with the concept of + * tokens which can be copied so that they are seen by both the hidden token + * stream as well as the parser itself. This is useful when one wants to use + * an existing parser (like the Java parser included with ANTLR) that throws + * away some tokens to create a parse tree which can be used to spit out + * a copy of the code with only minor modifications. + * + * This code is partially derived from the public domain ANLTR TokenStream + */ +public class TokenStreamCopyingHiddenTokenFilter + extends TokenStreamHiddenTokenFilter + implements TokenStream { + + protected BitSet copyMask; + CommonHiddenStreamToken hiddenCopy = null; + + public TokenStreamCopyingHiddenTokenFilter(TokenStream input) { + super(input); + copyMask = new BitSet(); + } + + /** + * Indicate that all tokens of type tokenType should be copied. The copy + * is put in the stream of hidden tokens, and the original is returned in the + * stream of normal tokens. + * + * @param tokenType integer representing the token type to copied + */ + public void copy(int tokenType) { + copyMask.add(tokenType); + } + + /** + * Create a clone of the important parts of the given token. Note that this + * does NOT copy the hiddenBefore and hiddenAfter fields. + * + * @param t token to partially clone + * @return newly created partial clone + */ + public CommonHiddenStreamToken partialCloneToken(CommonHiddenStreamToken t) { + + CommonHiddenStreamToken u = new CommonHiddenStreamToken(t.getType(), + t.getText()); + u.setColumn(t.getColumn()); + u.setLine(t.getLine()); + u.setFilename(t.getFilename()); + + return u; + } + + public void linkAndCopyToken(CommonHiddenStreamToken prev, + CommonHiddenStreamToken monitored) { + // create a copy of the token in the lookahead for use as hidden token + hiddenCopy = partialCloneToken(LA(1)); + + // attach copy to the previous token, whether hidden or monitored + prev.setHiddenAfter(hiddenCopy); + + // if previous token was hidden, set the hiddenBefore pointer of the + // copy to point back to it + if (prev != monitored) { + hiddenCopy.setHiddenBefore(prev); + } + + // we don't want the non-hidden copy to link back to the hidden + // copy on the next pass through this function, so we leave + // lastHiddenToken alone + + //System.err.println("hidden copy: " + hiddenCopy.toString()); + + return; + } + + private void consumeFirst() throws TokenStreamException { + consume(); // get first token of input stream + + // Handle situation where hidden or discarded tokens + // appear first in input stream + CommonHiddenStreamToken p=null; + + // while hidden, copied, or discarded scarf tokens + while ( hideMask.member(LA(1).getType()) || + discardMask.member(LA(1).getType()) || + copyMask.member(LA(1).getType()) ) { + + // if we've hit one of the tokens that needs to be copied, we copy it + // and then break out of the loop, because the parser needs to see it + // too + // + if (copyMask.member(LA(1).getType())) { + + // copy the token in the lookahead + hiddenCopy = partialCloneToken(LA(1)); + + // if there's an existing token before this, link that and the + // copy together + if (p != null) { + p.setHiddenAfter(hiddenCopy); + hiddenCopy.setHiddenBefore(p); // double-link + } + + lastHiddenToken = hiddenCopy; + if (firstHidden == null) { + firstHidden = hiddenCopy; + } + + // we don't want to consume this token, because it also needs to + // be passed through to the parser, so break out of the while look + // entirely + // + break; + } else if (hideMask.member(LA(1).getType())) { + if (p != null) { + p.setHiddenAfter(LA(1)); + LA(1).setHiddenBefore(p); // double-link + } + p = LA(1); + + lastHiddenToken = p; + if (firstHidden == null) { + firstHidden = p; // record hidden token if first + } + } + consume(); + } + } + + /** Return the next monitored token. + * Test the token following the monitored token. + * If following is another monitored token, save it + * for the next invocation of nextToken (like a single + * lookahead token) and return it then. + * If following is unmonitored, nondiscarded (hidden) + * channel token, add it to the monitored token. + * + * Note: EOF must be a monitored Token. + */ + public Token nextToken() throws TokenStreamException { + // handle an initial condition; don't want to get lookahead + // token of this splitter until first call to nextToken + if (LA(1) == null) { + consumeFirst(); + } + + //System.err.println(); + + // we always consume hidden tokens after monitored, thus, + // upon entry LA(1) is a monitored token. + CommonHiddenStreamToken monitored = LA(1); + + // point to hidden tokens found during last invocation + monitored.setHiddenBefore(lastHiddenToken); + lastHiddenToken = null; + + // Look for hidden tokens, hook them into list emanating + // from the monitored tokens. + consume(); + CommonHiddenStreamToken prev = monitored; + + // deal with as many not-purely-monitored tokens as possible + while ( hideMask.member(LA(1).getType()) || + discardMask.member(LA(1).getType()) || + copyMask.member(LA(1).getType()) ) { + + if (copyMask.member(LA(1).getType())) { + + // copy the token and link it backwards + if (hiddenCopy != null) { + linkAndCopyToken(hiddenCopy, monitored); + } else { + linkAndCopyToken(prev, monitored); + } + + // we now need to parse it as a monitored token, so we return, which + // avoids the consume() call at the end of this loop. the next call + // will parse it as a monitored token. + //System.err.println("returned: " + monitored.toString()); + return monitored; + + } else if (hideMask.member(LA(1).getType())) { + + // attach the hidden token to the monitored in a chain + // link forwards + prev.setHiddenAfter(LA(1)); + + // link backwards + if (prev != monitored) { //hidden cannot point to monitored tokens + LA(1).setHiddenBefore(prev); + } else if (hiddenCopy != null) { + hiddenCopy.setHiddenAfter(LA(1)); + LA(1).setHiddenBefore(hiddenCopy); + hiddenCopy = null; + } + + //System.err.println("hidden: " + prev.getHiddenAfter().toString() + "\" after: " + prev.toString()); + prev = lastHiddenToken = LA(1); + } + + consume(); + } + + // remember the last hidden token for next time around + if (hiddenCopy != null) { + lastHiddenToken = hiddenCopy; + hiddenCopy = null; + } + + //System.err.println("returned: " + monitored.toString()); + return monitored; + } +} diff --git a/app/src/antlr/java/java.g b/app/src/antlr/java/java.g new file mode 100644 index 000000000..ee948ccd0 --- /dev/null +++ b/app/src/antlr/java/java.g @@ -0,0 +1,1277 @@ +header { +package antlr.java; +} + +/** Java 1.3 Recognizer + *
+ * Run 'java Main [-showtree] directory-full-of-java-files'
+ *
+ * [The -showtree option pops up a Swing frame that shows
+ *  the AST constructed from the parser.]
+ *
+ * Run 'java Main '
+ *
+ * Contributing authors:
+ *		John Mitchell		johnm@non.net
+ *		Terence Parr		parrt@magelang.com
+ *		John Lilley			jlilley@empathy.com
+ *		Scott Stanchfield	thetick@magelang.com
+ *		Markus Mohnen       mohnen@informatik.rwth-aachen.de
+ *      Peter Williams      pete.williams@sun.com
+ *      Allan Jacobs        Allan.Jacobs@eng.sun.com
+ *      Steve Messick       messick@redhills.com
+ *      John Pybus			john@pybus.org
+ *
+ * Version 1.00 December 9, 1997 -- initial release
+ * Version 1.01 December 10, 1997
+ *		fixed bug in octal def (0..7 not 0..8)
+ * Version 1.10 August 1998 (parrt)
+ *		added tree construction
+ *		fixed definition of WS,comments for mac,pc,unix newlines
+ *		added unary plus
+ * Version 1.11 (Nov 20, 1998)
+ *		Added "shutup" option to turn off last ambig warning.
+ *		Fixed inner class def to allow named class defs as statements
+ *		synchronized requires compound not simple statement
+ *		add [] after builtInType DOT class in primaryExpression
+ *		"const" is reserved but not valid..removed from modifiers
+ * Version 1.12 (Feb 2, 1999)
+ *		Changed LITERAL_xxx to xxx in tree grammar.
+ *		Updated java.g to use tokens {...} now for 2.6.0 (new feature).
+ *
+ * Version 1.13 (Apr 23, 1999)
+ *		Didn't have (stat)? for else clause in tree parser.
+ *		Didn't gen ASTs for interface extends.  Updated tree parser too.
+ *		Updated to 2.6.0.
+ * Version 1.14 (Jun 20, 1999)
+ *		Allowed final/abstract on local classes.
+ *		Removed local interfaces from methods
+ *		Put instanceof precedence where it belongs...in relationalExpr
+ *			It also had expr not type as arg; fixed it.
+ *		Missing ! on SEMI in classBlock
+ *		fixed: (expr) + "string" was parsed incorrectly (+ as unary plus).
+ *		fixed: didn't like Object[].class in parser or tree parser
+ * Version 1.15 (Jun 26, 1999)
+ *		Screwed up rule with instanceof in it. :(  Fixed.
+ *		Tree parser didn't like (expr).something; fixed.
+ *		Allowed multiple inheritance in tree grammar. oops.
+ * Version 1.16 (August 22, 1999)
+ *		Extending an interface built a wacky tree: had extra EXTENDS.
+ *		Tree grammar didn't allow multiple superinterfaces.
+ *		Tree grammar didn't allow empty var initializer: {}
+ * Version 1.17 (October 12, 1999)
+ *		ESC lexer rule allowed 399 max not 377 max.
+ *		java.tree.g didn't handle the expression of synchronized
+ *		statements.
+ * Version 1.18 (August 12, 2001)
+ *      	Terence updated to Java 2 Version 1.3 by
+ *		observing/combining work of Allan Jacobs and Steve
+ *		Messick.  Handles 1.3 src.  Summary:
+ *		o  primary didn't include boolean.class kind of thing
+ *      	o  constructor calls parsed explicitly now:
+ * 		   see explicitConstructorInvocation
+ *		o  add strictfp modifier
+ *      	o  missing objBlock after new expression in tree grammar
+ *		o  merged local class definition alternatives, moved after declaration
+ *		o  fixed problem with ClassName.super.field
+ *      	o  reordered some alternatives to make things more efficient
+ *		o  long and double constants were not differentiated from int/float
+ *		o  whitespace rule was inefficient: matched only one char
+ *		o  add an examples directory with some nasty 1.3 cases
+ *		o  made Main.java use buffered IO and a Reader for Unicode support
+ *		o  supports UNICODE?
+ *		   Using Unicode charVocabulay makes code file big, but only
+ *		   in the bitsets at the end. I need to make ANTLR generate
+ *		   unicode bitsets more efficiently.
+ * Version 1.19 (April 25, 2002)
+ *		Terence added in nice fixes by John Pybus concerning floating
+ *		constants and problems with super() calls.  John did a nice
+ *		reorg of the primary/postfix expression stuff to read better
+ *		and makes f.g.super() parse properly (it was METHOD_CALL not
+ *		a SUPER_CTOR_CALL).  Also:
+ *
+ *		o  "finally" clause was a root...made it a child of "try"
+ *		o  Added stuff for asserts too for Java 1.4, but *commented out*
+ *		   as it is not backward compatible.
+ *
+ * Version 1.20 (October 27, 2002)
+ *
+ *      Terence ended up reorging John Pybus' stuff to
+ *      remove some nondeterminisms and some syntactic predicates.
+ *      Note that the grammar is stricter now; e.g., this(...) must
+ *	be the first statement.
+ *
+ *      Trinary ?: operator wasn't working as array name:
+ *          (isBig ? bigDigits : digits)[i];
+ *
+ *      Checked parser/tree parser on source for
+ *          Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4,
+ *	    and the 110k-line jGuru server source.
+ *
+ * This grammar is in the PUBLIC DOMAIN
+ * 
+ */ +class JavaRecognizer extends Parser; +options { + k = 2; // two token lookahead + exportVocab=Java; // Call its vocabulary "Java" + codeGenMakeSwitchThreshold = 2; // Some optimizations + codeGenBitsetTestThreshold = 3; + defaultErrorHandler = false; // Don't generate parser error handlers + buildAST = true; +} + +tokens { + BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF; + INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF; + PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE; + PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP; + POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT; + IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION; + FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract"; + STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL; +} + +// Compilation Unit: In Java, this is a single file. This is the start +// rule for this parser +compilationUnit + : // A compilation unit starts with an optional package definition + ( packageDefinition + | /* nothing */ + ) + + // Next we have a series of zero or more import statements + ( importDefinition )* + + // Wrapping things up with any number of class or interface + // definitions + ( typeDefinition )* + + EOF! + ; + + +// Package statement: "package" followed by an identifier. +packageDefinition + options {defaultErrorHandler = true;} // let ANTLR handle errors + : p:"package"^ {#p.setType(PACKAGE_DEF);} identifier SEMI! + ; + + +// Import statement: import followed by a package or class name +importDefinition + options {defaultErrorHandler = true;} + : i:"import"^ {#i.setType(IMPORT);} identifierStar SEMI! + ; + +// A type definition in a file is either a class or interface definition. +typeDefinition + options {defaultErrorHandler = true;} + : m:modifiers! + ( classDefinition[#m] + | interfaceDefinition[#m] + ) + | SEMI! + ; + +/** A declaration is the creation of a reference or primitive-type variable + * Create a separate Type/Var tree for each var in the var list. + */ +declaration! + : m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t] + {#declaration = #v;} + ; + +// A type specification is a type name with possible brackets afterwards +// (which would make it an array type). +typeSpec[boolean addImagNode] + : classTypeSpec[addImagNode] + | builtInTypeSpec[addImagNode] + ; + +// A class type specification is a class type with possible brackets afterwards +// (which would make it an array type). +classTypeSpec[boolean addImagNode] + : identifier (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* + { + if ( addImagNode ) { + #classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec); + } + } + ; + +// A builtin type specification is a builtin type with possible brackets +// afterwards (which would make it an array type). +builtInTypeSpec[boolean addImagNode] + : builtInType (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* + { + if ( addImagNode ) { + #builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec); + } + } + ; + +// A type name. which is either a (possibly qualified) class name or +// a primitive (builtin) type +type + : identifier + | builtInType + ; + +// The primitive types. +builtInType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +// A (possibly-qualified) java identifier. We start with the first IDENT +// and expand its name by adding dots and following IDENTS +identifier + : IDENT ( DOT^ IDENT )* + ; + +identifierStar + : IDENT + ( DOT^ IDENT )* + ( DOT^ STAR )? + ; + +// A list of zero or more modifiers. We could have used (modifier)* in +// place of a call to modifiers, but I thought it was a good idea to keep +// this rule separate so they can easily be collected in a Vector if +// someone so desires +modifiers + : ( modifier )* + {#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);} + ; + +// modifiers for Java classes, interfaces, class/instance vars and methods +modifier + : "private" + | "public" + | "protected" + | "static" + | "transient" + | "final" + | "abstract" + | "native" + | "threadsafe" + | "synchronized" +// | "const" // reserved word, but not valid + | "volatile" + | "strictfp" + ; + +// Definition of a Java class +classDefinition![AST modifiers] + : "class" IDENT + // it _might_ have a superclass... + sc:superClassClause + // it might implement some interfaces... + ic:implementsClause + // now parse the body of the class + cb:classBlock + {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"], + modifiers,IDENT,sc,ic,cb);} + ; + +superClassClause! + : ( "extends" id:identifier )? + {#superClassClause = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],id);} + ; + +// Definition of a Java Interface +interfaceDefinition![AST modifiers] + : "interface" IDENT + // it might extend some other interfaces + ie:interfaceExtends + // now parse the body of the interface (looks like a class...) + cb:classBlock + {#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"], + modifiers,IDENT,ie,cb);} + ; + + +// This is the body of a class. You can have fields and extra semicolons, +// That's about it (until you see what a field is...) +classBlock + : LCURLY! + ( field | SEMI! )* + RCURLY! + {#classBlock = #([OBJBLOCK, "OBJBLOCK"], #classBlock);} + ; + +// An interface can extend several other interfaces... +interfaceExtends + : ( + e:"extends"! + identifier ( COMMA! identifier )* + )? + {#interfaceExtends = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"], + #interfaceExtends);} + ; + +// A class can implement several interfaces... +implementsClause + : ( + i:"implements"! identifier ( COMMA! identifier )* + )? + {#implementsClause = #(#[IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"], + #implementsClause);} + ; + +// Now the various things that can be defined inside a class or interface... +// Note that not all of these are really valid in an interface (constructors, +// for example), and if this grammar were used for a compiler there would +// need to be some semantic checks to make sure we're doing the right thing... +field! + : // method, constructor, or variable declaration + mods:modifiers + ( h:ctorHead s:constructorBody // constructor + {#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, h, s);} + + | cd:classDefinition[#mods] // inner class + {#field = #cd;} + + | id:interfaceDefinition[#mods] // inner interface + {#field = #id;} + + | t:typeSpec[false] // method or variable declaration(s) + ( IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN! param:parameterDeclarationList RPAREN! + + rt:declaratorBrackets[#t] + + // get the list of exceptions that this method is + // declared to throw + (tc:throwsClause)? + + ( s2:compoundStatement | SEMI ) + {#field = #(#[METHOD_DEF,"METHOD_DEF"], + mods, + #(#[TYPE,"TYPE"],rt), + IDENT, + param, + tc, + s2);} + | v:variableDefinitions[#mods,#t] SEMI +// {#field = #(#[VARIABLE_DEF,"VARIABLE_DEF"], v);} + {#field = #v;} + ) + ) + + // "static { ... }" class initializer + | "static" s3:compoundStatement + {#field = #(#[STATIC_INIT,"STATIC_INIT"], s3);} + + // "{ ... }" instance initializer + | s4:compoundStatement + {#field = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);} + ; + +constructorBody + : lc:LCURLY^ {#lc.setType(SLIST);} + ( options { greedy=true; } : explicitConstructorInvocation)? + (statement)* + RCURLY! + ; + +/** Catch obvious constructor calls, but not the expr.super(...) calls */ +explicitConstructorInvocation + : "this"! lp1:LPAREN^ argList RPAREN! SEMI! + {#lp1.setType(CTOR_CALL);} + | "super"! lp2:LPAREN^ argList RPAREN! SEMI! + {#lp2.setType(SUPER_CTOR_CALL);} + ; + +variableDefinitions[AST mods, AST t] + : variableDeclarator[getASTFactory().dupTree(mods), + getASTFactory().dupTree(t)] + ( COMMA! + variableDeclarator[getASTFactory().dupTree(mods), + getASTFactory().dupTree(t)] + )* + ; + +/** Declaration of a variable. This can be a class/instance variable, + * or a local variable in a method + * It can also include possible initialization. + */ +variableDeclarator![AST mods, AST t] + : id:IDENT d:declaratorBrackets[t] v:varInitializer + {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v);} + ; + +declaratorBrackets[AST typ] + : {#declaratorBrackets=typ;} + (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* + ; + +varInitializer + : ( ASSIGN^ initializer )? + ; + +// This is an initializer used to set up an array. +arrayInitializer + : lc:LCURLY^ {#lc.setType(ARRAY_INIT);} + ( initializer + ( + // CONFLICT: does a COMMA after an initializer start a new + // initializer or start the option ',' at end? + // ANTLR generates proper code by matching + // the comma as soon as possible. + options { + warnWhenFollowAmbig = false; + } + : + COMMA! initializer + )* + (COMMA!)? + )? + RCURLY! + ; + + +// The two "things" that can initialize an array element are an expression +// and another (nested) array initializer. +initializer + : expression + | arrayInitializer + ; + +// This is the header of a method. It includes the name and parameters +// for the method. +// This also watches for a list of exception classes in a "throws" clause. +ctorHead + : IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN! parameterDeclarationList RPAREN! + + // get the list of exceptions that this method is declared to throw + (throwsClause)? + ; + +// This is a list of exception classes that the method is declared to throw +throwsClause + : "throws"^ identifier ( COMMA! identifier )* + ; + + +// A list of formal parameters +parameterDeclarationList + : ( parameterDeclaration ( COMMA! parameterDeclaration )* )? + {#parameterDeclarationList = #(#[PARAMETERS,"PARAMETERS"], + #parameterDeclarationList);} + ; + +// A formal parameter. +parameterDeclaration! + : pm:parameterModifier t:typeSpec[false] id:IDENT + pd:declaratorBrackets[#t] + {#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"], + pm, #([TYPE,"TYPE"],pd), id);} + ; + +parameterModifier + : (f:"final")? + {#parameterModifier = #(#[MODIFIERS,"MODIFIERS"], f);} + ; + +// Compound statement. This is used in many contexts: +// Inside a class definition prefixed with "static": +// it is a class initializer +// Inside a class definition without "static": +// it is an instance initializer +// As the body of a method +// As a completely indepdent braced block of code inside a method +// it starts a new scope for variable definitions + +compoundStatement + : lc:LCURLY^ {#lc.setType(SLIST);} + // include the (possibly-empty) list of statements + (statement)* + RCURLY! + ; + + +statement + // A list of statements in curly braces -- start a new scope! + : compoundStatement + + // declarations are ambiguous with "ID DOT" relative to expression + // statements. Must backtrack to be sure. Could use a semantic + // predicate to test symbol table to see what the type was coming + // up, but that's pretty hard without a symbol table ;) + | (declaration)=> declaration SEMI! + + // An expression statement. This could be a method call, + // assignment statement, or any other expression evaluated for + // side-effects. + | expression SEMI! + + // class definition + | m:modifiers! classDefinition[#m] + + // Attach a label to the front of a statement + | IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement + + // If-else statement + | "if"^ LPAREN! expression RPAREN! statement + ( + // CONFLICT: the old "dangling-else" problem... + // ANTLR generates proper code matching + // as soon as possible. Hush warning. + options { + warnWhenFollowAmbig = false; + } + : + "else"! statement + )? + + // For statement + | "for"^ + LPAREN! + forInit SEMI! // initializer + forCond SEMI! // condition test + forIter // updater + RPAREN! + statement // statement to loop over + + // While statement + | "while"^ LPAREN! expression RPAREN! statement + + // do-while statement + | "do"^ statement "while"! LPAREN! expression RPAREN! SEMI! + + // get out of a loop (or switch) + | "break"^ (IDENT)? SEMI! + + // do next iteration of a loop + | "continue"^ (IDENT)? SEMI! + + // Return an expression + | "return"^ (expression)? SEMI! + + // switch/case statement + | "switch"^ LPAREN! expression RPAREN! LCURLY! + ( casesGroup )* + RCURLY! + + // exception try-catch block + | tryBlock + + // throw an exception + | "throw"^ expression SEMI! + + // synchronize a statement + | "synchronized"^ LPAREN! expression RPAREN! compoundStatement + + // asserts (uncomment if you want 1.4 compatibility) + | "assert"^ expression ( COLON! expression )? SEMI! + + // empty statement + | s:SEMI {#s.setType(EMPTY_STAT);} + ; + +casesGroup + : ( // CONFLICT: to which case group do the statements bind? + // ANTLR generates proper code: it groups the + // many "case"/"default" labels together then + // follows them with the statements + options { + greedy = true; + } + : + aCase + )+ + caseSList + {#casesGroup = #([CASE_GROUP, "CASE_GROUP"], #casesGroup);} + ; + +aCase + : ("case"^ expression | "default") COLON! + ; + +caseSList + : (statement)* + {#caseSList = #(#[SLIST,"SLIST"],#caseSList);} + ; + +// The initializer for a for loop +forInit + // if it looks like a declaration, it is + : ( (declaration)=> declaration + // otherwise it could be an expression list... + | expressionList + )? + {#forInit = #(#[FOR_INIT,"FOR_INIT"],#forInit);} + ; + +forCond + : (expression)? + {#forCond = #(#[FOR_CONDITION,"FOR_CONDITION"],#forCond);} + ; + +forIter + : (expressionList)? + {#forIter = #(#[FOR_ITERATOR,"FOR_ITERATOR"],#forIter);} + ; + +// an exception handler try/catch block +tryBlock + : "try"^ compoundStatement + (handler)* + ( finallyClause )? + ; + +finallyClause + : "finally"^ compoundStatement + ; + +// an exception handler +handler + : "catch"^ LPAREN! parameterDeclaration RPAREN! compoundStatement + ; + + +// expressions +// Note that most of these expressions follow the pattern +// thisLevelExpression : +// nextHigherPrecedenceExpression +// (OPERATOR nextHigherPrecedenceExpression)* +// which is a standard recursive definition for a parsing an expression. +// The operators in java have the following precedences: +// lowest (13) = *= /= %= += -= <<= >>= >>>= &= ^= |= +// (12) ?: +// (11) || +// (10) && +// ( 9) | +// ( 8) ^ +// ( 7) & +// ( 6) == != +// ( 5) < <= > >= +// ( 4) << >> +// ( 3) +(binary) -(binary) +// ( 2) * / % +// ( 1) ++ -- +(unary) -(unary) ~ ! (type) +// [] () (method call) . (dot -- identifier qualification) +// new () (explicit parenthesis) +// +// the last two are not usually on a precedence chart; I put them in +// to point out that new has a higher precedence than '.', so you +// can validy use +// new Frame().show() +// +// Note that the above precedence levels map to the rules below... +// Once you have a precedence chart, writing the appropriate rules as below +// is usually very straightfoward + + + +// the mother of all expressions +expression + : assignmentExpression + {#expression = #(#[EXPR,"EXPR"],#expression);} + ; + + +// This is a list of expressions. +expressionList + : expression (COMMA! expression)* + {#expressionList = #(#[ELIST,"ELIST"], expressionList);} + ; + + +// assignment expression (level 13) +assignmentExpression + : conditionalExpression + ( ( ASSIGN^ + | PLUS_ASSIGN^ + | MINUS_ASSIGN^ + | STAR_ASSIGN^ + | DIV_ASSIGN^ + | MOD_ASSIGN^ + | SR_ASSIGN^ + | BSR_ASSIGN^ + | SL_ASSIGN^ + | BAND_ASSIGN^ + | BXOR_ASSIGN^ + | BOR_ASSIGN^ + ) + assignmentExpression + )? + ; + + +// conditional test (level 12) +conditionalExpression + : logicalOrExpression + ( QUESTION^ assignmentExpression COLON! conditionalExpression )? + ; + + +// logical or (||) (level 11) +logicalOrExpression + : logicalAndExpression (LOR^ logicalAndExpression)* + ; + + +// logical and (&&) (level 10) +logicalAndExpression + : inclusiveOrExpression (LAND^ inclusiveOrExpression)* + ; + + +// bitwise or non-short-circuiting or (|) (level 9) +inclusiveOrExpression + : exclusiveOrExpression (BOR^ exclusiveOrExpression)* + ; + + +// exclusive or (^) (level 8) +exclusiveOrExpression + : andExpression (BXOR^ andExpression)* + ; + + +// bitwise or non-short-circuiting and (&) (level 7) +andExpression + : equalityExpression (BAND^ equalityExpression)* + ; + + +// equality/inequality (==/!=) (level 6) +equalityExpression + : relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)* + ; + + +// boolean relational expressions (level 5) +relationalExpression + : shiftExpression + ( ( ( LT^ + | GT^ + | LE^ + | GE^ + ) + shiftExpression + )* + | "instanceof"^ typeSpec[true] + ) + ; + + +// bit shift expressions (level 4) +shiftExpression + : additiveExpression ((SL^ | SR^ | BSR^) additiveExpression)* + ; + + +// binary addition/subtraction (level 3) +additiveExpression + : multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)* + ; + + +// multiplication/division/modulo (level 2) +multiplicativeExpression + : unaryExpression ((STAR^ | DIV^ | MOD^ ) unaryExpression)* + ; + +unaryExpression + : INC^ unaryExpression + | DEC^ unaryExpression + | MINUS^ {#MINUS.setType(UNARY_MINUS);} unaryExpression + | PLUS^ {#PLUS.setType(UNARY_PLUS);} unaryExpression + | unaryExpressionNotPlusMinus + ; + +unaryExpressionNotPlusMinus + : BNOT^ unaryExpression + | LNOT^ unaryExpression + + | ( // subrule allows option to shut off warnings + options { + // "(int" ambig with postfixExpr due to lack of sequence + // info in linear approximate LL(k). It's ok. Shut up. + generateAmbigWarnings=false; + } + : // If typecast is built in type, must be numeric operand + // Also, no reason to backtrack if type keyword like int, float... + lpb:LPAREN^ {#lpb.setType(TYPECAST);} builtInTypeSpec[true] RPAREN! + unaryExpression + + // Have to backtrack to see if operator follows. If no operator + // follows, it's a typecast. No semantic checking needed to parse. + // if it _looks_ like a cast, it _is_ a cast; else it's a "(expr)" + | (LPAREN classTypeSpec[true] RPAREN unaryExpressionNotPlusMinus)=> + lp:LPAREN^ {#lp.setType(TYPECAST);} classTypeSpec[true] RPAREN! + unaryExpressionNotPlusMinus + + | postfixExpression + ) + ; + +// qualified names, array expressions, method invocation, post inc/dec +postfixExpression + : + /* + "this"! lp1:LPAREN^ argList RPAREN! + {#lp1.setType(CTOR_CALL);} + + | "super"! lp2:LPAREN^ argList RPAREN! + {#lp2.setType(SUPER_CTOR_CALL);} + | + */ + primaryExpression + + ( + /* + options { + // the use of postfixExpression in SUPER_CTOR_CALL adds DOT + // to the lookahead set, and gives loads of false non-det + // warnings. + // shut them off. + generateAmbigWarnings=false; + } + : */ + DOT^ IDENT + ( lp:LPAREN^ {#lp.setType(METHOD_CALL);} + argList + RPAREN! + )? + | DOT^ "this" + + | DOT^ "super" + ( // (new Outer()).super() (create enclosing instance) + lp3:LPAREN^ argList RPAREN! + {#lp3.setType(SUPER_CTOR_CALL);} + | DOT^ IDENT + ( lps:LPAREN^ {#lps.setType(METHOD_CALL);} + argList + RPAREN! + )? + ) + | DOT^ newExpression + | lb:LBRACK^ {#lb.setType(INDEX_OP);} expression RBRACK! + )* + + ( // possibly add on a post-increment or post-decrement. + // allows INC/DEC on too much, but semantics can check + in:INC^ {#in.setType(POST_INC);} + | de:DEC^ {#de.setType(POST_DEC);} + )? + ; + +// the basic element of an expression +primaryExpression + : identPrimary ( options {greedy=true;} : DOT^ "class" )? + | constant + | "true" + | "false" + | "null" + | newExpression + | "this" + | "super" + | LPAREN! assignmentExpression RPAREN! + // look for int.class and int[].class + | builtInType + ( lbt:LBRACK^ {#lbt.setType(ARRAY_DECLARATOR);} RBRACK! )* + DOT^ "class" + ; + +/** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + * and a.b.c.class refs. Also this(...) and super(...). Match + * this or super. + */ +identPrimary + : IDENT + ( + options { + // .ident could match here or in postfixExpression. + // We do want to match here. Turn off warning. + greedy=true; + } + : DOT^ IDENT + )* + ( + options { + // ARRAY_DECLARATOR here conflicts with INDEX_OP in + // postfixExpression on LBRACK RBRACK. + // We want to match [] here, so greedy. This overcomes + // limitation of linear approximate lookahead. + greedy=true; + } + : ( lp:LPAREN^ {#lp.setType(METHOD_CALL);} argList RPAREN! ) + | ( options {greedy=true;} : + lbc:LBRACK^ {#lbc.setType(ARRAY_DECLARATOR);} RBRACK! + )+ + )? + ; + +/** object instantiation. + * Trees are built as illustrated by the following input/tree pairs: + * + * new T() + * + * new + * | + * T -- ELIST + * | + * arg1 -- arg2 -- .. -- argn + * + * new int[] + * + * new + * | + * int -- ARRAY_DECLARATOR + * + * new int[] {1,2} + * + * new + * | + * int -- ARRAY_DECLARATOR -- ARRAY_INIT + * | + * EXPR -- EXPR + * | | + * 1 2 + * + * new int[3] + * new + * | + * int -- ARRAY_DECLARATOR + * | + * EXPR + * | + * 3 + * + * new int[1][2] + * + * new + * | + * int -- ARRAY_DECLARATOR + * | + * ARRAY_DECLARATOR -- EXPR + * | | + * EXPR 1 + * | + * 2 + * + */ +newExpression + : "new"^ type + ( LPAREN! argList RPAREN! (classBlock)? + + //java 1.1 + // Note: This will allow bad constructs like + // new int[4][][3] {exp,exp}. + // There needs to be a semantic check here... + // to make sure: + // a) [ expr ] and [ ] are not mixed + // b) [ expr ] and an init are not used together + + | newArrayDeclarator (arrayInitializer)? + ) + ; + +argList + : ( expressionList + | /*nothing*/ + {#argList = #[ELIST,"ELIST"];} + ) + ; + +newArrayDeclarator + : ( + // CONFLICT: + // newExpression is a primaryExpression which can be + // followed by an array index reference. This is ok, + // as the generated code will stay in this loop as + // long as it sees an LBRACK (proper behavior) + options { + warnWhenFollowAmbig = false; + } + : + lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} + (expression)? + RBRACK! + )+ + ; + +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + | NUM_LONG + | NUM_DOUBLE + ; + + +//---------------------------------------------------------------------------- +// The Java scanner +//---------------------------------------------------------------------------- +class JavaLexer extends Lexer; + +options { + exportVocab=Java; // call the vocabulary "Java" + testLiterals=false; // don't automatically test for literals + k=4; // four characters of lookahead + charVocabulary='\u0003'..'\uFFFF'; + // without inlining some bitset tests, couldn't do unicode; + // I need to make ANTLR generate smaller bitsets; see + // bottom of JavaLexer.java + codeGenBitsetTestThreshold=20; +} + + + +// OPERATORS +QUESTION : '?' ; +LPAREN : '(' ; +RPAREN : ')' ; +LBRACK : '[' ; +RBRACK : ']' ; +LCURLY : '{' ; +RCURLY : '}' ; +COLON : ':' ; +COMMA : ',' ; +//DOT : '.' ; +ASSIGN : '=' ; +EQUAL : "==" ; +LNOT : '!' ; +BNOT : '~' ; +NOT_EQUAL : "!=" ; +DIV : '/' ; +DIV_ASSIGN : "/=" ; +PLUS : '+' ; +PLUS_ASSIGN : "+=" ; +INC : "++" ; +MINUS : '-' ; +MINUS_ASSIGN : "-=" ; +DEC : "--" ; +STAR : '*' ; +STAR_ASSIGN : "*=" ; +MOD : '%' ; +MOD_ASSIGN : "%=" ; +SR : ">>" ; +SR_ASSIGN : ">>=" ; +BSR : ">>>" ; +BSR_ASSIGN : ">>>=" ; +GE : ">=" ; +GT : ">" ; +SL : "<<" ; +SL_ASSIGN : "<<=" ; +LE : "<=" ; +LT : '<' ; +BXOR : '^' ; +BXOR_ASSIGN : "^=" ; +BOR : '|' ; +BOR_ASSIGN : "|=" ; +LOR : "||" ; +BAND : '&' ; +BAND_ASSIGN : "&=" ; +LAND : "&&" ; +SEMI : ';' ; + + +// Whitespace -- ignored +WS : ( ' ' + | '\t' + | '\f' + // handle newlines + | ( options {generateAmbigWarnings=false;} + : "\r\n" // Evil DOS + | '\r' // Macintosh + | '\n' // Unix (the right way) + ) + { newline(); } + )+ + { _ttype = Token.SKIP; } + ; + +// Single-line comments +SL_COMMENT + : "//" + (~('\n'|'\r'))* ('\n'|'\r'('\n')?) + {$setType(Token.SKIP); newline();} + ; + +// multiple-line comments +ML_COMMENT + : "/*" + ( /* '\r' '\n' can be matched in one alternative or by matching + '\r' in one iteration and '\n' in another. I am trying to + handle any flavor of newline that comes in, but the language + that allows both "\r\n" and "\r" and "\n" to all be valid + newline is ambiguous. Consequently, the resulting grammar + must be ambiguous. I'm shutting this warning off. + */ + options { + generateAmbigWarnings=false; + } + : + { LA(2)!='/' }? '*' + | '\r' '\n' {newline();} + | '\r' {newline();} + | '\n' {newline();} + | ~('*'|'\n'|'\r') + )* + "*/" + {$setType(Token.SKIP);} + ; + + +// character literals +CHAR_LITERAL + : '\'' ( ESC | ~'\'' ) '\'' + ; + +// string literals +STRING_LITERAL + : '"' (ESC|~('"'|'\\'))* '"' + ; + + +// escape sequence -- note that this is protected; it can only be called +// from another lexer rule -- it will not ever directly return a token to +// the parser +// There are various ambiguities hushed in this rule. The optional +// '0'...'9' digit matches should be matched here rather than letting +// them go back to STRING_LITERAL to be matched. ANTLR does the +// right thing by matching immediately; hence, it's ok to shut off +// the FOLLOW ambig warnings. +protected +ESC + : '\\' + ( 'n' + | 'r' + | 't' + | 'b' + | 'f' + | '"' + | '\'' + | '\\' + | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT + | '0'..'3' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + )? + )? + | '4'..'7' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + )? + ) + ; + + +// hexadecimal digit (again, note it's protected!) +protected +HEX_DIGIT + : ('0'..'9'|'A'..'F'|'a'..'f') + ; + + +// a dummy rule to force vocabulary to be all characters (except special +// ones that ANTLR uses internally (0 to 2) +protected +VOCAB + : '\3'..'\377' + ; + + +// an identifier. Note that testLiterals is set to true! This means +// that after we match the rule, we look in the literals table to see +// if it's a literal or really an identifer +IDENT + options {testLiterals=true;} + : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')* + ; + + +// a numeric literal +NUM_INT + {boolean isDecimal=false; Token t=null;} + : '.' {_ttype = DOT;} + ( ('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})? + { + if (t != null && t.getText().toUpperCase().indexOf('F')>=0) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + } + )? + + | ( '0' {isDecimal = true;} // special case for just '0' + ( ('x'|'X') + ( // hex + // the 'e'|'E' and float suffix stuff look + // like hex digits, hence the (...)+ doesn't + // know when to stop: ambig. ANTLR resolves + // it correctly by matching immediately. It + // is therefor ok to hush warning. + options { + warnWhenFollowAmbig=false; + } + : HEX_DIGIT + )+ + | ('0'..'7')+ // octal + )? + | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal + ) + ( ('l'|'L') { _ttype = NUM_LONG; } + + // only check to see if it's a float if looks like decimal so far + | {isDecimal}? + ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})? + | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})? + | f4:FLOAT_SUFFIX {t=f4;} + ) + { + if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + } + )? + ; + + +// a couple protected methods to assist in matching floating point numbers +protected +EXPONENT + : ('e'|'E') ('+'|'-')? ('0'..'9')+ + ; + + +protected +FLOAT_SUFFIX + : 'f'|'F'|'d'|'D' + ; + diff --git a/app/src/antlr/java/java.g.java15 b/app/src/antlr/java/java.g.java15 new file mode 100644 index 000000000..b119cd35f --- /dev/null +++ b/app/src/antlr/java/java.g.java15 @@ -0,0 +1,2002 @@ +header +{ +package de.hunsicker.jalopy.language.antlr; + +import de.hunsicker.jalopy.language.antlr.JavaNode; +import de.hunsicker.jalopy.language.JavaNodeHelper; +} + +/** Java 1.5 Recognizer + * + * Run 'java Main [-showtree] directory-full-of-java-files' + * + * [The -showtree option pops up a Swing frame that shows + * the JavaNode constructed from the parser.] + * + * Run 'java Main ' + * + * Contributing authors: + * John Mitchell johnm@non.net + * Terence Parr parrt@magelang.com + * John Lilley jlilley@empathy.com + * Scott Stanchfield thetick@magelang.com + * Markus Mohnen mohnen@informatik.rwth-aachen.de + * Peter Williams pete.williams@sun.com + * Allan Jacobs Allan.Jacobs@eng.sun.com + * Steve Messick messick@redhills.com + * John Pybus john@pybus.org + * + * Version 1.00 December 9, 1997 -- initial release + * Version 1.01 December 10, 1997 + * fixed bug in octal def (0..7 not 0..8) + * Version 1.10 August 1998 (parrt) + * added tree construction + * fixed definition of WS,comments for mac,pc,unix newlines + * added unary plus + * Version 1.11 (Nov 20, 1998) + * Added "shutup" option to turn off last ambig warning. + * Fixed inner class def to allow named class defs as statements + * synchronized requires compound not simple statement + * add [] after builtInType DOT class in primaryExpression + * "const" is reserved but not valid..removed from modifiers + * Version 1.12 (Feb 2, 1999) + * Changed LITERAL_xxx to xxx in tree grammar. + * Updated java.g to use tokens {...} now for 2.6.0 (new feature). + * + * Version 1.13 (Apr 23, 1999) + * Didn't have (stat)? for else clause in tree parser. + * Didn't gen ASTs for interface extends. Updated tree parser too. + * Updated to 2.6.0. + * Version 1.14 (Jun 20, 1999) + * Allowed final/abstract on local classes. + * Removed local interfaces from methods + * Put instanceof precedence where it belongs...in relationalExpr + * It also had expr not type as arg; fixed it. + * Missing ! on SEMI in classBlock + * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus). + * fixed: didn't like Object[].class in parser or tree parser + * Version 1.15 (Jun 26, 1999) + * Screwed up rule with instanceof in it. :( Fixed. + * Tree parser didn't like (expr).something; fixed. + * Allowed multiple inheritance in tree grammar. oops. + * Version 1.16 (August 22, 1999) + * Extending an interface built a wacky tree: had extra EXTENDS. + * Tree grammar didn't allow multiple superinterfaces. + * Tree grammar didn't allow empty var initializer: {} + * Version 1.17 (October 12, 1999) + * ESC lexer rule allowed 399 max not 377 max. + * java.tree.g didn't handle the expression of synchronized + * statements. + * Version 1.18 (August 12, 2001) + * Terence updated to Java 2 Version 1.3 by + * observing/combining work of Allan Jacobs and Steve + * Messick. Handles 1.3 src. Summary: + * o primary didn't include boolean.class kind of thing + * o constructor calls parsed explicitly now: + * see explicitConstructorInvocation + * o add strictfp modifier + * o missing objBlock after new expression in tree grammar + * o merged local class definition alternatives, moved after declaration + * o fixed problem with ClassName.super.field + * o reordered some alternatives to make things more efficient + * o long and double constants were not differentiated from int/float + * o whitespace rule was inefficient: matched only one char + * o add an examples directory with some nasty 1.3 cases + * o made Main.java use buffered IO and a Reader for Unicode support + * o supports UNICODE? + * Using Unicode charVocabulay makes code file big, but only + * in the bitsets at the end. I need to make ANTLR generate + * unicode bitsets more efficiently. + * Version 1.19 (April 25, 2002) + * Terence added in nice fixes by John Pybus concerning floating + * constants and problems with super() calls. John did a nice + * reorg of the primary/postfix expression stuff to read better + * and makes f.g.super() parse properly (it was METHOD_CALL not + * a SUPER_CTOR_CALL). Also: + * + * o "finally" clause was a root...made it a child of "try" + * o Added stuff for asserts too for Java 1.4, but *commented out* + * as it is not backward compatible. + * + * Version 1.20 (October 27, 2002) + * + * Terence ended up reorging John Pybus' stuff to + * remove some nondeterminisms and some syntactic predicates. + * Note that the grammar is stricter now; e.g., this(...) must + * be the first statement. + * + * Trinary ?: operator wasn't working as array name: + * (isBig ? bigDigits : digits)[i]; + * + * Checked parser/tree parser on source for + * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4, + * and the 110k-line jGuru server source. + * + * Version 1.21 (October 17, 2003) + * Fixed lots of problems including: + * Ray Waldin: add typeDefinition to interfaceBlock in java.tree.g + * He found a problem/fix with floating point that start with 0 + * Ray also fixed problem that (int.class) was not recognized. + * Thorsten van Ellen noticed that \n are allowed incorrectly in strings. + * TJP fixed CHAR_LITERAL analogously. + * + * Version 1.21.2 (March, 2003) + * Changes by Matt Quail to support generics (as per JDK1.5/JSR14) + * Notes: + * o We only allow the "extends" keyword and not the "implements" + * keyword, since thats what JSR14 seems to imply. + * o Thanks to Monty Zukowski for his help on the antlr-interest + * mail list. + * o Thanks to Alan Eliasen for testing the grammar over his + * Fink source base + * + * Version 1.22 (July, 2004) + * Changes by Michael Studman to support Java 1.5 language extensions + * Notes: + * o Added support for annotations types + * o Finished off Matt Quail's generics enhancements to support bound type arguments + * o Added support for new for statement syntax + * o Added support for static import syntax + * o Added support for enum types + * o Tested against JDK 1.5 source base and source base of jdigraph project + * o Thanks to Matt Quail for doing the hard part by doing most of the generics work + * + * Version 1.22.1 (July 28, 2004) + * Bug/omission fixes for Java 1.5 language support + * o Fixed tree structure bug with classOrInterface - thanks to Pieter Vangorpto for + * spotting this + * o Fixed bug where incorrect handling of SR and BSR tokens would cause type + * parameters to be recognised as type arguments. + * o Enabled type parameters on constructors, annotations on enum constants + * and package definitions + * o Fixed problems when parsing if ((char.class.equals(c))) {} - solution by Matt Quail at Cenqua + * + * Version 1.22.2 (July 28, 2004) + * Slight refactoring of Java 1.5 language support + * o Refactored for/"foreach" productions so that original literal "for" literal + * is still used but the for sub-clauses vary by token type + * o Fixed bug where type parameter was not included in generic constructor's branch of AST + * + * Version 1.22.3 (August 26, 2004) + * Bug fixes as identified by Michael Stahl; clean up of tabs/spaces + * and other refactorings + * o Fixed typeParameters omission in identPrimary and newStatement + * o Replaced GT reconcilliation code with simple semantic predicate + * o Adapted enum/assert keyword checking support from Michael Stahl's java15 grammar + * o Refactored typeDefinition production and field productions to reduce duplication + * + * Version 1.22.4 (October 21, 2004) + * Small bux fixes + * o Added typeArguments to explicitConstructorInvocation, e.g. new MyParameterised() + * o Added typeArguments to postfixExpression productions for anonymous inner class super + * constructor invocation, e.g. new Outer().super() + * o Fixed bug in array declarations identified by Geoff Roy + * + * This grammar is in the PUBLIC DOMAIN + */ + +class InternalJavaParser extends Parser; +options { + k = 2; // two token lookahead + exportVocab=Java; // Call its vocabulary "Java" + codeGenMakeSwitchThreshold = 2; // Some optimizations + codeGenBitsetTestThreshold = 3; + defaultErrorHandler = false; // Don't generate parser error handlers + buildAST = true; +// classHeaderSuffix = "Parser"; + importVocab = Common; + ASTLabelType = JavaNode; +// useTokenPrefix = true; + // This class is abstract + classHeaderPrefix = "public abstract"; + +} +tokens { + BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF; + INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF; + PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE; + PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP; + POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT; + IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION; + FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract"; + STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL; VARIABLE_PARAMETER_DEF; + STATIC_IMPORT; ENUM_DEF; ENUM_CONSTANT_DEF; FOR_EACH_CLAUSE; ANNOTATION_DEF; ANNOTATIONS; + ANNOTATION; ANNOTATION_MEMBER_VALUE_PAIR; ANNOTATION_FIELD_DEF; ANNOTATION_ARRAY_INIT; + TYPE_ARGUMENTS; TYPE_ARGUMENT; TYPE_PARAMETERS; TYPE_PARAMETER; WILDCARD_TYPE; + TYPE_UPPER_BOUNDS; TYPE_LOWER_BOUNDS; + + ROOT;CASESLIST;SEPARATOR_COMMENT;BOF;SYNBLOCK;SPECIAL_COMMENT; + +} + +{ + /** + * Counts the number of LT seen in the typeArguments production. + * It is used in semantic predicates to ensure we have seen + * enough closing '>' characters; which actually may have been + * either GT, SR or BSR tokens. + */ + private int ltCounter = 0; + + protected abstract void attachStuff(JavaNode[] nodes) throws TokenStreamIOException; + +} + +// Compilation Unit: In Java, this is a single file. This is the start +// rule for this parser compilationUnit +parse + { + JavaNode root = (JavaNode) getASTFactory().create(); + root.setType(JavaTokenTypes.ROOT); + root.setText(getFilename()); + currentAST.root = root; + } + + : // A compilation unit starts with an optional package definition + ( (annotations "package")=> packageDefinition + | /* nothing */ + ) + + // Next we have a series of zero or more import statements + ( importDefinition )* + + // Wrapping things up with any number of class or interface + // definitions + ( typeDefinition )* + + EOF + ; + + +// Package statement: optional annotations followed by "package" then the package identifier. +packageDefinition + options {defaultErrorHandler = true;} // let ANTLR handle errors + : annotations p:"package"^ {#p.setType(PACKAGE_DEF);} identifier SEMI + ; + + +// Import statement: import followed by a package or class name +importDefinition + options {defaultErrorHandler = true;} + { boolean isStatic = false; } + : i:"import"^ {#i.setType(IMPORT);} ( "static"! {#i.setType(STATIC_IMPORT);} )? identifierStar SEMI + ; + +// A type definition is either a class, interface, enum or annotation with possible additional semis. +typeDefinition + options {defaultErrorHandler = true;} + : m:modifiers! + typeDefinitionInternal[#m] + | SEMI + ; + +// Protected type definitions production for reuse in other productions +protected typeDefinitionInternal[JavaNode mods] + : classDefinition[#mods] // inner class + | interfaceDefinition[#mods] // inner interface + | enumDefinition[#mods] // inner enum + | annotationDefinition[#mods] // inner annotation + ; + +// A declaration is the creation of a reference or primitive-type variable +// Create a separate Type/Var tree for each var in the var list. +declaration! + : m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t] + {#declaration = #v;} + ; + +// A type specification is a type name with possible brackets afterwards +// (which would make it an array type). +typeSpec[boolean addImagNode] + : classTypeSpec[addImagNode] + | builtInTypeSpec[addImagNode] + ; + +// A class type specification is a class type with either: +// - possible brackets afterwards +// (which would make it an array type). +// - generic type arguments after +classTypeSpec[boolean addImagNode] + : classOrInterfaceType[false] + (options{greedy=true;}: // match as many as possible + lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK! + )* + { + if ( addImagNode ) { + #classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec); + } + } + ; + +// A non-built in type name, with possible type parameters +classOrInterfaceType[boolean addImagNode] + : IDENT^ (typeArguments)? + (options{greedy=true;}: // match as many as possible + DOT^ + IDENT (typeArguments)? + )* + { + if ( addImagNode ) { + #classOrInterfaceType = #(#[TYPE,"TYPE"], #classOrInterfaceType); + } + } + ; + +// A specialised form of typeSpec where built in types must be arrays +typeArgumentSpec + : classTypeSpec[true] + | builtInTypeArraySpec[true] + ; + +// A generic type argument is a class type, a possibly bounded wildcard type or a built-in type array +typeArgument + : ( typeArgumentSpec + | wildcardType + ) + {#typeArgument = #(#[TYPE_ARGUMENT,"TYPE_ARGUMENT"], #typeArgument);} + ; + +// Wildcard type indicating all types (with possible constraint) +wildcardType + : q:QUESTION^ {#q.setType(WILDCARD_TYPE);} + (("extends" | "super")=> typeArgumentBounds)? + ; + +// Type arguments to a class or interface type +typeArguments +{int currentLtLevel = 0;} + : + {currentLtLevel = ltCounter;} + LT! {ltCounter++;} + typeArgument + (options{greedy=true;}: // match as many as possible + {inputState.guessing !=0 || ltCounter == currentLtLevel + 1}? + COMMA typeArgument + )* + + ( // turn warning off since Antlr generates the right code, + // plus we have our semantic predicate below + options{generateAmbigWarnings=false;}: + typeArgumentsOrParametersEnd + )? + + // make sure we have gobbled up enough '>' characters + // if we are at the "top level" of nested typeArgument productions + {(currentLtLevel != 0) || ltCounter == currentLtLevel}? + + {#typeArguments = #(#[TYPE_ARGUMENTS, "TYPE_ARGUMENTS"], #typeArguments);} + ; + +// this gobbles up *some* amount of '>' characters, and counts how many +// it gobbled. +protected typeArgumentsOrParametersEnd + : GT! {ltCounter-=1;} + | SR! {ltCounter-=2;} + | BSR! {ltCounter-=3;} + ; + +// Restriction on wildcard types based on super class or derrived class +typeArgumentBounds + {boolean isUpperBounds = false;} + : + ( "extends"! {isUpperBounds=true;} | "super"! ) classOrInterfaceType[false] + { + if (isUpperBounds) + { + #typeArgumentBounds = #(#[TYPE_UPPER_BOUNDS,"TYPE_UPPER_BOUNDS"], #typeArgumentBounds); + } + else + { + #typeArgumentBounds = #(#[TYPE_LOWER_BOUNDS,"TYPE_LOWER_BOUNDS"], #typeArgumentBounds); + } + } + ; + +// A builtin type array specification is a builtin type with brackets afterwards +builtInTypeArraySpec[boolean addImagNode] + : builtInType + (options{greedy=true;}: // match as many as possible + lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK! + )+ + + { + if ( addImagNode ) { + #builtInTypeArraySpec = #(#[TYPE,"TYPE"], #builtInTypeArraySpec); + } + } + ; + +// A builtin type specification is a builtin type with possible brackets +// afterwards (which would make it an array type). +builtInTypeSpec[boolean addImagNode] + : builtInType + (options{greedy=true;}: // match as many as possible + lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK! + )* + { + if ( addImagNode ) { + #builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec); + } + } + ; + +// A type name. which is either a (possibly qualified and parameterized) +// class name or a primitive (builtin) type +type + : classOrInterfaceType[false] + | builtInType + ; + +// The primitive types. +builtInType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +// A (possibly-qualified) java identifier. We start with the first IDENT +// and expand its name by adding dots and following IDENTS +identifier + : IDENT ( DOT^ IDENT )* + ; + +identifierStar + : IDENT + ( DOT^ IDENT )* + ( DOT^ STAR )? + ; + +// A list of zero or more modifiers. We could have used (modifier)* in +// place of a call to modifiers, but I thought it was a good idea to keep +// this rule separate so they can easily be collected in a Vector if +// someone so desires +modifiers + : + ( + //hush warnings since the semantic check for "@interface" solves the non-determinism + options{generateAmbigWarnings=false;}: + + modifier + | + //Semantic check that we aren't matching @interface as this is not an annotation + //A nicer way to do this would be nice + {LA(1)==AT && !LT(2).getText().equals("interface")}? annotation + )* + + {#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);} + ; + +// modifiers for Java classes, interfaces, class/instance vars and methods +modifier + : "private" + | "public" + | "protected" + | "static" + | "transient" + | "final" + | "abstract" + | "native" + | "threadsafe" + | "synchronized" + | "volatile" + | "strictfp" + ; + +annotation! + : a:AT i:identifier ( lp:LPAREN ( args:annotationArguments )? rp:RPAREN )? + {#annotation = #(#[ANNOTATION,"ANNOTATION"],a, i, lp, args, rp);} + ; + +annotations + : (annotation)* + {#annotations = #([ANNOTATIONS, "ANNOTATIONS"], #annotations);} + ; + +annotationArguments + : annotationMemberValueInitializer | anntotationMemberValuePairs + ; + +anntotationMemberValuePairs + : annotationMemberValuePair ( COMMA annotationMemberValuePair )* + ; + +annotationMemberValuePair! + : i:IDENT ASSIGN! v:annotationMemberValueInitializer + {#annotationMemberValuePair = #(#[ANNOTATION_MEMBER_VALUE_PAIR,"ANNOTATION_MEMBER_VALUE_PAIR"], i, v);} + ; + +annotationMemberValueInitializer + : + conditionalExpression | annotation | annotationMemberArrayInitializer + ; + +// This is an initializer used to set up an annotation member array. +annotationMemberArrayInitializer + : lc:LCURLY^ {#lc.setType(ANNOTATION_ARRAY_INIT);} + ( annotationMemberArrayValueInitializer + ( + // CONFLICT: does a COMMA after an initializer start a new + // initializer or start the option ',' at end? + // ANTLR generates proper code by matching + // the comma as soon as possible. + options { + warnWhenFollowAmbig = false; + } + : + COMMA annotationMemberArrayValueInitializer + )* + (COMMA)? + )? + RCURLY + ; + +// The two things that can initialize an annotation array element are a conditional expression +// and an annotation (nested annotation array initialisers are not valid) +annotationMemberArrayValueInitializer + : conditionalExpression + | annotation + ; + +superClassClause! + : ( "extends" c:classOrInterfaceType[false] )? + {#superClassClause = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],c);} + ; + +// Definition of a Java class +classDefinition![JavaNode modifiers] + : c:"class" IDENT + // it _might_ have type paramaters + (tp:typeParameters)? + // it _might_ have a superclass... + sc:superClassClause + // it might implement some interfaces... + ic:implementsClause + // now parse the body of the class + cb:classBlock + {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"], + modifiers,IDENT,tp,sc,ic,cb); + attachStuff(new JavaNode[] {#classDefinition, modifiers, #c}); + } + ; + +// Definition of a Java Interface +interfaceDefinition![JavaNode modifiers] + : i:"interface" IDENT + // it _might_ have type paramaters + (tp:typeParameters)? + // it might extend some other interfaces + ie:interfaceExtends + // now parse the body of the interface (looks like a class...) + ib:interfaceBlock + {#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"], + modifiers,IDENT,tp,ie,ib); + attachStuff(new JavaNode[] {#interfaceDefinition, modifiers, #i}); + } + ; + +enumDefinition![JavaNode modifiers] + : e:"enum" IDENT + // it might implement some interfaces... + ic:implementsClause + // now parse the body of the enum + eb:enumBlock + {#enumDefinition = #(#[ENUM_DEF,"ENUM_DEF"], + modifiers,IDENT,ic,eb); + attachStuff(new JavaNode[] {#enumDefinition, modifiers, #e}); + } + ; + +annotationDefinition![JavaNode modifiers] + : a:AT "interface" IDENT + // now parse the body of the annotation + ab:annotationBlock + {#annotationDefinition = #(#[ANNOTATION_DEF,"ANNOTATION_DEF"], + modifiers,IDENT,ab); + attachStuff(new JavaNode[] {#annotationDefinition, modifiers, #a}); + } + ; + +typeParameters +{int currentLtLevel = 0;} + : + {currentLtLevel = ltCounter;} + LT {ltCounter++;} + typeParameter (COMMA typeParameter)* + (typeArgumentsOrParametersEnd)? + + // make sure we have gobbled up enough '>' characters + // if we are at the "top level" of nested typeArgument productions + {(currentLtLevel != 0) || ltCounter == currentLtLevel}? + + {#typeParameters = #(#[TYPE_PARAMETERS, "TYPE_PARAMETERS"], #typeParameters);} + ; + +typeParameter + : + // I'm pretty sure Antlr generates the right thing here: + (id:IDENT) ( options{generateAmbigWarnings=false;}: typeParameterBounds )? + {#typeParameter = #(#[TYPE_PARAMETER,"TYPE_PARAMETER"], #typeParameter);} + ; + +typeParameterBounds + : + "extends"! classOrInterfaceType[false] + (BAND classOrInterfaceType[false])* + {#typeParameterBounds = #(#[TYPE_UPPER_BOUNDS,"TYPE_UPPER_BOUNDS"], #typeParameterBounds);} + ; + +// This is the body of a class. You can have classFields and extra semicolons. +classBlock + : lc:LCURLY^ + ( classField | SEMI )* + RCURLY + { #lc.setType(OBJBLOCK);} + //{#classBlock = #([OBJBLOCK, "OBJBLOCK"], #classBlock);} + ; + +// This is the body of an interface. You can have interfaceField and extra semicolons. +interfaceBlock + : lc:LCURLY^ + ( interfaceField | SEMI )* + RCURLY + { #lc.setType(OBJBLOCK);} + //{#interfaceBlock = #([OBJBLOCK, "OBJBLOCK"], #interfaceBlock);} + ; + +// This is the body of an annotation. You can have annotation fields and extra semicolons, +// That's about it (until you see what an annoation field is...) +annotationBlock + : lc:LCURLY^ + ( annotationField | SEMI )* + RCURLY + { #lc.setType(OBJBLOCK);} +// {#annotationBlock = #([OBJBLOCK, "OBJBLOCK"], #annotationBlock);} + ; + +// This is the body of an enum. You can have zero or more enum constants +// followed by any number of fields like a regular class +enumBlock + : lc:LCURLY^ + ( enumConstant ( options{greedy=true;}: COMMA! enumConstant )* ( COMMA! )? )? + ( SEMI! ( classField | SEMI! )* )? + RCURLY + { #lc.setType(OBJBLOCK);} +// {#enumBlock = #([OBJBLOCK, "OBJBLOCK"], #enumBlock);} + ; + +// An annotation field +annotationField! + : mods:modifiers + ( td:typeDefinitionInternal[#mods] + {#annotationField = #td;} + | t:typeSpec[false] // annotation field + ( i:IDENT // the name of the field + + LPAREN RPAREN + + rt:declaratorBrackets[#t] + + ( "default" amvi:annotationMemberValueInitializer ) ? +// { if (#d!=null) #d = #(d,#(amvi)); } + + SEMI + + {#annotationField = + #(#[ANNOTATION_FIELD_DEF,"ANNOTATION_FIELD_DEF"], + mods, + #(#[TYPE,"TYPE"],rt), + i,LPAREN,RPAREN,amvi,SEMI + ); + attachStuff(new JavaNode[] {#annotationField, #mods, #t}); + } + | v:variableDefinitions[#mods,#t] // typeVariableDefinitions + { + #annotationField = #v; + } + ) + ) + ; + +//An enum constant may have optional parameters and may have a +//a class body +enumConstant! + : an:annotations + i:IDENT + ( lp:LPAREN + a:argList + rp:RPAREN + )? + ( b:enumConstantBlock )? + {#enumConstant = #([ENUM_CONSTANT_DEF, "ENUM_CONSTANT_DEF"], an, i, lp,a,rp, b);} + ; + +//The class-like body of an enum constant +enumConstantBlock + : LCURLY + ( enumConstantField | SEMI )* + RCURLY + {#enumConstantBlock = #([OBJBLOCK, "OBJBLOCK"], #enumConstantBlock);} + ; + +//An enum constant field is just like a class field but without +//the posibility of a constructor definition or a static initializer +enumConstantField! + : mods:modifiers + ( td:typeDefinitionInternal[#mods] + {#enumConstantField = #td;} + + | // A generic method has the typeParameters before the return type. + // This is not allowed for variable definitions, but this production + // allows it, a semantic check could be used if you wanted. + (tp:typeParameters)? t:typeSpec[false] // method or variable declaration(s) + ( IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN param:parameterDeclarationList RPAREN + + rt:declaratorBrackets[#t] + + // get the list of exceptions that this method is + // declared to throw + (tc:throwsClause)? + + ( s2:compoundStatement | semim:SEMI ) + {#enumConstantField = #(#[METHOD_DEF,"METHOD_DEF"], + mods, + tp, + #(#[TYPE,"TYPE"],rt), + IDENT, + param, + tc, + s2, + semim); + attachStuff(new JavaNode[] {#enumConstantField, #mods, #t}); + } + | v:variableDefinitions[#mods,#t] // typeVariableDefinitions + {#enumConstantField = #v; + } + ) + ) + + // "{ ... }" instance initializer + | s4:compoundStatement + {#enumConstantField = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4); + attachStuff(new JavaNode[] {#enumConstantField, #s4}); + } + ; + +// An interface can extend several other interfaces... +interfaceExtends + : ( + e:"extends"! + classOrInterfaceType[false] ( COMMA! classOrInterfaceType[false] )* + )? + {#interfaceExtends = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"], + #interfaceExtends);} + ; + +// A class can implement several interfaces... +implementsClause + : ( + i:"implements"! classOrInterfaceType[false] ( COMMA! classOrInterfaceType[false] )* + )? + {#implementsClause = #(#[IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"], + #implementsClause);} + ; + +// Now the various things that can be defined inside a class +classField! + : // method, constructor, or variable declaration + mods:modifiers + ( td:typeDefinitionInternal[#mods] + {#classField = #td;} + + | (tp:typeParameters)? + ( + h:ctorHead s:constructorBody // constructor + {#classField = #(#[CTOR_DEF,"CTOR_DEF"], mods, tp, h, s); + attachStuff(new JavaNode[] {#classField, #mods, #h}); + } + + | // A generic method/ctor has the typeParameters before the return type. + // This is not allowed for variable definitions, but this production + // allows it, a semantic check could be used if you wanted. + t:typeSpec[false] // method or variable declaration(s) + ( IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN param:parameterDeclarationList RPAREN + + rt:declaratorBrackets[#t] + + // get the list of exceptions that this method is + // declared to throw + (tc:throwsClause)? + + ( s2:compoundStatement | semim:SEMI ) + {#classField = #(#[METHOD_DEF,"METHOD_DEF"], + mods, + tp, + #(#[TYPE,"TYPE"],rt), + IDENT, + LPAREN, + param, + RPAREN, + tc, + s2, + semim); + attachStuff(new JavaNode[] {#classField, #mods, #t}); + } + | v:variableDefinitions[#mods,#t] semi:SEMI!// typeVariableDefinitions + { + #classField = #v; + + #classField.addChild(#semi); + + AST next = #classField.getNextSibling(); + // HACK for multiple variable declaration in one statement + // e.g float x, y, z; + // the semicolon will only be added to the first statement so + // we have to add it manually to all others + if (next != null) + { + AST ssemi = JavaNodeHelper.getFirstChild(#classField, JavaTokenTypes.SEMI); + + for (AST var = next; var != null; var = var.getNextSibling()) + { + var.addChild(astFactory.create(ssemi)); + } + } + + + } + ) + ) + ) + + // "static { ... }" class initializer + | "static" s3:compoundStatement + {#classField = #(#[STATIC_INIT,"STATIC_INIT"], s3); + attachStuff(new JavaNode[] {#classField, #s3}); + } + + // "{ ... }" instance initializer + | s4:compoundStatement + {#classField = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4); + attachStuff(new JavaNode[] {#classField, #s4}); + } + ; + +// Now the various things that can be defined inside a interface +interfaceField! + : // method, constructor, or variable declaration + mods:modifiers + ( td:typeDefinitionInternal[#mods] + {#interfaceField = #td;} + + | (tp:typeParameters)? + // A generic method has the typeParameters before the return type. + // This is not allowed for variable definitions, but this production + // allows it, a semantic check could be used if you want a more strict + // grammar. + t:typeSpec[false] // method or variable declaration(s) + ( IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN param:parameterDeclarationList RPAREN + + rt:declaratorBrackets[#t] + + // get the list of exceptions that this method is + // declared to throw + (tc:throwsClause)? + + SEMI + + {#interfaceField = #(#[METHOD_DEF,"METHOD_DEF"], + mods, + tp, + #(#[TYPE,"TYPE"],rt), + IDENT, + LPAREN, + param, + RPAREN, + tc, + SEMI); + attachStuff(new JavaNode[] {#interfaceField, #mods, #t}); + } + | v:variableDefinitions[#mods,#t] semi:SEMI! + { + #interfaceField = #v; + + #interfaceField.addChild(#semi); + + AST next = #interfaceField.getNextSibling(); + // HACK for multiple variable declaration in one statement + // e.g float x, y, z; + // the semicolon will only be added to the first statement so + // we have to add it manually to all others + if (next != null) + { + AST ssemi = JavaNodeHelper.getFirstChild(#interfaceField, JavaTokenTypes.SEMI); + + for (AST var = next; var != null; var = var.getNextSibling()) + { + var.addChild(astFactory.create(ssemi)); + } + } + + + } + ) + ) + ; + +constructorBody + : lc:LCURLY^ {#lc.setType(SLIST);} + ( options { greedy=true; } : explicitConstructorInvocation)? + (statement)* + RCURLY + ; + +/** Catch obvious constructor calls, but not the expr.super(...) calls */ +explicitConstructorInvocation + : (typeArguments)? + ( "this" lp1:LPAREN^ argList RPAREN SEMI + {#lp1.setType(CTOR_CALL);} + | "super" lp2:LPAREN^ argList RPAREN SEMI + {#lp2.setType(SUPER_CTOR_CALL);} + ) + ; + +/** Catch variable definitions but add the semicolon ???*/ +typeVariableDefinitions[JavaNode mods, JavaNode t] + : v:variableDefinitions[mods,t] + (semi:SEMI + { + #v.addChild(#semi); + } + ) + ; + +variableDefinitions[JavaNode mods, JavaNode t] + : variableDeclarator[(JavaNode)getASTFactory().dupTree(mods), + (JavaNode)getASTFactory().dupTree(t)] + ( COMMA! + variableDeclarator[(JavaNode)getASTFactory().dupTree(mods), + (JavaNode)getASTFactory().dupTree(t)] + )* + + ; + +/** Declaration of a variable. This can be a class/instance variable, + * or a local variable in a method + * It can also include possible initialization. + */ +variableDeclarator![JavaNode mods, JavaNode t] + : id:IDENT d:declaratorBrackets[t] v:varInitializer + {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v); + attachStuff(new JavaNode[] {#variableDeclarator,mods, t}); + } + ; + +declaratorBrackets[JavaNode typ] + : {#declaratorBrackets=typ;} + (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* + ; + +varInitializer + : ( ASSIGN^ initializer )? + ; + +// This is an initializer used to set up an array. +arrayInitializer + : lc:LCURLY^ {#lc.setType(ARRAY_INIT);} + ( initializer + ( + // CONFLICT: does a COMMA after an initializer start a new + // initializer or start the option ',' at end? + // ANTLR generates proper code by matching + // the comma as soon as possible. + options { + warnWhenFollowAmbig = false; + } + : + COMMA initializer + )* + (COMMA)? + )? + RCURLY + ; + + +// The two "things" that can initialize an array element are an expression +// and another (nested) array initializer. +initializer + : expression + | arrayInitializer + ; + +// This is the header of a method. It includes the name and parameters +// for the method. +// This also watches for a list of exception classes in a "throws" clause. +ctorHead + : IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN parameterDeclarationList RPAREN + + // get the list of exceptions that this method is declared to throw + (throwsClause)? + ; + +// This is a list of exception classes that the method is declared to throw +throwsClause + : "throws"^ identifier ( COMMA identifier )* + ; + +// A list of formal parameters +// Zero or more parameters +// If a parameter is variable length (e.g. String... myArg) it is the right-most parameter +parameterDeclarationList + // The semantic check in ( .... )* block is flagged as superfluous, and seems superfluous but + // is the only way I could make this work. If my understanding is correct this is a known bug + : ( ( parameterDeclaration )=> parameterDeclaration + ( options {warnWhenFollowAmbig=false;} : ( COMMA parameterDeclaration ) => COMMA parameterDeclaration )* + ( COMMA variableLengthParameterDeclaration )? + | + variableLengthParameterDeclaration + )? + {#parameterDeclarationList = #(#[PARAMETERS,"PARAMETERS"], + #parameterDeclarationList);} + ; + +// A formal parameter. +parameterDeclaration! + : pm:parameterModifier t:typeSpec[false] id:IDENT + pd:declaratorBrackets[#t] + {#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"], + pm, #([TYPE,"TYPE"],pd), id);} + ; + +variableLengthParameterDeclaration! + : pm:parameterModifier t:typeSpec[false] TRIPLE_DOT id:IDENT + pd:declaratorBrackets[#t] + {#variableLengthParameterDeclaration = #(#[VARIABLE_PARAMETER_DEF,"VARIABLE_PARAMETER_DEF"], + pm, #([TYPE,"TYPE"],pd), id);} + ; + +parameterModifier + //final can appear amongst annotations in any order - greedily consume any preceding + //annotations to shut nond-eterminism warnings off + : (options{greedy=true;} : annotation)* (f:"final")? (annotation)* + {#parameterModifier = #(#[MODIFIERS,"MODIFIERS"], #parameterModifier);} + ; + +// Compound statement. This is used in many contexts: +// Inside a class definition prefixed with "static": +// it is a class initializer +// Inside a class definition without "static": +// it is an instance initializer +// As the body of a method +// As a completely indepdent braced block of code inside a method +// it starts a new scope for variable definitions + +compoundStatement + : lc:LCURLY^ {#lc.setType(SLIST);} + // include the (possibly-empty) list of statements + (statement)* + RCURLY + ; + + +statement + // A list of statements in curly braces -- start a new scope! + : compoundStatement + + // declarations are ambiguous with "ID DOT" relative to expression + // statements. Must backtrack to be sure. Could use a semantic + // predicate to test symbol table to see what the type was coming + // up, but that's pretty hard without a symbol table ;) + // (declaration)=> declaration SEMI + | (declaration)=> decl:declaration semi1:SEMI! + { + // add semicolon to the AST + #decl.addChild(#semi1); + + AST next = currentAST.root.getNextSibling(); + + // HACK for multiple variable declaration in one statement + // e.g float x, y, z; + // the semicolon will only be added to the first statement so + // we have to add it manually to all others + if (next != null) + { + AST semi = JavaNodeHelper.getFirstChild(currentAST.root, JavaTokenTypes.SEMI); + + for (AST var = next; var != null; var = var.getNextSibling()) + { + var.addChild(astFactory.create(semi)); + } + } + } + + // An expression statement. This could be a method call, + // assignment statement, or any other expression evaluated for + // side-effects. + | e:expression semi2:SEMI! + {#e.addChild(#semi2); + } + + //TODO: what abour interfaces, enums and annotations + // class definition + | m:modifiers! classDefinition[#m] + + // Attach a label to the front of a statement + | IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement + + // If-else statement + | "if"^ LPAREN expression RPAREN statement + ( + // CONFLICT: the old "dangling-else" problem... + // ANTLR generates proper code matching + // as soon as possible. Hush warning. + options { + warnWhenFollowAmbig = false; + } + : + "else" statement + )? + + // For statement + | forStatement + + // While statement + | "while"^ LPAREN expression RPAREN statement + + // do-while statement + | "do"^ statement "while" LPAREN expression RPAREN SEMI + + // get out of a loop (or switch) + | "break"^ (IDENT)? SEMI + + // do next iteration of a loop + | "continue"^ (IDENT)? SEMI + + // Return an expression + | "return"^ (expression)? SEMI + + // switch/case statement + | "switch"^ LPAREN expression RPAREN LCURLY + ( casesGroup )* + RCURLY + + // exception try-catch block + | tryBlock + + // throw an exception + | "throw"^ expression SEMI + + // synchronize a statement + | synBlock:"synchronized"^ LPAREN expression RPAREN compoundStatement + { #synBlock.setType(SYNBLOCK);} + + // asserts (uncomment if you want 1.4 compatibility) + | "assert"^ expression ( COLON! expression )? SEMI + + // empty statement possibly ????? + | s:SEMI {#s.setType(EMPTY_STAT);} + ; + +forStatement + : f:"for"^ + LPAREN + ( (forInit SEMI)=>traditionalForClause + | forEachClause + ) + RPAREN + statement // statement to loop over + ; + +traditionalForClause + : + forInit SEMI // initializer + forCond SEMI // condition test + forIter // updater + ; + +forEachClause + : + p:parameterDeclaration COLON! expression + {#forEachClause = #(#[FOR_EACH_CLAUSE,"FOR_EACH_CLAUSE"], #forEachClause);} + ; + +casesGroup + : ( // CONFLICT: to which case group do the statements bind? + // ANTLR generates proper code: it groups the + // many "case"/"default" labels together then + // follows them with the statements + options { + greedy = true; + } + : + aCase + )+ + caseSList + {#casesGroup = #([CASE_GROUP, "CASE_GROUP"], #casesGroup);} + ; + +aCase + : ("case"^ expression | "default") COLON + ; + +caseSList + : (statement)* + {#caseSList = #(#[CASESLIST,"CASESLIST"],#caseSList);} + ; + +// The initializer for a for loop +forInit + // if it looks like a declaration, it is + : ((declaration)=> declaration + // otherwise it could be an expression list... + | expressionList + )? + {#forInit = #(#[FOR_INIT,"FOR_INIT"],#forInit);} + ; + +forCond + : (expression)? + {#forCond = #(#[FOR_CONDITION,"FOR_CONDITION"],#forCond);} + ; + +forIter + : (expressionList)? + {#forIter = #(#[FOR_ITERATOR,"FOR_ITERATOR"],#forIter);} + ; + +// an exception handler try/catch block +tryBlock + : "try"^ compoundStatement + (handler)* + ( finallyClause )? + ; + +finallyClause + : "finally"^ compoundStatement + ; + +// an exception handler +handler + : "catch"^ LPAREN parameterDeclaration RPAREN compoundStatement + ; + + +// expressions +// Note that most of these expressions follow the pattern +// thisLevelExpression : +// nextHigherPrecedenceExpression +// (OPERATOR nextHigherPrecedenceExpression)* +// which is a standard recursive definition for a parsing an expression. +// The operators in java have the following precedences: +// lowest (13) = *= /= %= += -= <<= >>= >>>= &= ^= |= +// (12) ?: +// (11) || +// (10) && +// ( 9) | +// ( 8) ^ +// ( 7) & +// ( 6) == != +// ( 5) < <= > >= +// ( 4) << >> +// ( 3) +(binary) -(binary) +// ( 2) * / % +// ( 1) ++ -- +(unary) -(unary) ~ ! (type) +// [] () (method call) . (dot -- identifier qualification) +// new () (explicit parenthesis) +// +// the last two are not usually on a precedence chart; I put them in +// to point out that new has a higher precedence than '.', so you +// can validy use +// new Frame().show() +// +// Note that the above precedence levels map to the rules below... +// Once you have a precedence chart, writing the appropriate rules as below +// is usually very straightfoward + + + +// the mother of all expressions +expression + : assignmentExpression + {#expression = #(#[EXPR,"EXPR"],#expression);} + ; + + +// This is a list of expressions. +expressionList + : expression (COMMA expression)* + {#expressionList = #(#[ELIST,"ELIST"], expressionList);} + ; + + +// assignment expression (level 13) +assignmentExpression + : conditionalExpression + ( ( ASSIGN^ + | PLUS_ASSIGN^ + | MINUS_ASSIGN^ + | STAR_ASSIGN^ + | DIV_ASSIGN^ + | MOD_ASSIGN^ + | SR_ASSIGN^ + | BSR_ASSIGN^ + | SL_ASSIGN^ + | BAND_ASSIGN^ + | BXOR_ASSIGN^ + | BOR_ASSIGN^ + ) + assignmentExpression + )? + ; + + +// conditional test (level 12) +conditionalExpression + : logicalOrExpression + ( QUESTION^ assignmentExpression COLON conditionalExpression )? + ; + + +// logical or (||) (level 11) +logicalOrExpression + : logicalAndExpression (LOR^ logicalAndExpression)* + ; + + +// logical and (&&) (level 10) +logicalAndExpression + : inclusiveOrExpression (LAND^ inclusiveOrExpression)* + ; + + +// bitwise or non-short-circuiting or (|) (level 9) +inclusiveOrExpression + : exclusiveOrExpression (BOR^ exclusiveOrExpression)* + ; + + +// exclusive or (^) (level 8) +exclusiveOrExpression + : andExpression (BXOR^ andExpression)* + ; + + +// bitwise or non-short-circuiting and (&) (level 7) +andExpression + : equalityExpression (BAND^ equalityExpression)* + ; + + +// equality/inequality (==/!=) (level 6) +equalityExpression + : relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)* + ; + + +// boolean relational expressions (level 5) +relationalExpression + : shiftExpression + ( ( ( LT^ + | GT^ + | LE^ + | GE^ + ) + shiftExpression + )* + | "instanceof"^ typeSpec[true] + ) + ; + + +// bit shift expressions (level 4) +shiftExpression + : additiveExpression ((SL^ | SR^ | BSR^) additiveExpression)* + ; + + +// binary addition/subtraction (level 3) +additiveExpression + : multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)* + ; + + +// multiplication/division/modulo (level 2) +multiplicativeExpression + : unaryExpression ((STAR^ | DIV^ | MOD^ ) unaryExpression)* + ; + +unaryExpression + : INC^ unaryExpression + | DEC^ unaryExpression + | MINUS^ {#MINUS.setType(UNARY_MINUS);} unaryExpression + | PLUS^ {#PLUS.setType(UNARY_PLUS);} unaryExpression + | unaryExpressionNotPlusMinus + ; + +unaryExpressionNotPlusMinus + : BNOT^ unaryExpression + | LNOT^ unaryExpression + | ( // subrule allows option to shut off warnings + options { + // "(int" ambig with postfixExpr due to lack of sequence + // info in linear approximate LL(k). It's ok. Shut up. + generateAmbigWarnings=false; + } + : // If typecast is built in type, must be numeric operand + // Have to backtrack to see if operator follows + (LPAREN builtInTypeSpec[true] RPAREN unaryExpression)=> + lpb:LPAREN^ {#lpb.setType(TYPECAST);} builtInTypeSpec[true] RPAREN! + unaryExpression + + // Have to backtrack to see if operator follows. If no operator + // follows, it's a typecast. No semantic checking needed to parse. + // if it _looks_ like a cast, it _is_ a cast; else it's a "(expr)" + | (LPAREN classTypeSpec[true] RPAREN unaryExpressionNotPlusMinus)=> + lp:LPAREN^ {#lp.setType(TYPECAST);} classTypeSpec[true] RPAREN! + unaryExpressionNotPlusMinus + + | postfixExpression + ) + ; + +// qualified names, array expressions, method invocation, post inc/dec +postfixExpression + : + primaryExpression + + ( + /* + options { + // the use of postfixExpression in SUPER_CTOR_CALL adds DOT + // to the lookahead set, and gives loads of false non-det + // warnings. + // shut them off. + generateAmbigWarnings=false; + } + : */ + //type arguments are only appropriate for a parameterized method/ctor invocations + //semantic check may be needed here to ensure that this is the case + DOT^ (typeArguments)? + ( IDENT + ( lp:LPAREN^ {#lp.setType(METHOD_CALL);} + argList + RPAREN + )? + | "super" + ( // (new Outer()).super() (create enclosing instance) + lp3:LPAREN^ argList RPAREN + {#lp3.setType(SUPER_CTOR_CALL);} + | DOT^ (typeArguments)? IDENT + ( lps:LPAREN^ {#lps.setType(METHOD_CALL);} + argList + RPAREN + )? + ) + ) + | DOT^ "this" + | DOT^ newExpression + | lb:LBRACK^ {#lb.setType(INDEX_OP);} expression RBRACK + )* + + ( // possibly add on a post-increment or post-decrement. + // allows INC/DEC on too much, but semantics can check + in:INC^ {#in.setType(POST_INC);} + | de:DEC^ {#de.setType(POST_DEC);} + )? + ; + +// the basic element of an expression +primaryExpression + : identPrimary ( options {greedy=true;} : DOT^ "class" )? + | constant + | "true" + | "false" + | "null" + | newExpression + | "this" + | "super" + | LPAREN assignmentExpression RPAREN + // look for int.class and int[].class + | builtInType + ( lbt:LBRACK^ {#lbt.setType(ARRAY_DECLARATOR);} RBRACK! )* + DOT^ "class" + ; + +/** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + * and a.b.c.class refs. Also this(...) and super(...). Match + * this or super. + */ +identPrimary + : (ta1:typeArguments!)? + IDENT + // Syntax for method invocation with type arguments is + // foo("blah") + ( + options { + // .ident could match here or in postfixExpression. + // We do want to match here. Turn off warning. + greedy=true; + // This turns the ambiguity warning of the second alternative + // off. See below. (The "false" predicate makes it non-issue) + warnWhenFollowAmbig=false; + } + // we have a new nondeterminism because of + // typeArguments... only a syntactic predicate will help... + // The problem is that this loop here conflicts with + // DOT typeArguments "super" in postfixExpression (k=2) + // A proper solution would require a lot of refactoring... +// Original way. +// : (DOT (typeArguments)? IDENT) => +// DOT^ (ta2:typeArguments!)? IDENT + : (DOT^ (typeArguments)? IDENT) + | {false}? // FIXME: this is very ugly but it seems to work... + // this will also produce an ANTLR warning! + // Unfortunately a syntactic predicate can only select one of + // multiple alternatives on the same level, not break out of + // an enclosing loop, which is why this ugly hack (a fake + // empty alternative with always-false semantic predicate) + // is necessary. + )* + ( + options { + // ARRAY_DECLARATOR here conflicts with INDEX_OP in + // postfixExpression on LBRACK RBRACK. + // We want to match [] here, so greedy. This overcomes + // limitation of linear approximate lookahead. + greedy=true; + } + : ( lp:LPAREN^ {#lp.setType(METHOD_CALL);} + // if the input is valid, only the last IDENT may + // have preceding typeArguments... rather hacky, this is... +// Not required because see above +// {if (#ta2 != null) astFactory.addASTChild(currentAST, #ta2);} +// {if (#ta2 == null) astFactory.addASTChild(currentAST, #ta1);} + argList RPAREN + ) + | ( options {greedy=true;} : + lbc:LBRACK^ {#lbc.setType(ARRAY_DECLARATOR);} RBRACK! + )+ + )? + ; + +/** object instantiation. + * Trees are built as illustrated by the following input/tree pairs: + * + * new T() + * + * new + * | + * T -- ELIST + * | + * arg1 -- arg2 -- .. -- argn + * + * new int[] + * + * new + * | + * int -- ARRAY_DECLARATOR + * + * new int[] {1,2} + * + * new + * | + * int -- ARRAY_DECLARATOR -- ARRAY_INIT + * | + * EXPR -- EXPR + * | | + * 1 2 + * + * new int[3] + * new + * | + * int -- ARRAY_DECLARATOR + * | + * EXPR + * | + * 3 + * + * new int[1][2] + * + * new + * | + * int -- ARRAY_DECLARATOR + * | + * ARRAY_DECLARATOR -- EXPR + * | | + * EXPR 1 + * | + * 2 + * + */ +newExpression + : "new"^ (typeArguments)? type + ( LPAREN argList RPAREN (classBlock)? + + //java 1.1 + // Note: This will allow bad constructs like + // new int[4][][3] {exp,exp}. + // There needs to be a semantic check here... + // to make sure: + // a) [ expr ] and [ ] are not mixed + // b) [ expr ] and an init are not used together + + | newArrayDeclarator (arrayInitializer)? + ) + ; + +argList + : ( expressionList + | /*nothing*/ + {#argList = #[ELIST,"ELIST"];} + ) + ; + +newArrayDeclarator + : ( + // CONFLICT: + // newExpression is a primaryExpression which can be + // followed by an array index reference. This is ok, + // as the generated code will stay in this loop as + // long as it sees an LBRACK (proper behavior) + options { + warnWhenFollowAmbig = false; + } + : + lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} + (expression)? + RBRACK! + )+ + ; + +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + | NUM_LONG + | NUM_DOUBLE + ; + + +//---------------------------------------------------------------------------- +// The Java scanner +//---------------------------------------------------------------------------- +class InternalJavaLexer extends Lexer; + +options { + exportVocab=Java; // call the vocabulary "Java" + testLiterals=false; // don't automatically test for literals + k=4; // four characters of lookahead + charVocabulary='\u0003'..'\uFFFF'; + // without inlining some bitset tests, couldn't do unicode; + // I need to make ANTLR generate smaller bitsets; see + // bottom of JavaLexer.java + codeGenBitsetTestThreshold=20; + // This class is abstract + classHeaderPrefix = "public abstract"; +} + +{ + /** flag for enabling the "assert" keyword */ + private boolean assertEnabled = true; + /** flag for enabling the "enum" keyword */ + private boolean enumEnabled = true; + + /** Enable the "assert" keyword */ + public void enableAssert(boolean shouldEnable) { assertEnabled = shouldEnable; } + /** Query the "assert" keyword state */ + public boolean isAssertEnabled() { return assertEnabled; } + /** Enable the "enum" keyword */ + public void enableEnum(boolean shouldEnable) { enumEnabled = shouldEnable; } + /** Query the "enum" keyword state */ + public boolean isEnumEnabled() { return enumEnabled; } + + protected abstract Token makeJavaDoc(Token node, String text) throws TokenStreamIOException; + +} + +// OPERATORS +QUESTION : '?' ; +LPAREN : '(' ; +RPAREN : ')' ; +LBRACK : '[' ; +RBRACK : ']' ; +LCURLY : '{' ; +RCURLY : '}' ; +COLON : ':' ; +COMMA : ',' ; +//DOT : '.' ; +ASSIGN : '=' ; +EQUAL : "==" ; +LNOT : '!' ; +BNOT : '~' ; +NOT_EQUAL : "!=" ; +DIV : '/' ; +DIV_ASSIGN : "/=" ; +PLUS : '+' ; +PLUS_ASSIGN : "+=" ; +INC : "++" ; +MINUS : '-' ; +MINUS_ASSIGN : "-=" ; +DEC : "--" ; +STAR : '*' ; +STAR_ASSIGN : "*=" ; +MOD : '%' ; +MOD_ASSIGN : "%=" ; +SR : ">>" ; +SR_ASSIGN : ">>=" ; +BSR : ">>>" ; +BSR_ASSIGN : ">>>=" ; +GE : ">=" ; +GT : ">" ; +SL : "<<" ; +SL_ASSIGN : "<<=" ; +LE : "<=" ; +LT : '<' ; +BXOR : '^' ; +BXOR_ASSIGN : "^=" ; +BOR : '|' ; +BOR_ASSIGN : "|=" ; +LOR : "||" ; +BAND : '&' ; +BAND_ASSIGN : "&=" ; +LAND : "&&" ; +SEMI : ';' ; + + +// Whitespace -- ignored +WS : ( ' ' + | '\t' + | '\f' + // handle newlines + | ( options {generateAmbigWarnings=false;} + : "\r\n" // Evil DOS + | '\r' // Macintosh + | '\n' // Unix (the right way) + ) + { newline(); } + )+ + { // _ttype = Token.SKIP; + } + ; + +protected SEPARATOR_COMMENT +: "//~" (~('\n'|'\r') {if (LA(1) == EOF_CHAR) break;} )* + ( '\n'! | '\r'!('\n'!)? )? + {newline();} +; + +// Single-line comments +protected SL_COMMENT +: "//" (~('\n'|'\r') {if (LA(1) == EOF_CHAR) break;} )* + ( '\n'! | '\r'!('\n'!)? )? + {newline(); + + } +; +COMMENT +: + ( + options { + // ANTLR does it right by consuming input as soon as possible + generateAmbigWarnings=false; + // TODO spec:SPECIAL_COMMENT {$setToken(spec);} | + }: + + sep:SEPARATOR_COMMENT {$setToken(sep); } | + sl:SL_COMMENT {$setToken(sl); } + ) +; + +// multiple-line comments +ML_COMMENT + : "/*" + ( /* '\r' '\n' can be matched in one alternative or by matching + '\r' in one iteration and '\n' in another. I am trying to + handle any flavor of newline that comes in, but the language + that allows both "\r\n" and "\r" and "\n" to all be valid + newline is ambiguous. Consequently, the resulting grammar + must be ambiguous. I'm shutting this warning off. + */ + options { + generateAmbigWarnings=false; + } + : + { LA(2)!='/' }? '*' + | '\r' '\n' {newline();} + | '\r' {newline();} + | '\n' {newline();} + | ~('*'|'\n'|'\r') + )* + "*/" + { + // $setType(Token.SKIP); + Token n = makeJavaDoc(makeToken(_ttype), $getText); + $setToken(n); + $setType(n.getType()); + } + ; + + +// character literals +CHAR_LITERAL + : '\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\'' + ; + +// string literals +STRING_LITERAL + : '"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"' + ; + + +// escape sequence -- note that this is protected; it can only be called +// from another lexer rule -- it will not ever directly return a token to +// the parser +// There are various ambiguities hushed in this rule. The optional +// '0'...'9' digit matches should be matched here rather than letting +// them go back to STRING_LITERAL to be matched. ANTLR does the +// right thing by matching immediately; hence, it's ok to shut off +// the FOLLOW ambig warnings. +protected +ESC + : '\\' + ( 'n' + | 'r' + | 't' + | 'b' + | 'f' + | '"' + | '\'' + | '\\' + | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT + | '0'..'3' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + )? + )? + | '4'..'7' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + )? + ) + ; + + +// hexadecimal digit (again, note it's protected!) +protected +HEX_DIGIT + : ('0'..'9'|'A'..'F'|'a'..'f') + ; + + +// a dummy rule to force vocabulary to be all characters (except special +// ones that ANTLR uses internally (0 to 2) +protected +VOCAB + : '\3'..'\377' + ; + + +// an identifier. Note that testLiterals is set to true! This means +// that after we match the rule, we look in the literals table to see +// if it's a literal or really an identifer +IDENT + options {testLiterals=true;} + : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')* + { + // check if "assert" keyword is enabled + if (assertEnabled && "assert".equals($getText)) { + $setType(LITERAL_assert); // set token type for the rule in the parser + } + // check if "enum" keyword is enabled + if (enumEnabled && "enum".equals($getText)) { + $setType(LITERAL_enum); // set token type for the rule in the parser + } + } + ; + + +// a numeric literal +NUM_INT + {boolean isDecimal=false; Token t=null;} + : '.' {_ttype = DOT;} + ( + (('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})? + { + if (t != null && t.getText().toUpperCase().indexOf('F')>=0) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + }) + | + // JDK 1.5 token for variable length arguments + (".." {_ttype = TRIPLE_DOT;}) + )? + + | ( '0' {isDecimal = true;} // special case for just '0' + ( ('x'|'X') + ( // hex + // the 'e'|'E' and float suffix stuff look + // like hex digits, hence the (...)+ doesn't + // know when to stop: ambig. ANTLR resolves + // it correctly by matching immediately. It + // is therefor ok to hush warning. + options { + warnWhenFollowAmbig=false; + } + : HEX_DIGIT + )+ + + | //float or double with leading zero + (('0'..'9')+ ('.'|EXPONENT|FLOAT_SUFFIX)) => ('0'..'9')+ + + | ('0'..'7')+ // octal + )? + | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal + ) + ( ('l'|'L') { _ttype = NUM_LONG; } + + // only check to see if it's a float if looks like decimal so far + | {isDecimal}? + ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})? + | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})? + | f4:FLOAT_SUFFIX {t=f4;} + ) + { + if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + } + )? + ; + +// JDK 1.5 token for annotations and their declarations +AT + : '@' + ; + +// a couple protected methods to assist in matching floating point numbers +protected +EXPONENT + : ('e'|'E') ('+'|'-')? ('0'..'9')+ + ; + + +protected +FLOAT_SUFFIX + : 'f'|'F'|'d'|'D' + ; + diff --git a/app/src/antlr/java/java.tree.g b/app/src/antlr/java/java.tree.g new file mode 100644 index 000000000..e995ef49d --- /dev/null +++ b/app/src/antlr/java/java.tree.g @@ -0,0 +1,326 @@ +package antlr; + + +/** Java 1.3 AST Recognizer Grammar + * + * Author: (see java.g preamble) + * + * This grammar is in the PUBLIC DOMAIN + */ +class JavaTreeParser extends TreeParser; + +options { + importVocab = Java; +} + +compilationUnit + : (packageDefinition)? + (importDefinition)* + (typeDefinition)* + ; + +packageDefinition + : #( PACKAGE_DEF identifier ) + ; + +importDefinition + : #( IMPORT identifierStar ) + ; + +typeDefinition + : #(CLASS_DEF modifiers IDENT extendsClause implementsClause objBlock ) + | #(INTERFACE_DEF modifiers IDENT extendsClause interfaceBlock ) + ; + +typeSpec + : #(TYPE typeSpecArray) + ; + +typeSpecArray + : #( ARRAY_DECLARATOR typeSpecArray ) + | type + ; + +type: identifier + | builtInType + ; + +builtInType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +modifiers + : #( MODIFIERS (modifier)* ) + ; + +modifier + : "private" + | "public" + | "protected" + | "static" + | "transient" + | "final" + | "abstract" + | "native" + | "threadsafe" + | "synchronized" + | "const" + | "volatile" + | "strictfp" + ; + +extendsClause + : #(EXTENDS_CLAUSE (identifier)* ) + ; + +implementsClause + : #(IMPLEMENTS_CLAUSE (identifier)* ) + ; + + +interfaceBlock + : #( OBJBLOCK + ( methodDecl + | variableDef + )* + ) + ; + +objBlock + : #( OBJBLOCK + ( ctorDef + | methodDef + | variableDef + | typeDefinition + | #(STATIC_INIT slist) + | #(INSTANCE_INIT slist) + )* + ) + ; + +ctorDef + : #(CTOR_DEF modifiers methodHead (slist)?) + ; + +methodDecl + : #(METHOD_DEF modifiers typeSpec methodHead) + ; + +methodDef + : #(METHOD_DEF modifiers typeSpec methodHead (slist)?) + ; + +variableDef + : #(VARIABLE_DEF modifiers typeSpec variableDeclarator varInitializer) + ; + +parameterDef + : #(PARAMETER_DEF modifiers typeSpec IDENT ) + ; + +objectinitializer + : #(INSTANCE_INIT slist) + ; + +variableDeclarator + : IDENT + | LBRACK variableDeclarator + ; + +varInitializer + : #(ASSIGN initializer) + | + ; + +initializer + : expression + | arrayInitializer + ; + +arrayInitializer + : #(ARRAY_INIT (initializer)*) + ; + +methodHead + : IDENT #( PARAMETERS (parameterDef)* ) (throwsClause)? + ; + +throwsClause + : #( "throws" (identifier)* ) + ; + +identifier + : IDENT + | #( DOT identifier IDENT ) + ; + +identifierStar + : IDENT + | #( DOT identifier (STAR|IDENT) ) + ; + +slist + : #( SLIST (stat)* ) + ; + +stat: typeDefinition + | variableDef + | expression + | #(LABELED_STAT IDENT stat) + | #("if" expression stat (stat)? ) + | #( "for" + #(FOR_INIT (variableDef | elist)?) + #(FOR_CONDITION (expression)?) + #(FOR_ITERATOR (elist)?) + stat + ) + | #("while" expression stat) + | #("do" stat expression) + | #("break" (IDENT)? ) + | #("continue" (IDENT)? ) + | #("return" (expression)? ) + | #("switch" expression (caseGroup)*) + | #("throw" expression) + | #("synchronized" expression stat) + | tryBlock + | slist // nested SLIST + // uncomment to make assert JDK 1.4 stuff work + | #("assert" expression (expression)?) + | EMPTY_STAT + ; + +caseGroup + : #(CASE_GROUP (#("case" expression) | "default")+ slist) + ; + +tryBlock + : #( "try" slist (handler)* (#("finally" slist))? ) + ; + +handler + : #( "catch" parameterDef slist ) + ; + +elist + : #( ELIST (expression)* ) + ; + +expression + : #(EXPR expr) + ; + +expr: #(QUESTION expr expr expr) // trinary operator + | #(ASSIGN expr expr) // binary operators... + | #(PLUS_ASSIGN expr expr) + | #(MINUS_ASSIGN expr expr) + | #(STAR_ASSIGN expr expr) + | #(DIV_ASSIGN expr expr) + | #(MOD_ASSIGN expr expr) + | #(SR_ASSIGN expr expr) + | #(BSR_ASSIGN expr expr) + | #(SL_ASSIGN expr expr) + | #(BAND_ASSIGN expr expr) + | #(BXOR_ASSIGN expr expr) + | #(BOR_ASSIGN expr expr) + | #(LOR expr expr) + | #(LAND expr expr) + | #(BOR expr expr) + | #(BXOR expr expr) + | #(BAND expr expr) + | #(NOT_EQUAL expr expr) + | #(EQUAL expr expr) + | #(LT expr expr) + | #(GT expr expr) + | #(LE expr expr) + | #(GE expr expr) + | #(SL expr expr) + | #(SR expr expr) + | #(BSR expr expr) + | #(PLUS expr expr) + | #(MINUS expr expr) + | #(DIV expr expr) + | #(MOD expr expr) + | #(STAR expr expr) + | #(INC expr) + | #(DEC expr) + | #(POST_INC expr) + | #(POST_DEC expr) + | #(BNOT expr) + | #(LNOT expr) + | #("instanceof" expr expr) + | #(UNARY_MINUS expr) + | #(UNARY_PLUS expr) + | primaryExpression + ; + +primaryExpression + : IDENT + | #( DOT + ( expr + ( IDENT + | arrayIndex + | "this" + | "class" + | #( "new" IDENT elist ) + | "super" + ) + | #(ARRAY_DECLARATOR typeSpecArray) + | builtInType ("class")? + ) + ) + | arrayIndex + | #(METHOD_CALL primaryExpression elist) + | ctorCall + | #(TYPECAST typeSpec expr) + | newExpression + | constant + | "super" + | "true" + | "false" + | "this" + | "null" + | typeSpec // type name used with instanceof + ; + +ctorCall + : #( CTOR_CALL elist ) + | #( SUPER_CTOR_CALL + ( elist + | primaryExpression elist + ) + ) + ; + +arrayIndex + : #(INDEX_OP expr expression) + ; + +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + | NUM_DOUBLE + | NUM_LONG + ; + +newExpression + : #( "new" type + ( newArrayDeclarator (arrayInitializer)? + | elist (objBlock)? + ) + ) + + ; + +newArrayDeclarator + : #( ARRAY_DECLARATOR (newArrayDeclarator)? (expression)? ) + ; diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java new file mode 100644 index 000000000..2a70cd6d6 --- /dev/null +++ b/app/src/processing/app/Base.java @@ -0,0 +1,2021 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; + +import javax.swing.*; + +import processing.app.debug.Compiler; +import processing.core.*; + + +/** + * The base class for the main processing application. + * Primary role of this class is for platform identification and + * general interaction with the system (launching URLs, loading + * files and images, etc) that comes from that. + */ +public class Base { + static final int REVISION = 165; + static String VERSION_NAME = "0165"; + + static HashMap platformNames = new HashMap(); + static { + platformNames.put(PConstants.WINDOWS, "windows"); + platformNames.put(PConstants.MACOSX, "macosx"); + platformNames.put(PConstants.LINUX, "linux"); + } + + static HashMap platformIndices = new HashMap(); + static { + platformIndices.put("windows", PConstants.WINDOWS); + platformIndices.put("macosx", PConstants.MACOSX); + platformIndices.put("linux", PConstants.LINUX); + } + static Platform platform; + + static private boolean commandLine; + + // A single instance of the preferences window + Preferences preferencesFrame; + + // set to true after the first time the menu is built. + // so that the errors while building don't show up again. + boolean builtOnce; + + static File buildFolder; + + // these are static because they're used by Sketch + static private File examplesFolder; + static private File librariesFolder; + static private File toolsFolder; + + // maps imported packages to their library folder + static HashMap importToLibraryTable; + + // classpath for all known libraries for p5 + // (both those in the p5/libs folder and those with lib subfolders + // found in the sketchbook) + static public String librariesClassPath; + + // Location for untitled items + static File untitledFolder; + + // p5 icon for the window + static Image icon; + +// int editorCount; +// Editor[] editors; + java.util.List editors = + Collections.synchronizedList(new ArrayList()); +// ArrayList editors = Collections.synchronizedList(new ArrayList()); + Editor activeEditor; + +// int nextEditorX; +// int nextEditorY; + + + static public void main(String args[]) { + try { + File versionFile = getContentFile("lib/version.txt"); + if (versionFile.exists()) { + VERSION_NAME = PApplet.loadStrings(versionFile)[0]; + } + } catch (Exception e) { + e.printStackTrace(); + } + +// if (System.getProperty("mrj.version") != null) { +// //String jv = System.getProperty("java.version"); +// String ov = System.getProperty("os.version"); +// if (ov.startsWith("10.5")) { +// System.setProperty("apple.laf.useScreenMenuBar", "true"); +// } +// } + + /* + commandLine = false; + if (args.length >= 2) { + if (args[0].startsWith("--")) { + commandLine = true; + } + } + + if (PApplet.javaVersion < 1.5f) { + //System.err.println("no way man"); + Base.showError("Need to install Java 1.5", + "This version of Processing requires \n" + + "Java 1.5 or later to run properly.\n" + + "Please visit java.com to upgrade.", null); + } + */ + + initPlatform(); + +// // Set the look and feel before opening the window +// try { +// platform.setLookAndFeel(); +// } catch (Exception e) { +// System.err.println("Non-fatal error while setting the Look & Feel."); +// System.err.println("The error message follows, however Processing should run fine."); +// System.err.println(e.getMessage()); +// //e.printStackTrace(); +// } + + // Use native popups so they don't look so crappy on osx + JPopupMenu.setDefaultLightWeightPopupEnabled(false); + + // Don't put anything above this line that might make GUI, + // because the platform has to be inited properly first. + + // Make sure a full JDK is installed + initRequirements(); + + // run static initialization that grabs all the prefs + Preferences.init(null); + + // setup the theme coloring fun + Theme.init(); + + if (Base.isMacOS()) { + String properMenuBar = "apple.laf.useScreenMenuBar"; + String menubar = Preferences.get(properMenuBar); + if (menubar != null) { + // Get the current menu bar setting and use it + System.setProperty(properMenuBar, menubar); + + } else { + // 10.4 is not affected, 10.5 (and prolly 10.6) are + if (System.getProperty("os.version").startsWith("10.4")) { + // Don't bother checking next time + Preferences.set(properMenuBar, "true"); + // Also set the menubar now + System.setProperty(properMenuBar, "true"); + + } else { + // Running 10.5 or 10.6 or whatever, give 'em the business + String warning = + "" + + " " + + "The standard menu bar has been disabled." + + "

Due to an Apple bug, the Processing menu bar " + + "is unusable on Mac OS X 10.5.
" + + "As a workaround, the menu bar will be placed inside " + + "the editor window. This
setting can be changed in the " + + "Preferences window. If this bug makes you sad,
" + + "please contact Apple via bugreporter.apple.com.

" + + " "; + Object[] options = { "OK", "More Info" }; + int result = JOptionPane.showOptionDialog(new Frame(), + warning, + "Menu Bar Problem", + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE, + null, + options, + options[0]); + if (result == -1) { + // They hit ESC or closed the window, so just hide it for now + // But don't bother setting the preference in the file + } else { + // Shut off in the preferences for next time + Preferences.set(properMenuBar, "false"); + if (result == 1) { // More Info + Base.openURL("http://dev.processing.org/bugs/show_bug.cgi?id=786"); + } + } + // Whether or not canceled, set to false (right now) if we're on 10.5 + System.setProperty(properMenuBar, "false"); + } + } + } + + // Set the look and feel before opening the window + // For 0158, moving it lower so that the apple.laf.useScreenMenuBar stuff works + try { + platform.setLookAndFeel(); + } catch (Exception e) { + System.err.println("Non-fatal error while setting the Look & Feel."); + System.err.println("The error message follows, however Processing should run fine."); + System.err.println(e.getMessage()); + //e.printStackTrace(); + } + + // Create a location for untitled sketches + untitledFolder = createTempFolder("untitled"); + untitledFolder.deleteOnExit(); + + new Base(args); + } + + + static protected void setCommandLine() { + commandLine = true; + } + + + static protected boolean isCommandLine() { + return commandLine; + } + + + static protected void initPlatform() { + try { + Class platformClass = Class.forName("processing.app.Platform"); + if (Base.isMacOS()) { + platformClass = Class.forName("processing.app.macosx.Platform"); + } else if (Base.isWindows()) { + platformClass = Class.forName("processing.app.windows.Platform"); + } else if (Base.isLinux()) { + platformClass = Class.forName("processing.app.linux.Platform"); + } + platform = (Platform) platformClass.newInstance(); + } catch (Exception e) { + Base.showError("Problem Setting the Platform", + "An unknown error occurred while trying to load\n" + + "platform-specific code for your machine.", e); + } + } + + + static protected void initRequirements() { + try { + Class.forName("com.sun.jdi.VirtualMachine"); + } catch (ClassNotFoundException cnfe) { + Base.showPlatforms(); + Base.showError("Please install JDK 1.5 or later", + "Processing requires a full JDK (not just a JRE)\n" + + "to run. Please install JDK 1.5 or later.\n" + + "More information can be found in the reference.", cnfe); + } + } + + + public Base(String[] args) { + platform.init(this); + + // Get paths for the libraries and examples in the Processing folder + //String workingDirectory = System.getProperty("user.dir"); + examplesFolder = getContentFile("examples"); + librariesFolder = getContentFile("libraries"); + toolsFolder = getContentFile("tools"); + + // Get the sketchbook path, and make sure it's set properly + String sketchbookPath = Preferences.get("sketchbook.path"); + + // If a value is at least set, first check to see if the folder exists. + // If it doesn't, warn the user that the sketchbook folder is being reset. + if (sketchbookPath != null) { + File skechbookFolder = new File(sketchbookPath); + if (!skechbookFolder.exists()) { + Base.showWarning("Sketchbook folder disappeared", + "The sketchbook folder no longer exists.\n" + + "Processing will switch to the default sketchbook\n" + + "location, and create a new sketchbook folder if\n" + + "necessary. Procesing will then stop talking about\n" + + "himself in the third person.", null); + sketchbookPath = null; + } + } + + // If not path is set, get the default sketchbook folder for this platform + if (sketchbookPath == null) { + File defaultFolder = getDefaultSketchbookFolder(); + Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath()); + if (!defaultFolder.exists()) { + defaultFolder.mkdirs(); + } + } + + // Check if there were previously opened sketches to be restored + boolean opened = restoreSketches(); + + // Check if any files were passed in on the command line + for (int i = 0; i < args.length; i++) { + String path = args[i]; + // Fix a problem with systems that use a non-ASCII languages. Paths are + // being passed in with 8.3 syntax, which makes the sketch loader code + // unhappy, since the sketch folder naming doesn't match up correctly. + // http://dev.processing.org/bugs/show_bug.cgi?id=1089 + if (isWindows()) { + try { + File file = new File(args[i]); + path = file.getCanonicalPath(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (handleOpen(path) != null) { + opened = true; + } + } + + // Create a new empty window (will be replaced with any files to be opened) + if (!opened) { + handleNew(); + } + + // check for updates + if (Preferences.getBoolean("update.check")) { + new UpdateCheck(this); + } + } + + + /** + * Post-constructor setup for the editor area. Loads the last + * sketch that was used (if any), and restores other Editor settings. + * The complement to "storePreferences", this is called when the + * application is first launched. + */ + protected boolean restoreSketches() { + // figure out window placement + + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + boolean windowPositionValid = true; + + if (Preferences.get("last.screen.height") != null) { + // if screen size has changed, the window coordinates no longer + // make sense, so don't use them unless they're identical + int screenW = Preferences.getInteger("last.screen.width"); + int screenH = Preferences.getInteger("last.screen.height"); + + if ((screen.width != screenW) || (screen.height != screenH)) { + windowPositionValid = false; + } + /* + int windowX = Preferences.getInteger("last.window.x"); + int windowY = Preferences.getInteger("last.window.y"); + if ((windowX < 0) || (windowY < 0) || + (windowX > screenW) || (windowY > screenH)) { + windowPositionValid = false; + } + */ + } else { + windowPositionValid = false; + } + + // Iterate through all sketches that were open last time p5 was running. + // If !windowPositionValid, then ignore the coordinates found for each. + + // Save the sketch path and window placement for each open sketch + int count = Preferences.getInteger("last.sketch.count"); + int opened = 0; + for (int i = 0; i < count; i++) { + String path = Preferences.get("last.sketch" + i + ".path"); + int[] location; + if (windowPositionValid) { + String locationStr = Preferences.get("last.sketch" + i + ".location"); + location = PApplet.parseInt(PApplet.split(locationStr, ',')); + } else { + location = nextEditorLocation(); + } + // If file did not exist, null will be returned for the Editor + if (handleOpen(path, location) != null) { + opened++; + } + } + return (opened > 0); + } + + + /** + * Store list of sketches that are currently open. + * Called when the application is quitting and documents are still open. + */ + protected void storeSketches() { + // Save the width and height of the screen + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + Preferences.setInteger("last.screen.width", screen.width); + Preferences.setInteger("last.screen.height", screen.height); + + String untitledPath = untitledFolder.getAbsolutePath(); + + // Save the sketch path and window placement for each open sketch + int index = 0; + for (Editor editor : editors) { + String path = editor.getSketch().getMainFilePath(); + // In case of a crash, save untitled sketches if they contain changes. + // (Added this for release 0158, may not be a good idea.) + if (path.startsWith(untitledPath) && + !editor.getSketch().isModified()) { + continue; + } + Preferences.set("last.sketch" + index + ".path", path); + + int[] location = editor.getPlacement(); + String locationStr = PApplet.join(PApplet.str(location), ","); + Preferences.set("last.sketch" + index + ".location", locationStr); + index++; + } + Preferences.setInteger("last.sketch.count", index); + } + + + // If a sketch is untitled on quit, may need to store the new name + // rather than the location from the temp folder. + protected void storeSketchPath(Editor editor, int index) { + String path = editor.getSketch().getMainFilePath(); + String untitledPath = untitledFolder.getAbsolutePath(); + if (path.startsWith(untitledPath)) { + path = ""; + } + Preferences.set("last.sketch" + index + ".path", path); + } + + + /* + public void storeSketch(Editor editor) { + int index = -1; + for (int i = 0; i < editorCount; i++) { + if (editors[i] == editor) { + index = i; + break; + } + } + if (index == -1) { + System.err.println("Problem storing sketch " + editor.sketch.name); + } else { + String path = editor.sketch.getMainFilePath(); + Preferences.set("last.sketch" + index + ".path", path); + } + } + */ + + + // ................................................................. + + + // Because of variations in native windowing systems, no guarantees about + // changes to the focused and active Windows can be made. Developers must + // never assume that this Window is the focused or active Window until this + // Window receives a WINDOW_GAINED_FOCUS or WINDOW_ACTIVATED event. + protected void handleActivated(Editor whichEditor) { + activeEditor = whichEditor; + + // set the current window to be the console that's getting output + EditorConsole.setEditor(activeEditor); + } + + + protected int[] nextEditorLocation() { + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + int defaultWidth = Preferences.getInteger("default.window.width"); + int defaultHeight = Preferences.getInteger("default.window.height"); + + if (activeEditor == null) { + // If no current active editor, use default placement + return new int[] { + (screen.width - defaultWidth) / 2, + (screen.height - defaultHeight) / 2, + defaultWidth, defaultHeight, 0 + }; + + } else { + // With a currently active editor, open the new window + // using the same dimensions, but offset slightly. + synchronized (editors) { + final int OVER = 50; + // In release 0160, don't + //location = activeEditor.getPlacement(); + Editor lastOpened = editors.get(editors.size() - 1); + int[] location = lastOpened.getPlacement(); + // Just in case the bounds for that window are bad + location[0] += OVER; + location[1] += OVER; + + if (location[0] == OVER || + location[2] == OVER || + location[0] + location[2] > screen.width || + location[1] + location[3] > screen.height) { + // Warp the next window to a randomish location on screen. + return new int[] { + (int) (Math.random() * (screen.width - defaultWidth)), + (int) (Math.random() * (screen.height - defaultHeight)), + defaultWidth, defaultHeight, 0 + }; + } + + return location; + } + } + } + + + // ................................................................. + + + boolean breakTime = false; + String[] months = { + "jan", "feb", "mar", "apr", "may", "jun", + "jul", "aug", "sep", "oct", "nov", "dec" + }; + + /** + * Handle creating a sketch folder, return its base .pde file + * or null if the operation was canceled. + * @param shift whether shift is pressed, which will invert prompt setting + * @param noPrompt disable prompt, no matter the setting + */ + protected String createNewUntitled() throws IOException { + File newbieDir = null; + String newbieName = null; + + // In 0126, untitled sketches will begin in the temp folder, + // and then moved to a new location because Save will default to Save As. + File sketchbookDir = getSketchbookFolder(); + File newbieParentDir = untitledFolder; + + // Use a generic name like sketch_031008a, the date plus a char + int index = 0; + //SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd"); + //SimpleDateFormat formatter = new SimpleDateFormat("MMMdd"); + //String purty = formatter.format(new Date()).toLowerCase(); + Calendar cal = Calendar.getInstance(); + int day = cal.get(Calendar.DAY_OF_MONTH); // 1..31 + int month = cal.get(Calendar.MONTH); // 0..11 + String purty = months[month] + PApplet.nf(day, 2); + do { + if (index == 26) { + // In 0159, avoid running past z by sending people outdoors. + if (!breakTime) { + Base.showWarning("Time for a Break", + "You've reached the limit for auto naming of new sketches\n" + + "for the day. How about going for a walk instead?", null); + breakTime = true; + } else { + Base.showWarning("Sunshine", + "No really, time for some fresh air for you.", null); + } + return null; + } + newbieName = "sketch_" + purty + ((char) ('a' + index)); + newbieDir = new File(newbieParentDir, newbieName); + index++; + // Make sure it's not in the temp folder *and* it's not in the sketchbook + } while (newbieDir.exists() || new File(sketchbookDir, newbieName).exists()); + + // Make the directory for the new sketch + newbieDir.mkdirs(); + + // Make an empty pde file + File newbieFile = new File(newbieDir, newbieName + ".pde"); + new FileOutputStream(newbieFile); // create the file + return newbieFile.getAbsolutePath(); + } + + + /** + * Create a new untitled document in a new sketch window. + */ + public void handleNew() { + try { + String path = createNewUntitled(); + if (path != null) { + Editor editor = handleOpen(path); + editor.untitled = true; + } + + } catch (IOException e) { + if (activeEditor != null) { + activeEditor.statusError(e); + } + } + } + + + /** + * Replace the sketch in the current window with a new untitled document. + */ + public void handleNewReplace() { + if (!activeEditor.checkModified(false)) { + return; // sketch was modified, and user canceled + } + // Close the running window, avoid window boogers with multiple sketches + activeEditor.internalCloseRunner(); + + // Actually replace things + handleNewReplaceImpl(); + } + + + protected void handleNewReplaceImpl() { + try { + String path = createNewUntitled(); + if (path != null) { + activeEditor.handleOpenInternal(path); + activeEditor.untitled = true; + } +// return true; + + } catch (IOException e) { + activeEditor.statusError(e); +// return false; + } + } + + + /** + * Open a sketch, replacing the sketch in the current window. + * @param path Location of the primary pde file for the sketch. + */ + public void handleOpenReplace(String path) { + if (!activeEditor.checkModified(false)) { + return; // sketch was modified, and user canceled + } + // Close the running window, avoid window boogers with multiple sketches + activeEditor.internalCloseRunner(); + + boolean loaded = activeEditor.handleOpenInternal(path); + if (!loaded) { + // replace the document without checking if that's ok + handleNewReplaceImpl(); + } + } + + + /** + * Prompt for a sketch to open, and open it in a new window. + */ + public void handleOpenPrompt() { + // get the frontmost window frame for placing file dialog + FileDialog fd = new FileDialog(activeEditor, + "Open a Processing sketch...", + FileDialog.LOAD); + // This was annoying people, so disabled it in 0125. + //fd.setDirectory(Preferences.get("sketchbook.path")); + //fd.setDirectory(getSketchbookPath()); + + // Only show .pde files as eligible bachelors + fd.setFilenameFilter(new FilenameFilter() { + public boolean accept(File dir, String name) { + // TODO this doesn't seem to ever be used. AWESOME. + //System.out.println("check filter on " + dir + " " + name); + return name.toLowerCase().endsWith(".pde"); + } + }); + + fd.setVisible(true); + + String directory = fd.getDirectory(); + String filename = fd.getFile(); + + // User canceled selection + if (filename == null) return; + + File inputFile = new File(directory, filename); + handleOpen(inputFile.getAbsolutePath()); + } + + + /** + * Open a sketch in a new window. + * @param path Path to the pde file for the sketch in question + * @return the Editor object, so that properties (like 'untitled') + * can be set by the caller + */ + public Editor handleOpen(String path) { + return handleOpen(path, nextEditorLocation()); + } + + + protected Editor handleOpen(String path, int[] location) { + File file = new File(path); + if (!file.exists()) return null; + + // Cycle through open windows to make sure that it's not already open. + for (Editor editor : editors) { + if (editor.getSketch().getMainFilePath().equals(path)) { + editor.toFront(); + return editor; + } + } + + // If the active editor window is an untitled, and un-modified document, + // just replace it with the file that's being opened. +// if (activeEditor != null) { +// Sketch activeSketch = activeEditor.sketch; +// if (activeSketch.isUntitled() && !activeSketch.isModified()) { +// // if it's an untitled, unmodified document, it can be replaced. +// // except in cases where a second blank window is being opened. +// if (!path.startsWith(untitledFolder.getAbsolutePath())) { +// activeEditor.handleOpenUnchecked(path, 0, 0, 0, 0); +// return activeEditor; +// } +// } +// } + + Editor editor = new Editor(this, path, location); + + // Make sure that the sketch actually loaded + if (editor.getSketch() == null) { + return null; // Just walk away quietly + } + +// if (editors == null) { +// editors = new Editor[5]; +// } +// if (editorCount == editors.length) { +// editors = (Editor[]) PApplet.expand(editors); +// } +// editors[editorCount++] = editor; + editors.add(editor); + +// if (markedForClose != null) { +// Point p = markedForClose.getLocation(); +// handleClose(markedForClose, false); +// // open the new window in +// editor.setLocation(p); +// } + + // now that we're ready, show the window + // (don't do earlier, cuz we might move it based on a window being closed) + editor.setVisible(true); + + return editor; + } + + + /** + * Close a sketch as specified by its editor window. + * @param editor Editor object of the sketch to be closed. + * @return true if succeeded in closing, false if canceled. + */ + public boolean handleClose(Editor editor) { + // Check if modified + if (!editor.checkModified(false)) { + return false; + } + + // Close the running window, avoid window boogers with multiple sketches + editor.internalCloseRunner(); + + if (editors.size() == 1) { + // For 0158, when closing the last window /and/ it was already an + // untitled sketch, just give up and let the user quit. +// if (Preferences.getBoolean("sketchbook.closing_last_window_quits") || +// (editor.untitled && !editor.getSketch().isModified())) { + if (Base.isMacOS()) { + Object[] options = { "OK", "Cancel" }; + String prompt = + " " + + " " + + "Are you sure you want to Quit?" + + "

Closing the last open sketch will quit Processing."; + + int result = JOptionPane.showOptionDialog(editor, + prompt, + "Quit", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[0]); + if (result == JOptionPane.NO_OPTION || + result == JOptionPane.CLOSED_OPTION) { + return false; + } + } + + // This will store the sketch count as zero + editors.remove(editor); + storeSketches(); + + // Save out the current prefs state + Preferences.save(); + + // Since this wasn't an actual Quit event, call System.exit() + System.exit(0); + + } else { + // More than one editor window open, + // proceed with closing the current window. + editor.setVisible(false); + editor.dispose(); +// for (int i = 0; i < editorCount; i++) { +// if (editor == editors[i]) { +// for (int j = i; j < editorCount-1; j++) { +// editors[j] = editors[j+1]; +// } +// editorCount--; +// // Set to null so that garbage collection occurs +// editors[editorCount] = null; +// } +// } + editors.remove(editor); + } + return true; + } + + + /** + * Handler for File → Quit. + * @return false if canceled, true otherwise. + */ + public boolean handleQuit() { + // If quit is canceled, this will be replaced anyway + // by a later handleQuit() that is not canceled. + storeSketches(); + + if (handleQuitEach()) { + // make sure running sketches close before quitting + for (Editor editor : editors) { + editor.internalCloseRunner(); + } + // Save out the current prefs state + Preferences.save(); + + if (!Base.isMacOS()) { + // If this was fired from the menu or an AppleEvent (the Finder), + // then Mac OS X will send the terminate signal itself. + System.exit(0); + } + return true; + } + return false; + } + + + /** + * Attempt to close each open sketch in preparation for quitting. + * @return false if canceled along the way + */ + protected boolean handleQuitEach() { + int index = 0; + for (Editor editor : editors) { + if (editor.checkModified(true)) { + // Update to the new/final sketch path for this fella + storeSketchPath(editor, index); + index++; + + } else { + return false; + } + } + return true; + } + + + // ................................................................. + + + /** + * Asynchronous version of menu rebuild to be used on save and rename + * to prevent the interface from locking up until the menus are done. + */ + protected void rebuildSketchbookMenus() { + //System.out.println("async enter"); + //new Exception().printStackTrace(); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + //System.out.println("starting rebuild"); + rebuildSketchbookMenu(Editor.sketchbookMenu); + rebuildToolbarMenu(Editor.toolbarMenu); + //System.out.println("done with rebuild"); + } + }); + //System.out.println("async exit"); + } + + + protected void rebuildToolbarMenu(JMenu menu) { + JMenuItem item; + menu.removeAll(); + + //System.out.println("rebuilding toolbar menu"); + // Add the single "Open" item + item = Editor.newJMenuItem("Open...", 'O'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleOpenPrompt(); + } + }); + menu.add(item); + menu.addSeparator(); + + // Add a list of all sketches and subfolders + try { + boolean sketches = addSketches(menu, getSketchbookFolder(), true); + if (sketches) menu.addSeparator(); + } catch (IOException e) { + e.printStackTrace(); + } + + //System.out.println("rebuilding examples menu"); + // Add each of the subfolders of examples directly to the menu + try { + addSketches(menu, examplesFolder, true); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + protected void rebuildSketchbookMenu(JMenu menu) { + //System.out.println("rebuilding sketchbook menu"); + //new Exception().printStackTrace(); + try { + menu.removeAll(); + addSketches(menu, getSketchbookFolder(), false); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + public void rebuildImportMenu(JMenu importMenu) { + //System.out.println("rebuilding import menu"); + importMenu.removeAll(); + + // reset the table mapping imports to libraries + importToLibraryTable = new HashMap(); + + // Add libraries found in the sketchbook folder + try { + File sketchbookLibraries = getSketchbookLibrariesFolder(); + boolean found = addLibraries(importMenu, sketchbookLibraries); + if (found) importMenu.addSeparator(); + } catch (IOException e) { + e.printStackTrace(); + } + // Add from the "libraries" subfolder in the Processing directory + try { + addLibraries(importMenu, librariesFolder); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + public void rebuildExamplesMenu(JMenu menu) { + //System.out.println("rebuilding examples menu"); + + try { + menu.removeAll(); + addSketches(menu, examplesFolder, false); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + /** + * Scan a folder recursively, and add any sketches found to the menu + * specified. Set the openReplaces parameter to true when opening the sketch + * should replace the sketch in the current window, or false when the + * sketch should open in a new window. + */ + protected boolean addSketches(JMenu menu, File folder, + final boolean openReplaces) throws IOException { + // skip .DS_Store files, etc (this shouldn't actually be necessary) + if (!folder.isDirectory()) return false; + + String[] list = folder.list(); + // If a bad folder or unreadable or whatever, this will come back null + if (list == null) return false; + + // Alphabetize list, since it's not always alpha order + Arrays.sort(list, String.CASE_INSENSITIVE_ORDER); + //processing.core.PApplet.println("adding sketches " + folder.getAbsolutePath()); + //PApplet.println(list); + + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + String path = e.getActionCommand(); + if (new File(path).exists()) { + if (openReplaces) { + handleOpenReplace(path); + } else { + handleOpen(path); + } + } else { + showWarning("Sketch Does Not Exist", + "The selected sketch no longer exists.\n" + + "You may need to restart Processing to update\n" + + "the sketchbook menu.", null); + } + } + }; + // offers no speed improvement + //menu.addActionListener(listener); + + boolean ifound = false; + + for (int i = 0; i < list.length; i++) { + if ((list[i].charAt(0) == '.') || + list[i].equals("CVS")) continue; + + File subfolder = new File(folder, list[i]); + if (!subfolder.isDirectory()) continue; + + File entry = new File(subfolder, list[i] + ".pde"); + // if a .pde file of the same prefix as the folder exists.. + if (entry.exists()) { + //String sanityCheck = sanitizedName(list[i]); + //if (!sanityCheck.equals(list[i])) { + if (!Sketch.isSanitaryName(list[i])) { + if (!builtOnce) { + String complaining = + "The sketch \"" + list[i] + "\" cannot be used.\n" + + "Sketch names must contain only basic letters and numbers\n" + + "(ASCII-only with no spaces, " + + "and it cannot start with a number).\n" + + "To get rid of this message, remove the sketch from\n" + + entry.getAbsolutePath(); + Base.showMessage("Ignoring sketch with bad name", complaining); + } + continue; + } + + JMenuItem item = new JMenuItem(list[i]); + item.addActionListener(listener); + item.setActionCommand(entry.getAbsolutePath()); + menu.add(item); + ifound = true; + + } else { + // not a sketch folder, but maybe a subfolder containing sketches + JMenu submenu = new JMenu(list[i]); + // needs to be separate var + // otherwise would set ifound to false + boolean found = addSketches(submenu, subfolder, openReplaces); //, false); + if (found) { + menu.add(submenu); + ifound = true; + } + } + } + return ifound; // actually ignored, but.. + } + + + protected boolean addLibraries(JMenu menu, File folder) throws IOException { + if (!folder.isDirectory()) return false; + + String list[] = folder.list(new FilenameFilter() { + public boolean accept(File dir, String name) { + // skip .DS_Store files, .svn folders, etc + if (name.charAt(0) == '.') return false; + if (name.equals("CVS")) return false; + return (new File(dir, name).isDirectory()); + } + }); + // if a bad folder or something like that, this might come back null + if (list == null) return false; + + // alphabetize list, since it's not always alpha order + // replaced hella slow bubble sort with this feller for 0093 + Arrays.sort(list, String.CASE_INSENSITIVE_ORDER); + + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + activeEditor.getSketch().importLibrary(e.getActionCommand()); + } + }; + + boolean ifound = false; + + for (String libraryName : list) { + File subfolder = new File(folder, libraryName); + File libraryFolder = new File(subfolder, "library"); + File libraryJar = new File(libraryFolder, libraryName + ".jar"); + // If a .jar file of the same prefix as the folder exists + // inside the 'library' subfolder of the sketch + if (libraryJar.exists()) { + String sanityCheck = Sketch.sanitizeName(libraryName); + if (!sanityCheck.equals(libraryName)) { + String mess = + "The library \"" + libraryName + "\" cannot be used.\n" + + "Library names must contain only basic letters and numbers.\n" + + "(ascii only and no spaces, and it cannot start with a number)"; + Base.showMessage("Ignoring bad library name", mess); + continue; + } + + // get the path for all .jar files in this code folder + String libraryClassPath = + Compiler.contentsToClassPath(libraryFolder); + // grab all jars and classes from this folder, + // and append them to the library classpath + librariesClassPath += + File.pathSeparatorChar + libraryClassPath; + // need to associate each import with a library folder + String packages[] = + Compiler.packageListFromClassPath(libraryClassPath); + for (String pkg : packages) { + importToLibraryTable.put(pkg, libraryFolder); + } + + JMenuItem item = new JMenuItem(libraryName); + item.addActionListener(listener); + item.setActionCommand(libraryJar.getAbsolutePath()); + menu.add(item); + ifound = true; + + } else { // not a library, but is still a folder, so recurse + JMenu submenu = new JMenu(libraryName); + // needs to be separate var, otherwise would set ifound to false + boolean found = addLibraries(submenu, subfolder); + if (found) { + menu.add(submenu); + ifound = true; + } + } + } + return ifound; + } + + + // ................................................................. + + + /** + * Show the About box. + */ + public void handleAbout() { + final Image image = Base.getLibImage("about.jpg", activeEditor); + final Window window = new Window(activeEditor) { + public void paint(Graphics g) { + g.drawImage(image, 0, 0, null); + + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + + g.setFont(new Font("SansSerif", Font.PLAIN, 11)); + g.setColor(Color.white); + g.drawString(Base.VERSION_NAME, 50, 30); + } + }; + window.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + window.dispose(); + } + }); + int w = image.getWidth(activeEditor); + int h = image.getHeight(activeEditor); + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + window.setBounds((screen.width-w)/2, (screen.height-h)/2, w, h); + window.setVisible(true); + } + + + /** + * Show the Preferences window. + */ + public void handlePrefs() { + if (preferencesFrame == null) preferencesFrame = new Preferences(); + preferencesFrame.showFrame(activeEditor); + } + + + // ................................................................... + + + /** + * Get list of platform constants. + */ +// static public int[] getPlatforms() { +// return platforms; +// } + + +// static public int getPlatform() { +// String osname = System.getProperty("os.name"); +// +// if (osname.indexOf("Mac") != -1) { +// return PConstants.MACOSX; +// +// } else if (osname.indexOf("Windows") != -1) { +// return PConstants.WINDOWS; +// +// } else if (osname.equals("Linux")) { // true for the ibm vm +// return PConstants.LINUX; +// +// } else { +// return PConstants.OTHER; +// } +// } + + + static public String getPlatformName() { + String osname = System.getProperty("os.name"); + + if (osname.indexOf("Mac") != -1) { + return "macosx"; + + } else if (osname.indexOf("Windows") != -1) { + return "windows"; + + } else if (osname.equals("Linux")) { // true for the ibm vm + return "linux"; + + } else { + return "other"; + } + } + + + /** + * Map a platform constant to its name. + * @param which PConstants.WINDOWS, PConstants.MACOSX, PConstants.LINUX + * @return one of "windows", "macosx", or "linux" + */ + static public String getPlatformName(int which) { + return platformNames.get(which); + } + + + static public int getPlatformIndex(String what) { + Integer entry = platformIndices.get(what); + return (entry == null) ? -1 : entry.intValue(); + } + + + // These were changed to no longer rely on PApplet and PConstants because + // of conflicts that could happen with older versions of core.jar, where + // the MACOSX constant would instead read as the LINUX constant. + + + /** + * returns true if Processing is running on a Mac OS X machine. + */ + static public boolean isMacOS() { + //return PApplet.platform == PConstants.MACOSX; + return System.getProperty("os.name").indexOf("Mac") != -1; + } + + + /** + * returns true if running on windows. + */ + static public boolean isWindows() { + //return PApplet.platform == PConstants.WINDOWS; + return System.getProperty("os.name").indexOf("Windows") != -1; + } + + + /** + * true if running on linux. + */ + static public boolean isLinux() { + //return PApplet.platform == PConstants.LINUX; + return System.getProperty("os.name").indexOf("Linux") != -1; + } + + + // ................................................................. + + + static public File getSettingsFolder() { + File settingsFolder = null; + + String preferencesPath = Preferences.get("settings.path"); + if (preferencesPath != null) { + settingsFolder = new File(preferencesPath); + + } else { + try { + settingsFolder = platform.getSettingsFolder(); + } catch (Exception e) { + showError("Problem getting data folder", + "Error getting the Processing data folder.", e); + } + } + + // create the folder if it doesn't exist already + if (!settingsFolder.exists()) { + if (!settingsFolder.mkdirs()) { + showError("Settings issues", + "Processing cannot run because it could not\n" + + "create a folder to store your settings.", null); + } + } + return settingsFolder; + } + + + /** + * Convenience method to get a File object for the specified filename inside + * the settings folder. + * For now, only used by Preferences to get the preferences.txt file. + * @param filename A file inside the settings folder. + * @return filename wrapped as a File object inside the settings folder + */ + static public File getSettingsFile(String filename) { + return new File(getSettingsFolder(), filename); + } + + + static public File getBuildFolder() { + if (buildFolder == null) { + String buildPath = Preferences.get("build.path"); + if (buildPath != null) { + buildFolder = new File(buildPath); + + } else { + //File folder = new File(getTempFolder(), "build"); + //if (!folder.exists()) folder.mkdirs(); + buildFolder = createTempFolder("build"); + buildFolder.deleteOnExit(); + } + } + return buildFolder; + } + + + /** + * Get the path to the platform's temporary folder, by creating + * a temporary temporary file and getting its parent folder. + *
+ * Modified for revision 0094 to actually make the folder randomized + * to avoid conflicts in multi-user environments. (Bug 177) + */ + static public File createTempFolder(String name) { + try { + File folder = File.createTempFile(name, null); + //String tempPath = ignored.getParent(); + //return new File(tempPath); + folder.delete(); + folder.mkdirs(); + return folder; + + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + static public String getExamplesPath() { + return examplesFolder.getAbsolutePath(); + } + + + static public String getLibrariesPath() { + return librariesFolder.getAbsolutePath(); + } + + + static public File getToolsFolder() { + return toolsFolder; + } + + + static public String getToolsPath() { + return toolsFolder.getAbsolutePath(); + } + + + static public File getSketchbookFolder() { + return new File(Preferences.get("sketchbook.path")); + } + + + static public File getSketchbookLibrariesFolder() { + return new File(getSketchbookFolder(), "libraries"); + } + + + protected File getDefaultSketchbookFolder() { + File sketchbookFolder = null; + try { + sketchbookFolder = platform.getDefaultSketchbookFolder(); + } catch (Exception e) { } + + if (sketchbookFolder == null) { + sketchbookFolder = promptSketchbookLocation(); + } + + // create the folder if it doesn't exist already + boolean result = true; + if (!sketchbookFolder.exists()) { + result = sketchbookFolder.mkdirs(); + } + + if (!result) { + showError("You forgot your sketchbook", + "Processing cannot run because it could not\n" + + "create a folder to store your sketchbook.", null); + } + + return sketchbookFolder; + } + + + /** + * Check for a new sketchbook location. + */ + static protected File promptSketchbookLocation() { + File folder = null; + + folder = new File(System.getProperty("user.home"), "sketchbook"); + if (!folder.exists()) { + folder.mkdirs(); + return folder; + } + + String prompt = "Select (or create new) folder for sketches..."; + folder = Base.selectFolder(prompt, null, null); + if (folder == null) { + System.exit(0); + } + return folder; + } + + + // ................................................................. + + + /** + * Implements the cross-platform headache of opening URLs + * TODO This code should be replaced by PApplet.link(), + * however that's not a static method (because it requires + * an AppletContext when used as an applet), so it's mildly + * trickier than just removing this method. + */ + static public void openURL(String url) { + try { + platform.openURL(url); + + } catch (Exception e) { + showWarning("Problem Opening URL", + "Could not open the URL\n" + url, e); + } + } + + + /** + * Used to determine whether to disable the "Show Sketch Folder" option. + * @return true If a means of opening a folder is known to be available. + */ + static protected boolean openFolderAvailable() { + return platform.openFolderAvailable(); + } + + + /** + * Implements the other cross-platform headache of opening + * a folder in the machine's native file browser. + */ + static public void openFolder(File file) { + try { + platform.openFolder(file); + + } catch (Exception e) { + showWarning("Problem Opening Folder", + "Could not open the folder\n" + file.getAbsolutePath(), e); + } + } + + + // ................................................................. + + + /** + * Prompt for a fodler and return it as a File object (or null). + * Implementation for choosing directories that handles both the + * Mac OS X hack to allow the native AWT file dialog, or uses + * the JFileChooser on other platforms. Mac AWT trick obtained from + * this post + * on the OS X Java dev archive which explains the cryptic note in + * Apple's Java 1.4 release docs about the special System property. + */ + static public File selectFolder(String prompt, File folder, Frame frame) { + if (Base.isMacOS()) { + if (frame == null) frame = new Frame(); //.pack(); + FileDialog fd = new FileDialog(frame, prompt, FileDialog.LOAD); + if (folder != null) { + fd.setDirectory(folder.getParent()); + //fd.setFile(folder.getName()); + } + System.setProperty("apple.awt.fileDialogForDirectories", "true"); + fd.setVisible(true); + System.setProperty("apple.awt.fileDialogForDirectories", "false"); + if (fd.getFile() == null) { + return null; + } + return new File(fd.getDirectory(), fd.getFile()); + + } else { + JFileChooser fc = new JFileChooser(); + fc.setDialogTitle(prompt); + if (folder != null) { + fc.setSelectedFile(folder); + } + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + int returned = fc.showOpenDialog(new JDialog()); + if (returned == JFileChooser.APPROVE_OPTION) { + return fc.getSelectedFile(); + } + } + return null; + } + + + // ................................................................. + + + /** + * Give this Frame a Processing icon. + */ + static public void setIcon(Frame frame) { + Image image = Toolkit.getDefaultToolkit().createImage(PApplet.ICON_IMAGE); + frame.setIconImage(image); + } + + + // someone needs to be slapped + //static KeyStroke closeWindowKeyStroke; + + /** + * Return true if the key event was a Ctrl-W or an ESC, + * both indicators to close the window. + * Use as part of a keyPressed() event handler for frames. + */ + /* + static public boolean isCloseWindowEvent(KeyEvent e) { + if (closeWindowKeyStroke == null) { + int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + closeWindowKeyStroke = KeyStroke.getKeyStroke('W', modifiers); + } + return ((e.getKeyCode() == KeyEvent.VK_ESCAPE) || + KeyStroke.getKeyStrokeForEvent(e).equals(closeWindowKeyStroke)); + } + */ + + + /** + * Registers key events for a Ctrl-W and ESC with an ActionListener + * that will take care of disposing the window. + */ + static public void registerWindowCloseKeys(JRootPane root, //Window window, + ActionListener disposer) { + KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); + root.registerKeyboardAction(disposer, stroke, + JComponent.WHEN_IN_FOCUSED_WINDOW); + + int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + stroke = KeyStroke.getKeyStroke('W', modifiers); + root.registerKeyboardAction(disposer, stroke, + JComponent.WHEN_IN_FOCUSED_WINDOW); + } + + + // ................................................................. + + + static public void showReference(String filename) { + File referenceFolder = Base.getContentFile("reference"); + File referenceFile = new File(referenceFolder, filename); + openURL(referenceFile.getAbsolutePath()); + } + + + static public void showReference() { + showReference("index.html"); + } + + + static public void showEnvironment() { + showReference("environment" + File.separator + "index.html"); + } + + + static public void showPlatforms() { + showReference("environment" + File.separator + "platforms.html"); + } + + + static public void showTroubleshooting() { + showReference("troubleshooting" + File.separator + "index.html"); + } + + + // ................................................................. + + + /** + * "No cookie for you" type messages. Nothing fatal or all that + * much of a bummer, but something to notify the user about. + */ + static public void showMessage(String title, String message) { + if (title == null) title = "Message"; + + if (commandLine) { + System.out.println(title + ": " + message); + + } else { + JOptionPane.showMessageDialog(new Frame(), message, title, + JOptionPane.INFORMATION_MESSAGE); + } + } + + + /** + * Non-fatal error message with optional stack trace side dish. + */ + static public void showWarning(String title, String message, Exception e) { + if (title == null) title = "Warning"; + + if (commandLine) { + System.out.println(title + ": " + message); + + } else { + JOptionPane.showMessageDialog(new Frame(), message, title, + JOptionPane.WARNING_MESSAGE); + } + if (e != null) e.printStackTrace(); + } + + + /** + * Show an error message that's actually fatal to the program. + * This is an error that can't be recovered. Use showWarning() + * for errors that allow P5 to continue running. + */ + static public void showError(String title, String message, Throwable e) { + if (title == null) title = "Error"; + + if (commandLine) { + System.err.println(title + ": " + message); + + } else { + JOptionPane.showMessageDialog(new Frame(), message, title, + JOptionPane.ERROR_MESSAGE); + } + if (e != null) e.printStackTrace(); + System.exit(1); + } + + + // ................................................................... + + + /** + * Retrieve a path to something in the Processing folder. Eventually this + * may refer to the Contents subfolder of Processing.app, if we bundle things + * up as a single .app file with no additional folders. + */ +// static public String getContentsPath(String filename) { +// String basePath = System.getProperty("user.dir"); +// /* +// // do this later, when moving to .app package +// if (PApplet.platform == PConstants.MACOSX) { +// basePath = System.getProperty("processing.contents"); +// } +// */ +// return basePath + File.separator + filename; +// } + + + /** + * Get a path for something in the Processing lib folder. + */ + /* + static public String getLibContentsPath(String filename) { + String libPath = getContentsPath("lib/" + filename); + File libDir = new File(libPath); + if (libDir.exists()) { + return libPath; + } +// was looking into making this run from Eclipse, but still too much mess +// libPath = getContents("build/shared/lib/" + what); +// libDir = new File(libPath); +// if (libDir.exists()) { +// return libPath; +// } + return null; + } + */ + + static public File getContentFile(String name) { + String path = System.getProperty("user.dir"); + + // Get a path to somewhere inside the .app folder + if (Base.isMacOS()) { +// javaroot +// $JAVAROOT + String javaroot = System.getProperty("javaroot"); + if (javaroot != null) { + path = javaroot; + } + } + File working = new File(path); + return new File(working, name); + } + + + /** + * Get an image associated with the current color theme. + */ + static public Image getThemeImage(String name, Component who) { + return getLibImage("theme/" + name, who); + } + + + /** + * Return an Image object from inside the Processing lib folder. + */ + static public Image getLibImage(String name, Component who) { + Image image = null; + Toolkit tk = Toolkit.getDefaultToolkit(); + + File imageLocation = new File(getContentFile("lib"), name); + image = tk.getImage(imageLocation.getAbsolutePath()); + MediaTracker tracker = new MediaTracker(who); + tracker.addImage(image, 0); + try { + tracker.waitForAll(); + } catch (InterruptedException e) { } + return image; + } + + + /** + * Return an InputStream for a file inside the Processing lib folder. + */ + static public InputStream getLibStream(String filename) throws IOException { + return new FileInputStream(new File(getContentFile("lib"), filename)); + } + + + // ................................................................... + + + /** + * Get the number of lines in a file by counting the number of newline + * characters inside a String (and adding 1). + */ + static public int countLines(String what) { + int count = 1; + for (char c : what.toCharArray()) { + if (c == '\n') count++; + } + return count; + } + + + /** + * Same as PApplet.loadBytes(), however never does gzip decoding. + */ + static public byte[] loadBytesRaw(File file) throws IOException { + int size = (int) file.length(); + FileInputStream input = new FileInputStream(file); + byte buffer[] = new byte[size]; + int offset = 0; + int bytesRead; + while ((bytesRead = input.read(buffer, offset, size-offset)) != -1) { + offset += bytesRead; + if (bytesRead == 0) break; + } + input.close(); // weren't properly being closed + input = null; + return buffer; + } + + + static public void copyFile(File sourceFile, + File targetFile) throws IOException { + InputStream from = + new BufferedInputStream(new FileInputStream(sourceFile)); + OutputStream to = + new BufferedOutputStream(new FileOutputStream(targetFile)); + byte[] buffer = new byte[16 * 1024]; + int bytesRead; + while ((bytesRead = from.read(buffer)) != -1) { + to.write(buffer, 0, bytesRead); + } + to.flush(); + from.close(); // ?? + from = null; + to.close(); // ?? + to = null; + + targetFile.setLastModified(sourceFile.lastModified()); + } + + + /** + * Grab the contents of a file as a string. + */ + static public String loadFile(File file) throws IOException { + return PApplet.join(PApplet.loadStrings(file), "\n"); + + /* + // empty code file.. no worries, might be getting filled up later + if (file.length() == 0) return ""; + + //FileInputStream fis = new FileInputStream(file); + //InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); + //BufferedReader reader = new BufferedReader(isr); + BufferedReader reader = PApplet.createReader(file); + + StringBuffer buffer = new StringBuffer(); + String line = null; + while ((line = reader.readLine()) != null) { +// char[] cc = line.toCharArray(); +// for (int i = 0; i < cc.length; i++) { +// char c = cc[i]; +// if (c < 32 || c > 126) System.out.println("found " + c + " " + ((int) c)); +// } +// + buffer.append(line); + buffer.append('\n'); + } + reader.close(); + return buffer.toString(); + */ + } + + + /** + * Spew the contents of a String object out to a file. + */ + static public void saveFile(String str, File file) throws IOException { + PApplet.saveStrings(file, new String[] { str }); + /* + ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes()); + InputStreamReader isr = new InputStreamReader(bis); + BufferedReader reader = new BufferedReader(isr); + + FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); + PrintWriter writer = new PrintWriter(osw); + + String line = null; + while ((line = reader.readLine()) != null) { + writer.println(line); + } + writer.flush(); + writer.close(); + */ + } + + + /** + * Copy a folder from one place to another. This ignores all dot files and + * folders found in the source directory, to avoid copying silly .DS_Store + * files and potentially troublesome .svn folders. + */ + static public void copyDir(File sourceDir, + File targetDir) throws IOException { + targetDir.mkdirs(); + String files[] = sourceDir.list(); + for (int i = 0; i < files.length; i++) { + // Ignore dot files (.DS_Store), dot folders (.svn) while copying + if (files[i].charAt(0) == '.') continue; + //if (files[i].equals(".") || files[i].equals("..")) continue; + File source = new File(sourceDir, files[i]); + File target = new File(targetDir, files[i]); + if (source.isDirectory()) { + //target.mkdirs(); + copyDir(source, target); + target.setLastModified(source.lastModified()); + } else { + copyFile(source, target); + } + } + } + + + /** + * Remove all files in a directory and the directory itself. + */ + static public void removeDir(File dir) { + if (dir.exists()) { + removeDescendants(dir); + if (!dir.delete()) { + System.err.println("Could not delete " + dir); + } + } + } + + + /** + * Recursively remove all files within a directory, + * used with removeDir(), or when the contents of a dir + * should be removed, but not the directory itself. + * (i.e. when cleaning temp files from lib/build) + */ + static public void removeDescendants(File dir) { + if (!dir.exists()) return; + + String files[] = dir.list(); + for (int i = 0; i < files.length; i++) { + if (files[i].equals(".") || files[i].equals("..")) continue; + File dead = new File(dir, files[i]); + if (!dead.isDirectory()) { + if (!Preferences.getBoolean("compiler.save_build_files")) { + if (!dead.delete()) { + // temporarily disabled + System.err.println("Could not delete " + dead); + } + } + } else { + removeDir(dead); + //dead.delete(); + } + } + } + + + /** + * Calculate the size of the contents of a folder. + * Used to determine whether sketches are empty or not. + * Note that the function calls itself recursively. + */ + static public int calcFolderSize(File folder) { + int size = 0; + + String files[] = folder.list(); + // null if folder doesn't exist, happens when deleting sketch + if (files == null) return -1; + + for (int i = 0; i < files.length; i++) { + if (files[i].equals(".") || (files[i].equals("..")) || + files[i].equals(".DS_Store")) continue; + File fella = new File(folder, files[i]); + if (fella.isDirectory()) { + size += calcFolderSize(fella); + } else { + size += (int) fella.length(); + } + } + return size; + } + + + /** + * Recursively creates a list of all files within the specified folder, + * and returns a list of their relative paths. + * Ignores any files/folders prefixed with a dot. + */ + static public String[] listFiles(String path, boolean relative) { + return listFiles(new File(path), relative); + } + + + static public String[] listFiles(File folder, boolean relative) { + String path = folder.getAbsolutePath(); + Vector vector = new Vector(); + listFiles(relative ? (path + File.separator) : "", path, vector); + String outgoing[] = new String[vector.size()]; + vector.copyInto(outgoing); + return outgoing; + } + + + static protected void listFiles(String basePath, + String path, Vector vector) { + File folder = new File(path); + String list[] = folder.list(); + if (list == null) return; + + for (int i = 0; i < list.length; i++) { + if (list[i].charAt(0) == '.') continue; + + File file = new File(path, list[i]); + String newPath = file.getAbsolutePath(); + if (newPath.startsWith(basePath)) { + newPath = newPath.substring(basePath.length()); + } + vector.add(newPath); + if (file.isDirectory()) { + listFiles(basePath, newPath, vector); + } + } + } +} diff --git a/app/src/processing/app/Commander.java b/app/src/processing/app/Commander.java new file mode 100644 index 000000000..88d9cb598 --- /dev/null +++ b/app/src/processing/app/Commander.java @@ -0,0 +1,297 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package processing.app; + + +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; + +import processing.core.PApplet; + +import processing.app.debug.*; + + +/** + * Class to handle running Processing from the command line. + *

+ * --help               Show the help text.
+ * 
+ * --sketch=<name&rt;      Specify the sketch folder (required)
+ * --output=<name&rt;      Specify the output folder (required and
+ *                      cannot be the same as the sketch folder.)
+ * 
+ * --preprocess         Preprocess a sketch into .java files.
+ * --build              Preprocess and compile a sketch into .class files.
+ * --run                Preprocess, compile, and run a sketch.
+ * --present            Preprocess, compile, and run a sketch full screen.
+ * 
+ * --export-applet      Export an applet.
+ * --export-application Export an application.
+ * --platform           Specify the platform (export to application only).
+ *                      Should be one of 'windows', 'macosx', or 'linux'.
+ * 
+ * --preferences=<file&rt; Specify a preferences file to use (optional).
+ * 
+ * + * To build the command line version, first build for your platform, + * then cd to processing/build/cmd and type 'dist.sh'. This will create a + * usable installation plus a zip file of the same. + * + * @author fry + */ +public class Commander implements RunnerListener { + static final String helpArg = "--help"; + static final String preprocArg = "--preprocess"; + static final String buildArg = "--build"; + static final String runArg = "--run"; + static final String presentArg = "--present"; + static final String sketchArg = "--sketch="; + static final String outputArg = "--output="; + static final String exportAppletArg = "--export-applet"; + static final String exportApplicationArg = "--export-application"; + static final String platformArg = "--platform="; + static final String preferencesArg = "--preferences="; + + static final int HELP = -1; + static final int PREPROCESS = 0; + static final int BUILD = 1; + static final int RUN = 2; + static final int PRESENT = 3; + static final int EXPORT_APPLET = 4; + static final int EXPORT_APPLICATION = 5; + + Sketch sketch; + + + static public void main(String[] args) { + // init the platform so that prefs and other native code is ready to go + Base.initPlatform(); + // make sure a full JDK is installed + Base.initRequirements(); + // run static initialization that grabs all the prefs + //Preferences.init(null); + // launch command line handler + new Commander(args); + } + + + public Commander(String[] args) { + String sketchFolder = null; + String pdePath = null; // path to the .pde file + String outputPath = null; + String preferencesPath = null; + int platformIndex = PApplet.platform; // default to this platform + int mode = HELP; + + for (String arg : args) { + if (arg.length() == 0) { + // ignore it, just the crappy shell script + + } else if (arg.equals(helpArg)) { + // mode already set to HELP + + } else if (arg.equals(buildArg)) { + mode = BUILD; + + } else if (arg.equals(runArg)) { + mode = RUN; + + } else if (arg.equals(presentArg)) { + mode = PRESENT; + + } else if (arg.equals(preprocArg)) { + mode = PREPROCESS; + + } else if (arg.equals(exportAppletArg)) { + mode = EXPORT_APPLET; + + } else if (arg.equals(exportApplicationArg)) { + mode = EXPORT_APPLICATION; + + } else if (arg.startsWith(platformArg)) { + String platformStr = arg.substring(platformArg.length()); + platformIndex = Base.getPlatformIndex(platformStr); + if (platformIndex == -1) { + complainAndQuit(platformStr + " should instead be " + + "'windows', 'macosx', or 'linux'."); + } + } else if (arg.startsWith(sketchArg)) { + sketchFolder = arg.substring(sketchArg.length()); + File sketchy = new File(sketchFolder); + File pdeFile = new File(sketchy, sketchy.getName() + ".pde"); + pdePath = pdeFile.getAbsolutePath(); + + } else if (arg.startsWith(outputArg)) { + outputPath = arg.substring(outputArg.length()); + + } else { + complainAndQuit("I don't know anything about " + arg + "."); + } + } + + if ((outputPath == null) && + (mode == PREPROCESS || mode == BUILD || + mode == RUN || mode == PRESENT)) { + complainAndQuit("An output path must be specified when using " + + preprocArg + ", " + buildArg + ", " + + runArg + ", or " + presentArg + "."); + } + + if (mode == HELP) { + printCommandLine(System.out); + System.exit(0); + } + + // --present --platform=windows "--sketch=/Applications/Processing 0148/examples/Basics/Arrays/Array" --output=test-build + + File outputFolder = new File(outputPath); + if (!outputFolder.exists()) { + if (!outputFolder.mkdirs()) { + complainAndQuit("Could not create the output folder."); + } + } + + // run static initialization that grabs all the prefs + // (also pass in a prefs path if that was specified) + Preferences.init(preferencesPath); + + if (sketchFolder == null) { + complainAndQuit("No sketch path specified."); + + } else if (outputPath.equals(pdePath)) { + complainAndQuit("The sketch path and output path cannot be identical."); + + } else if (!pdePath.toLowerCase().endsWith(".pde")) { + complainAndQuit("Sketch path must point to the main .pde file."); + + } else { + //Sketch sketch = null; + boolean success = false; + + try { + sketch = new Sketch(null, pdePath); + if (mode == PREPROCESS) { + success = sketch.preprocess(outputPath) != null; + + } else if (mode == BUILD) { + success = sketch.build(outputPath) != null; + + } else if (mode == RUN || mode == PRESENT) { + String className = sketch.build(outputPath); + if (className != null) { + success = true; + Runner runner = + new Runner(sketch, className, mode == PRESENT, this); + runner.launch(); + + } else { + success = false; + } + + } else if (mode == EXPORT_APPLET) { + if (outputPath != null) { + success = sketch.exportApplet(outputPath); + } else { + String target = sketchFolder + File.separatorChar + "applet"; + success = sketch.exportApplet(target); + } + } else if (mode == EXPORT_APPLICATION) { + if (outputPath != null) { + success = sketch.exportApplication(outputPath, platformIndex); + } else { + //String sketchFolder = + // pdePath.substring(0, pdePath.lastIndexOf(File.separatorChar)); + outputPath = + sketchFolder + File.separatorChar + + "application." + Base.getPlatformName(platformIndex); + success = sketch.exportApplication(outputPath, platformIndex); + } + } + System.exit(success ? 0 : 1); + + } catch (RunnerException re) { + statusError(re); + + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); + } + } + } + + + public void statusError(String message) { + System.err.println(message); + } + + + public void statusError(Exception exception) { + if (exception instanceof RunnerException) { + RunnerException re = (RunnerException) exception; + + // format the runner exception like emacs + //blah.java:2:10:2:13: Syntax Error: This is a big error message + String filename = sketch.getCode(re.getCodeIndex()).getFileName(); + int line = re.getCodeLine(); + int column = re.getCodeColumn(); + if (column == -1) column = 0; + // TODO if column not specified, should just select the whole line. + System.err.println(filename + ":" + + line + ":" + column + ":" + + line + ":" + column + ":" + " " + re.getMessage()); + } else { + exception.printStackTrace(); + } + } + + + static void complainAndQuit(String lastWords) { + printCommandLine(System.err); + System.err.println(lastWords); + System.exit(1); + } + + + static void printCommandLine(PrintStream out) { + out.println("Processing " + Base.VERSION_NAME + " rocks the console."); + out.println(); + out.println("--help Show this help text."); + out.println(); + out.println("--sketch= Specify the sketch folder (required)"); + out.println("--output= Specify the output folder (required and"); + out.println(" cannot be the same as the sketch folder.)"); + out.println(); + out.println("--preprocess Preprocess a sketch into .java files."); + out.println("--build Preprocess and compile a sketch into .class files."); + out.println("--run Preprocess, compile, and run a sketch."); + out.println("--present Preprocess, compile, and run a sketch full screen."); + out.println(); + out.println("--export-applet Export an applet."); + out.println("--export-application Export an application."); + out.println("--platform Specify the platform (export to application only)."); + out.println(" Should be one of 'windows', 'macosx', or 'linux'."); + out.println(); + out.println("--preferences= Specify a preferences file to use (optional)."); + } +} \ No newline at end of file diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java new file mode 100644 index 000000000..a52b55b69 --- /dev/null +++ b/app/src/processing/app/Editor.java @@ -0,0 +1,2301 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import processing.app.debug.*; +import processing.app.syntax.*; +import processing.app.tools.*; +import processing.core.*; + +import java.awt.*; +import java.awt.datatransfer.*; +import java.awt.event.*; +import java.awt.print.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.zip.*; + +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.text.*; +import javax.swing.undo.*; + + +/** + * Main editor panel for the Processing Development Environment. + */ +public class Editor extends JFrame implements RunnerListener { + + Base base; + + // otherwise, if the window is resized with the message label + // set to blank, it's preferredSize() will be fukered + static protected final String EMPTY = + " " + + " " + + " "; + + /** Command on Mac OS X, Ctrl on Windows and Linux */ + static final int SHORTCUT_KEY_MASK = + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + /** Command-W on Mac OS X, Ctrl-W on Windows and Linux */ + static final KeyStroke WINDOW_CLOSE_KEYSTROKE = + KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK); + /** Command-Option on Mac OS X, Ctrl-Alt on Windows and Linux */ + static final int SHORTCUT_ALT_KEY_MASK = ActionEvent.ALT_MASK | + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + + /** + * true if this file has not yet been given a name by the user + */ + boolean untitled; + + PageFormat pageFormat; + PrinterJob printerJob; + + // file and sketch menus for re-inserting items + JMenu fileMenu; + JMenu sketchMenu; + + EditorToolbar toolbar; + // these menus are shared so that they needn't be rebuilt for all windows + // each time a sketch is created, renamed, or moved. + static JMenu toolbarMenu; + static JMenu sketchbookMenu; + static JMenu examplesMenu; + static JMenu importMenu; + + EditorHeader header; + EditorStatus status; + EditorConsole console; + + JSplitPane splitPane; + JPanel consolePanel; + + JLabel lineNumberComponent; + + // currently opened program + Sketch sketch; + + EditorLineStatus lineStatus; + + JEditTextArea textarea; + EditorListener listener; + + // runtime information and window placement + Point sketchWindowLocation; + Runner runtime; + + JMenuItem exportAppItem; + JMenuItem saveMenuItem; + JMenuItem saveAsMenuItem; + + boolean running; + boolean presenting; + + // undo fellers + JMenuItem undoItem, redoItem; + protected UndoAction undoAction; + protected RedoAction redoAction; + UndoManager undo; + // used internally, and only briefly + CompoundEdit compoundEdit; + + FindReplace find; + + + public Editor(Base ibase, String path, int[] location) { + super("Processing"); + this.base = ibase; + + Base.setIcon(this); + + // add listener to handle window close box hit event + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + base.handleClose(Editor.this); + } + }); + // don't close the window when clicked, the app will take care + // of that via the handleQuitInternal() methods + // http://dev.processing.org/bugs/show_bug.cgi?id=440 + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + + // When bringing a window to front, let the Base know + addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent e) { + base.handleActivated(Editor.this); + + // re-add the sub-menus that are shared by all windows + fileMenu.insert(sketchbookMenu, 2); + fileMenu.insert(examplesMenu, 3); + sketchMenu.insert(importMenu, 4); + } + }); + + //PdeKeywords keywords = new PdeKeywords(); + //sketchbook = new Sketchbook(this); + + buildMenuBar(); + + // For rev 0120, placing things inside a JPanel + Container contentPain = getContentPane(); + contentPain.setLayout(new BorderLayout()); + JPanel pain = new JPanel(); + pain.setLayout(new BorderLayout()); + contentPain.add(pain, BorderLayout.CENTER); + + Box box = Box.createVerticalBox(); + Box upper = Box.createVerticalBox(); + + if (toolbarMenu == null) { + toolbarMenu = new JMenu(); + base.rebuildToolbarMenu(toolbarMenu); + } + toolbar = new EditorToolbar(this, toolbarMenu); + upper.add(toolbar); + + header = new EditorHeader(this); + upper.add(header); + + textarea = new JEditTextArea(new PdeTextAreaDefaults()); + textarea.setRightClickPopup(new TextAreaPopup()); + textarea.setHorizontalOffset(6); + + // assemble console panel, consisting of status area and the console itself + consolePanel = new JPanel(); + consolePanel.setLayout(new BorderLayout()); + + status = new EditorStatus(this); + consolePanel.add(status, BorderLayout.NORTH); + + console = new EditorConsole(this); + // windows puts an ugly border on this guy + console.setBorder(null); + consolePanel.add(console, BorderLayout.CENTER); + + lineStatus = new EditorLineStatus(textarea); + consolePanel.add(lineStatus, BorderLayout.SOUTH); + + upper.add(textarea); + splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + upper, consolePanel); + + splitPane.setOneTouchExpandable(true); + // repaint child panes while resizing + splitPane.setContinuousLayout(true); + // if window increases in size, give all of increase to + // the textarea in the uppper pane + splitPane.setResizeWeight(1D); + + // to fix ugliness.. normally macosx java 1.3 puts an + // ugly white border around this object, so turn it off. + splitPane.setBorder(null); + + // the default size on windows is too small and kinda ugly + int dividerSize = Preferences.getInteger("editor.divider.size"); + if (dividerSize != 0) { + splitPane.setDividerSize(dividerSize); + } + + splitPane.setMinimumSize(new Dimension(600, 400)); + box.add(splitPane); + + // hopefully these are no longer needed w/ swing + // (har har har.. that was wishful thinking) + listener = new EditorListener(this, textarea); + pain.add(box); + + pain.setTransferHandler(new TransferHandler() { + + public boolean canImport(JComponent dest, DataFlavor[] flavors) { + return true; + } + + public boolean importData(JComponent src, Transferable transferable) { + int successful = 0; + + try { + DataFlavor uriListFlavor = + new DataFlavor("text/uri-list;class=java.lang.String"); + + if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { + java.util.List list = (java.util.List) + transferable.getTransferData(DataFlavor.javaFileListFlavor); + for (int i = 0; i < list.size(); i++) { + File file = (File) list.get(i); + if (sketch.addFile(file)) { + successful++; + } + } + } else if (transferable.isDataFlavorSupported(uriListFlavor)) { + //System.out.println("uri list"); + String data = (String)transferable.getTransferData(uriListFlavor); + String[] pieces = PApplet.splitTokens(data, "\r\n"); + //PApplet.println(pieces); + for (int i = 0; i < pieces.length; i++) { + if (pieces[i].startsWith("#")) continue; + + String path = null; + if (pieces[i].startsWith("file:///")) { + path = pieces[i].substring(7); + } else if (pieces[i].startsWith("file:/")) { + path = pieces[i].substring(5); + } + if (sketch.addFile(new File(path))) { + successful++; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + if (successful == 0) { + statusError("No files were added to the sketch."); + + } else if (successful == 1) { + statusNotice("One file added to the sketch."); + + } else { + statusNotice(successful + " files added to the sketch."); + } + return true; + } + }); + +// System.out.println("t1"); + + // Finish preparing Editor (formerly found in Base) + pack(); + +// System.out.println("t2"); + + // Set the window bounds and the divider location before setting it visible + setPlacement(location); + +// System.out.println("t3"); + + // Bring back the general options for the editor + applyPreferences(); + +// System.out.println("t4"); + + // Open the document that was passed in + boolean loaded = handleOpenInternal(path); + if (!loaded) sketch = null; + +// System.out.println("t5"); + + // All set, now show the window + //setVisible(true); + } + + + protected void setPlacement(int[] location) { + setBounds(location[0], location[1], location[2], location[3]); + if (location[4] != 0) { + splitPane.setDividerLocation(location[4]); + } + } + + + protected int[] getPlacement() { + int[] location = new int[5]; + + // Get the dimensions of the Frame + Rectangle bounds = getBounds(); + location[0] = bounds.x; + location[1] = bounds.y; + location[2] = bounds.width; + location[3] = bounds.height; + + // Get the current placement of the divider + location[4] = splitPane.getDividerLocation(); + + return location; + } + + + /** + * Hack for #@#)$(* Mac OS X 10.2. + *

+ * This appears to only be required on OS X 10.2, and is not + * even being called on later versions of OS X or Windows. + */ + public Dimension getMinimumSize() { + //System.out.println("getting minimum size"); + return new Dimension(500, 550); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Read and apply new values from the preferences, either because + * the app is just starting up, or the user just finished messing + * with things in the Preferences window. + */ + protected void applyPreferences() { + + // apply the setting for 'use external editor' + boolean external = Preferences.getBoolean("editor.external"); + + textarea.setEditable(!external); + saveMenuItem.setEnabled(!external); + saveAsMenuItem.setEnabled(!external); + + TextAreaPainter painter = textarea.getPainter(); + if (external) { + // disable line highlight and turn off the caret when disabling + Color color = Theme.getColor("editor.external.bgcolor"); + painter.setBackground(color); + painter.setLineHighlightEnabled(false); + textarea.setCaretVisible(false); + + } else { + Color color = Theme.getColor("editor.bgcolor"); + painter.setBackground(color); + boolean highlight = Preferences.getBoolean("editor.linehighlight"); + painter.setLineHighlightEnabled(highlight); + textarea.setCaretVisible(true); + } + + // apply changes to the font size for the editor + //TextAreaPainter painter = textarea.getPainter(); + painter.setFont(Preferences.getFont("editor.font")); + //Font font = painter.getFont(); + //textarea.getPainter().setFont(new Font("Courier", Font.PLAIN, 36)); + + // in case tab expansion stuff has changed + listener.applyPreferences(); + + // in case moved to a new location + // For 0125, changing to async version (to be implemented later) + //sketchbook.rebuildMenus(); + // For 0126, moved into Base, which will notify all editors. + //base.rebuildMenusAsync(); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + protected void buildMenuBar() { + JMenuBar menubar = new JMenuBar(); + menubar = new JMenuBar(); + menubar.add(buildFileMenu()); + menubar.add(buildEditMenu()); + menubar.add(buildSketchMenu()); + menubar.add(buildToolsMenu()); + menubar.add(buildHelpMenu()); + setJMenuBar(menubar); + } + + + protected JMenu buildFileMenu() { + JMenuItem item; + fileMenu = new JMenu("File"); + + item = newJMenuItem("New", 'N'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + base.handleNew(); + } + }); + fileMenu.add(item); + + item = Editor.newJMenuItem("Open...", 'O'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + base.handleOpenPrompt(); + } + }); + fileMenu.add(item); + + if (sketchbookMenu == null) { + sketchbookMenu = new JMenu("Sketchbook"); + base.rebuildSketchbookMenu(sketchbookMenu); + } + fileMenu.add(sketchbookMenu); + + if (examplesMenu == null) { + examplesMenu = new JMenu("Examples"); + base.rebuildExamplesMenu(examplesMenu); + } + fileMenu.add(examplesMenu); + + item = Editor.newJMenuItem("Close", 'W'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + base.handleClose(Editor.this); + } + }); + fileMenu.add(item); + + saveMenuItem = newJMenuItem("Save", 'S'); + saveMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleSave(false); + } + }); + fileMenu.add(saveMenuItem); + + saveAsMenuItem = newJMenuItemShift("Save As...", 'S'); + saveAsMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleSaveAs(); + } + }); + fileMenu.add(saveAsMenuItem); + + item = newJMenuItem("Export", 'E'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleExport(); + } + }); + fileMenu.add(item); + + exportAppItem = newJMenuItemShift("Export Application", 'E'); + exportAppItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //buttons.activate(EditorButtons.EXPORT); + //SwingUtilities.invokeLater(new Runnable() { + //public void run() { + handleExportApplication(); + //}}); + } + }); + fileMenu.add(exportAppItem); + + fileMenu.addSeparator(); + + item = newJMenuItemShift("Page Setup", 'P'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handlePageSetup(); + } + }); + fileMenu.add(item); + + item = newJMenuItem("Print", 'P'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handlePrint(); + } + }); + fileMenu.add(item); + + // macosx already has its own preferences and quit menu + if (!Base.isMacOS()) { + fileMenu.addSeparator(); + + item = newJMenuItem("Preferences", ','); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + base.handlePrefs(); + } + }); + fileMenu.add(item); + + fileMenu.addSeparator(); + + item = newJMenuItem("Quit", 'Q'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + base.handleQuit(); + } + }); + fileMenu.add(item); + } + return fileMenu; + } + + + protected JMenu buildSketchMenu() { + JMenuItem item; + sketchMenu = new JMenu("Sketch"); + + item = newJMenuItem("Run", 'R'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleRun(false); + } + }); + sketchMenu.add(item); + + item = newJMenuItemShift("Present", 'R'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleRun(true); + } + }); + sketchMenu.add(item); + + item = new JMenuItem("Stop"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleStop(); + } + }); + sketchMenu.add(item); + + sketchMenu.addSeparator(); + + if (importMenu == null) { + importMenu = new JMenu("Import Library..."); + base.rebuildImportMenu(importMenu); + } + sketchMenu.add(importMenu); + + item = newJMenuItem("Show Sketch Folder", 'K'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.openFolder(sketch.getFolder()); + } + }); + sketchMenu.add(item); + item.setEnabled(Base.openFolderAvailable()); + + item = new JMenuItem("Add File..."); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + sketch.handleAddFile(); + } + }); + sketchMenu.add(item); + + return sketchMenu; + } + + + protected JMenu buildToolsMenu() { + JMenu menu = new JMenu("Tools"); + + addInternalTools(menu); + addTools(menu, Base.getToolsFolder()); + File sketchbookTools = new File(Base.getSketchbookFolder(), "tools"); + addTools(menu, sketchbookTools); + + return menu; + } + + + protected void addTools(JMenu menu, File sourceFolder) { + HashMap toolItems = new HashMap(); + + File[] folders = sourceFolder.listFiles(new FileFilter() { + public boolean accept(File folder) { + if (folder.isDirectory()) { + //System.out.println("checking " + folder); + File subfolder = new File(folder, "tool"); + return subfolder.exists(); + } + return false; + } + }); + + if (folders == null || folders.length == 0) { + return; + } + + for (int i = 0; i < folders.length; i++) { + File toolDirectory = new File(folders[i], "tool"); + + try { + // add dir to classpath for .classes + //urlList.add(toolDirectory.toURL()); + + // add .jar files to classpath + File[] archives = toolDirectory.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return (name.toLowerCase().endsWith(".jar") || + name.toLowerCase().endsWith(".zip")); + } + }); + + URL[] urlList = new URL[archives.length]; + for (int j = 0; j < urlList.length; j++) { + urlList[j] = archives[j].toURL(); + } + URLClassLoader loader = new URLClassLoader(urlList); + + String className = null; + for (int j = 0; j < archives.length; j++) { + className = findClassInZipFile(folders[i].getName(), archives[j]); + if (className != null) break; + } + + /* + // Alternatively, could use manifest files with special attributes: + // http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html + // Example code for loading from a manifest file: + // http://forums.sun.com/thread.jspa?messageID=3791501 + File infoFile = new File(toolDirectory, "tool.txt"); + if (!infoFile.exists()) continue; + + String[] info = PApplet.loadStrings(infoFile); + //Main-Class: org.poo.shoe.AwesomerTool + //String className = folders[i].getName(); + String className = null; + for (int k = 0; k < info.length; k++) { + if (info[k].startsWith(";")) continue; + + String[] pieces = PApplet.splitTokens(info[k], ": "); + if (pieces.length == 2) { + if (pieces[0].equals("Main-Class")) { + className = pieces[1]; + } + } + } + */ + // If no class name found, just move on. + if (className == null) continue; + + Class toolClass = Class.forName(className, true, loader); + final Tool tool = (Tool) toolClass.newInstance(); + + tool.init(Editor.this); + + String title = tool.getMenuTitle(); + JMenuItem item = new JMenuItem(title); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + SwingUtilities.invokeLater(tool); + } + }); + //menu.add(item); + toolItems.put(title, item); + + } catch (Exception e) { + e.printStackTrace(); + } + } + ArrayList toolList = new ArrayList(toolItems.keySet()); + if (toolList.size() == 0) return; + + menu.addSeparator(); + Collections.sort(toolList); + for (String title : toolList) { + menu.add((JMenuItem) toolItems.get(title)); + } + } + + + protected String findClassInZipFile(String base, File file) { + // Class file to search for + String classFileName = "/" + base + ".class"; + + try { + ZipFile zipFile = new ZipFile(file); + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = (ZipEntry) entries.nextElement(); + + if (!entry.isDirectory()) { + String name = entry.getName(); + //System.out.println("entry: " + name); + + if (name.endsWith(classFileName)) { + //int slash = name.lastIndexOf('/'); + //String packageName = (slash == -1) ? "" : name.substring(0, slash); + // Remove .class and convert slashes to periods. + return name.substring(0, name.length() - 6).replace('/', '.'); + } + } + } + } catch (IOException e) { + //System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")"); + e.printStackTrace(); + } + return null; + } + + + protected JMenuItem createToolMenuItem(String className) { + try { + Class toolClass = Class.forName(className); + final Tool tool = (Tool) toolClass.newInstance(); + + JMenuItem item = new JMenuItem(tool.getMenuTitle()); + + tool.init(Editor.this); + + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + SwingUtilities.invokeLater(tool); + } + }); + return item; + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + protected JMenu addInternalTools(JMenu menu) { + JMenuItem item; + + item = createToolMenuItem("processing.app.tools.AutoFormat"); + int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + item.setAccelerator(KeyStroke.getKeyStroke('T', modifiers)); + menu.add(item); + + menu.add(createToolMenuItem("processing.app.tools.CreateFont")); + menu.add(createToolMenuItem("processing.app.tools.ColorSelector")); + menu.add(createToolMenuItem("processing.app.tools.Archiver")); + menu.add(createToolMenuItem("processing.app.tools.FixEncoding")); + + return menu; + } + + + protected JMenu buildHelpMenu() { + JMenu menu = new JMenu("Help"); + JMenuItem item; + + /* + // testing internal web server to serve up docs from a zip file + item = new JMenuItem("Web Server Test"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //WebServer ws = new WebServer(); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + try { + int port = WebServer.launch("/Users/fry/coconut/processing/build/shared/reference.zip"); + Base.openURL("http://127.0.0.1:" + port + "/reference/setup_.html"); + + } catch (IOException e1) { + e1.printStackTrace(); + } + } + }); + } + }); + menu.add(item); + */ + + /* + item = new JMenuItem("Browser Test"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //Base.openURL("http://processing.org/learning/gettingstarted/"); + //JFrame browserFrame = new JFrame("Browser"); + BrowserStartup bs = new BrowserStartup("jar:file:/Users/fry/coconut/processing/build/shared/reference.zip!/reference/setup_.html"); + bs.initUI(); + bs.launch(); + } + }); + menu.add(item); + */ + + item = new JMenuItem("Getting Started"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.openURL("http://processing.org/learning/gettingstarted/"); + } + }); + menu.add(item); + + item = new JMenuItem("Environment"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.showEnvironment(); + } + }); + menu.add(item); + + item = new JMenuItem("Troubleshooting"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.showTroubleshooting(); + } + }); + menu.add(item); + + item = new JMenuItem("Reference"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.showReference(); + } + }); + menu.add(item); + + item = newJMenuItemShift("Find in Reference", 'F'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (textarea.isSelectionActive()) { + handleFindReference(); + } + } + }); + menu.add(item); + + item = new JMenuItem("Frequently Asked Questions"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.openURL("http://processing.org/faq.html"); + } + }); + menu.add(item); + + item = newJMenuItem("Visit Processing.org", '5'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Base.openURL("http://processing.org/"); + } + }); + menu.add(item); + + // macosx already has its own about menu + if (!Base.isMacOS()) { + menu.addSeparator(); + item = new JMenuItem("About Processing"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + base.handleAbout(); + } + }); + menu.add(item); + } + + return menu; + } + + + protected JMenu buildEditMenu() { + JMenu menu = new JMenu("Edit"); + JMenuItem item; + + undoItem = newJMenuItem("Undo", 'Z'); + undoItem.addActionListener(undoAction = new UndoAction()); + menu.add(undoItem); + + redoItem = newJMenuItem("Redo", 'Y'); + redoItem.addActionListener(redoAction = new RedoAction()); + menu.add(redoItem); + + menu.addSeparator(); + + // TODO "cut" and "copy" should really only be enabled + // if some text is currently selected + item = newJMenuItem("Cut", 'X'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleCut(); + } + }); + menu.add(item); + + item = newJMenuItem("Copy", 'C'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + textarea.copy(); + } + }); + menu.add(item); + + item = newJMenuItemShift("Copy for Discourse", 'C'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { +// SwingUtilities.invokeLater(new Runnable() { +// public void run() { + new DiscourseFormat(Editor.this).show(); +// } +// }); + } + }); + menu.add(item); + + item = newJMenuItem("Paste", 'V'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + textarea.paste(); + sketch.setModified(true); + } + }); + menu.add(item); + + item = newJMenuItem("Select All", 'A'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + textarea.selectAll(); + } + }); + menu.add(item); + + menu.addSeparator(); + + item = newJMenuItem("Comment/Uncomment", '/'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleCommentUncomment(); + } + }); + menu.add(item); + + item = newJMenuItem("Increase Indent", ']'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleIndentOutdent(true); + } + }); + menu.add(item); + + item = newJMenuItem("Decrease Indent", '['); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleIndentOutdent(false); + } + }); + menu.add(item); + + menu.addSeparator(); + + item = newJMenuItem("Find...", 'F'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (find == null) { + find = new FindReplace(Editor.this); + } + //new FindReplace(Editor.this).show(); + find.setVisible(true); + //find.setVisible(true); + } + }); + menu.add(item); + + // TODO find next should only be enabled after a + // search has actually taken place + item = newJMenuItem("Find Next", 'G'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (find != null) { + //find.find(true); + //FindReplace find = new FindReplace(Editor.this); //.show(); + find.find(true); + } + } + }); + menu.add(item); + + return menu; + } + + + /** + * A software engineer, somewhere, needs to have his abstraction + * taken away. In some countries they jail or beat people for writing + * the sort of API that would require a five line helper function + * just to set the command key for a menu item. + */ + static public JMenuItem newJMenuItem(String title, int what) { + JMenuItem menuItem = new JMenuItem(title); + int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers)); + return menuItem; + } + + + /** + * Like newJMenuItem() but adds shift as a modifier for the key command. + */ + static public JMenuItem newJMenuItemShift(String title, int what) { + JMenuItem menuItem = new JMenuItem(title); + int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + modifiers |= ActionEvent.SHIFT_MASK; + menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers)); + return menuItem; + } + + + /** + * Same as newJMenuItem(), but adds the ALT (on Linux and Windows) + * or OPTION (on Mac OS X) key as a modifier. + */ + static public JMenuItem newJMenuItemAlt(String title, int what) { + JMenuItem menuItem = new JMenuItem(title); + //int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + //menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers)); + menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_ALT_KEY_MASK)); + return menuItem; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + class UndoAction extends AbstractAction { + public UndoAction() { + super("Undo"); + this.setEnabled(false); + } + + public void actionPerformed(ActionEvent e) { + try { + undo.undo(); + } catch (CannotUndoException ex) { + //System.out.println("Unable to undo: " + ex); + //ex.printStackTrace(); + } + updateUndoState(); + redoAction.updateRedoState(); + } + + protected void updateUndoState() { + if (undo.canUndo()) { + this.setEnabled(true); + undoItem.setEnabled(true); + undoItem.setText(undo.getUndoPresentationName()); + putValue(Action.NAME, undo.getUndoPresentationName()); + if (sketch != null) { + sketch.setModified(true); // 0107 + } + } else { + this.setEnabled(false); + undoItem.setEnabled(false); + undoItem.setText("Undo"); + putValue(Action.NAME, "Undo"); + if (sketch != null) { + sketch.setModified(false); // 0107 + } + } + } + } + + + class RedoAction extends AbstractAction { + public RedoAction() { + super("Redo"); + this.setEnabled(false); + } + + public void actionPerformed(ActionEvent e) { + try { + undo.redo(); + } catch (CannotRedoException ex) { + //System.out.println("Unable to redo: " + ex); + //ex.printStackTrace(); + } + updateRedoState(); + undoAction.updateUndoState(); + } + + protected void updateRedoState() { + if (undo.canRedo()) { + redoItem.setEnabled(true); + redoItem.setText(undo.getRedoPresentationName()); + putValue(Action.NAME, undo.getRedoPresentationName()); + } else { + this.setEnabled(false); + redoItem.setEnabled(false); + redoItem.setText("Redo"); + putValue(Action.NAME, "Redo"); + } + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Gets the current sketch object. + */ + public Sketch getSketch() { + return sketch; + } + + + /** + * Get the JEditTextArea object for use (not recommended). This should only + * be used in obscure cases that really need to hack the internals of the + * JEditTextArea. Most tools should only interface via the get/set functions + * found in this class. This will maintain compatibility with future releases, + * which will not use JEditTextArea. + */ + public JEditTextArea getTextArea() { + return textarea; + } + + + /** + * Get the contents of the current buffer. Used by the Sketch class. + */ + public String getText() { + return textarea.getText(); + } + + + /** + * Get a range of text from the current buffer. + */ + public String getText(int start, int stop) { + return textarea.getText(start, stop - start); + } + + + /** + * Replace the entire contents of the front-most tab. + */ + public void setText(String what) { + startCompoundEdit(); + textarea.setText(what); + stopCompoundEdit(); + } + + + public void insertText(String what) { + startCompoundEdit(); + int caret = getCaretOffset(); + setSelection(caret, caret); + textarea.setSelectedText(what); + stopCompoundEdit(); + } + + + /** + * Called to update the text but not switch to a different set of code + * (which would affect the undo manager). + */ +// public void setText2(String what, int start, int stop) { +// beginCompoundEdit(); +// textarea.setText(what); +// endCompoundEdit(); +// +// // make sure that a tool isn't asking for a bad location +// start = Math.max(0, Math.min(start, textarea.getDocumentLength())); +// stop = Math.max(0, Math.min(start, textarea.getDocumentLength())); +// textarea.select(start, stop); +// +// textarea.requestFocus(); // get the caret blinking +// } + + + public String getSelectedText() { + return textarea.getSelectedText(); + } + + + public void setSelectedText(String what) { + textarea.setSelectedText(what); + } + + + public void setSelection(int start, int stop) { + // make sure that a tool isn't asking for a bad location + start = PApplet.constrain(start, 0, textarea.getDocumentLength()); + stop = PApplet.constrain(stop, 0, textarea.getDocumentLength()); + + textarea.select(start, stop); + } + + + /** + * Get the position (character offset) of the caret. With text selected, + * this will be the last character actually selected, no matter the direction + * of the selection. That is, if the user clicks and drags to select lines + * 7 up to 4, then the caret position will be somewhere on line four. + */ + public int getCaretOffset() { + return textarea.getCaretPosition(); + } + + + /** + * True if some text is currently selected. + */ + public boolean isSelectionActive() { + return textarea.isSelectionActive(); + } + + + /** + * Get the beginning point of the current selection. + */ + public int getSelectionStart() { + return textarea.getSelectionStart(); + } + + + /** + * Get the end point of the current selection. + */ + public int getSelectionStop() { + return textarea.getSelectionStop(); + } + + + /** + * Get text for a specified line. + */ + public String getLineText(int line) { + return textarea.getLineText(line); + } + + + /** + * Replace the text on a specified line. + */ + public void setLineText(int line, String what) { + startCompoundEdit(); + textarea.select(getLineStartOffset(line), getLineStopOffset(line)); + textarea.setSelectedText(what); + stopCompoundEdit(); + } + + + /** + * Get character offset for the start of a given line of text. + */ + public int getLineStartOffset(int line) { + return textarea.getLineStartOffset(line); + } + + + /** + * Get character offset for end of a given line of text. + */ + public int getLineStopOffset(int line) { + return textarea.getLineStopOffset(line); + } + + + /** + * Get the number of lines in the currently displayed buffer. + */ + public int getLineCount() { + return textarea.getLineCount(); + } + + + /** + * Use before a manipulating text to group editing operations together as a + * single undo. Use stopCompoundEdit() once finished. + */ + public void startCompoundEdit() { + compoundEdit = new CompoundEdit(); + } + + + /** + * Use with startCompoundEdit() to group edit operations in a single undo. + */ + public void stopCompoundEdit() { + compoundEdit.end(); + undo.addEdit(compoundEdit); + undoAction.updateUndoState(); + redoAction.updateRedoState(); + compoundEdit = null; + } + + + public int getScrollPosition() { + return textarea.getScrollPosition(); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Switch between tabs, this swaps out the Document object + * that's currently being manipulated. + */ + protected void setCode(SketchCode code) { + SyntaxDocument document = (SyntaxDocument) code.getDocument(); + + if (document == null) { // this document not yet inited + document = new SyntaxDocument(); + code.setDocument(document); + + // turn on syntax highlighting + document.setTokenMarker(new PdeKeywords()); + + // insert the program text into the document object + try { + document.insertString(0, code.getProgram(), null); + } catch (BadLocationException bl) { + bl.printStackTrace(); + } + + // set up this guy's own undo manager +// code.undo = new UndoManager(); + + // connect the undo listener to the editor + document.addUndoableEditListener(new UndoableEditListener() { + public void undoableEditHappened(UndoableEditEvent e) { + if (compoundEdit != null) { + compoundEdit.addEdit(e.getEdit()); + + } else if (undo != null) { + undo.addEdit(e.getEdit()); + undoAction.updateUndoState(); + redoAction.updateRedoState(); + } + } + }); + } + + // update the document object that's in use + textarea.setDocument(document, + code.getSelectionStart(), code.getSelectionStop(), + code.getScrollPosition()); + + textarea.requestFocus(); // get the caret blinking + + this.undo = code.getUndo(); + undoAction.updateUndoState(); + redoAction.updateRedoState(); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Implements Edit → Cut. + */ + public void handleCut() { + textarea.cut(); + sketch.setModified(true); + } + + + /** + * Implements Edit → Copy. + */ + public void handleCopy() { + textarea.copy(); + } + + + protected void handleDiscourseCopy() { + new DiscourseFormat(Editor.this).show(); + } + + + /** + * Implements Edit → Paste. + */ + public void handlePaste() { + textarea.paste(); + sketch.setModified(true); + } + + + /** + * Implements Edit → Select All. + */ + public void handleSelectAll() { + textarea.selectAll(); + } + + + protected void handleCommentUncomment() { + startCompoundEdit(); + + int startLine = textarea.getSelectionStartLine(); + int stopLine = textarea.getSelectionStopLine(); + + int lastLineStart = textarea.getLineStartOffset(stopLine); + int selectionStop = textarea.getSelectionStop(); + // If the selection ends at the beginning of the last line, + // then don't (un)comment that line. + if (selectionStop == lastLineStart) { + // Though if there's no selection, don't do that + if (textarea.isSelectionActive()) { + stopLine--; + } + } + + // If the text is empty, ignore the user. + // Also ensure that all lines are commented (not just the first) + // when determining whether to comment or uncomment. + int length = textarea.getDocumentLength(); + boolean commented = true; + for (int i = startLine; commented && (i <= stopLine); i++) { + int pos = textarea.getLineStartOffset(i); + if (pos + 2 > length) { + commented = false; + } else { + // Check the first two characters to see if it's already a comment. + String begin = textarea.getText(pos, 2); + //System.out.println("begin is '" + begin + "'"); + commented = begin.equals("//"); + } + } + + for (int line = startLine; line <= stopLine; line++) { + int location = textarea.getLineStartOffset(line); + if (commented) { + // remove a comment + textarea.select(location, location+2); + if (textarea.getSelectedText().equals("//")) { + textarea.setSelectedText(""); + } + } else { + // add a comment + textarea.select(location, location); + textarea.setSelectedText("//"); + } + } + // Subtract one from the end, otherwise selects past the current line. + // (Which causes subsequent calls to keep expanding the selection) + textarea.select(textarea.getLineStartOffset(startLine), + textarea.getLineStopOffset(stopLine) - 1); + stopCompoundEdit(); + } + + + protected void handleIndentOutdent(boolean indent) { + int tabSize = Preferences.getInteger("editor.tabs.size"); + String tabString = Editor.EMPTY.substring(0, tabSize); + + startCompoundEdit(); + + int startLine = textarea.getSelectionStartLine(); + int stopLine = textarea.getSelectionStopLine(); + + // If the selection ends at the beginning of the last line, + // then don't (un)comment that line. + int lastLineStart = textarea.getLineStartOffset(stopLine); + int selectionStop = textarea.getSelectionStop(); + if (selectionStop == lastLineStart) { + // Though if there's no selection, don't do that + if (textarea.isSelectionActive()) { + stopLine--; + } + } + + for (int line = startLine; line <= stopLine; line++) { + int location = textarea.getLineStartOffset(line); + + if (indent) { + textarea.select(location, location); + textarea.setSelectedText(tabString); + + } else { // outdent + textarea.select(location, location + tabSize); + // Don't eat code if it's not indented + if (textarea.getSelectedText().equals(tabString)) { + textarea.setSelectedText(""); + } + } + } + // Subtract one from the end, otherwise selects past the current line. + // (Which causes subsequent calls to keep expanding the selection) + textarea.select(textarea.getLineStartOffset(startLine), + textarea.getLineStopOffset(stopLine) - 1); + stopCompoundEdit(); + } + + + protected void handleFindReference() { + String text = textarea.getSelectedText().trim(); + + if (text.length() == 0) { + statusNotice("First select a word to find in the reference."); + + } else { + String referenceFile = PdeKeywords.getReference(text); + //System.out.println("reference file is " + referenceFile); + if (referenceFile == null) { + statusNotice("No reference available for \"" + text + "\""); + } else { + Base.showReference(referenceFile + ".html"); + } + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Implements Sketch → Run. + * @param present Set true to run in full screen (present mode). + */ + public void handleRun(boolean present) { + internalCloseRunner(); + running = true; + toolbar.activate(EditorToolbar.RUN); + statusEmpty(); + + // do this to advance/clear the terminal window / dos prompt / etc + for (int i = 0; i < 10; i++) System.out.println(); + + // clear the console on each run, unless the user doesn't want to + if (Preferences.getBoolean("console.auto_clear")) { + console.clear(); + } + + presenting = present; + + try { + String appletClassName = sketch.compile(); + if (appletClassName != null) { + runtime = new Runner(sketch, appletClassName, presenting, Editor.this); + + // Cannot use invokeLater() here, otherwise it gets + // placed on the event thread and causes a hang--bad idea all around. + Thread t = new Thread(new Runnable() { + public void run() { + runtime.launch(); + } + }); + t.start(); + //runtime.start(appletLocation); + } + + } catch (Exception e) { + //System.err.println("exception reached editor"); + //e.printStackTrace(); + statusError(e); + } + } + + + /** + * Set the location of the sketch run window. Used by Runner to update the + * Editor about window drag events while the sketch is running. + */ + public void setSketchLocation(Point p) { + sketchWindowLocation = p; + } + + + /** + * Get the last location of the sketch's run window. Used by Runner to make + * the window show up in the same location as when it was last closed. + */ + public Point getSketchLocation() { + return sketchWindowLocation; + } + + + /** + * Implements Sketch → Stop, or pressing Stop on the toolbar. + */ + public void handleStop() { // called by menu or buttons + toolbar.activate(EditorToolbar.STOP); + + internalCloseRunner(); + + toolbar.deactivate(EditorToolbar.RUN); + toolbar.deactivate(EditorToolbar.STOP); + + // focus the PDE again after quitting presentation mode [toxi 030903] + toFront(); + } + + + /** + * Called by Runner to notify that the sketch has stopped running. + * Tools should not call this function, use handleStop() instead. + */ + public void internalRunnerClosed() { + running = false; + toolbar.deactivate(EditorToolbar.RUN); + } + + + /** + * Handle internal shutdown of the runner. + */ + public void internalCloseRunner() { + running = false; + + try { + if (runtime != null) { + runtime.close(); // kills the window + runtime = null; // will this help? + } + } catch (Exception e) { } + + sketch.cleanup(); + } + + + /** + * Check if the sketch is modified and ask user to save changes. + * Immediately should be set true when quitting, or when the save should + * not happen asynchronously. Come to think of it, that's always now? + * @return false if canceling the close/quit operation + */ + protected boolean checkModified(boolean immediately) { + if (!sketch.isModified()) return true; + + String prompt = "Save changes to " + sketch.getName() + "? "; + + if (!Base.isMacOS()) { + int result = + JOptionPane.showConfirmDialog(this, prompt, "Close", + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + + if (result == JOptionPane.YES_OPTION) { + return handleSave(immediately); + + } else if (result == JOptionPane.NO_OPTION) { + return true; // ok to continue + + } else if (result == JOptionPane.CANCEL_OPTION) { + return false; + } else { + throw new IllegalStateException(); + } + + } else { + // This code is disabled unless Java 1.5 is being used on Mac OS X + // because of a Java bug that prevents the initial value of the + // dialog from being set properly (at least on my MacBook Pro). + // The bug causes the "Don't Save" option to be the highlighted, + // blinking, default. This sucks. But I'll tell you what doesn't + // suck--workarounds for the Mac and Apple's snobby attitude about it! + // I think it's nifty that they treat their developers like dirt. + + // Pane formatting adapted from the quaqua guide + // http://www.randelshofer.ch/quaqua/guide/joptionpane.html + JOptionPane pane = + new JOptionPane(" " + + " " + + "Do you want to save changes to this sketch
" + + " before closing?
" + + "

If you don't save, your changes will be lost.", + JOptionPane.QUESTION_MESSAGE); + + String[] options = new String[] { + "Save", "Cancel", "Don't Save" + }; + pane.setOptions(options); + + // highlight the safest option ala apple hig + pane.setInitialValue(options[0]); + + // on macosx, setting the destructive property places this option + // away from the others at the lefthand side + pane.putClientProperty("Quaqua.OptionPane.destructiveOption", + new Integer(2)); + + JDialog dialog = pane.createDialog(this, null); + dialog.setVisible(true); + + Object result = pane.getValue(); + if (result == options[0]) { // save (and close/quit) + return handleSave(immediately); + + } else if (result == options[2]) { // don't save (still close/quit) + return true; + + } else { // cancel? + return false; + } + } + } + + + /** + * Open a sketch from a particular path, but don't check to save changes. + * Used by Sketch.saveAs() to re-open a sketch after the "Save As" + */ + protected void handleOpenUnchecked(String path, int codeIndex, + int selStart, int selStop, int scrollPos) { + internalCloseRunner(); + handleOpenInternal(path); + // Replacing a document that may be untitled. If this is an actual + // untitled document, then editor.untitled will be set by Base. + untitled = false; + + sketch.setCurrentCode(codeIndex); + textarea.select(selStart, selStop); + textarea.setScrollPosition(scrollPos); + } + + + /** + * Second stage of open, occurs after having checked to see if the + * modifications (if any) to the previous sketch need to be saved. + */ + protected boolean handleOpenInternal(String path) { + // check to make sure that this .pde file is + // in a folder of the same name + File file = new File(path); + File parentFile = new File(file.getParent()); + String parentName = parentFile.getName(); + String pdeName = parentName + ".pde"; + File altFile = new File(file.getParent(), pdeName); + + if (pdeName.equals(file.getName())) { + // no beef with this guy + + } else if (altFile.exists()) { + // user selected a .java from the same sketch, + // but open the .pde instead + path = altFile.getAbsolutePath(); + //System.out.println("found alt file in same folder"); + + } else if (!path.endsWith(".pde")) { + Base.showWarning("Bad file selected", + "Processing can only open its own sketches\n" + + "and other files ending in .pde", null); + return false; + + } else { + String properParent = + file.getName().substring(0, file.getName().length() - 4); + + Object[] options = { "OK", "Cancel" }; + String prompt = + "The file \"" + file.getName() + "\" needs to be inside\n" + + "a sketch folder named \"" + properParent + "\".\n" + + "Create this folder, move the file, and continue?"; + + int result = JOptionPane.showOptionDialog(this, + prompt, + "Moving", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[0]); + + if (result == JOptionPane.YES_OPTION) { + // create properly named folder + File properFolder = new File(file.getParent(), properParent); + if (properFolder.exists()) { + Base.showWarning("Error", + "A folder named \"" + properParent + "\" " + + "already exists. Can't open sketch.", null); + return false; + } + if (!properFolder.mkdirs()) { + //throw new IOException("Couldn't create sketch folder"); + Base.showWarning("Error", + "Could not create the sketch folder.", null); + return false; + } + // copy the sketch inside + File properPdeFile = new File(properFolder, file.getName()); + File origPdeFile = new File(path); + try { + Base.copyFile(origPdeFile, properPdeFile); + } catch (IOException e) { + Base.showWarning("Error", "Could not copy to a proper location.", e); + return false; + } + + // remove the original file, so user doesn't get confused + origPdeFile.delete(); + + // update with the new path + path = properPdeFile.getAbsolutePath(); + + } else if (result == JOptionPane.NO_OPTION) { + return false; + } + } + + try { + sketch = new Sketch(this, path); + } catch (IOException e) { + Base.showWarning("Error", "Could not create the sketch.", e); + return false; + } + header.rebuild(); + // Set the title of the window to "sketch_070752a - Processing 0126" + setTitle(sketch.getName() + " | Processing " + Base.VERSION_NAME); + // Disable untitled setting from previous document, if any + untitled = false; + + // Store information on who's open and running + // (in case there's a crash or something that can't be recovered) + base.storeSketches(); + Preferences.save(); + + // opening was successful + return true; + +// } catch (Exception e) { +// e.printStackTrace(); +// statusError(e); +// return false; +// } + } + + + /** + * Actually handle the save command. If 'immediately' is set to false, + * this will happen in another thread so that the message area + * will update and the save button will stay highlighted while the + * save is happening. If 'immediately' is true, then it will happen + * immediately. This is used during a quit, because invokeLater() + * won't run properly while a quit is happening. This fixes + * Bug 276. + */ + public boolean handleSave(boolean immediately) { + //stopRunner(); + handleStop(); // 0136 + + if (untitled) { + return handleSaveAs(); + // need to get the name, user might also cancel here + + } else if (immediately) { + handleSave2(); + + } else { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + handleSave2(); + } + }); + } + return true; + } + + + protected void handleSave2() { + toolbar.activate(EditorToolbar.SAVE); + statusNotice("Saving..."); + try { + if (sketch.save()) { + statusNotice("Done Saving."); + } else { + statusEmpty(); + } + // rebuild sketch menu in case a save-as was forced + // Disabling this for 0125, instead rebuild the menu inside + // the Save As method of the Sketch object, since that's the + // only one who knows whether something was renamed. + //sketchbook.rebuildMenus(); + //sketchbook.rebuildMenusAsync(); + + } catch (Exception e) { + // show the error as a message in the window + statusError(e); + + // zero out the current action, + // so that checkModified2 will just do nothing + //checkModifiedMode = 0; + // this is used when another operation calls a save + } + //toolbar.clear(); + toolbar.deactivate(EditorToolbar.SAVE); + } + + + public boolean handleSaveAs() { + //stopRunner(); // formerly from 0135 + handleStop(); + + toolbar.activate(EditorToolbar.SAVE); + + //SwingUtilities.invokeLater(new Runnable() { + //public void run() { + statusNotice("Saving..."); + try { + if (sketch.saveAs()) { + statusNotice("Done Saving."); + // Disabling this for 0125, instead rebuild the menu inside + // the Save As method of the Sketch object, since that's the + // only one who knows whether something was renamed. + //sketchbook.rebuildMenusAsync(); + } else { + statusNotice("Save Canceled."); + return false; + } + } catch (Exception e) { + // show the error as a message in the window + statusError(e); + + } finally { + // make sure the toolbar button deactivates + toolbar.deactivate(EditorToolbar.SAVE); + } + + return true; + } + + + /** + * Called by Sketch → Export. + * Handles calling the export() function on sketch, and + * queues all the gui status stuff that comes along with it. + *

+ * Made synchronized to (hopefully) avoid problems of people + * hitting export twice, quickly, and horking things up. + */ + synchronized public void handleExport() { + if (!handleExportCheckModified()) return; + toolbar.activate(EditorToolbar.EXPORT); + + //SwingUtilities.invokeLater(new Runnable() { + Thread t = new Thread(new Runnable() { + public void run() { + try { + boolean success = sketch.exportApplet(); + if (success) { + File appletFolder = new File(sketch.getFolder(), "applet"); + Base.openFolder(appletFolder); + statusNotice("Done exporting."); + } else { + // error message will already be visible + } + } catch (Exception e) { + statusError(e); + } + //toolbar.clear(); + toolbar.deactivate(EditorToolbar.EXPORT); + }}); + t.start(); + } + + + /** + * Handler for Sketch → Export Application + */ + synchronized public void handleExportApplication() { + if (!handleExportCheckModified()) return; + toolbar.activate(EditorToolbar.EXPORT); + + //SwingUtilities.invokeLater(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + statusNotice("Exporting application..."); + try { + if (sketch.exportApplicationPrompt()) { + Base.openFolder(sketch.getFolder()); + statusNotice("Done exporting."); + } else { + // error message will already be visible + // or there was no error, in which case it was canceled. + } + } catch (Exception e) { + statusNotice("Error during export."); + e.printStackTrace(); + } + //toolbar.clear(); + toolbar.deactivate(EditorToolbar.EXPORT); + }}); + } + + + /** + * Checks to see if the sketch has been modified, and if so, + * asks the user to save the sketch or cancel the export. + * This prevents issues where an incomplete version of the sketch + * would be exported, and is a fix for + * Bug 157 + */ + protected boolean handleExportCheckModified() { + if (!sketch.isModified()) return true; + + Object[] options = { "OK", "Cancel" }; + int result = JOptionPane.showOptionDialog(this, + "Save changes before export?", + "Save", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[0]); + + if (result == JOptionPane.OK_OPTION) { + handleSave(true); + + } else { + // why it's not CANCEL_OPTION is beyond me (at least on the mac) + // but f-- it.. let's get this shite done.. + //} else if (result == JOptionPane.CANCEL_OPTION) { + statusNotice("Export canceled, changes must first be saved."); + //toolbar.clear(); + return false; + } + return true; + } + + + /** + * Handler for File → Page Setup. + */ + public void handlePageSetup() { + //printerJob = null; + if (printerJob == null) { + printerJob = PrinterJob.getPrinterJob(); + } + if (pageFormat == null) { + pageFormat = printerJob.defaultPage(); + } + pageFormat = printerJob.pageDialog(pageFormat); + //System.out.println("page format is " + pageFormat); + } + + + /** + * Handler for File → Print. + */ + public void handlePrint() { + statusNotice("Printing..."); + //printerJob = null; + if (printerJob == null) { + printerJob = PrinterJob.getPrinterJob(); + } + if (pageFormat != null) { + //System.out.println("setting page format " + pageFormat); + printerJob.setPrintable(textarea.getPainter(), pageFormat); + } else { + printerJob.setPrintable(textarea.getPainter()); + } + // set the name of the job to the code name + printerJob.setJobName(sketch.getCurrentCode().getPrettyName()); + + if (printerJob.printDialog()) { + try { + printerJob.print(); + statusNotice("Done printing."); + + } catch (PrinterException pe) { + statusError("Error while printing."); + pe.printStackTrace(); + } + } else { + statusNotice("Printing canceled."); + } + //printerJob = null; // clear this out? + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Show an error int the status bar. + */ + public void statusError(String what) { + status.error(what); + //new Exception("deactivating RUN").printStackTrace(); + toolbar.deactivate(EditorToolbar.RUN); + } + + + /** + * Show an exception in the editor status bar. + */ + public void statusError(Exception e) { + e.printStackTrace(); +// if (e == null) { +// System.err.println("Editor.statusError() was passed a null exception."); +// return; +// } + + if (e instanceof RunnerException) { + RunnerException re = (RunnerException) e; + if (re.hasCodeIndex()) { + sketch.setCurrentCode(re.getCodeIndex()); + } + if (re.hasCodeLine()) { + int line = re.getCodeLine(); + // subtract one from the end so that the \n ain't included + if (line >= textarea.getLineCount()) { + // The error is at the end of this current chunk of code, + // so the last line needs to be selected. + line = textarea.getLineCount() - 1; + if (textarea.getLineText(line).length() == 0) { + // The last line may be zero length, meaning nothing to select. + // If so, back up one more line. + line--; + } + } + if (line < 0 || line >= textarea.getLineCount()) { + System.err.println("Bad error line: " + line); + } else { + textarea.select(textarea.getLineStartOffset(line), + textarea.getLineStopOffset(line) - 1); + } + } + } + + // Since this will catch all Exception types, spend some time figuring + // out which kind and try to give a better error message to the user. + String mess = e.getMessage(); + if (mess != null) { + String javaLang = "java.lang."; + if (mess.indexOf(javaLang) == 0) { + mess = mess.substring(javaLang.length()); + } + String rxString = "RuntimeException: "; + if (mess.indexOf(rxString) == 0) { + mess = mess.substring(rxString.length()); + } + statusError(mess); + } + e.printStackTrace(); + } + + + /** + * Show a notice message in the editor status bar. + */ + public void statusNotice(String msg) { + status.notice(msg); + } + + + /** + * Clear the status area. + */ + public void statusEmpty() { + statusNotice(EMPTY); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Returns the edit popup menu. + */ + class TextAreaPopup extends JPopupMenu { + //String currentDir = System.getProperty("user.dir"); + String referenceFile = null; + + JMenuItem cutItem; + JMenuItem copyItem; + JMenuItem discourseItem; + JMenuItem referenceItem; + + + public TextAreaPopup() { + JMenuItem item; + + cutItem = new JMenuItem("Cut"); + cutItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleCut(); + } + }); + this.add(cutItem); + + copyItem = new JMenuItem("Copy"); + copyItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleCopy(); + } + }); + this.add(copyItem); + + discourseItem = new JMenuItem("Copy for Discourse"); + discourseItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleDiscourseCopy(); + } + }); + this.add(discourseItem); + + item = new JMenuItem("Paste"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handlePaste(); + } + }); + this.add(item); + + item = new JMenuItem("Select All"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleSelectAll(); + } + }); + this.add(item); + + this.addSeparator(); + + item = new JMenuItem("Comment/Uncomment"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleCommentUncomment(); + } + }); + this.add(item); + + item = new JMenuItem("Increase Indent"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleIndentOutdent(true); + } + }); + this.add(item); + + item = new JMenuItem("Decrease Indent"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleIndentOutdent(false); + } + }); + this.add(item); + + this.addSeparator(); + + referenceItem = new JMenuItem("Find in Reference"); + referenceItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + handleFindReference(); + } + }); + this.add(referenceItem); + } + + // if no text is selected, disable copy and cut menu items + public void show(Component component, int x, int y) { + if (textarea.isSelectionActive()) { + cutItem.setEnabled(true); + copyItem.setEnabled(true); + discourseItem.setEnabled(true); + + String sel = textarea.getSelectedText().trim(); + referenceFile = PdeKeywords.getReference(sel); + referenceItem.setEnabled(referenceFile != null); + + } else { + cutItem.setEnabled(false); + copyItem.setEnabled(false); + discourseItem.setEnabled(false); + referenceItem.setEnabled(false); + } + super.show(component, x, y); + } + } +} + diff --git a/app/src/processing/app/EditorConsole.java b/app/src/processing/app/EditorConsole.java new file mode 100644 index 000000000..e8dc578f1 --- /dev/null +++ b/app/src/processing/app/EditorConsole.java @@ -0,0 +1,460 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.swing.*; +import javax.swing.text.*; +import java.util.*; + + +/** + * Message console that sits below the editing area. + *

+ * Debugging this class is tricky... If it's throwing exceptions, + * don't take over System.err, and debug while watching just System.out + * or just write println() or whatever directly to systemOut or systemErr. + */ +public class EditorConsole extends JScrollPane { + Editor editor; + + JTextPane consoleTextPane; + BufferedStyledDocument consoleDoc; + + MutableAttributeSet stdStyle; + MutableAttributeSet errStyle; + + boolean cerror; + + int maxLineCount; + + static File errFile; + static File outFile; + static File tempFolder; + + // Single static instance shared because there's only one real System.out. + // Within the input handlers, the currentConsole variable will be used to + // echo things to the correct location. + + static public PrintStream systemOut; + static public PrintStream systemErr; + + static PrintStream consoleOut; + static PrintStream consoleErr; + + static OutputStream stdoutFile; + static OutputStream stderrFile; + + static EditorConsole currentConsole; + + + public EditorConsole(Editor editor) { + this.editor = editor; + + maxLineCount = Preferences.getInteger("console.length"); + + consoleDoc = new BufferedStyledDocument(10000, maxLineCount); + consoleTextPane = new JTextPane(consoleDoc); + consoleTextPane.setEditable(false); + + // necessary? + MutableAttributeSet standard = new SimpleAttributeSet(); + StyleConstants.setAlignment(standard, StyleConstants.ALIGN_LEFT); + consoleDoc.setParagraphAttributes(0, 0, standard, true); + + // build styles for different types of console output + Color bgColor = Theme.getColor("console.color"); + Color fgColorOut = Theme.getColor("console.output.color"); + Color fgColorErr = Theme.getColor("console.error.color"); + Font font = Theme.getFont("console.font"); + + stdStyle = new SimpleAttributeSet(); + StyleConstants.setForeground(stdStyle, fgColorOut); + StyleConstants.setBackground(stdStyle, bgColor); + StyleConstants.setFontSize(stdStyle, font.getSize()); + StyleConstants.setFontFamily(stdStyle, font.getFamily()); + StyleConstants.setBold(stdStyle, font.isBold()); + StyleConstants.setItalic(stdStyle, font.isItalic()); + + errStyle = new SimpleAttributeSet(); + StyleConstants.setForeground(errStyle, fgColorErr); + StyleConstants.setBackground(errStyle, bgColor); + StyleConstants.setFontSize(errStyle, font.getSize()); + StyleConstants.setFontFamily(errStyle, font.getFamily()); + StyleConstants.setBold(errStyle, font.isBold()); + StyleConstants.setItalic(errStyle, font.isItalic()); + + consoleTextPane.setBackground(bgColor); + + // add the jtextpane to this scrollpane + this.setViewportView(consoleTextPane); + + // calculate height of a line of text in pixels + // and size window accordingly + FontMetrics metrics = this.getFontMetrics(font); + int height = metrics.getAscent() + metrics.getDescent(); + int lines = Preferences.getInteger("console.lines"); //, 4); + int sizeFudge = 6; //10; // unclear why this is necessary, but it is + setPreferredSize(new Dimension(1024, (height * lines) + sizeFudge)); + setMinimumSize(new Dimension(1024, (height * 4) + sizeFudge)); + + if (systemOut == null) { + systemOut = System.out; + systemErr = System.err; + + // Create a temporary folder which will have a randomized name. Has to + // be randomized otherwise another instance of Processing (or one of its + // sister IDEs) might collide with the file causing permissions problems. + // The files and folders are not deleted on exit because they may be + // needed for debugging or bug reporting. + tempFolder = Base.createTempFolder("console"); + try { + String outFileName = Preferences.get("console.output.file"); + if (outFileName != null) { + outFile = new File(tempFolder, outFileName); + stdoutFile = new FileOutputStream(outFile); + } + + String errFileName = Preferences.get("console.error.file"); + if (errFileName != null) { + errFile = new File(tempFolder, errFileName); + stderrFile = new FileOutputStream(errFile); + } + } catch (IOException e) { + Base.showWarning("Console Error", + "A problem occurred while trying to open the\n" + + "files used to store the console output.", e); + } + consoleOut = new PrintStream(new EditorConsoleStream(false)); + consoleErr = new PrintStream(new EditorConsoleStream(true)); + + if (Preferences.getBoolean("console")) { + try { + System.setOut(consoleOut); + System.setErr(consoleErr); + } catch (Exception e) { + e.printStackTrace(systemOut); + } + } + } + + // to fix ugliness.. normally macosx java 1.3 puts an + // ugly white border around this object, so turn it off. + if (Base.isMacOS()) { + setBorder(null); + } + + // periodically post buffered messages to the console + // should the interval come from the preferences file? + new javax.swing.Timer(250, new ActionListener() { + public void actionPerformed(ActionEvent evt) { + // only if new text has been added + if (consoleDoc.hasAppendage) { + // insert the text that's been added in the meantime + consoleDoc.insertAll(); + // always move to the end of the text as it's added + consoleTextPane.setCaretPosition(consoleDoc.getLength()); + } + } + }).start(); + } + + + static public void setEditor(Editor editor) { + currentConsole = editor.console; + } + + + /** + * Close the streams so that the temporary files can be deleted. + *

+ * File.deleteOnExit() cannot be used because the stdout and stderr + * files are inside a folder, and have to be deleted before the + * folder itself is deleted, which can't be guaranteed when using + * the deleteOnExit() method. + */ + public void handleQuit() { + // replace original streams to remove references to console's streams + System.setOut(systemOut); + System.setErr(systemErr); + + // close the PrintStream + consoleOut.close(); + consoleErr.close(); + + // also have to close the original FileOutputStream + // otherwise it won't be shut down completely + try { + stdoutFile.close(); + stderrFile.close(); + } catch (IOException e) { + e.printStackTrace(systemOut); + } + + outFile.delete(); + errFile.delete(); + tempFolder.delete(); + } + + + public void write(byte b[], int offset, int length, boolean err) { + if (err != cerror) { + // advance the line because switching between err/out streams + // potentially, could check whether we're already on a new line + message("", cerror, true); + } + + // we could do some cross platform CR/LF mangling here before outputting + + // add text to output document + message(new String(b, offset, length), err, false); + // set last error state + cerror = err; + } + + + // added sync for 0091.. not sure if it helps or hinders + synchronized public void message(String what, boolean err, boolean advance) { + if (err) { + systemErr.print(what); + //systemErr.print("CE" + what); + } else { + systemOut.print(what); + //systemOut.print("CO" + what); + } + + if (advance) { + appendText("\n", err); + if (err) { + systemErr.println(); + } else { + systemOut.println(); + } + } + + // to console display + appendText(what, err); + // moved down here since something is punting + } + + + /** + * Append a piece of text to the console. + *

+ * Swing components are NOT thread-safe, and since the MessageSiphon + * instantiates new threads, and in those callbacks, they often print + * output to stdout and stderr, which are wrapped by EditorConsoleStream + * and eventually leads to EditorConsole.appendText(), which directly + * updates the Swing text components, causing deadlock. + *

+ * Updates are buffered to the console and displayed at regular + * intervals on Swing's event-dispatching thread. (patch by David Mellis) + */ + synchronized private void appendText(String txt, boolean e) { + consoleDoc.appendString(txt, e ? errStyle : stdStyle); + } + + + public void clear() { + try { + consoleDoc.remove(0, consoleDoc.getLength()); + } catch (BadLocationException e) { + // ignore the error otherwise this will cause an infinite loop + // maybe not a good idea in the long run? + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + class EditorConsoleStream extends OutputStream { + //static EditorConsole current; + boolean err; // whether stderr or stdout + byte single[] = new byte[1]; + + public EditorConsoleStream(boolean err) { + this.err = err; + } + + public void close() { } + + public void flush() { } + + public void write(byte b[]) { // appears never to be used +// if (currentConsole.isDisplayable()) { + currentConsole.write(b, 0, b.length, err); +// } else { +// systemOut.println("not displayable"); +// if (err) { +// systemErr.write(b, 0, b.length); +// } else { +// systemOut.write(b, 0, b.length); +// } +// } + + OutputStream echo = err ? stderrFile : stdoutFile; + if (echo != null) { + try { + echo.write(b); + echo.flush(); + } catch (IOException e) { + e.printStackTrace(); + echo = null; + } + } + } + + public void write(byte b[], int offset, int length) { + currentConsole.write(b, offset, length, err); +// if (currentConsole.isDisplayable()) { +// systemOut.println("is displayable"); +// currentConsole.write(b, offset, length, err); +// } else { +// systemOut.println("not displayable"); +// if (err) { +// systemErr.write(b, offset, length); +// } else { +// systemOut.write(b, offset, length); +// } +// } + + OutputStream echo = err ? stderrFile : stdoutFile; + if (echo != null) { + try { + echo.write(b, offset, length); + echo.flush(); + } catch (IOException e) { + e.printStackTrace(); + echo = null; + } + } + } + + public void write(int b) { + single[0] = (byte)b; + currentConsole.write(single, 0, 1, err); + + OutputStream echo = err ? stderrFile : stdoutFile; + if (echo != null) { + try { + echo.write(b); + echo.flush(); + } catch (IOException e) { + e.printStackTrace(); + echo = null; + } + } + } + } +} + + +// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +/** + * Buffer updates to the console and output them in batches. For info, see: + * http://java.sun.com/products/jfc/tsc/articles/text/element_buffer and + * http://javatechniques.com/public/java/docs/gui/jtextpane-speed-part2.html + * appendString() is called from multiple threads, and insertAll from the + * swing event thread, so they need to be synchronized + */ +class BufferedStyledDocument extends DefaultStyledDocument { + ArrayList elements = new ArrayList(); + int maxLineLength, maxLineCount; + int currentLineLength = 0; + boolean needLineBreak = false; + boolean hasAppendage = false; + + public BufferedStyledDocument(int maxLineLength, int maxLineCount) { + this.maxLineLength = maxLineLength; + this.maxLineCount = maxLineCount; + } + + /** buffer a string for insertion at the end of the DefaultStyledDocument */ + public synchronized void appendString(String str, AttributeSet a) { + // do this so that it's only updated when needed (otherwise console + // updates every 250 ms when an app isn't even running.. see bug 180) + hasAppendage = true; + + // process each line of the string + while (str.length() > 0) { + // newlines within an element have (almost) no effect, so we need to + // replace them with proper paragraph breaks (start and end tags) + if (needLineBreak || currentLineLength > maxLineLength) { + elements.add(new ElementSpec(a, ElementSpec.EndTagType)); + elements.add(new ElementSpec(a, ElementSpec.StartTagType)); + currentLineLength = 0; + } + + if (str.indexOf('\n') == -1) { + elements.add(new ElementSpec(a, ElementSpec.ContentType, + str.toCharArray(), 0, str.length())); + currentLineLength += str.length(); + needLineBreak = false; + str = str.substring(str.length()); // eat the string + } else { + elements.add(new ElementSpec(a, ElementSpec.ContentType, + str.toCharArray(), 0, str.indexOf('\n') + 1)); + needLineBreak = true; + str = str.substring(str.indexOf('\n') + 1); // eat the line + } + } + } + + /** insert the buffered strings */ + public synchronized void insertAll() { + ElementSpec[] elementArray = new ElementSpec[elements.size()]; + elements.toArray(elementArray); + + try { + // check how many lines have been used so far + // if too many, shave off a few lines from the beginning + Element element = super.getDefaultRootElement(); + int lineCount = element.getElementCount(); + int overage = lineCount - maxLineCount; + if (overage > 0) { + // if 1200 lines, and 1000 lines is max, + // find the position of the end of the 200th line + //systemOut.println("overage is " + overage); + Element lineElement = element.getElement(overage); + if (lineElement == null) return; // do nuthin + + int endOffset = lineElement.getEndOffset(); + // remove to the end of the 200th line + super.remove(0, endOffset); + } + super.insert(super.getLength(), elementArray); + + } catch (BadLocationException e) { + // ignore the error otherwise this will cause an infinite loop + // maybe not a good idea in the long run? + } + elements.clear(); + hasAppendage = false; + } +} diff --git a/app/src/processing/app/EditorHeader.java b/app/src/processing/app/EditorHeader.java new file mode 100644 index 000000000..1dc7d4422 --- /dev/null +++ b/app/src/processing/app/EditorHeader.java @@ -0,0 +1,394 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; + + +/** + * Sketch tabs at the top of the editor window. + */ +public class EditorHeader extends JComponent { + static Color backgroundColor; + static Color textColor[] = new Color[2]; + + Editor editor; + + int tabLeft[]; + int tabRight[]; + + Font font; + FontMetrics metrics; + int fontAscent; + + JMenu menu; + JPopupMenu popup; + + int menuLeft; + int menuRight; + + // + + static final String STATUS[] = { "unsel", "sel" }; + static final int UNSELECTED = 0; + static final int SELECTED = 1; + + static final String WHERE[] = { "left", "mid", "right", "menu" }; + static final int LEFT = 0; + static final int MIDDLE = 1; + static final int RIGHT = 2; + static final int MENU = 3; + + static final int PIECE_WIDTH = 4; + + static Image[][] pieces; + + // + + Image offscreen; + int sizeW, sizeH; + int imageW, imageH; + + + public EditorHeader(Editor eddie) { + this.editor = eddie; // weird name for listener + + if (pieces == null) { + pieces = new Image[STATUS.length][WHERE.length]; + for (int i = 0; i < STATUS.length; i++) { + for (int j = 0; j < WHERE.length; j++) { + String path = "tab-" + STATUS[i] + "-" + WHERE[j] + ".gif"; + pieces[i][j] = Base.getThemeImage(path, this); + } + } + } + + if (backgroundColor == null) { + backgroundColor = + Theme.getColor("header.bgcolor"); + textColor[SELECTED] = + Theme.getColor("header.text.selected.color"); + textColor[UNSELECTED] = + Theme.getColor("header.text.unselected.color"); + } + + addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + + if ((x > menuLeft) && (x < menuRight)) { + popup.show(EditorHeader.this, x, y); + + } else { + Sketch sketch = editor.getSketch(); + for (int i = 0; i < sketch.getCodeCount(); i++) { + if ((x > tabLeft[i]) && (x < tabRight[i])) { + sketch.setCurrentCode(i); + repaint(); + } + } + } + } + }); + } + + + public void paintComponent(Graphics screen) { + if (screen == null) return; + + Sketch sketch = editor.getSketch(); + if (sketch == null) return; // ?? + + Dimension size = getSize(); + if ((size.width != sizeW) || (size.height != sizeH)) { + // component has been resized + + if ((size.width > imageW) || (size.height > imageH)) { + // nix the image and recreate, it's too small + offscreen = null; + + } else { + // who cares, just resize + sizeW = size.width; + sizeH = size.height; + } + } + + if (offscreen == null) { + sizeW = size.width; + sizeH = size.height; + imageW = sizeW; + imageH = sizeH; + offscreen = createImage(imageW, imageH); + } + + Graphics g = offscreen.getGraphics(); + if (font == null) { + font = Theme.getFont("header.text.font"); + } + g.setFont(font); // need to set this each time through + metrics = g.getFontMetrics(); + fontAscent = metrics.getAscent(); + //} + + //Graphics2D g2 = (Graphics2D) g; + //g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + // RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + + // set the background for the offscreen + g.setColor(backgroundColor); + g.fillRect(0, 0, imageW, imageH); + + int codeCount = sketch.getCodeCount(); + if ((tabLeft == null) || (tabLeft.length < codeCount)) { + tabLeft = new int[codeCount]; + tabRight = new int[codeCount]; + } + + int x = 6; // offset from left edge of the component + for (int i = 0; i < sketch.getCodeCount(); i++) { + SketchCode code = sketch.getCode(i); + + String codeName = sketch.hideExtension(code.getExtension()) ? + code.getPrettyName() : code.getFileName(); + + // if modified, add the li'l glyph next to the name + String text = " " + codeName + (code.isModified() ? " \u00A7" : " "); + + Graphics2D g2 = (Graphics2D) g; + int textWidth = (int) + font.getStringBounds(text, g2.getFontRenderContext()).getWidth(); + + int pieceCount = 2 + (textWidth / PIECE_WIDTH); + int pieceWidth = pieceCount * PIECE_WIDTH; + + int state = (code == sketch.getCurrentCode()) ? SELECTED : UNSELECTED; + g.drawImage(pieces[state][LEFT], x, 0, null); + x += PIECE_WIDTH; + + int contentLeft = x; + tabLeft[i] = x; + for (int j = 0; j < pieceCount; j++) { + g.drawImage(pieces[state][MIDDLE], x, 0, null); + x += PIECE_WIDTH; + } + tabRight[i] = x; + int textLeft = contentLeft + (pieceWidth - textWidth) / 2; + + g.setColor(textColor[state]); + int baseline = (sizeH + fontAscent) / 2; + //g.drawString(sketch.code[i].name, textLeft, baseline); + g.drawString(text, textLeft, baseline); + + g.drawImage(pieces[state][RIGHT], x, 0, null); + x += PIECE_WIDTH - 1; // overlap by 1 pixel + } + + menuLeft = sizeW - (16 + pieces[0][MENU].getWidth(this)); + menuRight = sizeW - 16; + // draw the dropdown menu target + g.drawImage(pieces[popup.isVisible() ? SELECTED : UNSELECTED][MENU], + menuLeft, 0, null); + + screen.drawImage(offscreen, 0, 0, null); + } + + + /** + * Called when a new sketch is opened. + */ + public void rebuild() { + //System.out.println("rebuilding editor header"); + rebuildMenu(); + repaint(); + Toolkit.getDefaultToolkit().sync(); + } + + + public void rebuildMenu() { + //System.out.println("rebuilding"); + if (menu != null) { + menu.removeAll(); + + } else { + menu = new JMenu(); + popup = menu.getPopupMenu(); + add(popup); + popup.setLightWeightPopupEnabled(true); + + /* + popup.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuCanceled(PopupMenuEvent e) { + // on redraw, the isVisible() will get checked. + // actually, a repaint may be fired anyway, so this + // may be redundant. + repaint(); + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { } + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { } + }); + */ + } + JMenuItem item; + + // maybe this shouldn't have a command key anyways.. + // since we're not trying to make this a full ide.. + //item = Editor.newJMenuItem("New", 'T'); + + /* + item = Editor.newJMenuItem("Previous", KeyEvent.VK_PAGE_UP); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.out.println("prev"); + } + }); + if (editor.sketch != null) { + item.setEnabled(editor.sketch.codeCount > 1); + } + menu.add(item); + + item = Editor.newJMenuItem("Next", KeyEvent.VK_PAGE_DOWN); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.out.println("ext"); + } + }); + if (editor.sketch != null) { + item.setEnabled(editor.sketch.codeCount > 1); + } + menu.add(item); + + menu.addSeparator(); + */ + + //item = new JMenuItem("New Tab"); + item = Editor.newJMenuItemShift("New Tab", 'N'); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + editor.getSketch().handleNewCode(); + } + }); + menu.add(item); + + item = new JMenuItem("Rename"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + editor.getSketch().handleRenameCode(); + /* + // this is already being called by nameCode(), the second stage of rename + if (editor.sketch.current == editor.sketch.code[0]) { + editor.sketchbook.rebuildMenus(); + } + */ + } + }); + menu.add(item); + + item = new JMenuItem("Delete"); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + editor.getSketch().handleDeleteCode(); + } + }); + menu.add(item); + + menu.addSeparator(); + + // KeyEvent.VK_LEFT and VK_RIGHT will make Windows beep + + item = new JMenuItem("Previous Tab"); + KeyStroke ctrlAltLeft = + KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Editor.SHORTCUT_ALT_KEY_MASK); + item.setAccelerator(ctrlAltLeft); + // this didn't want to work consistently + /* + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + editor.sketch.prevCode(); + } + }); + */ + menu.add(item); + + item = new JMenuItem("Next Tab"); + KeyStroke ctrlAltRight = + KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Editor.SHORTCUT_ALT_KEY_MASK); + item.setAccelerator(ctrlAltRight); + /* + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + editor.sketch.nextCode(); + } + }); + */ + menu.add(item); + + Sketch sketch = editor.getSketch(); + if (sketch != null) { + menu.addSeparator(); + + ActionListener jumpListener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + editor.getSketch().setCurrentCode(e.getActionCommand()); + } + }; + for (SketchCode code : sketch.getCode()) { + item = new JMenuItem(code.getPrettyName()); + item.addActionListener(jumpListener); + menu.add(item); + } + } + } + + + public void deselectMenu() { + repaint(); + } + + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + + public Dimension getMinimumSize() { + if (Base.isMacOS()) { + return new Dimension(300, Preferences.GRID_SIZE); + } + return new Dimension(300, Preferences.GRID_SIZE - 1); + } + + + public Dimension getMaximumSize() { + if (Base.isMacOS()) { + return new Dimension(3000, Preferences.GRID_SIZE); + } + return new Dimension(3000, Preferences.GRID_SIZE - 1); + } +} diff --git a/app/src/processing/app/EditorLineStatus.java b/app/src/processing/app/EditorLineStatus.java new file mode 100644 index 000000000..f28175ff0 --- /dev/null +++ b/app/src/processing/app/EditorLineStatus.java @@ -0,0 +1,116 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-07 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import processing.app.syntax.*; + +import java.awt.*; +import javax.swing.*; + + +/** + * Li'l status bar fella that shows the line number. + */ +public class EditorLineStatus extends JComponent { + JEditTextArea textarea; + int start = -1, stop; + + Image resize; + + Color foreground; + Color background; + Font font; + int high; + + String text = ""; + + + public EditorLineStatus(JEditTextArea textarea) { + this.textarea = textarea; + textarea.editorLineStatus = this; + + background = Theme.getColor("linestatus.bgcolor"); + font = Theme.getFont("linestatus.font"); + foreground = Theme.getColor("linestatus.color"); + high = Theme.getInteger("linestatus.height"); + + if (Base.isMacOS()) { + resize = Base.getThemeImage("resize.gif", this); + } + //linestatus.bgcolor = #000000 + //linestatus.font = SansSerif,plain,10 + //linestatus.color = #FFFFFF + } + + + public void set(int newStart, int newStop) { + if ((newStart == start) && (newStop == stop)) return; + + start = newStart; + stop = newStop; + + /* + if (start == stop) { + text = "Line " + (start + 1); + } else { + text = "Lines " + (start + 1) + " to " + (stop + 1); + } + */ + if (start == stop) { + text = String.valueOf(start+1); + } else { + text = (start+1) + " - " + (stop+1); + } + + repaint(); + } + + + public void paintComponent(Graphics g) { + g.setColor(background); + Dimension size = getSize(); + g.fillRect(0, 0, size.width, size.height); + + g.setFont(font); + g.setColor(foreground); + int baseline = (high + g.getFontMetrics().getAscent()) / 2; + g.drawString(text, 6, baseline); + + if (Base.isMacOS()) { + g.drawImage(resize, size.width - 20, 0, this); + } + } + + + public Dimension getPreferredSize() { + return new Dimension(300, high); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public Dimension getMaximumSize() { + return new Dimension(3000, high); + } +} diff --git a/app/src/processing/app/EditorListener.java b/app/src/processing/app/EditorListener.java new file mode 100644 index 000000000..ffd05b022 --- /dev/null +++ b/app/src/processing/app/EditorListener.java @@ -0,0 +1,612 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import processing.app.syntax.*; + +import java.awt.*; +import java.awt.event.*; + + +/** + * Filters key events for tab expansion/indent/etc. + *

+ * For version 0099, some changes have been made to make the indents + * smarter. There are still issues though: + * + indent happens when it picks up a curly brace on the previous line, + * but not if there's a blank line between them. + * + It also doesn't handle single indent situations where a brace + * isn't used (i.e. an if statement or for loop that's a single line). + * It shouldn't actually be using braces. + * Solving these issues, however, would probably best be done by a + * smarter parser/formatter, rather than continuing to hack this class. + */ +public class EditorListener { + private Editor editor; + private JEditTextArea textarea; + + private boolean externalEditor; + private boolean tabsExpand; + private boolean tabsIndent; + private int tabSize; + private String tabString; + private boolean autoIndent; + +// private int selectionStart, selectionEnd; +// private int position; + + /** ctrl-alt on windows and linux, cmd-alt on mac os x */ + static final int CTRL_ALT = ActionEvent.ALT_MASK | + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + + + public EditorListener(Editor editor, JEditTextArea textarea) { + this.editor = editor; + this.textarea = textarea; + + // let him know that i'm leechin' + textarea.editorListener = this; + + applyPreferences(); + } + + + public void applyPreferences() { + tabsExpand = Preferences.getBoolean("editor.tabs.expand"); + //tabsIndent = Preferences.getBoolean("editor.tabs.indent"); + tabSize = Preferences.getInteger("editor.tabs.size"); + tabString = Editor.EMPTY.substring(0, tabSize); + autoIndent = Preferences.getBoolean("editor.indent"); + externalEditor = Preferences.getBoolean("editor.external"); + } + + + //public void setExternalEditor(boolean externalEditor) { + //this.externalEditor = externalEditor; + //} + + + /** + * Intercepts key pressed events for JEditTextArea. + *

+ * Called by JEditTextArea inside processKeyEvent(). Note that this + * won't intercept actual characters, because those are fired on + * keyTyped(). + * @return true if the event has been handled (to remove it from the queue) + */ + public boolean keyPressed(KeyEvent event) { + // don't do things if the textarea isn't editable + if (externalEditor) return false; + + //deselect(); // this is for paren balancing + char c = event.getKeyChar(); + int code = event.getKeyCode(); + + //System.out.println((int)c + " " + code + " " + event); + //System.out.println(); + + Sketch sketch = editor.getSketch(); + + if ((event.getModifiers() & CTRL_ALT) == CTRL_ALT) { + if (code == KeyEvent.VK_LEFT) { + sketch.handlePrevCode(); + return true; + } else if (code == KeyEvent.VK_RIGHT) { + sketch.handleNextCode(); + return true; + } + } + + if ((event.getModifiers() & KeyEvent.META_MASK) != 0) { + //event.consume(); // does nothing + return false; + } + + // TODO i don't like these accessors. clean em up later. + if (!editor.getSketch().isModified()) { + if ((code == KeyEvent.VK_BACK_SPACE) || (code == KeyEvent.VK_TAB) || + (code == KeyEvent.VK_ENTER) || ((c >= 32) && (c < 128))) { + sketch.setModified(true); + } + } + + if ((code == KeyEvent.VK_UP) && + ((event.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + // back up to the last empty line + char contents[] = textarea.getText().toCharArray(); + //int origIndex = textarea.getCaretPosition() - 1; + int caretIndex = textarea.getCaretPosition(); + + int index = calcLineStart(caretIndex - 1, contents); + //System.out.println("line start " + (int) contents[index]); + index -= 2; // step over the newline + //System.out.println((int) contents[index]); + boolean onlySpaces = true; + while (index > 0) { + if (contents[index] == 10) { + if (onlySpaces) { + index++; + break; + } else { + onlySpaces = true; // reset + } + } else if (contents[index] != ' ') { + onlySpaces = false; + } + index--; + } + // if the first char, index will be -2 + if (index < 0) index = 0; + + if ((event.getModifiers() & KeyEvent.SHIFT_MASK) != 0) { + textarea.setSelectionStart(caretIndex); + textarea.setSelectionEnd(index); + } else { + textarea.setCaretPosition(index); + } + event.consume(); + return true; + + } else if ((code == KeyEvent.VK_DOWN) && + ((event.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + char contents[] = textarea.getText().toCharArray(); + int caretIndex = textarea.getCaretPosition(); + + int index = caretIndex; + int lineStart = 0; + boolean onlySpaces = false; // don't count this line + while (index < contents.length) { + if (contents[index] == 10) { + if (onlySpaces) { + index = lineStart; // this is it + break; + } else { + lineStart = index + 1; + onlySpaces = true; // reset + } + } else if (contents[index] != ' ') { + onlySpaces = false; + } + index++; + } + // if the first char, index will be -2 + //if (index < 0) index = 0; + + //textarea.setSelectionStart(index); + //textarea.setSelectionEnd(index); + if ((event.getModifiers() & KeyEvent.SHIFT_MASK) != 0) { + textarea.setSelectionStart(caretIndex); + textarea.setSelectionEnd(index); + } else { + textarea.setCaretPosition(index); + } + event.consume(); + return true; + } + + + switch ((int) c) { + + case 9: // TAB + if (textarea.isSelectionActive()) { + boolean outdent = (event.getModifiers() & KeyEvent.SHIFT_MASK) != 0; + editor.handleIndentOutdent(!outdent); + + } else if (tabsExpand) { // expand tabs + textarea.setSelectedText(tabString); + event.consume(); + return true; + + } else if (tabsIndent) { + // this code is incomplete + + // if this brace is the only thing on the line, outdent + //char contents[] = getCleanedContents(); + char contents[] = textarea.getText().toCharArray(); + // index to the character to the left of the caret + int prevCharIndex = textarea.getCaretPosition() - 1; + + // now find the start of this line + int lineStart = calcLineStart(prevCharIndex, contents); + + int lineEnd = lineStart; + while ((lineEnd < contents.length - 1) && + (contents[lineEnd] != 10)) { + lineEnd++; + } + + // get the number of braces, to determine whether this is an indent + int braceBalance = 0; + int index = lineStart; + while ((index < contents.length) && + (contents[index] != 10)) { + if (contents[index] == '{') { + braceBalance++; + } else if (contents[index] == '}') { + braceBalance--; + } + index++; + } + + // if it's a starting indent, need to ignore it, so lineStart + // will be the counting point. but if there's a closing indent, + // then the lineEnd should be used. + int where = (braceBalance > 0) ? lineStart : lineEnd; + int indent = calcBraceIndent(where, contents); + if (indent == -1) { + // no braces to speak of, do nothing + indent = 0; + } else { + indent += tabSize; + } + + // and the number of spaces it has + int spaceCount = calcSpaceCount(prevCharIndex, contents); + + textarea.setSelectionStart(lineStart); + textarea.setSelectionEnd(lineStart + spaceCount); + textarea.setSelectedText(Editor.EMPTY.substring(0, indent)); + + event.consume(); + return true; + } + break; + + case 10: // auto-indent + case 13: + if (autoIndent) { + char contents[] = textarea.getText().toCharArray(); + + // this is the previous character + // (i.e. when you hit return, it'll be the last character + // just before where the newline will be inserted) + int origIndex = textarea.getCaretPosition() - 1; + + // NOTE all this cursing about CRLF stuff is probably moot + // NOTE since the switch to JEditTextArea, which seems to use + // NOTE only LFs internally (thank god). disabling for 0099. + // walk through the array to the current caret position, + // and count how many weirdo windows line endings there are, + // which would be throwing off the caret position number + /* + int offset = 0; + int realIndex = origIndex; + for (int i = 0; i < realIndex-1; i++) { + if ((contents[i] == 13) && (contents[i+1] == 10)) { + offset++; + realIndex++; + } + } + // back up until \r \r\n or \n.. @#($* cross platform + //System.out.println(origIndex + " offset = " + offset); + origIndex += offset; // ARGH!#(* WINDOWS#@($* + */ + + // if the previous thing is a brace (whether prev line or + // up farther) then the correct indent is the number of spaces + // on that line + 'indent'. + // if the previous line is not a brace, then just use the + // identical indentation to the previous line + + // calculate the amount of indent on the previous line + // this will be used *only if the prev line is not an indent* + int spaceCount = calcSpaceCount(origIndex, contents); + + // If the last character was a left curly brace, then indent. + // For 0122, walk backwards a bit to make sure that the there + // isn't a curly brace several spaces (or lines) back. Also + // moved this before calculating extraCount, since it'll affect + // that as well. + int index2 = origIndex; + while ((index2 >= 0) && + Character.isWhitespace(contents[index2])) { + index2--; + } + if (index2 != -1) { + // still won't catch a case where prev stuff is a comment + if (contents[index2] == '{') { + // intermediate lines be damned, + // use the indent for this line instead + spaceCount = calcSpaceCount(index2, contents); + spaceCount += tabSize; + } + } + //System.out.println("spaceCount should be " + spaceCount); + + // now before inserting this many spaces, walk forward from + // the caret position and count the number of spaces, + // so that the number of spaces aren't duplicated again + int index = origIndex + 1; + int extraCount = 0; + while ((index < contents.length) && + (contents[index] == ' ')) { + //spaceCount--; + extraCount++; + index++; + } + int braceCount = 0; + while ((index < contents.length) && (contents[index] != '\n')) { + if (contents[index] == '}') { + braceCount++; + } + index++; + } + + // hitting return on a line with spaces *after* the caret + // can cause trouble. for 0099, was ignoring the case, but this is + // annoying, so in 0122 we're trying to fix that. + /* + if (spaceCount - extraCount > 0) { + spaceCount -= extraCount; + } + */ + spaceCount -= extraCount; + //if (spaceCount < 0) spaceCount = 0; + //System.out.println("extraCount is " + extraCount); + + // now, check to see if the current line contains a } and if so, + // outdent again by indent + //if (braceCount > 0) { + //spaceCount -= 2; + //} + + if (spaceCount < 0) { + // for rev 0122, actually delete extra space + //textarea.setSelectionStart(origIndex + 1); + textarea.setSelectionEnd(textarea.getSelectionStop() - spaceCount); + textarea.setSelectedText("\n"); + } else { + String insertion = "\n" + Editor.EMPTY.substring(0, spaceCount); + textarea.setSelectedText(insertion); + } + + // not gonna bother handling more than one brace + if (braceCount > 0) { + int sel = textarea.getSelectionStart(); + // sel - tabSize will be -1 if start/end parens on the same line + // http://dev.processing.org/bugs/show_bug.cgi?id=484 + if (sel - tabSize >= 0) { + textarea.select(sel - tabSize, sel); + String s = Editor.EMPTY.substring(0, tabSize); + // if these are spaces that we can delete + if (textarea.getSelectedText().equals(s)) { + textarea.setSelectedText(""); + } else { + textarea.select(sel, sel); + } + } + } + } else { + // Enter/Return was being consumed by somehow even if false + // was returned, so this is a band-aid to simply fire the event again. + // http://dev.processing.org/bugs/show_bug.cgi?id=1073 + textarea.setSelectedText(String.valueOf(c)); + } + // mark this event as already handled (all but ignored) + event.consume(); + return true; + + case '}': + if (autoIndent) { + // first remove anything that was there (in case this multiple + // characters are selected, so that it's not in the way of the + // spaces for the auto-indent + if (textarea.getSelectionStart() != textarea.getSelectionStop()) { + textarea.setSelectedText(""); + } + + // if this brace is the only thing on the line, outdent + char contents[] = textarea.getText().toCharArray(); + // index to the character to the left of the caret + int prevCharIndex = textarea.getCaretPosition() - 1; + + // backup from the current caret position to the last newline, + // checking for anything besides whitespace along the way. + // if there's something besides whitespace, exit without + // messing any sort of indenting. + int index = prevCharIndex; + boolean finished = false; + while ((index != -1) && (!finished)) { + if (contents[index] == 10) { + finished = true; + index++; + } else if (contents[index] != ' ') { + // don't do anything, this line has other stuff on it + return false; + } else { + index--; + } + } + if (!finished) return false; // brace with no start + int lineStartIndex = index; + + int pairedSpaceCount = calcBraceIndent(prevCharIndex, contents); //, 1); + if (pairedSpaceCount == -1) return false; + + textarea.setSelectionStart(lineStartIndex); + textarea.setSelectedText(Editor.EMPTY.substring(0, pairedSpaceCount)); + + // mark this event as already handled + event.consume(); + return true; + } + break; + } + return false; + } + + + public boolean keyTyped(KeyEvent event) { + char c = event.getKeyChar(); + + if ((event.getModifiers() & KeyEvent.CTRL_MASK) != 0) { + // on linux, ctrl-comma (prefs) being passed through to the editor + if (c == KeyEvent.VK_COMMA) { + event.consume(); + return true; + } + } + return false; + } + + + + /** + * Return the index for the first character on this line. + */ + protected int calcLineStart(int index, char contents[]) { + // backup from the current caret position to the last newline, + // so that we can figure out how far this line was indented + /*int spaceCount = 0;*/ + boolean finished = false; + while ((index != -1) && (!finished)) { + if ((contents[index] == 10) || + (contents[index] == 13)) { + finished = true; + //index++; // maybe ? + } else { + index--; // new + } + } + // add one because index is either -1 (the start of the document) + // or it's the newline character for the previous line + return index + 1; + } + + + /** + * Calculate the number of spaces on this line. + */ + protected int calcSpaceCount(int index, char contents[]) { + index = calcLineStart(index, contents); + + int spaceCount = 0; + // now walk forward and figure out how many spaces there are + while ((index < contents.length) && (index >= 0) && + (contents[index++] == ' ')) { + spaceCount++; + } + return spaceCount; + } + + + /** + * Walk back from 'index' until the brace that seems to be + * the beginning of the current block, and return the number of + * spaces found on that line. + */ + protected int calcBraceIndent(int index, char contents[]) { + // now that we know things are ok to be indented, walk + // backwards to the last { to see how far its line is indented. + // this isn't perfect cuz it'll pick up commented areas, + // but that's not really a big deal and can be fixed when + // this is all given a more complete (proper) solution. + int braceDepth = 1; + boolean finished = false; + while ((index != -1) && (!finished)) { + if (contents[index] == '}') { + // aww crap, this means we're one deeper + // and will have to find one more extra { + braceDepth++; + //if (braceDepth == 0) { + //finished = true; + //} + index--; + } else if (contents[index] == '{') { + braceDepth--; + if (braceDepth == 0) { + finished = true; + } + index--; + } else { + index--; + } + } + // never found a proper brace, be safe and don't do anything + if (!finished) return -1; + + // check how many spaces on the line with the matching open brace + //int pairedSpaceCount = calcSpaceCount(index, contents); + //System.out.println(pairedSpaceCount); + return calcSpaceCount(index, contents); + } + + + /** + * Get the character array and blank out the commented areas. + * This hasn't yet been tested, the plan was to make auto-indent + * less gullible (it gets fooled by braces that are commented out). + */ + protected char[] getCleanedContents() { + char c[] = textarea.getText().toCharArray(); + + int index = 0; + while (index < c.length - 1) { + if ((c[index] == '/') && (c[index+1] == '*')) { + c[index++] = 0; + c[index++] = 0; + while ((index < c.length - 1) && + !((c[index] == '*') && (c[index+1] == '/'))) { + c[index++] = 0; + } + + } else if ((c[index] == '/') && (c[index+1] == '/')) { + // clear out until the end of the line + while ((index < c.length) && (c[index] != 10)) { + c[index++] = 0; + } + if (index != c.length) { + index++; // skip over the newline + } + } + } + return c; + } + + /* + protected char[] getCleanedContents() { + char c[] = textarea.getText().toCharArray(); + boolean insideMulti; // multi-line comment + boolean insideSingle; // single line double slash + + //for (int i = 0; i < c.length - 1; i++) { + int index = 0; + while (index < c.length - 1) { + if (insideMulti && (c[index] == '*') && (c[index+1] == '/')) { + insideMulti = false; + index += 2; + } else if ((c[index] == '/') && (c[index+1] == '*')) { + insideMulti = true; + index += 2; + } else if ((c[index] == '/') && (c[index+1] == '/')) { + // clear out until the end of the line + while (c[index] != 10) { + c[index++] = 0; + } + index++; + } + } + } + */ +} diff --git a/app/src/processing/app/EditorStatus.java b/app/src/processing/app/EditorStatus.java new file mode 100644 index 000000000..a7035ab7c --- /dev/null +++ b/app/src/processing/app/EditorStatus.java @@ -0,0 +1,431 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + + +/** + * Panel just below the editing area that contains status messages. + */ +public class EditorStatus extends JPanel /*implements ActionListener*/ { + static Color bgcolor[]; + static Color fgcolor[]; + + static final int NOTICE = 0; + static final int ERR = 1; + //static final int PROMPT = 2; + //static final int EDIT = 3; + static final int EDIT = 2; + + static final int YES = 1; + static final int NO = 2; + static final int CANCEL = 3; + static final int OK = 4; + + static final String NO_MESSAGE = ""; + + Editor editor; + + int mode; + String message; + + Font font; + FontMetrics metrics; + int ascent; + + Image offscreen; + int sizeW, sizeH; + int imageW, imageH; + + //JButton yesButton; + //JButton noButton; + JButton cancelButton; + JButton okButton; + JTextField editField; + + //Thread promptThread; + int response; + + + public EditorStatus(Editor editor) { + this.editor = editor; + empty(); + + if (bgcolor == null) { + bgcolor = new Color[3]; //4]; + bgcolor[0] = Theme.getColor("status.notice.bgcolor"); + bgcolor[1] = Theme.getColor("status.error.bgcolor"); + bgcolor[2] = Theme.getColor("status.edit.bgcolor"); + + fgcolor = new Color[3]; //4]; + fgcolor[0] = Theme.getColor("status.notice.fgcolor"); + fgcolor[1] = Theme.getColor("status.error.fgcolor"); + fgcolor[2] = Theme.getColor("status.edit.fgcolor"); + } + } + + + public void empty() { + mode = NOTICE; + message = NO_MESSAGE; + //update(); + repaint(); + } + + + public void notice(String message) { + mode = NOTICE; + this.message = message; + //update(); + repaint(); + } + + public void unnotice(String unmessage) { + if (message.equals(unmessage)) empty(); + } + + + public void error(String message) { + mode = ERR; + this.message = message; + repaint(); + } + + + /* + public void prompt(String message) { + mode = PROMPT; + this.message = message; + + response = 0; + yesButton.setVisible(true); + noButton.setVisible(true); + cancelButton.setVisible(true); + yesButton.requestFocus(); + + repaint(); + } + + + // prompt has been handled, re-hide the buttons + public void unprompt() { + yesButton.setVisible(false); + noButton.setVisible(false); + cancelButton.setVisible(false); + empty(); + } + */ + + + public void edit(String message, String dflt) { + mode = EDIT; + this.message = message; + + response = 0; + okButton.setVisible(true); + cancelButton.setVisible(true); + editField.setVisible(true); + editField.setText(dflt); + editField.selectAll(); + editField.requestFocus(); + + repaint(); + } + + public void unedit() { + okButton.setVisible(false); + cancelButton.setVisible(false); + editField.setVisible(false); + empty(); + } + + + /* + public void update() { + Graphics g = this.getGraphics(); + try { + setBackground(bgcolor[mode]); + } catch (NullPointerException e) { } // if not ready yet + if (g != null) paint(g); + } + + public void update(Graphics g) { + paint(g); + } + */ + + + public void paintComponent(Graphics screen) { + //if (screen == null) return; + if (okButton == null) setup(); + + //System.out.println("status.paintComponent"); + + Dimension size = getSize(); + if ((size.width != sizeW) || (size.height != sizeH)) { + // component has been resized + + if ((size.width > imageW) || (size.height > imageH)) { + // nix the image and recreate, it's too small + offscreen = null; + + } else { + // who cares, just resize + sizeW = size.width; + sizeH = size.height; + setButtonBounds(); + } + } + + if (offscreen == null) { + sizeW = size.width; + sizeH = size.height; + setButtonBounds(); + imageW = sizeW; + imageH = sizeH; + offscreen = createImage(imageW, imageH); + } + + Graphics g = offscreen.getGraphics(); + if (font == null) { + font = Theme.getFont("status.font"); + //new Font("SansSerif", Font.PLAIN, 12)); + g.setFont(font); + metrics = g.getFontMetrics(); + ascent = metrics.getAscent(); + } + + //setBackground(bgcolor[mode]); // does nothing + + g.setColor(bgcolor[mode]); + g.fillRect(0, 0, imageW, imageH); + + g.setColor(fgcolor[mode]); + g.setFont(font); // needs to be set each time on osx + g.drawString(message, Preferences.GUI_SMALL, (sizeH + ascent) / 2); + + screen.drawImage(offscreen, 0, 0, null); + } + + + protected void setup() { + if (okButton == null) { + cancelButton = new JButton(Preferences.PROMPT_CANCEL); + okButton = new JButton(Preferences.PROMPT_OK); + + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (mode == EDIT) { + unedit(); + //editor.toolbar.clear(); + } + } + }); + + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // answering to rename/new code question + if (mode == EDIT) { // this if() isn't (shouldn't be?) necessary + String answer = editField.getText(); + editor.getSketch().nameCode(answer); + unedit(); + } + } + }); + + // !@#(* aqua ui #($*(( that turtle-neck wearing #(** (#$@)( + // os9 seems to work if bg of component is set, but x still a bastard + if (Base.isMacOS()) { + //yesButton.setBackground(bgcolor[EDIT]); + //noButton.setBackground(bgcolor[EDIT]); + cancelButton.setBackground(bgcolor[EDIT]); + okButton.setBackground(bgcolor[EDIT]); + } + setLayout(null); + + /* + yesButton.addActionListener(this); + noButton.addActionListener(this); + cancelButton.addActionListener(this); + okButton.addActionListener(this); + */ + + //add(yesButton); + //add(noButton); + add(cancelButton); + add(okButton); + + //yesButton.setVisible(false); + //noButton.setVisible(false); + cancelButton.setVisible(false); + okButton.setVisible(false); + + editField = new JTextField(); + // disabling, was not in use + //editField.addActionListener(this); + + //if (Base.platform != Base.MACOSX) { + editField.addKeyListener(new KeyAdapter() { + + // Grab ESC with keyPressed, because it's not making it to keyTyped + public void keyPressed(KeyEvent event) { + if (event.getKeyChar() == KeyEvent.VK_ESCAPE) { + unedit(); + //editor.toolbar.clear(); + event.consume(); + } + } + + // use keyTyped to catch when the feller is actually + // added to the text field. with keyTyped, as opposed to + // keyPressed, the keyCode will be zero, even if it's + // enter or backspace or whatever, so the keychar should + // be used instead. grr. + public void keyTyped(KeyEvent event) { + //System.out.println("got event " + event); + int c = event.getKeyChar(); + + if (c == KeyEvent.VK_ENTER) { // accept the input + String answer = editField.getText(); + editor.getSketch().nameCode(answer); + unedit(); + event.consume(); + + // easier to test the affirmative case than the negative + } else if ((c == KeyEvent.VK_BACK_SPACE) || + (c == KeyEvent.VK_DELETE) || + (c == KeyEvent.VK_RIGHT) || + (c == KeyEvent.VK_LEFT) || + (c == KeyEvent.VK_UP) || + (c == KeyEvent.VK_DOWN) || + (c == KeyEvent.VK_HOME) || + (c == KeyEvent.VK_END) || + (c == KeyEvent.VK_SHIFT)) { + // these events are ignored + + /* + } else if (c == KeyEvent.VK_ESCAPE) { + unedit(); + editor.toolbar.clear(); + event.consume(); + */ + + } else if (c == KeyEvent.VK_SPACE) { + String t = editField.getText(); + int start = editField.getSelectionStart(); + int end = editField.getSelectionEnd(); + editField.setText(t.substring(0, start) + "_" + + t.substring(end)); + editField.setCaretPosition(start+1); + event.consume(); + + } else if ((c == '_') || (c == '.') || // allow .pde and .java + ((c >= 'A') && (c <= 'Z')) || + ((c >= 'a') && (c <= 'z'))) { + // these are ok, allow them through + + } else if ((c >= '0') && (c <= '9')) { + // getCaretPosition == 0 means that it's the first char + // and the field is empty. + // getSelectionStart means that it *will be* the first + // char, because the selection is about to be replaced + // with whatever is typed. + if ((editField.getCaretPosition() == 0) || + (editField.getSelectionStart() == 0)) { + // number not allowed as first digit + //System.out.println("bad number bad"); + event.consume(); + } + } else { + event.consume(); + //System.out.println("code is " + code + " char = " + c); + } + //System.out.println("code is " + code + " char = " + c); + } + }); + add(editField); + editField.setVisible(false); + } + } + + + protected void setButtonBounds() { + int top = (sizeH - Preferences.BUTTON_HEIGHT) / 2; + int eachButton = Preferences.GUI_SMALL + Preferences.BUTTON_WIDTH; + + int cancelLeft = sizeW - eachButton; + int noLeft = cancelLeft - eachButton; + int yesLeft = noLeft - eachButton; + + //yesButton.setLocation(yesLeft, top); + //noButton.setLocation(noLeft, top); + cancelButton.setLocation(cancelLeft, top); + okButton.setLocation(noLeft, top); + + //yesButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + //noButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + cancelButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + okButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT); + + // edit field height is awkward, and very different between mac and pc, + // so use at least the preferred height for now. + int editWidth = 2*Preferences.BUTTON_WIDTH; + int editHeight = editField.getPreferredSize().height; + int editTop = (1 + sizeH - editHeight) / 2; // add 1 for ceil + editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop, + editWidth, editHeight); + } + + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + public Dimension getMinimumSize() { + return new Dimension(300, Preferences.GRID_SIZE); + } + + public Dimension getMaximumSize() { + return new Dimension(3000, Preferences.GRID_SIZE); + } + + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == cancelButton) { + if (mode == EDIT) unedit(); + //editor.toolbar.clear(); + + } else if (e.getSource() == okButton) { + // answering to rename/new code question + if (mode == EDIT) { // this if() isn't (shouldn't be?) necessary + String answer = editField.getText(); + editor.getSketch().nameCode(answer); + unedit(); + } + } + } +} diff --git a/app/src/processing/app/EditorToolbar.java b/app/src/processing/app/EditorToolbar.java new file mode 100644 index 000000000..f7bf14569 --- /dev/null +++ b/app/src/processing/app/EditorToolbar.java @@ -0,0 +1,447 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + + +/** + * run/stop/etc buttons for the ide + */ +public class EditorToolbar extends JComponent implements MouseInputListener { + + static final String title[] = { + "Run", "Stop", "New", "Open", "Save", "Export" + }; + + static final int BUTTON_COUNT = title.length; + /** Width of each toolbar button. */ + static final int BUTTON_WIDTH = 27; + /** Height of each toolbar button. */ + static final int BUTTON_HEIGHT = 32; + /** The amount of space between groups of buttons on the toolbar. */ + static final int BUTTON_GAP = 5; + + static final int RUN = 0; + static final int STOP = 1; + + static final int NEW = 2; + static final int OPEN = 3; + static final int SAVE = 4; + static final int EXPORT = 5; + + static final int INACTIVE = 0; + static final int ROLLOVER = 1; + static final int ACTIVE = 2; + + Editor editor; + //boolean disableRun; // this was for library + //Label status; + + Image offscreen; + int width, height; + + Color bgcolor; + + static Image buttons; + static Image inactive[]; + static Image rollover[]; + static Image active[]; + int currentRollover; + //int currentSelection; + + JPopupMenu popup; + JMenu menu; + + int buttonCount; + int state[] = new int[BUTTON_COUNT]; + Image stateImage[]; + int which[]; // mapping indices to implementation + + int x1[], x2[]; + int y1, y2; + + String status; + Font statusFont; + Color statusColor; + + + public EditorToolbar(Editor editor, JMenu menu) { + this.editor = editor; + this.menu = menu; + + if (buttons == null) { + buttons = Base.getThemeImage("buttons.gif", this); + } + + buttonCount = 0; + which = new int[BUTTON_COUNT]; + + //which[buttonCount++] = NOTHING; + which[buttonCount++] = RUN; + which[buttonCount++] = STOP; + which[buttonCount++] = NEW; + which[buttonCount++] = OPEN; + which[buttonCount++] = SAVE; + which[buttonCount++] = EXPORT; + + currentRollover = -1; + + bgcolor = Theme.getColor("buttons.bgcolor"); + + status = ""; + + statusFont = Theme.getFont("buttons.status.font"); + statusColor = Theme.getColor("buttons.status.color"); + + addMouseListener(this); + addMouseMotionListener(this); + } + + + public void paintComponent(Graphics screen) { + // this data is shared by all EditorToolbar instances + if (inactive == null) { + inactive = new Image[BUTTON_COUNT]; + rollover = new Image[BUTTON_COUNT]; + active = new Image[BUTTON_COUNT]; + + int IMAGE_SIZE = 33; + + for (int i = 0; i < BUTTON_COUNT; i++) { + inactive[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT); + Graphics g = inactive[i].getGraphics(); + g.drawImage(buttons, -(i*IMAGE_SIZE) - 3, -2*IMAGE_SIZE, null); + + rollover[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT); + g = rollover[i].getGraphics(); + g.drawImage(buttons, -(i*IMAGE_SIZE) - 3, -1*IMAGE_SIZE, null); + + active[i] = createImage(BUTTON_WIDTH, BUTTON_HEIGHT); + g = active[i].getGraphics(); + g.drawImage(buttons, -(i*IMAGE_SIZE) - 3, -0*IMAGE_SIZE, null); + } + } + + // this happens once per instance of EditorToolbar + if (stateImage == null) { + state = new int[buttonCount]; + stateImage = new Image[buttonCount]; + for (int i = 0; i < buttonCount; i++) { + setState(i, INACTIVE, false); + } + y1 = 0; + y2 = BUTTON_HEIGHT; + x1 = new int[buttonCount]; + x2 = new int[buttonCount]; + } + + Dimension size = getSize(); + if ((offscreen == null) || + (size.width != width) || (size.height != height)) { + offscreen = createImage(size.width, size.height); + width = size.width; + height = size.height; + + int offsetX = 3; + for (int i = 0; i < buttonCount; i++) { + x1[i] = offsetX; + if (i == 2) x1[i] += BUTTON_GAP; + x2[i] = x1[i] + BUTTON_WIDTH; + offsetX = x2[i]; + } + } + Graphics g = offscreen.getGraphics(); + g.setColor(bgcolor); //getBackground()); + g.fillRect(0, 0, width, height); + + for (int i = 0; i < buttonCount; i++) { + g.drawImage(stateImage[i], x1[i], y1, null); + } + + g.setColor(statusColor); + g.setFont(statusFont); + + /* + // if i ever find the guy who wrote the java2d api, i will hurt him. + Graphics2D g2 = (Graphics2D) g; + FontRenderContext frc = g2.getFontRenderContext(); + float statusW = (float) statusFont.getStringBounds(status, frc).getWidth(); + float statusX = (getSize().width - statusW) / 2; + g2.drawString(status, statusX, statusY); + */ + //int statusY = (BUTTON_HEIGHT + statusFont.getAscent()) / 2; + int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2; + g.drawString(status, buttonCount * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY); + + screen.drawImage(offscreen, 0, 0, null); + } + + + public void mouseMoved(MouseEvent e) { + // mouse events before paint(); + if (state == null) return; + + if (state[OPEN] != INACTIVE) { + // avoid flicker, since there will probably be an update event + setState(OPEN, INACTIVE, false); + } + //System.out.println(e); + //mouseMove(e); + handleMouse(e.getX(), e.getY()); + } + + + public void mouseDragged(MouseEvent e) { } + + + public void handleMouse(int x, int y) { + if (currentRollover != -1) { + if ((x > x1[currentRollover]) && (y > y1) && + (x < x2[currentRollover]) && (y < y2)) { + return; + + } else { + setState(currentRollover, INACTIVE, true); + messageClear(title[currentRollover]); + currentRollover = -1; + } + } + int sel = findSelection(x, y); + if (sel == -1) return; + + if (state[sel] != ACTIVE) { + //if (!(disableRun && ((sel == RUN) || (sel == STOP)))) { + setState(sel, ROLLOVER, true); + currentRollover = sel; + //} + } + } + + + private int findSelection(int x, int y) { + // if app loads slowly and cursor is near the buttons + // when it comes up, the app may not have time to load + if ((x1 == null) || (x2 == null)) return -1; + + for (int i = 0; i < buttonCount; i++) { + if ((y > y1) && (x > x1[i]) && + (y < y2) && (x < x2[i])) { + //System.out.println("sel is " + i); + return i; + } + } + return -1; + } + + + private void setState(int slot, int newState, boolean updateAfter) { + //if (inactive == null) return; + state[slot] = newState; + switch (newState) { + case INACTIVE: + stateImage[slot] = inactive[which[slot]]; + break; + case ACTIVE: + stateImage[slot] = active[which[slot]]; + break; + case ROLLOVER: + stateImage[slot] = rollover[which[slot]]; + message(title[which[slot]]); + break; + } + if (updateAfter) { + //System.out.println("trying to update " + slot + " " + state[slot]); + //new Exception("setting slot " + slot + " to " + state[slot]).printStackTrace(); + repaint(); // changed for swing from update(); + //Toolkit.getDefaultToolkit().sync(); + } + } + + + public void mouseEntered(MouseEvent e) { + //mouseMove(e); + handleMouse(e.getX(), e.getY()); + } + + + public void mouseExited(MouseEvent e) { + // if the popup menu for is visible, don't register this, + // because the popup being set visible will fire a mouseExited() event + if ((popup != null) && popup.isVisible()) return; + + if (state[OPEN] != INACTIVE) { + setState(OPEN, INACTIVE, true); + } + status = ""; + handleMouse(e.getX(), e.getY()); + } + + int wasDown = -1; + + + public void mousePressed(MouseEvent e) { + final int x = e.getX(); + final int y = e.getY(); + + int sel = findSelection(x, y); + ///if (sel == -1) return false; + if (sel == -1) return; + currentRollover = -1; + + switch (sel) { + case RUN: + editor.handleRun(e.isShiftDown()); + break; + + case STOP: + editor.handleStop(); + break; + + case OPEN: + popup = menu.getPopupMenu(); + popup.show(EditorToolbar.this, x, y); + break; + + case NEW: + //editor.base.handleNew(e.isShiftDown()); + editor.base.handleNewReplace(); + break; + + case SAVE: + editor.handleSave(false); + break; + + case EXPORT: + if (e.isShiftDown()) { + editor.handleExportApplication(); + } else { + editor.handleExport(); + } + break; + } + } + + + public void mouseClicked(MouseEvent e) { } + + + public void mouseReleased(MouseEvent e) { + /* + switch (currentSelection) { + + case OPEN: + setState(OPEN, INACTIVE, true); + break; + } + currentSelection = -1; + */ + } + + + //public void disableRun(boolean what) { + //disableRun = what; + //} + + + /* + public void run() { + if (inactive == null) return; + clear(); + setState(RUN, ACTIVE, true); + } + */ + +// public void running(boolean yesno) { +// setState(RUN, yesno ? ACTIVE : INACTIVE, true); +// } + + + /** + * Set a particular button to be active. + */ + public void activate(int what) { + //System.out.println("activating " + what); + if (inactive == null) return; + setState(what, ACTIVE, true); + } + + //public void clearRun() { + //if (inactive == null) return; + //setState(RUN, INACTIVE, true); + //} + + + /** + * Set a particular button to be active. + */ + public void deactivate(int what) { + if (inactive == null) return; // don't draw if not ready + setState(what, INACTIVE, true); + } + + /** + * Clear all the state of all buttons. + */ +// public void clear() { // (int button) { +// if (inactive == null) return; +// +// System.out.println("clearing state of buttons"); +// // skip the run button, do the others +// for (int i = 1; i < buttonCount; i++) { +// setState(i, INACTIVE, false); +// } +// repaint(); // changed for swing from update(); +// } + + + public void message(String msg) { + //status.setText(msg + " "); // don't mind the hack + status = msg; + } + + + public void messageClear(String msg) { + //if (status.getText().equals(msg + " ")) status.setText(Editor.EMPTY); + if (status.equals(msg)) status = ""; + } + + + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + + public Dimension getMinimumSize() { + return new Dimension((BUTTON_COUNT + 1)*BUTTON_WIDTH, BUTTON_HEIGHT); + } + + + public Dimension getMaximumSize() { + return new Dimension(3000, BUTTON_HEIGHT); + } +} diff --git a/app/src/processing/app/FindReplace.java b/app/src/processing/app/FindReplace.java new file mode 100644 index 000000000..112eca3ad --- /dev/null +++ b/app/src/processing/app/FindReplace.java @@ -0,0 +1,350 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + + +/** + * Find & Replace window for the Processing editor. + *

+ * One major annoyance in this is that the window is re-created each time + * that "Find" is called. This is because Mac OS X has a strange focus + * issue with windows that are re-shown with setVisible() or show(). + * requestFocusInWindow() properly sets the focus to the find field, + * however, just a short moment later, the focus is set to null. Even + * trying to catch this scenario and request it again doesn't seem to work. + * Most likely this is some annoyance buried deep in one of Apple's docs, + * or in the doc for the focus stuff (I tend to think the former because + * Windows doesn't seem to be quite so beligerent). Filed as + * Bug 244 + * should anyone have clues about how to fix. + */ +public class FindReplace extends JFrame implements ActionListener { + + static final int BIG = 13; + static final int SMALL = 6; + + Editor editor; + + JTextField findField; + JTextField replaceField; + static String findString; + static String replaceString; + + JButton replaceButton; + JButton replaceAllButton; + JButton replaceFindButton; + JButton findButton; + + JCheckBox ignoreCaseBox; + static boolean ignoreCase = true; + + /// true when there's something selected in the editor + boolean found; + + + public FindReplace(Editor editor) { + super("Find"); + setResizable(false); + this.editor = editor; + + Container pain = getContentPane(); + pain.setLayout(null); + + JLabel findLabel = new JLabel("Find:"); + Dimension d0 = findLabel.getPreferredSize(); + JLabel replaceLabel = new JLabel("Replace with:"); + Dimension d1 = replaceLabel.getPreferredSize(); + + pain.add(findLabel); + pain.add(replaceLabel); + + pain.add(findField = new JTextField(20)); + pain.add(replaceField = new JTextField(20)); + Dimension d2 = findField.getPreferredSize(); + + if (findString != null) findField.setText(findString); + if (replaceString != null) replaceField.setText(replaceString); + //System.out.println("setting find str to " + findString); + //findField.requestFocusInWindow(); + + //pain.setDefault + /* + findField.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent e) { + System.out.println("Focus gained " + e.getOppositeComponent()); + } + + public void focusLost(FocusEvent e) { + System.out.println("Focus lost "); // + e.getOppositeComponent()); + if (e.getOppositeComponent() == null) { + requestFocusInWindow(); + } + } + }); + */ + + // +1 since it's better to tend downwards + int yoff = (1 + d2.height - d1.height) / 2; + + findLabel.setBounds(BIG + (d1.width-d0.width) + yoff, BIG, + d1.width, d1.height); + replaceLabel.setBounds(BIG, BIG + d2.height + SMALL + yoff, + d1.width, d1.height); + + //ignoreCase = true; + ignoreCaseBox = new JCheckBox("Ignore Case"); + ignoreCaseBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + ignoreCase = ignoreCaseBox.isSelected(); + } + }); + ignoreCaseBox.setSelected(ignoreCase); + pain.add(ignoreCaseBox); + + // + + JPanel buttons = new JPanel(); + buttons.setLayout(new FlowLayout()); + + // ordering is different on mac versus pc + if (Base.isMacOS()) { + buttons.add(replaceAllButton = new JButton("Replace All")); + buttons.add(replaceButton = new JButton("Replace")); + buttons.add(replaceFindButton = new JButton("Replace & Find")); + buttons.add(findButton = new JButton("Find")); + + } else { + buttons.add(findButton = new JButton("Find")); + buttons.add(replaceFindButton = new JButton("Replace & Find")); + buttons.add(replaceButton = new JButton("Replace")); + buttons.add(replaceAllButton = new JButton("Replace All")); + } + pain.add(buttons); + + // to fix ugliness.. normally macosx java 1.3 puts an + // ugly white border around this object, so turn it off. + if (Base.isMacOS()) { + buttons.setBorder(null); + } + + Dimension d3 = buttons.getPreferredSize(); + //buttons.setBounds(BIG, BIG + d2.height*2 + SMALL + BIG, + buttons.setBounds(BIG, BIG + d2.height*3 + SMALL*2 + BIG, + d3.width, d3.height); + + // + + findField.setBounds(BIG + d1.width + SMALL, BIG, + d3.width - (d1.width + SMALL), d2.height); + replaceField.setBounds(BIG + d1.width + SMALL, BIG + d2.height + SMALL, + d3.width - (d1.width + SMALL), d2.height); + + ignoreCaseBox.setBounds(BIG + d1.width + SMALL, + BIG + d2.height*2 + SMALL*2, + d3.width, d2.height); + + // + + replaceButton.addActionListener(this); + replaceAllButton.addActionListener(this); + replaceFindButton.addActionListener(this); + findButton.addActionListener(this); + + // you mustn't replace what you haven't found, my son + replaceButton.setEnabled(false); + replaceFindButton.setEnabled(false); + + // so that typing will go straight to this field + //findField.requestFocus(); + + // make the find button the blinky default + getRootPane().setDefaultButton(findButton); + + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + + int wide = d3.width + BIG*2; + Rectangle butt = buttons.getBounds(); // how big is your butt? + int high = butt.y + butt.height + BIG*2 + SMALL; + + setBounds((screen.width - wide) / 2, + (screen.height - high) / 2, wide, high); + + setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + handleClose(); + } + }); + Base.registerWindowCloseKeys(getRootPane(), new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + //hide(); + handleClose(); + } + }); + Base.setIcon(this); + + // hack to to get first field to focus properly on osx + addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent e) { + //System.out.println("activating"); + /*boolean ok =*/ findField.requestFocusInWindow(); + //System.out.println("got " + ok); + findField.selectAll(); + } + }); + } + + + public void handleClose() { + //System.out.println("handling close now"); + findString = findField.getText(); + replaceString = replaceField.getText(); + + // this object should eventually become dereferenced + setVisible(false); + } + + + /* + public void show() { + findField.requestFocusInWindow(); + super.show(); + //findField.selectAll(); + //findField.requestFocus(); + } + */ + + + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + + if (source == findButton) { + find(true); + + } else if (source == replaceFindButton) { + replace(); + find(true); + + } else if (source == replaceButton) { + replace(); + + } else if (source == replaceAllButton) { + replaceAll(); + } + } + + + // look for the next instance of the find string + // to be found later than the current caret selection + + // once found, select it (and go to that line) + + public void find(boolean wrap) { + // in case search len is zero, + // otherwise replace all will go into an infinite loop + found = false; + + String search = findField.getText(); + //System.out.println("finding for " + search + " " + findString); + // this will catch "find next" being called when no search yet + if (search.length() == 0) return; + + String text = editor.getText(); + + if (ignoreCase) { + search = search.toLowerCase(); + text = text.toLowerCase(); + } + + //int selectionStart = editor.textarea.getSelectionStart(); + int selectionEnd = editor.getSelectionStop(); + + int nextIndex = text.indexOf(search, selectionEnd); + if (nextIndex == -1) { + if (wrap) { + // if wrapping, a second chance is ok, start from beginning + nextIndex = text.indexOf(search, 0); + } + + if (nextIndex == -1) { + found = false; + replaceButton.setEnabled(false); + replaceFindButton.setEnabled(false); + //Toolkit.getDefaultToolkit().beep(); + return; + } + } + found = true; + replaceButton.setEnabled(true); + replaceFindButton.setEnabled(true); + editor.setSelection(nextIndex, nextIndex + search.length()); + } + + + /** + * Replace the current selection with whatever's in the + * replacement text field. + */ + public void replace() { + if (!found) return; // don't replace if nothing found + + // check to see if the document has wrapped around + // otherwise this will cause an infinite loop + String sel = editor.getSelectedText(); + if (sel.equals(replaceField.getText())) { + found = false; + replaceButton.setEnabled(false); + replaceFindButton.setEnabled(false); + return; + } + + editor.setSelectedText(replaceField.getText()); + //editor.setSketchModified(true); + //editor.sketch.setCurrentModified(true); + editor.getSketch().setModified(true); // TODO is this necessary? + + // don't allow a double replace + replaceButton.setEnabled(false); + replaceFindButton.setEnabled(false); + } + + + /** + * Replace everything that matches by doing find and replace + * alternately until nothing more found. + */ + public void replaceAll() { + // move to the beginning + editor.setSelection(0, 0); + + do { + find(false); + replace(); + } while (found); + } +} diff --git a/app/src/processing/app/Platform.java b/app/src/processing/app/Platform.java new file mode 100644 index 000000000..ef03f56ce --- /dev/null +++ b/app/src/processing/app/Platform.java @@ -0,0 +1,139 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.io.File; + +import javax.swing.UIManager; + + +/** + * Used by Base for platform-specific tweaking, for instance finding the + * sketchbook location using the Windows registry, or OS X event handling. + * + * The methods in this implementation are used by default, and can be + * overridden by a subclass, if loaded by Base.main(). + * + * These methods throw vanilla-flavored Exceptions, so that error handling + * occurs inside Base. + * + * There is currently no mechanism for adding new platforms, as the setup is + * not automated. We could use getProperty("os.arch") perhaps, but that's + * debatable (could be upper/lowercase, have spaces, etc.. basically we don't + * know if name is proper Java package syntax.) + */ +public class Platform { + Base base; + + + /** + * Set the default L & F. While I enjoy the bounty of the sixteen possible + * exception types that this UIManager method might throw, I feel that in + * just this one particular case, I'm being spoiled by those engineers + * at Sun, those Masters of the Abstractionverse. It leaves me feeling sad + * and overweight. So instead, I'll pretend that I'm not offered eleven dozen + * ways to report to the user exactly what went wrong, and I'll bundle them + * all into a single catch-all "Exception". Because in the end, all I really + * care about is whether things worked or not. And even then, I don't care. + * + * @throws Exception Just like I said. + */ + public void setLookAndFeel() throws Exception { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + + + public void init(Base base) { + this.base = base; + } + + + public File getSettingsFolder() throws Exception { + // otherwise make a .processing directory int the user's home dir + File home = new File(System.getProperty("user.home")); + File dataFolder = new File(home, ".processing"); + return dataFolder; + + /* + try { + Class clazz = Class.forName("processing.app.macosx.ThinkDifferent"); + Method m = clazz.getMethod("getLibraryFolder", new Class[] { }); + String libraryPath = (String) m.invoke(null, new Object[] { }); + //String libraryPath = BaseMacOS.getLibraryFolder(); + File libraryFolder = new File(libraryPath); + dataFolder = new File(libraryFolder, "Processing"); + + } catch (Exception e) { + showError("Problem getting data folder", + "Error getting the Processing data folder.", e); + } + */ + } + + + /** + * @return null if not overridden, which will cause a prompt to show instead. + * @throws Exception + */ + public File getDefaultSketchbookFolder() throws Exception { + return null; + } + + + public void openURL(String url) throws Exception { + String launcher = Preferences.get("launcher"); + if (launcher != null) { + Runtime.getRuntime().exec(new String[] { launcher, url }); + } else { + showLauncherWarning(); + } + } + + + public boolean openFolderAvailable() { + return Preferences.get("launcher") != null; + } + + + public void openFolder(File file) throws Exception { + String launcher = Preferences.get("launcher"); + if (launcher != null) { + String folder = file.getAbsolutePath(); + Runtime.getRuntime().exec(new String[] { launcher, folder }); + } else { + showLauncherWarning(); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + protected void showLauncherWarning() { + Base.showWarning("No launcher available", + "Unspecified platform, no launcher available.\n" + + "To enable opening URLs or folders, add a \n" + + "\"launcher=/path/to/app\" line to preferences.txt", + null); + } +} \ No newline at end of file diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java new file mode 100644 index 000000000..c6b53d0da --- /dev/null +++ b/app/src/processing/app/Preferences.java @@ -0,0 +1,909 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; + +import javax.swing.*; + +import processing.app.syntax.*; +import processing.core.*; + + + + +/** + * Storage class for user preferences and environment settings. + *

+ * This class no longer uses the Properties class, since + * properties files are iso8859-1, which is highly likely to + * be a problem when trying to save sketch folders and locations. + *

+ * The GUI portion in here is really ugly, as it uses exact layout. This was + * done in frustration one evening (and pre-Swing), but that's long since past, + * and it should all be moved to a proper swing layout like BoxLayout. + *

+ * This is very poorly put together, that the preferences panel and the actual + * preferences i/o is part of the same code. But there hasn't yet been a + * compelling reason to bother with the separation aside from concern about + * being lectured by strangers who feel that it doesn't look like what they + * learned in CS class. + *

+ * Would also be possible to change this to use the Java Preferences API. + * Some useful articles + * here and + * here. + * However, haven't implemented this yet for lack of time, but more + * importantly, because it would entail writing to the registry (on Windows), + * or an obscure file location (on Mac OS X) and make it far more difficult to + * find the preferences to tweak them by hand (no! stay out of regedit!) + * or to reset the preferences by simply deleting the preferences.txt file. + */ +public class Preferences { + + // what to call the feller + + static final String PREFS_FILE = "preferences.txt"; + + + // platform strings (used to get settings for specific platforms) + + //static final String platforms[] = { + // "other", "windows", "macosx", "linux" + //}; + + + // prompt text stuff + + static final String PROMPT_YES = "Yes"; + static final String PROMPT_NO = "No"; + static final String PROMPT_CANCEL = "Cancel"; + static final String PROMPT_OK = "OK"; + static final String PROMPT_BROWSE = "Browse"; + + /** + * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, + * Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper. + */ + static public int BUTTON_WIDTH = 80; + + /** + * Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29, + * presumably because it now includes the blue border, where it didn't + * in Java 1.3. Windows XP only wants 23 (not sure what default Linux + * would be). Because of the disparity, on Mac OS X, it will be set + * inside a static block. + */ + static public int BUTTON_HEIGHT = 24; + /* + // remove this for 0121, because quaqua takes care of it + static { + if (Base.isMacOS()) BUTTON_HEIGHT = 29; + } + */ + + // value for the size bars, buttons, etc + + static final int GRID_SIZE = 33; + + + // indents and spacing standards. these probably need to be modified + // per platform as well, since macosx is so huge, windows is smaller, + // and linux is all over the map + + static final int GUI_BIG = 13; + static final int GUI_BETWEEN = 10; + static final int GUI_SMALL = 6; + + // gui elements + + JFrame dialog; + int wide, high; + + JTextField sketchbookLocationField; + JCheckBox exportSeparateBox; + JCheckBox deletePreviousBox; +// JCheckBox closingLastQuitsBox; + JCheckBox externalEditorBox; + JCheckBox memoryOverrideBox; + JTextField memoryField; + JCheckBox checkUpdatesBox; + JTextField fontSizeField; + JCheckBox autoAssociateBox; + JCheckBox menubarWorkaroundBox; + + + // the calling editor, so updates can be applied + + Editor editor; + + + // data model + + static Hashtable defaults; + static Hashtable table = new Hashtable();; + static File preferencesFile; + + + static protected void init(String commandLinePrefs) { + + // start by loading the defaults, in case something + // important was deleted from the user prefs + try { + load(Base.getLibStream("preferences.txt")); + } catch (Exception e) { + Base.showError(null, "Could not read default settings.\n" + + "You'll need to reinstall Processing.", e); + } + + // check for platform-specific properties in the defaults + String platformExt = "." + PConstants.platformNames[PApplet.platform]; + int platformExtLength = platformExt.length(); + Enumeration e = table.keys(); + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + if (key.endsWith(platformExt)) { + // this is a key specific to a particular platform + String actualKey = key.substring(0, key.length() - platformExtLength); + String value = get(key); + table.put(actualKey, value); + } + } + + // clone the hash table + defaults = (Hashtable) table.clone(); + + // other things that have to be set explicitly for the defaults + setColor("run.window.bgcolor", SystemColor.control); + + // Load a prefs file if specified on the command line + if (commandLinePrefs != null) { + try { + load(new FileInputStream(commandLinePrefs)); + + } catch (Exception poe) { + Base.showError("Error", + "Could not read preferences from " + + commandLinePrefs, poe); + } + } else if (!Base.isCommandLine()) { + // next load user preferences file + preferencesFile = Base.getSettingsFile(PREFS_FILE); + if (!preferencesFile.exists()) { + // create a new preferences file if none exists + // saves the defaults out to the file + save(); + + } else { + // load the previous preferences file + + try { + load(new FileInputStream(preferencesFile)); + + } catch (Exception ex) { + Base.showError("Error reading preferences", + "Error reading the preferences file. " + + "Please delete (or move)\n" + + preferencesFile.getAbsolutePath() + + " and restart Processing.", ex); + } + } + + // Theme settings always override preferences +// try { +// load(Base.getStream("theme/theme.txt")); +// } catch (Exception te) { +// Base.showError(null, "Could not read color theme settings.\n" + +// "You'll need to reinstall Processing.", te); +// } + } + } + + + public Preferences() { + + // setup dialog for the prefs + + //dialog = new JDialog(editor, "Preferences", true); + dialog = new JFrame("Preferences"); + dialog.setResizable(false); + + Container pain = dialog.getContentPane(); + pain.setLayout(null); + + int top = GUI_BIG; + int left = GUI_BIG; + int right = 0; + + JLabel label; + JButton button; //, button2; + //JComboBox combo; + Dimension d, d2; //, d3; + int h, vmax; + + + // [ ] Quit after closing last sketch window + /* + closingLastQuitsBox = + new JCheckBox("Quit after closing last sketch window"); + pain.add(closingLastQuitsBox); + d = closingLastQuitsBox.getPreferredSize(); + closingLastQuitsBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + */ + + + /* + // [ ] Prompt for name and folder when creating new sketch + + sketchPromptBox = + new JCheckBox("Prompt for name when opening or creating a sketch"); + pain.add(sketchPromptBox); + d = sketchPromptBox.getPreferredSize(); + sketchPromptBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + */ + + + // [ ] Delete empty sketches on Quit + + /* + sketchCleanBox = new JCheckBox("Delete empty sketches on Quit"); + pain.add(sketchCleanBox); + d = sketchCleanBox.getPreferredSize(); + sketchCleanBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + */ + + + // Sketchbook location: + // [...............................] [ Browse ] + + label = new JLabel("Sketchbook location:"); + pain.add(label); + d = label.getPreferredSize(); + label.setBounds(left, top, d.width, d.height); + top += d.height; // + GUI_SMALL; + + sketchbookLocationField = new JTextField(40); + pain.add(sketchbookLocationField); + d = sketchbookLocationField.getPreferredSize(); + + button = new JButton(PROMPT_BROWSE); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + /* + JFileChooser fc = new JFileChooser(); + fc.setSelectedFile(new File(sketchbookLocationField.getText())); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + int returned = fc.showOpenDialog(new JDialog()); + if (returned == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + sketchbookLocationField.setText(file.getAbsolutePath()); + } + */ + File dflt = new File(sketchbookLocationField.getText()); + File file = + Base.selectFolder("Select new sketchbook location", dflt, dialog); + if (file != null) { + sketchbookLocationField.setText(file.getAbsolutePath()); + } + } + }); + pain.add(button); + d2 = button.getPreferredSize(); + + // take max height of all components to vertically align em + vmax = Math.max(d.height, d2.height); + //label.setBounds(left, top + (vmax-d.height)/2, + // d.width, d.height); + + //h = left + d.width + GUI_BETWEEN; + sketchbookLocationField.setBounds(left, top + (vmax-d.height)/2, + d.width, d.height); + h = left + d.width + GUI_SMALL; //GUI_BETWEEN; + button.setBounds(h, top + (vmax-d2.height)/2, + d2.width, d2.height); + + right = Math.max(right, h + d2.width + GUI_BIG); + top += vmax + GUI_BETWEEN; + + + // Editor font size [ ] + + Container box = Box.createHorizontalBox(); + label = new JLabel("Editor font size: "); + box.add(label); + fontSizeField = new JTextField(4); + box.add(fontSizeField); + label = new JLabel(" (requires restart of Processing)"); + box.add(label); + pain.add(box); + d = box.getPreferredSize(); + box.setBounds(left, top, d.width, d.height); + Font editorFont = Preferences.getFont("editor.font"); + fontSizeField.setText(String.valueOf(editorFont.getSize())); + top += d.height + GUI_BETWEEN; + + + // [ ] Increase maximum available memory to [______] MB + + Container memoryBox = Box.createHorizontalBox(); + memoryOverrideBox = new JCheckBox("Increase maximum available memory to "); + memoryBox.add(memoryOverrideBox); + memoryField = new JTextField(4); + memoryBox.add(memoryField); + memoryBox.add(new JLabel(" MB")); + pain.add(memoryBox); + d = memoryBox.getPreferredSize(); + memoryBox.setBounds(left, top, d.width, d.height); + top += d.height + GUI_BETWEEN; + + + // [ ] Use multiple .jar files when exporting applets + + exportSeparateBox = + new JCheckBox("Use multiple .jar files when exporting applets " + + "(ignored when using libraries)"); + pain.add(exportSeparateBox); + d = exportSeparateBox.getPreferredSize(); + // adding +10 because ubuntu + jre 1.5 truncating items + exportSeparateBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + + + // [ ] Delete previous applet or application folder on export + + deletePreviousBox = + new JCheckBox("Delete previous applet or application folder on export"); + pain.add(deletePreviousBox); + d = deletePreviousBox.getPreferredSize(); + deletePreviousBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + + + // [ ] Use external editor + + externalEditorBox = new JCheckBox("Use external editor"); + pain.add(externalEditorBox); + d = externalEditorBox.getPreferredSize(); + externalEditorBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + + + // [ ] Check for updates on startup + + checkUpdatesBox = new JCheckBox("Check for updates on startup"); + pain.add(checkUpdatesBox); + d = checkUpdatesBox.getPreferredSize(); + checkUpdatesBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + + + // [ ] Automatically associate .pde files with Processing + + if (Base.isWindows()) { + autoAssociateBox = + new JCheckBox("Automatically associate .pde files with Processing"); + pain.add(autoAssociateBox); + d = autoAssociateBox.getPreferredSize(); + autoAssociateBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + } + + + // [ ] Place menu bar inside + + if (Base.isMacOS()) { + if (System.getProperty("os.version").startsWith("10.5")) { + menubarWorkaroundBox = + new JCheckBox("Place menus inside editor window to avoid " + + "Apple Java bug (requires restart)"); + pain.add(menubarWorkaroundBox); + d = menubarWorkaroundBox.getPreferredSize(); + menubarWorkaroundBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + } + } + + + // More preferences are in the ... + + label = new JLabel("More preferences can be edited directly in the file"); + pain.add(label); + d = label.getPreferredSize(); + label.setForeground(Color.gray); + label.setBounds(left, top, d.width, d.height); + right = Math.max(right, left + d.width); + top += d.height; // + GUI_SMALL; + + label = new JLabel(preferencesFile.getAbsolutePath()); + pain.add(label); + d = label.getPreferredSize(); + label.setBounds(left, top, d.width, d.height); + right = Math.max(right, left + d.width); + top += d.height; + + label = new JLabel("(edit only when Processing is not running)"); + pain.add(label); + d = label.getPreferredSize(); + label.setForeground(Color.gray); + label.setBounds(left, top, d.width, d.height); + right = Math.max(right, left + d.width); + top += d.height; // + GUI_SMALL; + + + // [ OK ] [ Cancel ] maybe these should be next to the message? + + button = new JButton(PROMPT_OK); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + applyFrame(); + disposeFrame(); + } + }); + pain.add(button); + d2 = button.getPreferredSize(); + BUTTON_HEIGHT = d2.height; + + h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); + button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); + h += BUTTON_WIDTH + GUI_SMALL; + + button = new JButton(PROMPT_CANCEL); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + disposeFrame(); + } + }); + pain.add(button); + button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); + + top += BUTTON_HEIGHT + GUI_BETWEEN; + + + // finish up + + wide = right + GUI_BIG; + high = top + GUI_SMALL; + //setSize(wide, high); + + + // closing the window is same as hitting cancel button + + dialog.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + disposeFrame(); + } + }); + + ActionListener disposer = new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + disposeFrame(); + } + }; + Base.registerWindowCloseKeys(dialog.getRootPane(), disposer); + Base.setIcon(dialog); + + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + dialog.setLocation((screen.width - wide) / 2, + (screen.height - high) / 2); + + dialog.pack(); // get insets + Insets insets = dialog.getInsets(); + dialog.setSize(wide + insets.left + insets.right, + high + insets.top + insets.bottom); + + + // handle window closing commands for ctrl/cmd-W or hitting ESC. + + pain.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + //System.out.println(e); + KeyStroke wc = Editor.WINDOW_CLOSE_KEYSTROKE; + if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) || + (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) { + disposeFrame(); + } + } + }); + } + + + /* + protected JRootPane createRootPane() { + System.out.println("creating root pane esc received"); + + ActionListener actionListener = new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + //setVisible(false); + System.out.println("esc received"); + } + }; + + JRootPane rootPane = new JRootPane(); + KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); + rootPane.registerKeyboardAction(actionListener, stroke, + JComponent.WHEN_IN_FOCUSED_WINDOW); + return rootPane; + } + */ + + + public Dimension getPreferredSize() { + return new Dimension(wide, high); + } + + + // ................................................................. + + + /** + * Close the window after an OK or Cancel. + */ + protected void disposeFrame() { + dialog.dispose(); + } + + + /** + * Change internal settings based on what was chosen in the prefs, + * then send a message to the editor saying that it's time to do the same. + */ + protected void applyFrame() { + // put each of the settings into the table + setBoolean("export.applet.separate_jar_files", + exportSeparateBox.isSelected()); + setBoolean("export.delete_target_folder", + deletePreviousBox.isSelected()); + +// setBoolean("sketchbook.closing_last_window_quits", +// closingLastQuitsBox.isSelected()); + //setBoolean("sketchbook.prompt", sketchPromptBox.isSelected()); + //setBoolean("sketchbook.auto_clean", sketchCleanBox.isSelected()); + + // if the sketchbook path has changed, rebuild the menus + String oldPath = get("sketchbook.path"); + String newPath = sketchbookLocationField.getText(); + if (!newPath.equals(oldPath)) { + editor.base.rebuildSketchbookMenus(); + set("sketchbook.path", newPath); + } + + setBoolean("editor.external", externalEditorBox.isSelected()); + setBoolean("update.check", checkUpdatesBox.isSelected()); + + setBoolean("run.options.memory", memoryOverrideBox.isSelected()); + int memoryMin = Preferences.getInteger("run.options.memory.initial"); + int memoryMax = Preferences.getInteger("run.options.memory.maximum"); + try { + memoryMax = Integer.parseInt(memoryField.getText().trim()); + // make sure memory setting isn't too small + if (memoryMax < memoryMin) memoryMax = memoryMin; + setInteger("run.options.memory.maximum", memoryMax); + } catch (NumberFormatException e) { + System.err.println("Ignoring bad memory setting"); + } + + /* + // was gonna use this to check memory settings, + // but it quickly gets much too messy + if (getBoolean("run.options.memory")) { + Process process = Runtime.getRuntime().exec(new String[] { + "java", "-Xms" + memoryMin + "m", "-Xmx" + memoryMax + "m" + }); + processInput = new SystemOutSiphon(process.getInputStream()); + processError = new MessageSiphon(process.getErrorStream(), this); + } + */ + + String newSizeText = fontSizeField.getText(); + try { + int newSize = Integer.parseInt(newSizeText.trim()); + String pieces[] = PApplet.split(get("editor.font"), ','); + pieces[2] = String.valueOf(newSize); + set("editor.font", PApplet.join(pieces, ',')); + + } catch (Exception e) { + System.err.println("ignoring invalid font size " + newSizeText); + } + + if (autoAssociateBox != null) { + setBoolean("platform.auto_file_type_associations", + autoAssociateBox.isSelected()); + } + + if (menubarWorkaroundBox != null) { + setBoolean("apple.laf.useScreenMenuBar", + !menubarWorkaroundBox.isSelected()); + } + + editor.applyPreferences(); + } + + + protected void showFrame(Editor editor) { + this.editor = editor; + + // set all settings entry boxes to their actual status + exportSeparateBox. + setSelected(getBoolean("export.applet.separate_jar_files")); + deletePreviousBox. + setSelected(getBoolean("export.delete_target_folder")); + + //closingLastQuitsBox. + // setSelected(getBoolean("sketchbook.closing_last_window_quits")); + //sketchPromptBox. + // setSelected(getBoolean("sketchbook.prompt")); + //sketchCleanBox. + // setSelected(getBoolean("sketchbook.auto_clean")); + + sketchbookLocationField. + setText(get("sketchbook.path")); + externalEditorBox. + setSelected(getBoolean("editor.external")); + checkUpdatesBox. + setSelected(getBoolean("update.check")); + memoryOverrideBox. + setSelected(getBoolean("run.options.memory")); + memoryField. + setText(get("run.options.memory.maximum")); + + if (autoAssociateBox != null) { + autoAssociateBox. + setSelected(getBoolean("platform.auto_file_type_associations")); + } + + if (menubarWorkaroundBox != null) { + menubarWorkaroundBox. + setSelected(!getBoolean("apple.laf.useScreenMenuBar")); + } + + dialog.setVisible(true); + } + + + // ................................................................. + + + static protected void load(InputStream input) throws IOException { + String[] lines = PApplet.loadStrings(input); // Reads as UTF-8 + for (String line : lines) { + if ((line.length() == 0) || + (line.charAt(0) == '#')) continue; + + // this won't properly handle = signs being in the text + int equals = line.indexOf('='); + if (equals != -1) { + String key = line.substring(0, equals).trim(); + String value = line.substring(equals + 1).trim(); + table.put(key, value); + } + } + } + + + // ................................................................. + + + static protected void save() { +// try { + // on startup, don't worry about it + // this is trying to update the prefs for who is open + // before Preferences.init() has been called. + if (preferencesFile == null) return; + + // Fix for 0163 to properly use Unicode when writing preferences.txt + PrintWriter writer = PApplet.createWriter(preferencesFile); + + Enumeration e = table.keys(); //properties.propertyNames(); + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + writer.println(key + "=" + ((String) table.get(key))); + } + + writer.flush(); + writer.close(); + +// } catch (Exception ex) { +// Base.showWarning(null, "Error while saving the settings file", ex); +// } + } + + + // ................................................................. + + + // all the information from preferences.txt + + //static public String get(String attribute) { + //return get(attribute, null); + //} + + static public String get(String attribute /*, String defaultValue */) { + return (String) table.get(attribute); + /* + //String value = (properties != null) ? + //properties.getProperty(attribute) : applet.getParameter(attribute); + String value = properties.getProperty(attribute); + + return (value == null) ? + defaultValue : value; + */ + } + + + static public String getDefault(String attribute) { + return (String) defaults.get(attribute); + } + + + static public void set(String attribute, String value) { + table.put(attribute, value); + } + + + static public boolean getBoolean(String attribute) { + String value = get(attribute); //, null); + return (new Boolean(value)).booleanValue(); + + /* + supposedly not needed, because anything besides 'true' + (ignoring case) will just be false.. so if malformed -> false + if (value == null) return defaultValue; + + try { + return (new Boolean(value)).booleanValue(); + } catch (NumberFormatException e) { + System.err.println("expecting an integer: " + attribute + " = " + value); + } + return defaultValue; + */ + } + + + static public void setBoolean(String attribute, boolean value) { + set(attribute, value ? "true" : "false"); + } + + + static public int getInteger(String attribute /*, int defaultValue*/) { + return Integer.parseInt(get(attribute)); + + /* + String value = get(attribute, null); + if (value == null) return defaultValue; + + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + // ignored will just fall through to returning the default + System.err.println("expecting an integer: " + attribute + " = " + value); + } + return defaultValue; + //if (value == null) return defaultValue; + //return (value == null) ? defaultValue : + //Integer.parseInt(value); + */ + } + + + static public void setInteger(String key, int value) { + set(key, String.valueOf(value)); + } + + + static public Color getColor(String name) { + Color parsed = Color.GRAY; // set a default + String s = get(name); + if ((s != null) && (s.indexOf("#") == 0)) { + try { + parsed = new Color(Integer.parseInt(s.substring(1), 16)); + } catch (Exception e) { } + } + return parsed; + } + + + static public void setColor(String attr, Color what) { +// String r = Integer.toHexString(what.getRed()); +// String g = Integer.toHexString(what.getGreen()); +// String b = Integer.toHexString(what.getBlue()); +// set(attr, "#" + r.substring(r.length() - 2) + +// g.substring(g.length() - 2) + b.substring(b.length() - 2)); + set(attr, "#" + PApplet.hex(what.getRGB() & 0xffffff, 6)); + } + + + static public Font getFont(String attr) { + boolean replace = false; + String value = get(attr); + if (value == null) { + //System.out.println("reset 1"); + value = getDefault(attr); + replace = true; + } + + String[] pieces = PApplet.split(value, ','); + if (pieces.length != 3) { + value = getDefault(attr); + //System.out.println("reset 2 for " + attr); + pieces = PApplet.split(value, ','); + //PApplet.println(pieces); + replace = true; + } + + String name = pieces[0]; + int style = Font.PLAIN; // equals zero + if (pieces[1].indexOf("bold") != -1) { + style |= Font.BOLD; + } + if (pieces[1].indexOf("italic") != -1) { + style |= Font.ITALIC; + } + int size = PApplet.parseInt(pieces[2], 12); + Font font = new Font(name, style, size); + + // replace bad font with the default + if (replace) { + set(attr, value); + } + + return font; + } + + + static public SyntaxStyle getStyle(String what /*, String dflt*/) { + String str = get("editor." + what + ".style"); //, dflt); + + StringTokenizer st = new StringTokenizer(str, ","); + + String s = st.nextToken(); + if (s.indexOf("#") == 0) s = s.substring(1); + Color color = Color.DARK_GRAY; + try { + color = new Color(Integer.parseInt(s, 16)); + } catch (Exception e) { } + + s = st.nextToken(); + boolean bold = (s.indexOf("bold") != -1); + boolean italic = (s.indexOf("italic") != -1); + //System.out.println(what + " = " + str + " " + bold + " " + italic); + + return new SyntaxStyle(color, italic, bold); + } +} diff --git a/app/src/processing/app/PresentMode.java b/app/src/processing/app/PresentMode.java new file mode 100644 index 000000000..63f4578d9 --- /dev/null +++ b/app/src/processing/app/PresentMode.java @@ -0,0 +1,128 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-06 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.awt.event.*; +import java.util.Vector; +import javax.swing.*; + + +/** + * Helper class for full-screen presentation mode. + */ +public class PresentMode { + + static GraphicsDevice devices[]; + + /** + * Index of the default display device, probably the one that p5 was + * started from. + */ + static int defaultIndex; + + /** + * Menu object for preferences window + */ + //JMenu preferencesMenu; + static JComboBox selector; + + /** + * Index of the currently selected display to be used for present mode. + */ + static GraphicsDevice device; + + + static { + GraphicsEnvironment environment = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + devices = environment.getScreenDevices(); + GraphicsDevice defaultDevice = environment.getDefaultScreenDevice(); + + Vector names = new Vector(); + for (int i = 0; i < devices.length; i++) { + String name = String.valueOf(i + 1); + if (devices[i] == defaultDevice) { + defaultIndex = i; + name += " (default)"; + } + names.add(name); + } + + selector = new JComboBox(names); + selector.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int index = selector.getSelectedIndex(); + //device = devices[index]; + Preferences.setInteger("run.present.display", index + 1); + } + }); + } + + + static public JComboBox getSelector() { + int deviceIndex = Preferences.getInteger("run.present.display") - 1; + selector.setSelectedIndex(deviceIndex); + return selector; + } + + + /* + static public JFrame create() { + int deviceIndex = PrePreferences.getInteger("run.present.display") - 1; + if ((deviceIndex < 0) || (deviceIndex >= devices.length)) { + Base.showWarning("Display doesn't exist", + "Present Mode is set to use display " + + (deviceIndex+1) + + " but that doesn't seem to exist. \n" + + "This preference will be reset to " + + "use the default display.", null); + deviceIndex = defaultIndex; + } + //GraphicsDevice device = devices[ + //JFrame frame = new JFrame(devices[deviceIndex]); + PresentFrame frame = new PresentFrame(devices[deviceIndex]); + } + + + public void show() { + setUndecorated(true); + setResizable(false); + device.setFullScreenWindow(this); + } + + + public Window getWindow() { + return device.getFullScreenWindow(); // isn't this just me? + } + + + public void dispose() { + Window window = device.getFullScreenWindow(); + if (window != null) { + window.dispose(); + } + device.setFullScreenWindow(null); + } + */ +} diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java new file mode 100644 index 000000000..28f253b8c --- /dev/null +++ b/app/src/processing/app/Sketch.java @@ -0,0 +1,3004 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import processing.app.debug.Compiler; +import processing.app.debug.RunnerException; +import processing.app.preproc.*; +import processing.core.*; + +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import java.util.*; +import java.util.zip.*; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + + +/** + * Stores information about files in the current sketch + */ +public class Sketch { + static private File tempBuildFolder; + + private Editor editor; + + /** main pde file for this sketch. */ + private File primaryFile; + + /** + * Name of sketch, which is the name of main file + * (without .pde or .java extension) + */ + private String name; + + /** true if any of the files have been modified. */ + private boolean modified; + + /** folder that contains this sketch */ + private File folder; + + /** data folder location for this sketch (may not exist yet) */ + private File dataFolder; + + /** code folder location for this sketch (may not exist yet) */ + private File codeFolder; + + private SketchCode current; + private int currentIndex; + /** + * Number of sketchCode objects (tabs) in the current sketch. Note that this + * will be the same as code.length, because the getCode() method returns + * just the code[] array, rather than a copy of it, or an array that's been + * resized to just the relevant files themselves. + * http://dev.processing.org/bugs/show_bug.cgi?id=940 + */ + private int codeCount; + private SketchCode[] code; + + /** Class name for the PApplet, as determined by the preprocessor. */ + private String appletClassName; + /** Class path determined during build. */ + private String classPath; + + /** + * This is *not* the "Processing" libraries path, this is the Java libraries + * path, as in java.library.path=BlahBlah, which identifies search paths for + * DLLs or JNILIBs. + */ + private String libraryPath; + private ArrayList importedLibraries; + + /** + * path is location of the main .pde file, because this is also + * simplest to use when opening the file from the finder/explorer. + */ + public Sketch(Editor editor, String path) throws IOException { + this.editor = editor; + + primaryFile = new File(path); + + // get the name of the sketch by chopping .pde or .java + // off of the main file name + String mainFilename = primaryFile.getName(); + int suffixLength = getDefaultExtension().length() + 1; + name = mainFilename.substring(0, mainFilename.length() - suffixLength); + + // lib/build must exist when the application is started + // it is added to the CLASSPATH by default, but if it doesn't + // exist when the application is started, then java will remove + // the entry from the CLASSPATH, causing Runner to fail. + // + /* + tempBuildFolder = new File(TEMP_BUILD_PATH); + if (!tempBuildFolder.exists()) { + tempBuildFolder.mkdirs(); + Base.showError("Required folder missing", + "A required folder was missing from \n" + + "from your installation of Processing.\n" + + "It has now been replaced, please restart \n" + + "the application to complete the repair.", null); + } + */ + tempBuildFolder = Base.getBuildFolder(); + //Base.addBuildFolderToClassPath(); + + folder = new File(new File(path).getParent()); + //System.out.println("sketch dir is " + folder); + + load(); + } + + + /** + * Build the list of files. + *

+ * Generally this is only done once, rather than + * each time a change is made, because otherwise it gets to be + * a nightmare to keep track of what files went where, because + * not all the data will be saved to disk. + *

+ * This also gets called when the main sketch file is renamed, + * because the sketch has to be reloaded from a different folder. + *

+ * Another exception is when an external editor is in use, + * in which case the load happens each time "run" is hit. + */ + protected void load() { + codeFolder = new File(folder, "code"); + dataFolder = new File(folder, "data"); + + // get list of files in the sketch folder + String list[] = folder.list(); + + // reset these because load() may be called after an + // external editor event. (fix for 0099) + codeCount = 0; + + code = new SketchCode[list.length]; + + String[] extensions = getExtensions(); + + for (String filename : list) { + // Ignoring the dot prefix files is especially important to avoid files + // with the ._ prefix on Mac OS X. (You'll see this with Mac files on + // non-HFS drives, i.e. a thumb drive formatted FAT32.) + if (filename.startsWith(".")) continue; + + // Don't let some wacko name a directory blah.pde or bling.java. + if (new File(folder, filename).isDirectory()) continue; + + // figure out the name without any extension + String base = filename; + // now strip off the .pde and .java extensions + for (String extension : extensions) { + if (base.toLowerCase().endsWith("." + extension)) { + base = base.substring(0, base.length() - (extension.length() + 1)); + + // Don't allow people to use files with invalid names, since on load, + // it would be otherwise possible to sneak in nasty filenames. [0116] + if (Sketch.isSanitaryName(base)) { + code[codeCount++] = + new SketchCode(new File(folder, filename), extension); + } + } + } + } + // Remove any code that wasn't proper + code = (SketchCode[]) PApplet.subset(code, 0, codeCount); + + // move the main class to the first tab + // start at 1, if it's at zero, don't bother + for (int i = 1; i < codeCount; i++) { + //if (code[i].file.getName().equals(mainFilename)) { + if (code[i].getFile().equals(primaryFile)) { + SketchCode temp = code[0]; + code[0] = code[i]; + code[i] = temp; + break; + } + } + + // sort the entries at the top + sortCode(); + + // set the main file to be the current tab + if (editor != null) { + setCurrentCode(0); + } + } + + + protected void replaceCode(SketchCode newCode) { + for (int i = 0; i < codeCount; i++) { + if (code[i].getFileName().equals(newCode.getFileName())) { + code[i] = newCode; + break; + } + } + } + + + protected void insertCode(SketchCode newCode) { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // add file to the code/codeCount list, resort the list + if (codeCount == code.length) { + code = (SketchCode[]) PApplet.append(code, newCode); + } + code[codeCount++] = newCode; + } + + + protected void sortCode() { + // cheap-ass sort of the rest of the files + // it's a dumb, slow sort, but there shouldn't be more than ~5 files + for (int i = 1; i < codeCount; i++) { + int who = i; + for (int j = i + 1; j < codeCount; j++) { + if (code[j].getFileName().compareTo(code[who].getFileName()) < 0) { + who = j; // this guy is earlier in the alphabet + } + } + if (who != i) { // swap with someone if changes made + SketchCode temp = code[who]; + code[who] = code[i]; + code[i] = temp; + } + } + } + + + boolean renamingCode; + + /** + * Handler for the New Code menu option. + */ + public void handleNewCode() { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // if read-only, give an error + if (isReadOnly()) { + // if the files are read-only, need to first do a "save as". + Base.showMessage("Sketch is Read-Only", + "Some files are marked \"read-only\", so you'll\n" + + "need to re-save the sketch in another location,\n" + + "and try again."); + return; + } + + renamingCode = false; + editor.status.edit("Name for new file:", ""); + } + + + /** + * Handler for the Rename Code menu option. + */ + public void handleRenameCode() { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + if (currentIndex == 0 && editor.untitled) { + Base.showMessage("Sketch is Untitled", + "How about saving the sketch first \n" + + "before trying to rename it?"); + return; + } + + // if read-only, give an error + if (isReadOnly()) { + // if the files are read-only, need to first do a "save as". + Base.showMessage("Sketch is Read-Only", + "Some files are marked \"read-only\", so you'll\n" + + "need to re-save the sketch in another location,\n" + + "and try again."); + return; + } + + // ask for new name of file (internal to window) + // TODO maybe just popup a text area? + renamingCode = true; + String prompt = (currentIndex == 0) ? + "New name for sketch:" : "New name for file:"; + String oldName = (current.isExtension("pde")) ? + current.getPrettyName() : current.getFileName(); + editor.status.edit(prompt, oldName); + } + + + /** + * This is called upon return from entering a new file name. + * (that is, from either newCode or renameCode after the prompt) + * This code is almost identical for both the newCode and renameCode + * cases, so they're kept merged except for right in the middle + * where they diverge. + */ + protected void nameCode(String newName) { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // Add the extension here, this simplifies some of the logic below. + if (newName.indexOf('.') == -1) { + newName += "." + getDefaultExtension(); + } + + // if renaming to the same thing as before, just ignore. + // also ignoring case here, because i don't want to write + // a bunch of special stuff for each platform + // (osx is case insensitive but preserving, windows insensitive, + // *nix is sensitive and preserving.. argh) + if (renamingCode) { + if (newName.equalsIgnoreCase(current.getFileName())) { + // exit quietly for the 'rename' case. + // if it's a 'new' then an error will occur down below + return; + } + } + + newName = newName.trim(); + if (newName.equals("")) return; + + int dot = newName.indexOf('.'); + if (dot == 0) { + Base.showWarning("Problem with rename", + "The name cannot start with a period.", null); + return; + } + + String newExtension = newName.substring(dot+1).toLowerCase(); + if (!validExtension(newExtension)) { + Base.showWarning("Problem with rename", + "\"." + newExtension + "\"" + + "is not a valid extension.", null); + return; + } + + // Don't let the user create the main tab as a .java file instead of .pde + if (!isDefaultExtension(newExtension)) { + if (renamingCode) { // If creating a new tab, don't show this error + if (current == code[0]) { // If this is the main tab, disallow + Base.showWarning("Problem with rename", + "The main .pde file cannot be .java file.\n" + + "(It may be time for your to graduate to a\n" + + "\"real\" programming environment)", null); + return; + } + } + } + + // dots are allowed for the .pde and .java, but not in the name + // make sure the user didn't name things poo.time.pde + // or something like that (nothing against poo time) + String shortName = newName.substring(0, dot); + String sanitaryName = Sketch.sanitizeName(shortName); + if (!shortName.equals(sanitaryName)) { + newName = sanitaryName + "." + newExtension; + } + + // Make sure no .pde *and* no .java files with the same name already exist + // http://dev.processing.org/bugs/show_bug.cgi?id=543 + for (SketchCode c : code) { + if (sanitaryName.equals(c.getPrettyName())) { + Base.showMessage("Nope", + "A file named \"" + c.getFileName() + "\" already exists\n" + + "in \"" + folder.getAbsolutePath() + "\""); + return; + } + } + + File newFile = new File(folder, newName); +// if (newFile.exists()) { // yay! users will try anything +// Base.showMessage("Nope", +// "A file named \"" + newFile + "\" already exists\n" + +// "in \"" + folder.getAbsolutePath() + "\""); +// return; +// } + +// File newFileHidden = new File(folder, newName + ".x"); +// if (newFileHidden.exists()) { +// // don't let them get away with it if they try to create something +// // with the same name as something hidden +// Base.showMessage("No Way", +// "A hidden tab with the same name already exists.\n" + +// "Use \"Unhide\" to bring it back."); +// return; +// } + + if (renamingCode) { + if (currentIndex == 0) { + // get the new folder name/location + String folderName = newName.substring(0, newName.indexOf('.')); + File newFolder = new File(folder.getParentFile(), folderName); + if (newFolder.exists()) { + Base.showWarning("Cannot Rename", + "Sorry, a sketch (or folder) named " + + "\"" + newName + "\" already exists.", null); + return; + } + + // unfortunately this can't be a "save as" because that + // only copies the sketch files and the data folder + // however this *will* first save the sketch, then rename + + // first get the contents of the editor text area + if (current.isModified()) { + current.setProgram(editor.getText()); + try { + // save this new SketchCode + current.save(); + } catch (Exception e) { + Base.showWarning("Error", "Could not rename the sketch. (0)", e); + return; + } + } + + if (!current.renameTo(newFile, newExtension)) { + Base.showWarning("Error", + "Could not rename \"" + current.getFileName() + + "\" to \"" + newFile.getName() + "\"", null); + return; + } + + // save each of the other tabs because this is gonna be re-opened + try { + for (int i = 1; i < codeCount; i++) { + code[i].save(); + } + } catch (Exception e) { + Base.showWarning("Error", "Could not rename the sketch. (1)", e); + return; + } + + // now rename the sketch folder and re-open + boolean success = folder.renameTo(newFolder); + if (!success) { + Base.showWarning("Error", "Could not rename the sketch. (2)", null); + return; + } + // if successful, set base properties for the sketch + + File newMainFile = new File(newFolder, newName + ".pde"); + String newMainFilePath = newMainFile.getAbsolutePath(); + + // having saved everything and renamed the folder and the main .pde, + // use the editor to re-open the sketch to re-init state + // (unfortunately this will kill positions for carets etc) + editor.handleOpenUnchecked(newMainFilePath, + currentIndex, + editor.getSelectionStart(), + editor.getSelectionStop(), + editor.getScrollPosition()); + + // get the changes into the sketchbook menu + // (re-enabled in 0115 to fix bug #332) + editor.base.rebuildSketchbookMenus(); + + } else { // else if something besides code[0] + if (!current.renameTo(newFile, newExtension)) { + Base.showWarning("Error", + "Could not rename \"" + current.getFileName() + + "\" to \"" + newFile.getName() + "\"", null); + return; + } + } + + } else { // creating a new file + try { + if (!newFile.createNewFile()) { + // Already checking for IOException, so make our own. + throw new IOException("createNewFile() returned false"); + } + } catch (IOException e) { + Base.showWarning("Error", + "Could not create the file \"" + newFile + "\"\n" + + "in \"" + folder.getAbsolutePath() + "\"", e); + return; + } + SketchCode newCode = new SketchCode(newFile, newExtension); + //System.out.println("new code is named " + newCode.getPrettyName() + " " + newCode.getFile()); + insertCode(newCode); + } + + // sort the entries + sortCode(); + + // set the new guy as current + setCurrentCode(newName); + + // update the tabs + editor.header.rebuild(); + } + + + /** + * Remove a piece of code from the sketch and from the disk. + */ + public void handleDeleteCode() { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // if read-only, give an error + if (isReadOnly()) { + // if the files are read-only, need to first do a "save as". + Base.showMessage("Sketch is Read-Only", + "Some files are marked \"read-only\", so you'll\n" + + "need to re-save the sketch in another location,\n" + + "and try again."); + return; + } + + // confirm deletion with user, yes/no + Object[] options = { "OK", "Cancel" }; + String prompt = (currentIndex == 0) ? + "Are you sure you want to delete this sketch?" : + "Are you sure you want to delete \"" + current.getPrettyName() + "\"?"; + int result = JOptionPane.showOptionDialog(editor, + prompt, + "Delete", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[0]); + if (result == JOptionPane.YES_OPTION) { + if (currentIndex == 0) { + // need to unset all the modified flags, otherwise tries + // to do a save on the handleNew() + + // delete the entire sketch + Base.removeDir(folder); + + // get the changes into the sketchbook menu + //sketchbook.rebuildMenus(); + + // make a new sketch, and i think this will rebuild the sketch menu + //editor.handleNewUnchecked(); + //editor.handleClose2(); + editor.base.handleClose(editor); + + } else { + // delete the file + if (!current.deleteFile()) { + Base.showMessage("Couldn't do it", + "Could not delete \"" + + current.getFileName() + "\"."); + return; + } + + // remove code from the list + removeCode(current); + + // just set current tab to the main tab + setCurrentCode(0); + + // update the tabs + editor.header.repaint(); + } + } + } + + + protected void removeCode(SketchCode which) { + // remove it from the internal list of files + // resort internal list of files + for (int i = 0; i < codeCount; i++) { + if (code[i] == which) { + for (int j = i; j < codeCount-1; j++) { + code[j] = code[j+1]; + } + codeCount--; + return; + } + } + System.err.println("removeCode: internal error.. could not find code"); + } + + + /** + * Move to the previous tab. + */ + public void handlePrevCode() { + int prev = currentIndex - 1; + if (prev < 0) prev = codeCount-1; + setCurrentCode(prev); + } + + + /** + * Move to the next tab. + */ + public void handleNextCode() { + setCurrentCode((currentIndex + 1) % codeCount); + } + + + /** + * Sets the modified value for the code in the frontmost tab. + */ + public void setModified(boolean state) { + //System.out.println("setting modified to " + state); + //new Exception().printStackTrace(); + current.setModified(state); + calcModified(); + } + + + protected void calcModified() { + modified = false; + for (int i = 0; i < codeCount; i++) { + if (code[i].isModified()) { + modified = true; + break; + } + } + editor.header.repaint(); + + if (Base.isMacOS()) { + // http://developer.apple.com/qa/qa2001/qa1146.html + Object modifiedParam = modified ? Boolean.TRUE : Boolean.FALSE; + editor.getRootPane().putClientProperty("windowModified", modifiedParam); + } + } + + + public boolean isModified() { + return modified; + } + + + /** + * Save all code in the current sketch. + */ + public boolean save() throws IOException { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // first get the contents of the editor text area + if (current.isModified()) { + current.setProgram(editor.getText()); + } + + // don't do anything if not actually modified + //if (!modified) return false; + + if (isReadOnly()) { + // if the files are read-only, need to first do a "save as". + Base.showMessage("Sketch is read-only", + "Some files are marked \"read-only\", so you'll\n" + + "need to re-save this sketch to another location."); + // if the user cancels, give up on the save() + if (!saveAs()) return false; + } + + for (int i = 0; i < codeCount; i++) { + if (code[i].isModified()) code[i].save(); + } + calcModified(); + return true; + } + + + /** + * Handles 'Save As' for a sketch. + *

+ * This basically just duplicates the current sketch folder to + * a new location, and then calls 'Save'. (needs to take the current + * state of the open files and save them to the new folder.. + * but not save over the old versions for the old sketch..) + *

+ * Also removes the previously-generated .class and .jar files, + * because they can cause trouble. + */ + protected boolean saveAs() throws IOException { + String newParentDir = null; + String newName = null; + + /* + JFileChooser fc = new JFileChooser(); + fc.setDialogTitle("Save sketch folder as..."); + if (isReadOnly() || isUntitled()) { + // default to the sketchbook folder + fc.setCurrentDirectory(new File(Preferences.get("sketchbook.path"))); + } else { + // default to the parent folder of where this was + fc.setCurrentDirectory(folder.getParentFile()); + } + // can't do this, will try to save into itself by default + //fc.setSelectedFile(folder); + int result = fc.showSaveDialog(editor); + if (result == JFileChooser.APPROVE_OPTION) { + File selection = fc.getSelectedFile(); + newParentDir = selection.getParent(); + newName = selection.getName(); + } + */ + + // get new name for folder + FileDialog fd = new FileDialog(editor, + "Save sketch folder as...", + FileDialog.SAVE); + if (isReadOnly() || isUntitled()) { + // default to the sketchbook folder + fd.setDirectory(Preferences.get("sketchbook.path")); + } else { + // default to the parent folder of where this was + fd.setDirectory(folder.getParent()); + } + String oldName = folder.getName(); + fd.setFile(oldName); + + fd.setVisible(true); + newParentDir = fd.getDirectory(); + newName = fd.getFile(); + + // user canceled selection + if (newName == null) return false; + newName = Sketch.checkName(newName); + + File newFolder = new File(newParentDir, newName); +// String newPath = newFolder.getAbsolutePath(); +// String oldPath = folder.getAbsolutePath(); + +// if (newPath.equals(oldPath)) { +// return false; // Can't save a sketch over itself +// } + + // make sure there doesn't exist a tab with that name already + // but ignore this situation for the first tab, since it's probably being + // resaved (with the same name) to another location/folder. + for (int i = 1; i < codeCount; i++) { + if (newName.equals(code[i].getPrettyName())) { + Base.showMessage("Nope", + "You can't save the sketch as \"" + newName + "\"\n" + + "because the sketch already has a tab with that name."); + return false; + } + } + + // check if the paths are identical + if (newFolder.equals(folder)) { + // just use "save" here instead, because the user will have received a + // message (from the operating system) about "do you want to replace?" + return save(); + } + + // check to see if the user is trying to save this sketch inside itself + try { + String newPath = newFolder.getCanonicalPath() + File.separator; + String oldPath = folder.getCanonicalPath() + File.separator; + + if (newPath.indexOf(oldPath) == 0) { + Base.showWarning("How very Borges of you", + "You cannot save the sketch into a folder\n" + + "inside itself. This would go on forever.", null); + return false; + } + } catch (IOException e) { } + + // if the new folder already exists, then need to remove + // its contents before copying everything over + // (user will have already been warned) + if (newFolder.exists()) { + Base.removeDir(newFolder); + } + // in fact, you can't do this on windows because the file dialog + // will instead put you inside the folder, but it happens on osx a lot. + + // now make a fresh copy of the folder + newFolder.mkdirs(); + + // grab the contents of the current tab before saving + // first get the contents of the editor text area + if (current.isModified()) { + current.setProgram(editor.getText()); + } + + // save the other tabs to their new location + for (int i = 1; i < codeCount; i++) { + File newFile = new File(newFolder, code[i].getFileName()); + code[i].saveAs(newFile); + } + + // re-copy the data folder (this may take a while.. add progress bar?) + if (dataFolder.exists()) { + File newDataFolder = new File(newFolder, "data"); + Base.copyDir(dataFolder, newDataFolder); + } + + // re-copy the code folder + if (codeFolder.exists()) { + File newCodeFolder = new File(newFolder, "code"); + Base.copyDir(codeFolder, newCodeFolder); + } + + // copy custom applet.html file if one exists + // http://dev.processing.org/bugs/show_bug.cgi?id=485 + File customHtml = new File(folder, "applet.html"); + if (customHtml.exists()) { + File newHtml = new File(newFolder, "applet.html"); + Base.copyFile(customHtml, newHtml); + } + + // save the main tab with its new name + File newFile = new File(newFolder, newName + ".pde"); + code[0].saveAs(newFile); + + editor.handleOpenUnchecked(newFile.getPath(), + currentIndex, + editor.getSelectionStart(), + editor.getSelectionStop(), + editor.getScrollPosition()); + + // Name changed, rebuild the sketch menus + //editor.sketchbook.rebuildMenusAsync(); + editor.base.rebuildSketchbookMenus(); + + // Make sure that it's not an untitled sketch + setUntitled(false); + + // let Editor know that the save was successful + return true; + } + + + /** + * Prompt the user for a new file to the sketch, then call the + * other addFile() function to actually add it. + */ + public void handleAddFile() { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // if read-only, give an error + if (isReadOnly()) { + // if the files are read-only, need to first do a "save as". + Base.showMessage("Sketch is Read-Only", + "Some files are marked \"read-only\", so you'll\n" + + "need to re-save the sketch in another location,\n" + + "and try again."); + return; + } + + // get a dialog, select a file to add to the sketch + String prompt = + "Select an image or other data file to copy to your sketch"; + //FileDialog fd = new FileDialog(new Frame(), prompt, FileDialog.LOAD); + FileDialog fd = new FileDialog(editor, prompt, FileDialog.LOAD); + fd.setVisible(true); + + String directory = fd.getDirectory(); + String filename = fd.getFile(); + if (filename == null) return; + + // copy the file into the folder. if people would rather + // it move instead of copy, they can do it by hand + File sourceFile = new File(directory, filename); + + // now do the work of adding the file + boolean result = addFile(sourceFile); + + if (result) { + editor.statusNotice("One file added to the sketch."); + } + } + + + /** + * Add a file to the sketch. + *

+ * .pde or .java files will be added to the sketch folder.
+ * .jar, .class, .dll, .jnilib, and .so files will all + * be added to the "code" folder.
+ * All other files will be added to the "data" folder. + *

+ * If they don't exist already, the "code" or "data" folder + * will be created. + *

+ * @return true if successful. + */ + public boolean addFile(File sourceFile) { + String filename = sourceFile.getName(); + File destFile = null; + String codeExtension = null; + boolean replacement = false; + + // if the file appears to be code related, drop it + // into the code folder, instead of the data folder + if (filename.toLowerCase().endsWith(".class") || + filename.toLowerCase().endsWith(".jar") || + filename.toLowerCase().endsWith(".dll") || + filename.toLowerCase().endsWith(".jnilib") || + filename.toLowerCase().endsWith(".so")) { + + //if (!codeFolder.exists()) codeFolder.mkdirs(); + prepareCodeFolder(); + destFile = new File(codeFolder, filename); + + } else { + for (String extension : getExtensions()) { + String lower = filename.toLowerCase(); + if (lower.endsWith("." + extension)) { + destFile = new File(this.folder, filename); + codeExtension = extension; + } + } + if (codeExtension == null) { + prepareDataFolder(); + destFile = new File(dataFolder, filename); + } + } + + // check whether this file already exists + if (destFile.exists()) { + Object[] options = { "OK", "Cancel" }; + String prompt = "Replace the existing version of " + filename + "?"; + int result = JOptionPane.showOptionDialog(editor, + prompt, + "Replace", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[0]); + if (result == JOptionPane.YES_OPTION) { + replacement = true; + } else { + return false; + } + } + + // If it's a replacement, delete the old file first, + // otherwise case changes will not be preserved. + // http://dev.processing.org/bugs/show_bug.cgi?id=969 + if (replacement) { + boolean muchSuccess = destFile.delete(); + if (!muchSuccess) { + Base.showWarning("Error adding file", + "Could not delete the existing '" + + filename + "' file.", null); + return false; + } + } + + // make sure they aren't the same file + if ((codeExtension == null) && sourceFile.equals(destFile)) { + Base.showWarning("You can't fool me", + "This file has already been copied to the\n" + + "location from which where you're trying to add it.\n" + + "I ain't not doin nuthin'.", null); + return false; + } + + // in case the user is "adding" the code in an attempt + // to update the sketch's tabs + if (!sourceFile.equals(destFile)) { + try { + Base.copyFile(sourceFile, destFile); + + } catch (IOException e) { + Base.showWarning("Error adding file", + "Could not add '" + filename + "' to the sketch.", e); + return false; + } + } + + if (codeExtension != null) { + SketchCode newCode = new SketchCode(destFile, codeExtension); + + if (replacement) { + replaceCode(newCode); + + } else { + insertCode(newCode); + sortCode(); + } + setCurrentCode(filename); + editor.header.repaint(); + if (editor.untitled) { // TODO probably not necessary? problematic? + // Mark the new code as modified so that the sketch is saved + current.setModified(true); + } + + } else { + if (editor.untitled) { // TODO probably not necessary? problematic? + // If a file has been added, mark the main code as modified so + // that the sketch is properly saved. + code[0].setModified(true); + } + } + return true; + } + + + /** + * Add import statements to the current tab for all of packages inside + * the specified jar file. + */ + public void importLibrary(String jarPath) { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + String list[] = Compiler.packageListFromClassPath(jarPath); + + // import statements into the main sketch file (code[0]) + // if the current code is a .java file, insert into current + //if (current.flavor == PDE) { + if (hasDefaultExtension(current)) { + setCurrentCode(0); + } + // could also scan the text in the file to see if each import + // statement is already in there, but if the user has the import + // commented out, then this will be a problem. + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < list.length; i++) { + buffer.append("import "); + buffer.append(list[i]); + buffer.append(".*;\n"); + } + buffer.append('\n'); + buffer.append(editor.getText()); + editor.setText(buffer.toString()); + editor.setSelection(0, 0); // scroll to start + setModified(true); + } + + + /** + * Change what file is currently being edited. Changes the current tab index. + *

    + *
  1. store the String for the text of the current file. + *
  2. retrieve the String for the text of the new file. + *
  3. change the text that's visible in the text area + *
+ */ + public void setCurrentCode(int which) { + // if current is null, then this is the first setCurrent(0) + if ((currentIndex == which) && (current != null)) { + return; + } + + // get the text currently being edited + if (current != null) { + current.setState(editor.getText(), + editor.getSelectionStart(), + editor.getSelectionStop(), + editor.getScrollPosition()); + } + + current = code[which]; + currentIndex = which; + + editor.setCode(current); + editor.header.rebuild(); + } + + + /** + * Internal helper function to set the current tab based on a name. + * @param findName the file name (not pretty name) to be shown + */ + protected void setCurrentCode(String findName) { + for (int i = 0; i < codeCount; i++) { + if (findName.equals(code[i].getFileName()) || + findName.equals(code[i].getPrettyName())) { + setCurrentCode(i); + return; + } + } + } + + + /** + * Cleanup temporary files used during a build/run. + */ + protected void cleanup() { + // if the java runtime is holding onto any files in the build dir, we + // won't be able to delete them, so we need to force a gc here + System.gc(); + + // note that we can't remove the builddir itself, otherwise + // the next time we start up, internal runs using Runner won't + // work because the build dir won't exist at startup, so the classloader + // will ignore the fact that that dir is in the CLASSPATH in run.sh + Base.removeDescendants(tempBuildFolder); + } + + + /** + * Preprocess, Compile, and Run the current code. + *

+ * There are three main parts to this process: + *

+   *   (0. if not java, then use another 'engine'.. i.e. python)
+   *
+   *    1. do the p5 language preprocessing
+   *       this creates a working .java file in a specific location
+   *       better yet, just takes a chunk of java code and returns a
+   *       new/better string editor can take care of saving this to a
+   *       file location
+   *
+   *    2. compile the code from that location
+   *       catching errors along the way
+   *       placing it in a ready classpath, or .. ?
+   *
+   *    3. run the code
+   *       needs to communicate location for window
+   *       and maybe setup presentation space as well
+   *       run externally if a code folder exists,
+   *       or if more than one file is in the project
+   *
+   *    X. afterwards, some of these steps need a cleanup function
+   * 
+ */ + protected String compile() throws RunnerException { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + current.setProgram(editor.getText()); + + // TODO record history here + //current.history.record(program, SketchHistory.RUN); + + // if an external editor is being used, need to grab the + // latest version of the code from the file. + if (Preferences.getBoolean("editor.external")) { + // history gets screwed by the open.. + //String historySaved = history.lastRecorded; + //handleOpen(sketch); + //history.lastRecorded = historySaved; + + // set current to null so that the tab gets updated + // http://dev.processing.org/bugs/show_bug.cgi?id=515 + current = null; + // nuke previous files and settings, just get things loaded + load(); + } + + // in case there were any boogers left behind + // do this here instead of after exiting, since the exit + // can happen so many different ways.. and this will be + // better connected to the dataFolder stuff below. + cleanup(); + + // handle preprocessing the main file's code + return build(tempBuildFolder.getAbsolutePath()); + } + + + /** + * Build all the code for this sketch. + * + * In an advanced program, the returned class name could be different, + * which is why the className is set based on the return value. + * A compilation error will burp up a RunnerException. + * + * Setting purty to 'true' will cause exception line numbers to be incorrect. + * Unless you know the code compiles, you should first run the preprocessor + * with purty set to false to make sure there are no errors, then once + * successful, re-export with purty set to true. + * + * @param buildPath Location to copy all the .java files + * @return null if compilation failed, main class name if not + */ + public String preprocess(String buildPath) throws RunnerException { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + String[] codeFolderPackages = null; + classPath = buildPath; + + // figure out the contents of the code folder to see if there + // are files that need to be added to the imports + if (codeFolder.exists()) { + libraryPath = codeFolder.getAbsolutePath(); + + // get a list of .jar files in the "code" folder + // (class files in subfolders should also be picked up) + String codeFolderClassPath = + Compiler.contentsToClassPath(codeFolder); + // append the jar files in the code folder to the class path + classPath += File.pathSeparator + codeFolderClassPath; + // get list of packages found in those jars + codeFolderPackages = + Compiler.packageListFromClassPath(codeFolderClassPath); + + } else { + libraryPath = ""; + } + + // 1. concatenate all .pde files to the 'main' pde + // store line number for starting point of each code bit + + // Unfortunately, the header has to be written on a single line, because + // there's no way to determine how long it will be until the code has + // already been preprocessed. The header will vary in length based on + // the programming mode (STATIC, ACTIVE, or JAVA), which is determined + // by the preprocessor. So the preprocOffset for the primary class remains + // zero, even though it'd be nice to have a legitimate offset, and be able + // to remove the 'pretty' boolean for preproc.write(). + + StringBuffer bigCode = new StringBuffer(); + int bigCount = 0; + for (SketchCode sc : code) { + if (sc.isExtension("pde")) { + sc.setPreprocOffset(bigCount); + bigCode.append(sc.getProgram()); + bigCode.append('\n'); + bigCount += sc.getLineCount(); +// if (sc != code[0]) { +// sc.setPreprocName(null); // don't compile me +// } + } + } + + /* + String program = code[0].getProgram(); + StringBuffer bigCode = new StringBuffer(program); + int bigCount = code[0].getLineCount(); + bigCode.append('\n'); + + for (int i = 1; i < codeCount; i++) { + if (code[i].isExtension("pde")) { + code[i].setPreprocOffset(bigCount); + bigCode.append(code[i].getProgram()); + bigCode.append('\n'); + bigCount += code[i].getLineCount(); + code[i].setPreprocName(null); // don't compile me + } + } + */ + + // Note that the headerOffset isn't applied until compile and run, because + // it only applies to the code after it's been written to the .java file. + int headerOffset = 0; + PdePreprocessor preprocessor = new PdePreprocessor(); + try { + headerOffset = preprocessor.writePrefix(bigCode.toString(), + buildPath, + name, + codeFolderPackages); + } catch (FileNotFoundException fnfe) { + fnfe.printStackTrace(); + String msg = "Build folder disappeared or could not be written"; + throw new RunnerException(msg); + } + + // 2. run preproc on that code using the sugg class name + // to create a single .java file and write to buildpath + + String primaryClassName = null; + + try { + // if (i != 0) preproc will fail if a pde file is not + // java mode, since that's required + String className = preprocessor.write(); + + if (className == null) { + throw new RunnerException("Could not find main class"); + // this situation might be perfectly fine, + // (i.e. if the file is empty) + //System.out.println("No class found in " + code[i].name); + //System.out.println("(any code in that file will be ignored)"); + //System.out.println(); + +// } else { +// code[0].setPreprocName(className + ".java"); + } + + // store this for the compiler and the runtime + primaryClassName = className; + + } catch (antlr.RecognitionException re) { + // re also returns a column that we're not bothering with for now + + // first assume that it's the main file + int errorFile = 0; + int errorLine = re.getLine() - 1; + + // then search through for anyone else whose preprocName is null, + // since they've also been combined into the main pde. + for (int i = 1; i < codeCount; i++) { + if (code[i].isExtension("pde") && + (code[i].getPreprocOffset() < errorLine)) { + // keep looping until the errorLine is past the offset + errorFile = i; + } + } + errorLine -= code[errorFile].getPreprocOffset(); + +// System.out.println("i found this guy snooping around.."); +// System.out.println("whatcha want me to do with 'im boss?"); +// System.out.println(errorLine + " " + errorFile + " " + code[errorFile].getPreprocOffset()); + + String msg = re.getMessage(); + + if (msg.equals("expecting RCURLY, found 'null'")) { + // This can be a problem since the error is sometimes listed as a line + // that's actually past the number of lines. For instance, it might + // report "line 15" of a 14 line program. Added code to highlightLine() + // inside Editor to deal with this situation (since that code is also + // useful for other similar situations). + throw new RunnerException("Found one too many { characters " + + "without a } to match it.", + errorFile, errorLine, re.getColumn()); + } + + if (msg.indexOf("expecting RBRACK") != -1) { + System.err.println(msg); + throw new RunnerException("Syntax error, " + + "maybe a missing ] character?", + errorFile, errorLine, re.getColumn()); + } + + if (msg.indexOf("expecting SEMI") != -1) { + System.err.println(msg); + throw new RunnerException("Syntax error, " + + "maybe a missing semicolon?", + errorFile, errorLine, re.getColumn()); + } + + if (msg.indexOf("expecting RPAREN") != -1) { + System.err.println(msg); + throw new RunnerException("Syntax error, " + + "maybe a missing right parenthesis?", + errorFile, errorLine, re.getColumn()); + } + + if (msg.indexOf("preproc.web_colors") != -1) { + throw new RunnerException("A web color (such as #ffcc00) " + + "must be six digits.", + errorFile, errorLine, re.getColumn(), false); + } + + //System.out.println("msg is " + msg); + throw new RunnerException(msg, errorFile, + errorLine, re.getColumn()); + + } catch (antlr.TokenStreamRecognitionException tsre) { + // while this seems to store line and column internally, + // there doesn't seem to be a method to grab it.. + // so instead it's done using a regexp + +// System.err.println("and then she tells me " + tsre.toString()); + // TODO not tested since removing ORO matcher.. ^ could be a problem + String mess = "^line (\\d+):(\\d+):\\s"; + + String[] matches = PApplet.match(tsre.toString(), mess); + if (matches != null) { + int errorLine = Integer.parseInt(matches[1]) - 1; + int errorColumn = Integer.parseInt(matches[2]); + + int errorFile = 0; + for (int i = 1; i < codeCount; i++) { + if (code[i].isExtension("pde") && + (code[i].getPreprocOffset() < errorLine)) { + errorFile = i; + } + } + errorLine -= code[errorFile].getPreprocOffset(); + + throw new RunnerException(tsre.getMessage(), + errorFile, errorLine, errorColumn); + + } else { + // this is bad, defaults to the main class.. hrm. + String msg = tsre.toString(); + throw new RunnerException(msg, 0, -1, -1); + } + + } catch (RunnerException pe) { + // RunnerExceptions are caught here and re-thrown, so that they don't + // get lost in the more general "Exception" handler below. + throw pe; + + } catch (Exception ex) { + // TODO better method for handling this? + System.err.println("Uncaught exception type:" + ex.getClass()); + ex.printStackTrace(); + throw new RunnerException(ex.toString()); + } + + // grab the imports from the code just preproc'd + + importedLibraries = new ArrayList(); + for (String item : preprocessor.getExtraImports()) { + // remove things up to the last dot + int dot = item.lastIndexOf('.'); + // http://dev.processing.org/bugs/show_bug.cgi?id=1145 + String entry = (dot == -1) ? item : item.substring(0, dot); + File libFolder = (File) Base.importToLibraryTable.get(entry); + + if (libFolder != null) { + importedLibraries.add(libFolder); + classPath += Compiler.contentsToClassPath(libFolder); + libraryPath += File.pathSeparator + libFolder.getAbsolutePath(); + } + } + + // Finally, add the regular Java CLASSPATH + String javaClassPath = System.getProperty("java.class.path"); + // Remove quotes if any.. An annoying (and frequent) Windows problem + if (javaClassPath.startsWith("\"") && javaClassPath.endsWith("\"")) { + javaClassPath = javaClassPath.substring(1, javaClassPath.length() - 1); + } + classPath += File.pathSeparator + javaClassPath; + + + // 3. then loop over the code[] and save each .java file + + for (SketchCode sc : code) { + if (sc.isExtension("java")) { + // no pre-processing services necessary for java files + // just write the the contents of 'program' to a .java file + // into the build directory. uses byte stream and reader/writer + // shtuff so that unicode bunk is properly handled + String filename = sc.getFileName(); //code[i].name + ".java"; + try { + Base.saveFile(sc.getProgram(), new File(buildPath, filename)); + } catch (IOException e) { + e.printStackTrace(); + throw new RunnerException("Problem moving " + filename + + " to the build folder"); + } +// sc.setPreprocName(filename); + + } else if (sc.isExtension("pde")) { + // The compiler and runner will need this to have a proper offset + sc.addPreprocOffset(headerOffset); + } + } + return primaryClassName; + } + + + /** + * Preprocess and compile all the code for this sketch. + * + * In an advanced program, the returned class name could be different, + * which is why the className is set based on the return value. + * A compilation error will burp up a RunnerException. + * + * @return null if compilation failed, main class name if not + */ + public String build(String buildPath) throws RunnerException { + // run the preprocessor + String primaryClassName = preprocess(buildPath); + + // compile the program. errors will happen as a RunnerException + // that will bubble up to whomever called build(). + Compiler compiler = new Compiler(); + if (compiler.compile(this, buildPath, primaryClassName)) { + return primaryClassName; + } + return null; + } + + + protected boolean exportApplet() throws Exception { + return exportApplet(new File(folder, "applet").getAbsolutePath()); + } + + + /** + * Handle export to applet. + */ + public boolean exportApplet(String appletPath) throws RunnerException, IOException { + // Make sure the user didn't hide the sketch folder + ensureExistence(); + + // Reload the code when an external editor is being used + if (Preferences.getBoolean("editor.external")) { + // nuke previous files and settings + load(); + } + + File appletFolder = new File(appletPath); + // Nuke the old applet folder because it can cause trouble + if (Preferences.getBoolean("export.delete_target_folder")) { + Base.removeDir(appletFolder); + } + // Create a fresh applet folder (needed before preproc is run below) + appletFolder.mkdirs(); + + Hashtable zipFileContents = new Hashtable(); + + // build the sketch + String foundName = build(appletFolder.getPath()); + + // (already reported) error during export, exit this function + if (foundName == null) return false; + + // If name != exportSketchName, then that's weirdness + // BUG unfortunately, that can also be a bug in the preproc :( + if (!name.equals(foundName)) { + Base.showWarning("Error during export", + "Sketch name is " + name + " but the sketch\n" + + "name in the code was " + foundName, null); + return false; + } + + int wide = PApplet.DEFAULT_WIDTH; + int high = PApplet.DEFAULT_HEIGHT; + String renderer = ""; + + // This matches against any uses of the size() function, whether numbers + // or variables or whatever. This way, no warning is shown if size() isn't + // actually used in the applet, which is the case especially for anyone + // who is cutting/pasting from the reference. + String sizeRegex = + "(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+),?\\s*([^\\)]*)\\s*\\)"; + + String scrubbed = scrubComments(code[0].getProgram()); + String[] matches = PApplet.match(scrubbed, sizeRegex); + + if (matches != null) { + try { + wide = Integer.parseInt(matches[1]); + high = Integer.parseInt(matches[2]); + + // Adding back the trim() for 0136 to handle Bug #769 + if (matches.length == 4) renderer = matches[3].trim(); + + } catch (NumberFormatException e) { + // found a reference to size, but it didn't + // seem to contain numbers + final String message = + "The size of this applet could not automatically be\n" + + "determined from your code. You'll have to edit the\n" + + "HTML file to set the size of the applet.\n" + + "Use only numeric values (not variables) for the size()\n" + + "command. See the size() reference for an explanation."; + + Base.showWarning("Could not find applet size", message, null); + } + } // else no size() command found + + // Grab the Javadoc-style description from the main code. + // Originally tried to grab this with a regexp matcher, but it wouldn't + // span over multiple lines for the match. This could prolly be forced, + // but since that's the case better just to parse by hand. + StringBuffer dbuffer = new StringBuffer(); + String lines[] = PApplet.split(code[0].getProgram(), '\n'); + for (int i = 0; i < lines.length; i++) { + if (lines[i].trim().startsWith("/**")) { // this is our comment + // some smartass put the whole thing on the same line + //if (lines[j].indexOf("*/") != -1) break; + + for (int j = i+1; j < lines.length; j++) { + if (lines[j].trim().endsWith("*/")) { + // remove the */ from the end, and any extra *s + // in case there's also content on this line + // nah, don't bother.. make them use the three lines + break; + } + + int offset = 0; + while ((offset < lines[j].length()) && + ((lines[j].charAt(offset) == '*') || + (lines[j].charAt(offset) == ' '))) { + offset++; + } + // insert the return into the html to help w/ line breaks + dbuffer.append(lines[j].substring(offset) + "\n"); + } + } + } + String description = dbuffer.toString(); + + // Add links to all the code + StringBuffer sources = new StringBuffer(); + for (int i = 0; i < codeCount; i++) { + sources.append("" + + code[i].getPrettyName() + " "); + } + + // Copy the source files to the target, since we like + // to encourage people to share their code + for (int i = 0; i < codeCount; i++) { + try { + File exportedSource = new File(appletFolder, code[i].getFileName()); + //Base.copyFile(code[i].getFile(), exportedSource); + code[i].copyTo(exportedSource); + + } catch (IOException e) { + e.printStackTrace(); // ho hum, just move on... + } + } + + // Use separate jarfiles whenever a library or code folder is in use. + boolean separateJar = + Preferences.getBoolean("export.applet.separate_jar_files") || + codeFolder.exists() || + (libraryPath.length() != 0); + + // Copy the loading gif to the applet + String LOADING_IMAGE = "loading.gif"; + // Check if the user already has their own loader image + File loadingImage = new File(folder, LOADING_IMAGE); + if (!loadingImage.exists()) { + File skeletonFolder = new File(Base.getContentFile("lib"), "export"); + loadingImage = new File(skeletonFolder, LOADING_IMAGE); + } + Base.copyFile(loadingImage, new File(appletFolder, LOADING_IMAGE)); + + // Create new .jar file + FileOutputStream zipOutputFile = + new FileOutputStream(new File(appletFolder, name + ".jar")); + ZipOutputStream zos = new ZipOutputStream(zipOutputFile); + ZipEntry entry; + + StringBuffer archives = new StringBuffer(); + archives.append(name + ".jar"); + + // Add the manifest file + addManifest(zos); + + // add the contents of the code folder to the jar + // unpacks all jar files, unless multi jar files selected in prefs + if (codeFolder.exists()) { + String includes = Compiler.contentsToClassPath(codeFolder); + String[] codeList = PApplet.splitTokens(includes, File.separator); + String cp = ""; + for (int i = 0; i < codeList.length; i++) { + if (codeList[i].toLowerCase().endsWith(".jar") || + codeList[i].toLowerCase().endsWith(".zip")) { + if (separateJar) { + File exportFile = new File(codeFolder, codeList[i]); + String exportFilename = exportFile.getName(); + Base.copyFile(exportFile, new File(appletFolder, exportFilename)); + } else { + cp += codeList[i] + File.pathSeparatorChar; + //packClassPathIntoZipFile(cp, zos); + } + } + } + if (!separateJar) { + packClassPathIntoZipFile(cp, zos, zipFileContents); + } + } + + // add contents of 'library' folders to the jar file + // if a file called 'export.txt' is in there, it contains + // a list of the files that should be exported. + // otherwise, all files are exported. + for (File libraryFolder : importedLibraries) { +// Enumeration en = importedLibraries.elements(); +// while (en.hasMoreElements()) { + // in the list is a File object that points the + // library sketch's "library" folder +// File libraryFolder = (File)en.nextElement(); + File exportSettings = new File(libraryFolder, "export.txt"); + Hashtable exportTable = readSettings(exportSettings); + String appletList = (String) exportTable.get("applet"); + String exportList[] = null; + if (appletList != null) { + exportList = PApplet.splitTokens(appletList, ", "); + } else { + exportList = libraryFolder.list(); + } + for (int i = 0; i < exportList.length; i++) { + if (exportList[i].equals(".") || + exportList[i].equals("..")) continue; + + exportList[i] = PApplet.trim(exportList[i]); + if (exportList[i].equals("")) continue; + + File exportFile = new File(libraryFolder, exportList[i]); + if (!exportFile.exists()) { + System.err.println("File " + exportList[i] + " does not exist"); + + } else if (exportFile.isDirectory()) { + System.err.println("Ignoring sub-folder \"" + exportList[i] + "\""); + + } else if (exportFile.getName().toLowerCase().endsWith(".zip") || + exportFile.getName().toLowerCase().endsWith(".jar")) { + if (separateJar) { + String exportFilename = exportFile.getName(); + Base.copyFile(exportFile, new File(appletFolder, exportFilename)); + if (renderer.equals("OPENGL") && + exportFilename.indexOf("natives") != -1) { + // don't add these to the archives list + } else { + archives.append("," + exportFilename); + } + } else { + String path = exportFile.getAbsolutePath(); + packClassPathIntoZipFile(path, zos, zipFileContents); + } + + } else { // just copy the file over.. prolly a .dll or something + Base.copyFile(exportFile, + new File(appletFolder, exportFile.getName())); + } + } + } + + File bagelJar = Base.isMacOS() ? + Base.getContentFile("core.jar") : + Base.getContentFile("lib/core.jar"); + if (separateJar) { + Base.copyFile(bagelJar, new File(appletFolder, "core.jar")); + archives.append(",core.jar"); + } else { + String bagelJarPath = bagelJar.getAbsolutePath(); + packClassPathIntoZipFile(bagelJarPath, zos, zipFileContents); + } + + if (dataFolder.exists()) { + String dataFiles[] = Base.listFiles(dataFolder, false); + int offset = folder.getAbsolutePath().length() + 1; + for (int i = 0; i < dataFiles.length; i++) { + if (Base.isWindows()) { + dataFiles[i] = dataFiles[i].replace('\\', '/'); + } + File dataFile = new File(dataFiles[i]); + if (dataFile.isDirectory()) continue; + + // don't export hidden files + // skipping dot prefix removes all: . .. .DS_Store + if (dataFile.getName().charAt(0) == '.') continue; + + entry = new ZipEntry(dataFiles[i].substring(offset)); + zos.putNextEntry(entry); + zos.write(Base.loadBytesRaw(dataFile)); + zos.closeEntry(); + } + } + + // add the project's .class files to the jar + // just grabs everything from the build directory + // since there may be some inner classes + // (add any .class files from the applet dir, then delete them) + // TODO this needs to be recursive (for packages) + String classfiles[] = appletFolder.list(); + for (int i = 0; i < classfiles.length; i++) { + if (classfiles[i].endsWith(".class")) { + entry = new ZipEntry(classfiles[i]); + zos.putNextEntry(entry); + zos.write(Base.loadBytesRaw(new File(appletFolder, classfiles[i]))); + zos.closeEntry(); + } + } + + // remove the .class files from the applet folder. if they're not + // removed, the msjvm will complain about an illegal access error, + // since the classes are outside the jar file. + for (int i = 0; i < classfiles.length; i++) { + if (classfiles[i].endsWith(".class")) { + File deadguy = new File(appletFolder, classfiles[i]); + if (!deadguy.delete()) { + Base.showWarning("Could not delete", + classfiles[i] + " could not \n" + + "be deleted from the applet folder. \n" + + "You'll need to remove it by hand.", null); + } + } + } + + // close up the jar file + zos.flush(); + zos.close(); + + // + + // convert the applet template + // @@sketch@@, @@width@@, @@height@@, @@archive@@, @@source@@ + // and now @@description@@ + + File htmlOutputFile = new File(appletFolder, "index.html"); + // UTF-8 fixes http://dev.processing.org/bugs/show_bug.cgi?id=474 + PrintWriter htmlWriter = PApplet.createWriter(htmlOutputFile); + + InputStream is = null; + // if there is an applet.html file in the sketch folder, use that + File customHtml = new File(folder, "applet.html"); + if (customHtml.exists()) { + is = new FileInputStream(customHtml); + } + if (is == null) { + if (renderer.equals("OPENGL")) { + is = Base.getLibStream("export/applet-opengl.html"); + } else { + is = Base.getLibStream("export/applet.html"); + } + } + BufferedReader reader = PApplet.createReader(is); + + String line = null; + while ((line = reader.readLine()) != null) { + if (line.indexOf("@@") != -1) { + StringBuffer sb = new StringBuffer(line); + int index = 0; + while ((index = sb.indexOf("@@sketch@@")) != -1) { + sb.replace(index, index + "@@sketch@@".length(), + name); + } + while ((index = sb.indexOf("@@source@@")) != -1) { + sb.replace(index, index + "@@source@@".length(), + sources.toString()); + } + while ((index = sb.indexOf("@@archive@@")) != -1) { + sb.replace(index, index + "@@archive@@".length(), + archives.toString()); + } + while ((index = sb.indexOf("@@width@@")) != -1) { + sb.replace(index, index + "@@width@@".length(), + String.valueOf(wide)); + } + while ((index = sb.indexOf("@@height@@")) != -1) { + sb.replace(index, index + "@@height@@".length(), + String.valueOf(high)); + } + while ((index = sb.indexOf("@@description@@")) != -1) { + sb.replace(index, index + "@@description@@".length(), + description); + } + line = sb.toString(); + } + htmlWriter.println(line); + } + + reader.close(); + htmlWriter.flush(); + htmlWriter.close(); + + return true; + } + + + /** + * Replace all commented portions of a given String as spaces. + * Utility function used here and in the preprocessor. + */ + static public String scrubComments(String what) { + char p[] = what.toCharArray(); + + int index = 0; + while (index < p.length) { + // for any double slash comments, ignore until the end of the line + if ((p[index] == '/') && + (index < p.length - 1) && + (p[index+1] == '/')) { + p[index++] = ' '; + p[index++] = ' '; + while ((index < p.length) && + (p[index] != '\n')) { + p[index++] = ' '; + } + + // check to see if this is the start of a new multiline comment. + // if it is, then make sure it's actually terminated somewhere. + } else if ((p[index] == '/') && + (index < p.length - 1) && + (p[index+1] == '*')) { + p[index++] = ' '; + p[index++] = ' '; + boolean endOfRainbow = false; + while (index < p.length - 1) { + if ((p[index] == '*') && (p[index+1] == '/')) { + p[index++] = ' '; + p[index++] = ' '; + endOfRainbow = true; + break; + + } else { + index++; + } + } + if (!endOfRainbow) { + throw new RuntimeException("Missing the */ from the end of a " + + "/* comment */"); + } + } else { // any old character, move along + index++; + } + } + return new String(p); + } + + + public boolean exportApplicationPrompt() throws IOException, RunnerException { + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(Box.createVerticalStrut(6)); + + //Box panel = Box.createVerticalBox(); + + //Box labelBox = Box.createHorizontalBox(); +// String msg = "Click Export to Application to create a standalone, " + +// "double-clickable application for the selected plaforms."; + +// String msg = "Export to Application creates a standalone, \n" + +// "double-clickable application for the selected plaforms."; + String line1 = "Export to Application creates double-clickable,"; + String line2 = "standalone applications for the selected plaforms."; + JLabel label1 = new JLabel(line1, SwingConstants.CENTER); + JLabel label2 = new JLabel(line2, SwingConstants.CENTER); + label1.setAlignmentX(Component.LEFT_ALIGNMENT); + label2.setAlignmentX(Component.LEFT_ALIGNMENT); +// label1.setAlignmentX(); +// label2.setAlignmentX(0); + panel.add(label1); + panel.add(label2); + int wide = label2.getPreferredSize().width; + panel.add(Box.createVerticalStrut(12)); + + final JCheckBox windowsButton = new JCheckBox("Windows"); + //windowsButton.setMnemonic(KeyEvent.VK_W); + windowsButton.setSelected(Preferences.getBoolean("export.application.platform.windows")); + windowsButton.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + Preferences.setBoolean("export.application.platform.windows", windowsButton.isSelected()); + } + }); + + final JCheckBox macosxButton = new JCheckBox("Mac OS X"); + //macosxButton.setMnemonic(KeyEvent.VK_M); + macosxButton.setSelected(Preferences.getBoolean("export.application.platform.macosx")); + macosxButton.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + Preferences.setBoolean("export.application.platform.macosx", macosxButton.isSelected()); + } + }); + + final JCheckBox linuxButton = new JCheckBox("Linux"); + //linuxButton.setMnemonic(KeyEvent.VK_L); + linuxButton.setSelected(Preferences.getBoolean("export.application.platform.linux")); + linuxButton.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + Preferences.setBoolean("export.application.platform.linux", linuxButton.isSelected()); + } + }); + + JPanel platformPanel = new JPanel(); + //platformPanel.setLayout(new BoxLayout(platformPanel, BoxLayout.X_AXIS)); + platformPanel.add(windowsButton); + platformPanel.add(Box.createHorizontalStrut(6)); + platformPanel.add(macosxButton); + platformPanel.add(Box.createHorizontalStrut(6)); + platformPanel.add(linuxButton); + platformPanel.setBorder(new TitledBorder("Platforms")); + //Dimension goodIdea = new Dimension(wide, platformPanel.getPreferredSize().height); + //platformPanel.setMaximumSize(goodIdea); + wide = Math.max(wide, platformPanel.getPreferredSize().width); + platformPanel.setAlignmentX(Component.LEFT_ALIGNMENT); + panel.add(platformPanel); + +// Box indentPanel = Box.createHorizontalBox(); +// indentPanel.add(Box.createHorizontalStrut(new JCheckBox().getPreferredSize().width)); + final JCheckBox showStopButton = new JCheckBox("Show a Stop button"); + //showStopButton.setMnemonic(KeyEvent.VK_S); + showStopButton.setSelected(Preferences.getBoolean("export.application.stop")); + showStopButton.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + Preferences.setBoolean("export.application.stop", showStopButton.isSelected()); + } + }); + showStopButton.setEnabled(Preferences.getBoolean("export.application.fullscreen")); + showStopButton.setBorder(new EmptyBorder(3, 13, 6, 13)); +// indentPanel.add(showStopButton); +// indentPanel.setAlignmentX(Component.LEFT_ALIGNMENT); + + final JCheckBox fullScreenButton = new JCheckBox("Full Screen (Present mode)"); + //fullscreenButton.setMnemonic(KeyEvent.VK_F); + fullScreenButton.setSelected(Preferences.getBoolean("export.application.fullscreen")); + fullScreenButton.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + boolean sal = fullScreenButton.isSelected(); + Preferences.setBoolean("export.application.fullscreen", sal); + showStopButton.setEnabled(sal); + } + }); + fullScreenButton.setBorder(new EmptyBorder(3, 13, 3, 13)); + + JPanel optionPanel = new JPanel(); + optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS)); + optionPanel.add(fullScreenButton); + optionPanel.add(showStopButton); +// optionPanel.add(indentPanel); + optionPanel.setBorder(new TitledBorder("Options")); + wide = Math.max(wide, platformPanel.getPreferredSize().width); + //goodIdea = new Dimension(wide, optionPanel.getPreferredSize().height); + optionPanel.setAlignmentX(Component.LEFT_ALIGNMENT); + //optionPanel.setMaximumSize(goodIdea); + panel.add(optionPanel); + + Dimension good; + //label1, label2, platformPanel, optionPanel + good = new Dimension(wide, label1.getPreferredSize().height); + label1.setMaximumSize(good); + good = new Dimension(wide, label2.getPreferredSize().height); + label2.setMaximumSize(good); + good = new Dimension(wide, platformPanel.getPreferredSize().height); + platformPanel.setMaximumSize(good); + good = new Dimension(wide, optionPanel.getPreferredSize().height); + optionPanel.setMaximumSize(good); + +// JPanel actionPanel = new JPanel(); +// optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS)); +// optionPanel.add(Box.createHorizontalGlue()); + +// final JDialog frame = new JDialog(editor, "Export to Application"); + +// JButton cancelButton = new JButton("Cancel"); +// cancelButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// frame.dispose(); +// return false; +// } +// }); + + // Add the buttons in platform-specific order +// if (PApplet.platform == PConstants.MACOSX) { +// optionPanel.add(cancelButton); +// optionPanel.add(exportButton); +// } else { +// optionPanel.add(exportButton); +// optionPanel.add(cancelButton); +// } + String[] options = { "Export", "Cancel" }; + final JOptionPane optionPane = new JOptionPane(panel, + JOptionPane.PLAIN_MESSAGE, + //JOptionPane.QUESTION_MESSAGE, + JOptionPane.YES_NO_OPTION, + null, + options, + options[0]); + + final JDialog dialog = new JDialog(editor, "Export Options", true); + dialog.setContentPane(optionPane); + + optionPane.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent e) { + String prop = e.getPropertyName(); + + if (dialog.isVisible() && + (e.getSource() == optionPane) && + (prop.equals(JOptionPane.VALUE_PROPERTY))) { + //If you were going to check something + //before closing the window, you'd do + //it here. + dialog.setVisible(false); + } + } + }); + dialog.pack(); + dialog.setResizable(false); + + Rectangle bounds = editor.getBounds(); + dialog.setLocation(bounds.x + (bounds.width - dialog.getSize().width) / 2, + bounds.y + (bounds.height - dialog.getSize().height) / 2); + dialog.setVisible(true); + + Object value = optionPane.getValue(); + if (value.equals(options[0])) { + return exportApplication(); + } else if (value.equals(options[1]) || value.equals(new Integer(-1))) { + // closed window by hitting Cancel or ESC + editor.statusNotice("Export to Application canceled."); + } + return false; + } + + + /** + * Export to application via GUI. + */ + protected boolean exportApplication() throws IOException, RunnerException { + if (Preferences.getBoolean("export.application.platform.windows")) { + String windowsPath = + new File(folder, "application.windows").getAbsolutePath(); + if (!exportApplication(windowsPath, PConstants.WINDOWS)) { + return false; + } + } + if (Preferences.getBoolean("export.application.platform.macosx")) { + String macosxPath = + new File(folder, "application.macosx").getAbsolutePath(); + if (!exportApplication(macosxPath, PConstants.MACOSX)) { + return false; + } + } + if (Preferences.getBoolean("export.application.platform.linux")) { + String linuxPath = + new File(folder, "application.linux").getAbsolutePath(); + if (!exportApplication(linuxPath, PConstants.LINUX)) { + return false; + } + } + return true; + } + + + /** + * Export to application without GUI. + */ + public boolean exportApplication(String destPath, + int exportPlatform) throws IOException, RunnerException { + // make sure the user didn't hide the sketch folder + ensureExistence(); + + // fix for issue posted on the board. make sure that the code + // is reloaded when exporting and an external editor is being used. + if (Preferences.getBoolean("editor.external")) { + // don't do from the command line + if (editor != null) { + // nuke previous files and settings + load(); + } + } + + File destFolder = new File(destPath); + if (Preferences.getBoolean("export.delete_target_folder")) { + Base.removeDir(destFolder); + } + destFolder.mkdirs(); + + // build the sketch + String foundName = build(destFolder.getPath()); + + // (already reported) error during export, exit this function + if (foundName == null) return false; + + // if name != exportSketchName, then that's weirdness + // BUG unfortunately, that can also be a bug in the preproc :( + if (!name.equals(foundName)) { + Base.showWarning("Error during export", + "Sketch name is " + name + " but the sketch\n" + + "name in the code was " + foundName, null); + return false; + } + + + /// figure out where the jar files will be placed + + File jarFolder = new File(destFolder, "lib"); + + + /// where all the skeleton info lives + + File skeletonFolder = new File(Base.getContentFile("lib"), "export"); + + /// on macosx, need to copy .app skeleton since that's + /// also where the jar files will be placed + File dotAppFolder = null; + if (exportPlatform == PConstants.MACOSX) { + dotAppFolder = new File(destFolder, name + ".app"); + String APP_SKELETON = "skeleton.app"; + //File dotAppSkeleton = new File(folder, APP_SKELETON); + File dotAppSkeleton = new File(skeletonFolder, APP_SKELETON); + Base.copyDir(dotAppSkeleton, dotAppFolder); + + String stubName = "Contents/MacOS/JavaApplicationStub"; + // need to set the stub to executable + // will work on osx or *nix, but just dies on windows, oh well.. + if (Base.isWindows()) { + File warningFile = new File(destFolder, "readme.txt"); + PrintWriter pw = PApplet.createWriter(warningFile); + pw.println("This application was created on Windows, which does not"); + pw.println("properly support setting files as \"executable\","); + pw.println("a necessity for applications on Mac OS X."); + pw.println(); + pw.println("To fix this, use the Terminal on Mac OS X, and from this"); + pw.println("directory, type the following:"); + pw.println(); + pw.println("chmod +x " + dotAppFolder.getName() + "/" + stubName); + pw.flush(); + pw.close(); + + } else { + File stubFile = new File(dotAppFolder, stubName); + String stubPath = stubFile.getAbsolutePath(); + Runtime.getRuntime().exec(new String[] { "chmod", "+x", stubPath }); + } + + // set the jar folder to a different location than windows/linux + jarFolder = new File(dotAppFolder, "Contents/Resources/Java"); + } + + + /// make the jar folder (windows and linux) + + if (!jarFolder.exists()) jarFolder.mkdirs(); + + + /// on windows, copy the exe file + + if (exportPlatform == PConstants.WINDOWS) { + Base.copyFile(new File(skeletonFolder, "application.exe"), + new File(destFolder, this.name + ".exe")); + } + + + /// start copying all jar files + + Vector jarListVector = new Vector(); + + + /// create the main .jar file + + Hashtable zipFileContents = new Hashtable(); + + FileOutputStream zipOutputFile = + new FileOutputStream(new File(jarFolder, name + ".jar")); + ZipOutputStream zos = new ZipOutputStream(zipOutputFile); + ZipEntry entry; + + // add the manifest file so that the .jar can be double clickable + addManifest(zos); + + // add the project's .class files to the jar + // (just grabs everything from the build directory, + // since there may be some inner classes) + // TODO this needs to be recursive (for packages) + String classfiles[] = destFolder.list(); + for (int i = 0; i < classfiles.length; i++) { + if (classfiles[i].endsWith(".class")) { + entry = new ZipEntry(classfiles[i]); + zos.putNextEntry(entry); + zos.write(Base.loadBytesRaw(new File(destFolder, classfiles[i]))); + zos.closeEntry(); + } + } + + // add the data folder to the main jar file + if (dataFolder.exists()) { + String dataFiles[] = Base.listFiles(dataFolder, false); + int offset = folder.getAbsolutePath().length() + 1; + for (int i = 0; i < dataFiles.length; i++) { + if (Base.isWindows()) { + dataFiles[i] = dataFiles[i].replace('\\', '/'); + } + File dataFile = new File(dataFiles[i]); + if (dataFile.isDirectory()) continue; + + // don't export hidden files + // skipping dot prefix removes all: . .. .DS_Store + if (dataFile.getName().charAt(0) == '.') continue; + + entry = new ZipEntry(dataFiles[i].substring(offset)); + zos.putNextEntry(entry); + zos.write(Base.loadBytesRaw(dataFile)); + zos.closeEntry(); + } + } + + // add the contents of the code folder to the jar + if (codeFolder.exists()) { + String includes = Compiler.contentsToClassPath(codeFolder); + // Use tokens to get rid of extra blanks, which causes huge exports + String[] codeList = PApplet.splitTokens(includes, File.separator); + String cp = ""; + for (int i = 0; i < codeList.length; i++) { + if (codeList[i].toLowerCase().endsWith(".jar") || + codeList[i].toLowerCase().endsWith(".zip")) { + File exportFile = new File(codeFolder, codeList[i]); + String exportFilename = exportFile.getName(); + Base.copyFile(exportFile, new File(jarFolder, exportFilename)); + jarListVector.add(exportFilename); + } else { + cp += codeList[i] + File.separatorChar; + } + } + packClassPathIntoZipFile(cp, zos, zipFileContents); + } + + zos.flush(); + zos.close(); + + jarListVector.add(name + ".jar"); + + + /// add core.jar to the jar destination folder + + File bagelJar = Base.isMacOS() ? + Base.getContentFile("core.jar") : + Base.getContentFile("lib/core.jar"); + Base.copyFile(bagelJar, new File(jarFolder, "core.jar")); + jarListVector.add("core.jar"); + + + /// add contents of 'library' folders to the export + + // if a file called 'export.txt' is in there, it contains + // a list of the files that should be exported. + // otherwise, all files are exported. + for (File libraryFolder : importedLibraries) { + //System.out.println(libraryFolder + " " + libraryFolder.getAbsolutePath()); + // in the list is a File object that points the + // library sketch's "library" folder + File exportSettings = new File(libraryFolder, "export.txt"); + Hashtable exportTable = readSettings(exportSettings); + String commaList = null; + String exportList[] = null; + + // first check to see if there's something like application.blargh + if (exportPlatform == PConstants.MACOSX) { + commaList = (String) exportTable.get("application.macosx"); + } else if (exportPlatform == PConstants.WINDOWS) { + commaList = (String) exportTable.get("application.windows"); + } else if (exportPlatform == PConstants.LINUX) { + commaList = (String) exportTable.get("application.linux"); + } else { + // next check to see if something for 'application' is specified + commaList = (String) exportTable.get("application"); + } + if (commaList == null) { + // otherwise just dump the whole folder + exportList = libraryFolder.list(); + } else { + exportList = PApplet.splitTokens(commaList, ", "); + } + + // add each item from the library folder / export list to the output + for (int i = 0; i < exportList.length; i++) { + if (exportList[i].equals(".") || + exportList[i].equals("..")) continue; + + exportList[i] = PApplet.trim(exportList[i]); + if (exportList[i].equals("")) continue; + + File exportFile = new File(libraryFolder, exportList[i]); + if (!exportFile.exists()) { + System.err.println("File " + exportList[i] + " does not exist"); + + } else if (exportFile.isDirectory()) { + System.err.println("Ignoring sub-folder \"" + exportList[i] + "\""); + + } else if (exportFile.getName().toLowerCase().endsWith(".zip") || + exportFile.getName().toLowerCase().endsWith(".jar")) { + //packClassPathIntoZipFile(exportFile.getAbsolutePath(), zos); + Base.copyFile(exportFile, new File(jarFolder, exportList[i])); + jarListVector.add(exportList[i]); + + } else if ((exportPlatform == PConstants.MACOSX) && + (exportFile.getName().toLowerCase().endsWith(".jnilib"))) { + // jnilib files can be placed in Contents/Resources/Java + Base.copyFile(exportFile, new File(jarFolder, exportList[i])); + + } else { + // copy the file to the main directory.. prolly a .dll or something + Base.copyFile(exportFile, + new File(destFolder, exportFile.getName())); + } + } + } + + + /// create platform-specific CLASSPATH based on included jars + + String jarList[] = new String[jarListVector.size()]; + jarListVector.copyInto(jarList); + StringBuffer exportClassPath = new StringBuffer(); + + if (exportPlatform == PConstants.MACOSX) { + for (int i = 0; i < jarList.length; i++) { + if (i != 0) exportClassPath.append(":"); + exportClassPath.append("$JAVAROOT/" + jarList[i]); + } + } else if (exportPlatform == PConstants.WINDOWS) { + for (int i = 0; i < jarList.length; i++) { + if (i != 0) exportClassPath.append(","); + exportClassPath.append(jarList[i]); + } + } else { + for (int i = 0; i < jarList.length; i++) { + if (i != 0) exportClassPath.append(":"); + exportClassPath.append("$APPDIR/lib/" + jarList[i]); + } + } + + + /// figure out run options for the VM + + String runOptions = Preferences.get("run.options"); + if (Preferences.getBoolean("run.options.memory")) { + runOptions += " -Xms" + + Preferences.get("run.options.memory.initial") + "m"; + runOptions += " -Xmx" + + Preferences.get("run.options.memory.maximum") + "m"; + } + + /// macosx: write out Info.plist (template for classpath, etc) + + if (exportPlatform == PConstants.MACOSX) { + String PLIST_TEMPLATE = "template.plist"; + File plistTemplate = new File(folder, PLIST_TEMPLATE); + if (!plistTemplate.exists()) { + plistTemplate = new File(skeletonFolder, PLIST_TEMPLATE); + } + File plistFile = new File(dotAppFolder, "Contents/Info.plist"); + PrintWriter pw = PApplet.createWriter(plistFile); + + String lines[] = PApplet.loadStrings(plistTemplate); + for (int i = 0; i < lines.length; i++) { + if (lines[i].indexOf("@@") != -1) { + StringBuffer sb = new StringBuffer(lines[i]); + int index = 0; + while ((index = sb.indexOf("@@vmoptions@@")) != -1) { + sb.replace(index, index + "@@vmoptions@@".length(), + runOptions); + } + while ((index = sb.indexOf("@@sketch@@")) != -1) { + sb.replace(index, index + "@@sketch@@".length(), + name); + } + while ((index = sb.indexOf("@@classpath@@")) != -1) { + sb.replace(index, index + "@@classpath@@".length(), + exportClassPath.toString()); + } + while ((index = sb.indexOf("@@lsuipresentationmode@@")) != -1) { + sb.replace(index, index + "@@lsuipresentationmode@@".length(), + Preferences.getBoolean("export.application.fullscreen") ? "4" : "0"); + } + lines[i] = sb.toString(); + } + // explicit newlines to avoid Windows CRLF + pw.print(lines[i] + "\n"); + } + pw.flush(); + pw.close(); + + } else if (exportPlatform == PConstants.WINDOWS) { + File argsFile = new File(destFolder + "/lib/args.txt"); + PrintWriter pw = PApplet.createWriter(argsFile); + + pw.println(runOptions); + + pw.println(this.name); + pw.println(exportClassPath); + + pw.flush(); + pw.close(); + + } else { + File shellScript = new File(destFolder, this.name); + PrintWriter pw = PApplet.createWriter(shellScript); + + // do the newlines explicitly so that windows CRLF + // isn't used when exporting for unix + pw.print("#!/bin/sh\n\n"); + //ps.print("APPDIR=`dirname $0`\n"); + pw.print("APPDIR=$(dirname \"$0\")\n"); // more posix compliant + // another fix for bug #234, LD_LIBRARY_PATH ignored on some platforms + //ps.print("LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APPDIR\n"); + pw.print("java " + Preferences.get("run.options") + + " -Djava.library.path=\"$APPDIR\"" + + " -cp \"" + exportClassPath + "\"" + + " " + this.name + "\n"); + + pw.flush(); + pw.close(); + + String shellPath = shellScript.getAbsolutePath(); + // will work on osx or *nix, but just dies on windows, oh well.. + if (!Base.isWindows()) { + Runtime.getRuntime().exec(new String[] { "chmod", "+x", shellPath }); + } + } + + + /// copy the source files to the target + /// (we like to encourage people to share their code) + + File sourceFolder = new File(destFolder, "source"); + sourceFolder.mkdirs(); + + for (int i = 0; i < codeCount; i++) { + try { +// Base.copyFile(code[i].getFile(), +// new File(sourceFolder, code[i].file.getFileName())); + code[i].copyTo(new File(sourceFolder, code[i].getFileName())); + } catch (IOException e) { + e.printStackTrace(); + } + } + // move the .java file from the preproc there too + String preprocFilename = this.name + ".java"; + File preprocFile = new File(destFolder, preprocFilename); + if (preprocFile.exists()) { + preprocFile.renameTo(new File(sourceFolder, preprocFilename)); + } + + + /// remove the .class files from the export folder. + for (int i = 0; i < classfiles.length; i++) { + if (classfiles[i].endsWith(".class")) { + File deadguy = new File(destFolder, classfiles[i]); + if (!deadguy.delete()) { + Base.showWarning("Could not delete", + classfiles[i] + " could not \n" + + "be deleted from the applet folder. \n" + + "You'll need to remove it by hand.", null); + } + } + } + + + /// goodbye + return true; + } + + + protected void addManifest(ZipOutputStream zos) throws IOException { + ZipEntry entry = new ZipEntry("META-INF/MANIFEST.MF"); + zos.putNextEntry(entry); + + String contents = + "Manifest-Version: 1.0\n" + + "Created-By: Processing " + Base.VERSION_NAME + "\n" + + "Main-Class: " + name + "\n"; // TODO not package friendly + zos.write(contents.getBytes()); + zos.closeEntry(); + } + + + /** + * Read from a file with a bunch of attribute/value pairs + * that are separated by = and ignore comments with #. + */ + protected Hashtable readSettings(File inputFile) { + Hashtable outgoing = new Hashtable(); + if (!inputFile.exists()) return outgoing; // return empty hash + + String lines[] = PApplet.loadStrings(inputFile); + for (int i = 0; i < lines.length; i++) { + int hash = lines[i].indexOf('#'); + String line = (hash == -1) ? + lines[i].trim() : lines[i].substring(0, hash).trim(); + if (line.length() == 0) continue; + + int equals = line.indexOf('='); + if (equals == -1) { + System.err.println("ignoring illegal line in " + inputFile); + System.err.println(" " + line); + continue; + } + String attr = line.substring(0, equals).trim(); + String valu = line.substring(equals + 1).trim(); + outgoing.put(attr, valu); + } + return outgoing; + } + + + /** + * Slurps up .class files from a colon (or semicolon on windows) + * separated list of paths and adds them to a ZipOutputStream. + */ + protected void packClassPathIntoZipFile(String path, + ZipOutputStream zos, + Hashtable zipFileContents) + throws IOException { + String[] pieces = PApplet.split(path, File.pathSeparatorChar); + + for (int i = 0; i < pieces.length; i++) { + if (pieces[i].length() == 0) continue; + + // is it a jar file or directory? + if (pieces[i].toLowerCase().endsWith(".jar") || + pieces[i].toLowerCase().endsWith(".zip")) { + try { + ZipFile file = new ZipFile(pieces[i]); + Enumeration entries = file.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = (ZipEntry) entries.nextElement(); + if (entry.isDirectory()) { + // actually 'continue's for all dir entries + + } else { + String entryName = entry.getName(); + // ignore contents of the META-INF folders + if (entryName.indexOf("META-INF") == 0) continue; + + // don't allow duplicate entries + if (zipFileContents.get(entryName) != null) continue; + zipFileContents.put(entryName, new Object()); + + ZipEntry entree = new ZipEntry(entryName); + + zos.putNextEntry(entree); + byte buffer[] = new byte[(int) entry.getSize()]; + InputStream is = file.getInputStream(entry); + + int offset = 0; + int remaining = buffer.length; + while (remaining > 0) { + int count = is.read(buffer, offset, remaining); + offset += count; + remaining -= count; + } + + zos.write(buffer); + zos.flush(); + zos.closeEntry(); + } + } + } catch (IOException e) { + System.err.println("Error in file " + pieces[i]); + e.printStackTrace(); + } + } else { // not a .jar or .zip, prolly a directory + File dir = new File(pieces[i]); + // but must be a dir, since it's one of several paths + // just need to check if it exists + if (dir.exists()) { + packClassPathIntoZipFileRecursive(dir, null, zos); + } + } + } + } + + + /** + * Continue the process of magical exporting. This function + * can be called recursively to walk through folders looking + * for more goodies that will be added to the ZipOutputStream. + */ + static protected void packClassPathIntoZipFileRecursive(File dir, + String sofar, + ZipOutputStream zos) + throws IOException { + String files[] = dir.list(); + for (int i = 0; i < files.length; i++) { + // ignore . .. and .DS_Store + if (files[i].charAt(0) == '.') continue; + + File sub = new File(dir, files[i]); + String nowfar = (sofar == null) ? + files[i] : (sofar + "/" + files[i]); + + if (sub.isDirectory()) { + packClassPathIntoZipFileRecursive(sub, nowfar, zos); + + } else { + // don't add .jar and .zip files, since they only work + // inside the root, and they're unpacked + if (!files[i].toLowerCase().endsWith(".jar") && + !files[i].toLowerCase().endsWith(".zip") && + files[i].charAt(0) != '.') { + ZipEntry entry = new ZipEntry(nowfar); + zos.putNextEntry(entry); + zos.write(Base.loadBytesRaw(sub)); + zos.closeEntry(); + } + } + } + } + + + /** + * Make sure the sketch hasn't been moved or deleted by some + * nefarious user. If they did, try to re-create it and save. + * Only checks to see if the main folder is still around, + * but not its contents. + */ + protected void ensureExistence() { + if (folder.exists()) return; + + Base.showWarning("Sketch Disappeared", + "The sketch folder has disappeared.\n " + + "Will attempt to re-save in the same location,\n" + + "but anything besides the code will be lost.", null); + try { + folder.mkdirs(); + modified = true; + + for (int i = 0; i < codeCount; i++) { + code[i].save(); // this will force a save + } + calcModified(); + + } catch (Exception e) { + Base.showWarning("Could not re-save sketch", + "Could not properly re-save the sketch. " + + "You may be in trouble at this point,\n" + + "and it might be time to copy and paste " + + "your code to another text editor.", e); + } + } + + + /** + * Returns true if this is a read-only sketch. Used for the + * examples directory, or when sketches are loaded from read-only + * volumes or folders without appropriate permissions. + */ + public boolean isReadOnly() { + String apath = folder.getAbsolutePath(); + if (apath.startsWith(Base.getExamplesPath()) || + apath.startsWith(Base.getLibrariesPath())) { + return true; + + // canWrite() doesn't work on directories + //} else if (!folder.canWrite()) { + } else { + // check to see if each modified code file can be written to + for (int i = 0; i < codeCount; i++) { + if (code[i].isModified() && + code[i].fileReadOnly() && + code[i].fileExists()) { + //System.err.println("found a read-only file " + code[i].file); + return true; + } + } + //return true; + } + return false; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + // Breaking out extension types in order to clean up the code, and make it + // easier for other environments (like Arduino) to incorporate changes. + + + /** + * True if the specified extension should be hidden when shown on a tab. + * For Processing, this is true for .pde files. (Broken out for subclasses.) + */ + public boolean hideExtension(String what) { + return what.equals(getDefaultExtension()); + } + + + /** + * True if the specified code has the default file extension. + */ + public boolean hasDefaultExtension(SketchCode code) { + return code.getExtension().equals(getDefaultExtension()); + } + + + /** + * True if the specified extension is the default file extension. + */ + public boolean isDefaultExtension(String what) { + return what.equals(getDefaultExtension()); + } + + + /** + * Check this extension (no dots, please) against the list of valid + * extensions. + */ + public boolean validExtension(String what) { + String[] ext = getExtensions(); + for (int i = 0; i < ext.length; i++) { + if (ext[i].equals(what)) return true; + } + return false; + } + + + /** + * Returns the default extension for this editor setup. + */ + public String getDefaultExtension() { + return "pde"; + } + + + /** + * Returns a String[] array of proper extensions. + */ + public String[] getExtensions() { + return new String[] { "pde", "java" }; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + // Additional accessors added in 0136 because of package work. + // These will also be helpful for tool developers. + + + /** + * Returns the name of this sketch. (The pretty name of the main tab.) + */ + public String getName() { + return name; + } + + + /** + * Returns a file object for the primary .pde of this sketch. + */ + public File getPrimaryFile() { + return primaryFile; + } + + + /** + * Returns path to the main .pde file for this sketch. + */ + public String getMainFilePath() { + return primaryFile.getAbsolutePath(); + //return code[0].file.getAbsolutePath(); + } + + + /** + * Returns the sketch folder. + */ + public File getFolder() { + return folder; + } + + + /** + * Returns the location of the sketch's data folder. (It may not exist yet.) + */ + public File getDataFolder() { + return dataFolder; + } + + + /** + * Create the data folder if it does not exist already. As a convenience, + * it also returns the data folder, since it's likely about to be used. + */ + public File prepareDataFolder() { + if (!dataFolder.exists()) { + dataFolder.mkdirs(); + } + return dataFolder; + } + + + /** + * Returns the location of the sketch's code folder. (It may not exist yet.) + */ + public File getCodeFolder() { + return codeFolder; + } + + + /** + * Create the code folder if it does not exist already. As a convenience, + * it also returns the code folder, since it's likely about to be used. + */ + public File prepareCodeFolder() { + if (!codeFolder.exists()) { + codeFolder.mkdirs(); + } + return codeFolder; + } + + + public String getClassPath() { + return classPath; + } + + + public String getLibraryPath() { + return libraryPath; + } + + + public SketchCode[] getCode() { + return code; + } + + + public int getCodeCount() { + return codeCount; + } + + + public SketchCode getCode(int index) { + return code[index]; + } + + + public int getCodeIndex(SketchCode who) { + for (int i = 0; i < codeCount; i++) { + if (who == code[i]) { + return i; + } + } + return -1; + } + + + public SketchCode getCurrentCode() { + return current; + } + + + public void setUntitled(boolean u) { + editor.untitled = u; + } + + + public boolean isUntitled() { + return editor.untitled; + } + + + public String getAppletClassName2() { + return appletClassName; + } + + + // ................................................................. + + + /** + * Convert to sanitized name and alert the user + * if changes were made. + */ + static public String checkName(String origName) { + String newName = sanitizeName(origName); + + if (!newName.equals(origName)) { + String msg = + "The sketch name had to be modified. Sketch names can only consist\n" + + "of ASCII characters and numbers (but cannot start with a number).\n" + + "They should also be less less than 64 characters long."; + System.out.println(msg); + } + return newName; + } + + + /** + * Return true if the name is valid for a Processing sketch. + */ + static public boolean isSanitaryName(String name) { + return sanitizeName(name).equals(name); + } + + + /** + * Produce a sanitized name that fits our standards for likely to work. + *

+ * Java classes have a wider range of names that are technically allowed + * (supposedly any Unicode name) than what we support. The reason for + * going more narrow is to avoid situations with text encodings and + * converting during the process of moving files between operating + * systems, i.e. uploading from a Windows machine to a Linux server, + * or reading a FAT32 partition in OS X and using a thumb drive. + *

+ * This helper function replaces everything but A-Z, a-z, and 0-9 with + * underscores. Also disallows starting the sketch name with a digit. + */ + static public String sanitizeName(String origName) { + char c[] = origName.toCharArray(); + StringBuffer buffer = new StringBuffer(); + + // can't lead with a digit, so start with an underscore + if ((c[0] >= '0') && (c[0] <= '9')) { + buffer.append('_'); + } + for (int i = 0; i < c.length; i++) { + if (((c[i] >= '0') && (c[i] <= '9')) || + ((c[i] >= 'a') && (c[i] <= 'z')) || + ((c[i] >= 'A') && (c[i] <= 'Z'))) { + buffer.append(c[i]); + + } else { + buffer.append('_'); + } + } + // let's not be ridiculous about the length of filenames. + // in fact, Mac OS 9 can handle 255 chars, though it can't really + // deal with filenames longer than 31 chars in the Finder. + // but limiting to that for sketches would mean setting the + // upper-bound on the character limit here to 25 characters + // (to handle the base name + ".class") + if (buffer.length() > 63) { + buffer.setLength(63); + } + return buffer.toString(); + } +} diff --git a/app/src/processing/app/SketchCode.java b/app/src/processing/app/SketchCode.java new file mode 100644 index 000000000..f7dae32bb --- /dev/null +++ b/app/src/processing/app/SketchCode.java @@ -0,0 +1,285 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + SketchCode - data class for a single file inside a sketch + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.io.*; + +import javax.swing.text.Document; +import javax.swing.undo.*; + + +/** + * Represents a single tab of a sketch. + */ +public class SketchCode { + /** Pretty name (no extension), not the full file name */ + private String prettyName; + + /** File object for where this code is located */ + private File file; + + /** Extension for this file (no dots, and in lowercase). */ + private String extension; + + /** Text of the program text for this tab */ + private String program; + + /** Document object for this tab. Currently this is a SyntaxDocument. */ + private Document document; + + /** + * Undo Manager for this tab, each tab keeps track of their own + * Editor.undo will be set to this object when this code is the tab + * that's currently the front. + */ + private UndoManager undo = new UndoManager(); + + // saved positions from last time this tab was used + private int selectionStart; + private int selectionStop; + private int scrollPosition; + + private boolean modified; + + /** name of .java file after preproc */ +// private String preprocName; + /** where this code starts relative to the concat'd code */ + private int preprocOffset; + + + public SketchCode(File file, String extension) { + this.file = file; + this.extension = extension; + + makePrettyName(); + + try { + load(); + } catch (IOException e) { + System.err.println("Error while loading code " + file.getName()); + } + } + + + protected void makePrettyName() { + prettyName = file.getName(); + int dot = prettyName.indexOf('.'); + prettyName = prettyName.substring(0, dot); + } + + + public File getFile() { + return file; + } + + + protected boolean fileExists() { + return file.exists(); + } + + + protected boolean fileReadOnly() { + return !file.canWrite(); + } + + + protected boolean deleteFile() { + return file.delete(); + } + + + protected boolean renameTo(File what, String ext) { + boolean success = file.renameTo(what); + if (success) { + this.file = what; // necessary? + this.extension = ext; + makePrettyName(); + } + return success; + } + + + protected void copyTo(File dest) throws IOException { + Base.saveFile(program, dest); + } + + + public String getFileName() { + return file.getName(); + } + + + public String getPrettyName() { + return prettyName; + } + + + public String getExtension() { + return extension; + } + + + public boolean isExtension(String what) { + return extension.equals(what); + } + + + public String getProgram() { + return program; + } + + + public void setProgram(String replacement) { + program = replacement; + } + + + public int getLineCount() { + return Base.countLines(program); + } + + + public void setModified(boolean modified) { + this.modified = modified; + } + + + public boolean isModified() { + return modified; + } + + +// public void setPreprocName(String preprocName) { +// this.preprocName = preprocName; +// } +// +// +// public String getPreprocName() { +// return preprocName; +// } + + + public void setPreprocOffset(int preprocOffset) { + this.preprocOffset = preprocOffset; + } + + + public int getPreprocOffset() { + return preprocOffset; + } + + + public void addPreprocOffset(int extra) { + preprocOffset += extra; + } + + + public Document getDocument() { + return document; + } + + + public void setDocument(Document d) { + document = d; + } + + + public UndoManager getUndo() { + return undo; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + // TODO these could probably be handled better, since it's a general state + // issue that's read/write from only one location in Editor (on tab switch.) + + + public int getSelectionStart() { + return selectionStart; + } + + + public int getSelectionStop() { + return selectionStop; + } + + + public int getScrollPosition() { + return scrollPosition; + } + + + protected void setState(String p, int start, int stop, int pos) { + program = p; + selectionStart = start; + selectionStop = stop; + scrollPosition = pos; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Load this piece of code from a file. + */ + public void load() throws IOException { + program = Base.loadFile(file); + + if (program.indexOf('\uFFFD') != -1) { + System.err.println(file.getName() + " contains unrecognized characters."); + System.err.println("If this code was created with an older version of Processing,"); + System.err.println("you may need to use Tools -> Fix Encoding & Reload to update"); + System.err.println("the sketch to use UTF-8 encoding. If not, you may need to"); + System.err.println("delete the bad characters to get rid of this warning."); + System.err.println(); + } + + setModified(false); + } + + + /** + * Save this piece of code, regardless of whether the modified + * flag is set or not. + */ + public void save() throws IOException { + // TODO re-enable history + //history.record(s, SketchHistory.SAVE); + + Base.saveFile(program, file); + setModified(false); + } + + + /** + * Save this file to another location, used by Sketch.saveAs() + */ + public void saveAs(File newFile) throws IOException { + Base.saveFile(program, newFile); + } +} diff --git a/app/src/processing/app/Theme.java b/app/src/processing/app/Theme.java new file mode 100644 index 000000000..b62f18828 --- /dev/null +++ b/app/src/processing/app/Theme.java @@ -0,0 +1,208 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.awt.*; +import java.io.*; +import java.util.*; + +import processing.app.syntax.*; +import processing.core.*; + + +/** + * Storage class for theme settings. This was separated from the Preferences + * class for 1.0 so that the coloring wouldn't conflict with previous releases + * and to make way for future ability to customize. + */ +public class Theme { + + /** Copy of the defaults in case the user mangles a preference. */ + static Hashtable defaults; + /** Table of attributes/values for the theme. */ + static Hashtable table = new Hashtable();; + + + static protected void init() { + try { + load(Base.getLibStream("theme/theme.txt")); + } catch (Exception te) { + Base.showError(null, "Could not read color theme settings.\n" + + "You'll need to reinstall Processing.", te); + } + + // check for platform-specific properties in the defaults + String platformExt = "." + Base.getPlatformName(); + int platformExtLength = platformExt.length(); + Enumeration e = table.keys(); + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + if (key.endsWith(platformExt)) { + // this is a key specific to a particular platform + String actualKey = key.substring(0, key.length() - platformExtLength); + String value = get(key); + table.put(actualKey, value); + } + } + + // other things that have to be set explicitly for the defaults + setColor("run.window.bgcolor", SystemColor.control); + + // clone the hash table + defaults = (Hashtable) table.clone(); + } + + + static protected void load(InputStream input) throws IOException { + String[] lines = PApplet.loadStrings(input); + for (String line : lines) { + if ((line.length() == 0) || + (line.charAt(0) == '#')) continue; + + // this won't properly handle = signs being in the text + int equals = line.indexOf('='); + if (equals != -1) { + String key = line.substring(0, equals).trim(); + String value = line.substring(equals + 1).trim(); + table.put(key, value); + } + } + } + + + static public String get(String attribute) { + return (String) table.get(attribute); + } + + + static public String getDefault(String attribute) { + return (String) defaults.get(attribute); + } + + + static public void set(String attribute, String value) { + table.put(attribute, value); + } + + + static public boolean getBoolean(String attribute) { + String value = get(attribute); + return (new Boolean(value)).booleanValue(); + } + + + static public void setBoolean(String attribute, boolean value) { + set(attribute, value ? "true" : "false"); + } + + + static public int getInteger(String attribute) { + return Integer.parseInt(get(attribute)); + } + + + static public void setInteger(String key, int value) { + set(key, String.valueOf(value)); + } + + + static public Color getColor(String name) { + Color parsed = null; + String s = get(name); + if ((s != null) && (s.indexOf("#") == 0)) { + try { + int v = Integer.parseInt(s.substring(1), 16); + parsed = new Color(v); + } catch (Exception e) { + } + } + return parsed; + } + + + static public void setColor(String attr, Color what) { + String r = Integer.toHexString(what.getRed()); + String g = Integer.toHexString(what.getGreen()); + String b = Integer.toHexString(what.getBlue()); + set(attr, "#" + r.substring(r.length() - 2) + + g.substring(g.length() - 2) + b.substring(b.length() - 2)); + } + + + static public Font getFont(String attr) { + boolean replace = false; + String value = get(attr); + if (value == null) { + //System.out.println("reset 1"); + value = getDefault(attr); + replace = true; + } + + String[] pieces = PApplet.split(value, ','); + if (pieces.length != 3) { + value = getDefault(attr); + //System.out.println("reset 2 for " + attr); + pieces = PApplet.split(value, ','); + //PApplet.println(pieces); + replace = true; + } + + String name = pieces[0]; + int style = Font.PLAIN; // equals zero + if (pieces[1].indexOf("bold") != -1) { + style |= Font.BOLD; + } + if (pieces[1].indexOf("italic") != -1) { + style |= Font.ITALIC; + } + int size = PApplet.parseInt(pieces[2], 12); + Font font = new Font(name, style, size); + + // replace bad font with the default + if (replace) { + //System.out.println(attr + " > " + value); + //setString(attr, font.getName() + ",plain," + font.getSize()); + set(attr, value); + } + + return font; + } + + + static public SyntaxStyle getStyle(String what) { + String str = get("editor." + what + ".style"); + + StringTokenizer st = new StringTokenizer(str, ","); + + String s = st.nextToken(); + if (s.indexOf("#") == 0) s = s.substring(1); + Color color = new Color(Integer.parseInt(s, 16)); + + s = st.nextToken(); + boolean bold = (s.indexOf("bold") != -1); + boolean italic = (s.indexOf("italic") != -1); + + return new SyntaxStyle(color, italic, bold); + } +} \ No newline at end of file diff --git a/app/src/processing/app/UpdateCheck.java b/app/src/processing/app/UpdateCheck.java new file mode 100644 index 000000000..28043eca4 --- /dev/null +++ b/app/src/processing/app/UpdateCheck.java @@ -0,0 +1,134 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-06 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Random; + +import javax.swing.JOptionPane; + +import processing.core.PApplet; + + +/** + * Threaded class to check for updates in the background. + *

+ * This is the class that handles the mind control and stuff for + * spying on our users and stealing their personal information. + * A random ID number is generated for each user, and hits the server + * to check for updates. Also included is the operating system and + * its version and the version of Java being used to run Processing. + *

+ * The ID number also helps provide us a general idea of how many + * people are using Processing, which helps us when writing grant + * proposals and that kind of thing so that we can keep Processing free. + */ +public class UpdateCheck implements Runnable { + Base base; + String downloadURL = "http://processing.org/download/latest.txt"; + + static final long ONE_DAY = 24 * 60 * 60 * 1000; + + + public UpdateCheck(Base base) { + Thread thread = new Thread(this); + thread.start(); + } + + + public void run() { + //System.out.println("checking for updates..."); + + // generate a random id in case none exists yet + Random r = new Random(); + long id = r.nextLong(); + + String idString = Preferences.get("update.id"); + if (idString != null) { + id = Long.parseLong(idString); + } else { + Preferences.set("update.id", String.valueOf(id)); + } + + try { + String info; + info = URLEncoder.encode(id + "\t" + + PApplet.nf(Base.REVISION, 4) + "\t" + + System.getProperty("java.version") + "\t" + + System.getProperty("java.vendor") + "\t" + + System.getProperty("os.name") + "\t" + + System.getProperty("os.version") + "\t" + + System.getProperty("os.arch"), "UTF-8"); + + int latest = readInt(downloadURL + "?" + info); + + String lastString = Preferences.get("update.last"); + long now = System.currentTimeMillis(); + if (lastString != null) { + long when = Long.parseLong(lastString); + if (now - when < ONE_DAY) { + // don't annoy the shit outta people + return; + } + } + Preferences.set("update.last", String.valueOf(now)); + + String prompt = + "A new version of Processing is available,\n" + + "would you like to visit the Processing download page?"; + + if (base.activeEditor != null) { + if (latest > Base.REVISION) { + Object[] options = { "Yes", "No" }; + int result = JOptionPane.showOptionDialog(base.activeEditor, + prompt, + "Update", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[0]); + if (result == JOptionPane.YES_OPTION) { + Base.openURL("http://processing.org/download/"); + } + } + } + } catch (Exception e) { + //e.printStackTrace(); + //System.err.println("Error while trying to check for an update."); + } + } + + + protected int readInt(String filename) throws Exception { + URL url = new URL(filename); + InputStream stream = url.openStream(); + InputStreamReader isr = new InputStreamReader(stream); + BufferedReader reader = new BufferedReader(isr); + return Integer.parseInt(reader.readLine()); + } +} diff --git a/app/src/processing/app/WebServer.java b/app/src/processing/app/WebServer.java new file mode 100644 index 000000000..01f6cc39e --- /dev/null +++ b/app/src/processing/app/WebServer.java @@ -0,0 +1,569 @@ +package processing.app; + +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.zip.*; + +//import javax.swing.SwingUtilities; + +/** + * An example of a very simple, multi-threaded HTTP server. + * Taken from this article on java.sun.com. + */ +public class WebServer implements HttpConstants { + + /* Where worker threads stand idle */ + static Vector threads = new Vector(); + + /* the web server's virtual root */ + //static File root; + + /* timeout on client connections */ + static int timeout = 10000; + + /* max # worker threads */ + static int workers = 5; + +// static PrintStream log = System.out; + + + /* + static void loadProps() throws IOException { + File f = new File + (System.getProperty("java.home")+File.separator+ + "lib"+File.separator+"www-server.properties"); + if (f.exists()) { + InputStream is =new BufferedInputStream(new + FileInputStream(f)); + props.load(is); + is.close(); + String r = props.getProperty("root"); + if (r != null) { + root = new File(r); + if (!root.exists()) { + throw new Error(root + " doesn't exist as server root"); + } + } + r = props.getProperty("timeout"); + if (r != null) { + timeout = Integer.parseInt(r); + } + r = props.getProperty("workers"); + if (r != null) { + workers = Integer.parseInt(r); + } + r = props.getProperty("log"); + if (r != null) { + p("opening log file: " + r); + log = new PrintStream(new BufferedOutputStream( + new FileOutputStream(r))); + } + } + + // if no properties were specified, choose defaults + if (root == null) { + root = new File(System.getProperty("user.dir")); + } + if (timeout <= 1000) { + timeout = 5000; + } + if (workers < 25) { + workers = 5; + } + if (log == null) { + p("logging to stdout"); + log = System.out; + } + } + + static void printProps() { + p("root="+root); + p("timeout="+timeout); + p("workers="+workers); + } + */ + + + /* print to stdout */ +// protected static void p(String s) { +// System.out.println(s); +// } + + /* print to the log file */ + protected static void log(String s) { + if (false) { + System.out.println(s); + } +// synchronized (log) { +// log.println(s); +// log.flush(); +// } + } + + + //public static void main(String[] a) throws Exception { + static public int launch(String zipPath) throws IOException { + final ZipFile zip = new ZipFile(zipPath); + final HashMap entries = new HashMap(); + Enumeration en = zip.entries(); + while (en.hasMoreElements()) { + ZipEntry entry = (ZipEntry) en.nextElement(); + entries.put(entry.getName(), entry); + } + +// if (a.length > 0) { +// port = Integer.parseInt(a[0]); +// } +// loadProps(); +// printProps(); + // start worker threads + for (int i = 0; i < workers; ++i) { + WebServerWorker w = new WebServerWorker(zip, entries); + Thread t = new Thread(w, "Web Server Worker #" + i); + t.start(); + threads.addElement(w); + } + + final int port = 8080; + + //SwingUtilities.invokeLater(new Runnable() { + Runnable r = new Runnable() { + public void run() { + try { + ServerSocket ss = new ServerSocket(port); + while (true) { + Socket s = ss.accept(); + WebServerWorker w = null; + synchronized (threads) { + if (threads.isEmpty()) { + WebServerWorker ws = new WebServerWorker(zip, entries); + ws.setSocket(s); + (new Thread(ws, "additional worker")).start(); + } else { + w = (WebServerWorker) threads.elementAt(0); + threads.removeElementAt(0); + w.setSocket(s); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } + }; + new Thread(r).start(); +// }); + return port; + } +} + + +class WebServerWorker /*extends WebServer*/ implements HttpConstants, Runnable { + ZipFile zip; + HashMap entries; + + final static int BUF_SIZE = 2048; + + static final byte[] EOL = { (byte)'\r', (byte)'\n' }; + + /* buffer to use for requests */ + byte[] buf; + /* Socket to client we're handling */ + private Socket s; + + WebServerWorker(ZipFile zip, HashMap entries) { + this.entries = entries; + this.zip = zip; + + buf = new byte[BUF_SIZE]; + s = null; + } + +// Worker() { +// buf = new byte[BUF_SIZE]; +// s = null; +// } +// + synchronized void setSocket(Socket s) { + this.s = s; + notify(); + } + + public synchronized void run() { + while(true) { + if (s == null) { + /* nothing to do */ + try { + wait(); + } catch (InterruptedException e) { + /* should not happen */ + continue; + } + } + try { + handleClient(); + } catch (Exception e) { + e.printStackTrace(); + } + /* go back in wait queue if there's fewer + * than numHandler connections. + */ + s = null; + Vector pool = WebServer.threads; + synchronized (pool) { + if (pool.size() >= WebServer.workers) { + /* too many threads, exit this one */ + return; + } else { + pool.addElement(this); + } + } + } + } + + + void handleClient() throws IOException { + InputStream is = new BufferedInputStream(s.getInputStream()); + PrintStream ps = new PrintStream(s.getOutputStream()); + // we will only block in read for this many milliseconds + // before we fail with java.io.InterruptedIOException, + // at which point we will abandon the connection. + s.setSoTimeout(WebServer.timeout); + s.setTcpNoDelay(true); + // zero out the buffer from last time + for (int i = 0; i < BUF_SIZE; i++) { + buf[i] = 0; + } + try { + // We only support HTTP GET/HEAD, and don't support any fancy HTTP + // options, so we're only interested really in the first line. + int nread = 0, r = 0; + +outerloop: + while (nread < BUF_SIZE) { + r = is.read(buf, nread, BUF_SIZE - nread); + if (r == -1) { + return; // EOF + } + int i = nread; + nread += r; + for (; i < nread; i++) { + if (buf[i] == (byte)'\n' || buf[i] == (byte)'\r') { + break outerloop; // read one line + } + } + } + + /* are we doing a GET or just a HEAD */ + boolean doingGet; + /* beginning of file name */ + int index; + if (buf[0] == (byte)'G' && + buf[1] == (byte)'E' && + buf[2] == (byte)'T' && + buf[3] == (byte)' ') { + doingGet = true; + index = 4; + } else if (buf[0] == (byte)'H' && + buf[1] == (byte)'E' && + buf[2] == (byte)'A' && + buf[3] == (byte)'D' && + buf[4] == (byte)' ') { + doingGet = false; + index = 5; + } else { + /* we don't support this method */ + ps.print("HTTP/1.0 " + HTTP_BAD_METHOD + + " unsupported method type: "); + ps.write(buf, 0, 5); + ps.write(EOL); + ps.flush(); + s.close(); + return; + } + + int i = 0; + /* find the file name, from: + * GET /foo/bar.html HTTP/1.0 + * extract "/foo/bar.html" + */ + for (i = index; i < nread; i++) { + if (buf[i] == (byte)' ') { + break; + } + } + + String fname = new String(buf, index, i-index); + // get the zip entry, remove the front slash + ZipEntry entry = entries.get(fname.substring(1)); + //System.out.println(fname + " " + entry); + boolean ok = printHeaders(entry, ps); + if (entry != null) { + InputStream stream = zip.getInputStream(entry); + if (doingGet && ok) { + sendFile(stream, ps); + } + } else { + send404(ps); + } + /* + String fname = + (new String(buf, 0, index, i-index)).replace('/', File.separatorChar); + if (fname.startsWith(File.separator)) { + fname = fname.substring(1); + } + File targ = new File(WebServer.root, fname); + if (targ.isDirectory()) { + File ind = new File(targ, "index.html"); + if (ind.exists()) { + targ = ind; + } + } + boolean OK = printHeaders(targ, ps); + if (doingGet) { + if (OK) { + sendFile(targ, ps); + } else { + send404(targ, ps); + } + } + */ + } finally { + s.close(); + } + } + + + boolean printHeaders(ZipEntry targ, PrintStream ps) throws IOException { + boolean ret = false; + int rCode = 0; + if (targ == null) { + rCode = HTTP_NOT_FOUND; + ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " Not Found"); + ps.write(EOL); + ret = false; + } else { + rCode = HTTP_OK; + ps.print("HTTP/1.0 " + HTTP_OK + " OK"); + ps.write(EOL); + ret = true; + } + if (targ != null) { + WebServer.log("From " +s.getInetAddress().getHostAddress()+": GET " + targ.getName()+" --> "+rCode); + } + ps.print("Server: Processing Documentation Server"); + ps.write(EOL); + ps.print("Date: " + (new Date())); + ps.write(EOL); + if (ret) { + if (!targ.isDirectory()) { + ps.print("Content-length: " + targ.getSize()); + ps.write(EOL); + ps.print("Last Modified: " + new Date(targ.getTime())); + ps.write(EOL); + String name = targ.getName(); + int ind = name.lastIndexOf('.'); + String ct = null; + if (ind > 0) { + ct = (String) map.get(name.substring(ind)); + } + if (ct == null) { + //System.err.println("unknown content type " + name.substring(ind)); + ct = "application/x-unknown-content-type"; + } + ps.print("Content-type: " + ct); + ps.write(EOL); + } else { + ps.print("Content-type: text/html"); + ps.write(EOL); + } + } + ps.write(EOL); // adding another newline here [fry] + return ret; + } + + + boolean printHeaders(File targ, PrintStream ps) throws IOException { + boolean ret = false; + int rCode = 0; + if (!targ.exists()) { + rCode = HTTP_NOT_FOUND; + ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " Not Found"); + ps.write(EOL); + ret = false; + } else { + rCode = HTTP_OK; + ps.print("HTTP/1.0 " + HTTP_OK+" OK"); + ps.write(EOL); + ret = true; + } + WebServer.log("From " +s.getInetAddress().getHostAddress()+": GET " + targ.getAbsolutePath()+"-->"+rCode); + ps.print("Server: Simple java"); + ps.write(EOL); + ps.print("Date: " + (new Date())); + ps.write(EOL); + if (ret) { + if (!targ.isDirectory()) { + ps.print("Content-length: " + targ.length()); + ps.write(EOL); + ps.print("Last Modified: " + new Date(targ.lastModified())); + ps.write(EOL); + String name = targ.getName(); + int ind = name.lastIndexOf('.'); + String ct = null; + if (ind > 0) { + ct = (String) map.get(name.substring(ind)); + } + if (ct == null) { + ct = "unknown/unknown"; + } + ps.print("Content-type: " + ct); + ps.write(EOL); + } else { + ps.print("Content-type: text/html"); + ps.write(EOL); + } + } + return ret; + } + + + void send404(PrintStream ps) throws IOException { + ps.write(EOL); + ps.write(EOL); + ps.print("

404 Not Found

"+ + "The requested resource was not found."); + ps.write(EOL); + ps.write(EOL); + } + + + void sendFile(File targ, PrintStream ps) throws IOException { + InputStream is = null; + ps.write(EOL); + if (targ.isDirectory()) { + listDirectory(targ, ps); + return; + } else { + is = new FileInputStream(targ.getAbsolutePath()); + } + sendFile(is, ps); + } + + + void sendFile(InputStream is, PrintStream ps) throws IOException { + try { + int n; + while ((n = is.read(buf)) > 0) { + ps.write(buf, 0, n); + } + } finally { + is.close(); + } + } + + /* mapping of file extensions to content-types */ + static java.util.Hashtable map = new java.util.Hashtable(); + + static { + fillMap(); + } + static void setSuffix(String k, String v) { + map.put(k, v); + } + + static void fillMap() { + setSuffix("", "content/unknown"); + + setSuffix(".uu", "application/octet-stream"); + setSuffix(".exe", "application/octet-stream"); + setSuffix(".ps", "application/postscript"); + setSuffix(".zip", "application/zip"); + setSuffix(".sh", "application/x-shar"); + setSuffix(".tar", "application/x-tar"); + setSuffix(".snd", "audio/basic"); + setSuffix(".au", "audio/basic"); + setSuffix(".wav", "audio/x-wav"); + + setSuffix(".gif", "image/gif"); + setSuffix(".jpg", "image/jpeg"); + setSuffix(".jpeg", "image/jpeg"); + + setSuffix(".htm", "text/html"); + setSuffix(".html", "text/html"); + setSuffix(".css", "text/css"); + setSuffix(".java", "text/javascript"); + + setSuffix(".txt", "text/plain"); + setSuffix(".java", "text/plain"); + + setSuffix(".c", "text/plain"); + setSuffix(".cc", "text/plain"); + setSuffix(".c++", "text/plain"); + setSuffix(".h", "text/plain"); + setSuffix(".pl", "text/plain"); + } + + void listDirectory(File dir, PrintStream ps) throws IOException { + ps.println("Directory listing

\n"); + ps.println("Parent Directory
\n"); + String[] list = dir.list(); + for (int i = 0; list != null && i < list.length; i++) { + File f = new File(dir, list[i]); + if (f.isDirectory()) { + ps.println(""+list[i]+"/
"); + } else { + ps.println(""+list[i]+"



" + (new Date()) + ""); + } + +} + + +interface HttpConstants { + /** 2XX: generally "OK" */ + public static final int HTTP_OK = 200; + public static final int HTTP_CREATED = 201; + public static final int HTTP_ACCEPTED = 202; + public static final int HTTP_NOT_AUTHORITATIVE = 203; + public static final int HTTP_NO_CONTENT = 204; + public static final int HTTP_RESET = 205; + public static final int HTTP_PARTIAL = 206; + + /** 3XX: relocation/redirect */ + public static final int HTTP_MULT_CHOICE = 300; + public static final int HTTP_MOVED_PERM = 301; + public static final int HTTP_MOVED_TEMP = 302; + public static final int HTTP_SEE_OTHER = 303; + public static final int HTTP_NOT_MODIFIED = 304; + public static final int HTTP_USE_PROXY = 305; + + /** 4XX: client error */ + public static final int HTTP_BAD_REQUEST = 400; + public static final int HTTP_UNAUTHORIZED = 401; + public static final int HTTP_PAYMENT_REQUIRED = 402; + public static final int HTTP_FORBIDDEN = 403; + public static final int HTTP_NOT_FOUND = 404; + public static final int HTTP_BAD_METHOD = 405; + public static final int HTTP_NOT_ACCEPTABLE = 406; + public static final int HTTP_PROXY_AUTH = 407; + public static final int HTTP_CLIENT_TIMEOUT = 408; + public static final int HTTP_CONFLICT = 409; + public static final int HTTP_GONE = 410; + public static final int HTTP_LENGTH_REQUIRED = 411; + public static final int HTTP_PRECON_FAILED = 412; + public static final int HTTP_ENTITY_TOO_LARGE = 413; + public static final int HTTP_REQ_TOO_LONG = 414; + public static final int HTTP_UNSUPPORTED_TYPE = 415; + + /** 5XX: server error */ + public static final int HTTP_SERVER_ERROR = 500; + public static final int HTTP_INTERNAL_ERROR = 501; + public static final int HTTP_BAD_GATEWAY = 502; + public static final int HTTP_UNAVAILABLE = 503; + public static final int HTTP_GATEWAY_TIMEOUT = 504; + public static final int HTTP_VERSION = 505; +} diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java new file mode 100644 index 000000000..3eead5c42 --- /dev/null +++ b/app/src/processing/app/debug/Compiler.java @@ -0,0 +1,828 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.debug; + +import processing.app.Base; +import processing.app.Sketch; +import processing.app.SketchCode; +import processing.core.*; + +import java.io.*; +import java.util.*; +import java.util.zip.*; + +import org.eclipse.jdt.core.compiler.batch.BatchCompiler; +import org.eclipse.jdt.core.compiler.CompilationProgress; + + +public class Compiler { + + public Compiler() { } + + /** + * Compile with ECJ. + * + * @param sketch Sketch object to be compiled. + * @param buildPath Where the temporary files live and will be built from. + * @return true if successful. + * @throws RunnerException Only if there's a problem. Only then. + */ + public boolean compile(Sketch sketch, + String buildPath, + String primaryClassName) throws RunnerException { + // This will be filled in if anyone gets angry + RunnerException exception = null; + boolean success = false; + + String baseCommand[] = new String[] { + "-Xemacs", + //"-noExit", // not necessary for ecj + "-source", "1.5", + "-target", "1.5", + "-classpath", sketch.getClassPath(), + "-nowarn", // we're not currently interested in warnings (works in ecj) + "-d", buildPath // output the classes in the buildPath + }; + //PApplet.println(baseCommand); + + // make list of code files that need to be compiled + // (some files are skipped if they contain no class) + String[] sourceFiles = new String[sketch.getCodeCount()]; + int sourceCount = 0; + sourceFiles[sourceCount++] = + new File(buildPath, primaryClassName + ".java").getAbsolutePath(); + + for (SketchCode code : sketch.getCode()) { + if (code.isExtension("java")) { + String path = new File(buildPath, code.getFileName()).getAbsolutePath(); + sourceFiles[sourceCount++] = path; + } + } + String[] command = new String[baseCommand.length + sourceCount]; + System.arraycopy(baseCommand, 0, command, 0, baseCommand.length); + // append each of the files to the command string + System.arraycopy(sourceFiles, 0, command, baseCommand.length, sourceCount); + + //PApplet.println(command); + + try { + // Load errors into a local StringBuffer + final StringBuffer errorBuffer = new StringBuffer(); + + // Create single method dummy writer class to slurp errors from javac + Writer internalWriter = new Writer() { + public void write(char[] buf, int off, int len) { + errorBuffer.append(buf, off, len); + } + + public void flush() { } + + public void close() { } + }; + // Wrap as a PrintWriter since that's what compile() wants + PrintWriter writer = new PrintWriter(internalWriter); + + //result = com.sun.tools.javac.Main.compile(command, writer); + + CompilationProgress progress = null; + PrintWriter outWriter = new PrintWriter(System.out); + success = BatchCompiler.compile(command, outWriter, writer, progress); + // Close out the stream for good measure + writer.flush(); + writer.close(); + + BufferedReader reader = + new BufferedReader(new StringReader(errorBuffer.toString())); + //System.err.println(errorBuffer.toString()); + + String line = null; + while ((line = reader.readLine()) != null) { + //System.out.println("got line " + line); // debug + + // get first line, which contains file name, line number, + // and at least the first line of the error message + String errorFormat = "([\\w\\d_]+.java):(\\d+):\\s*(.*):\\s*(.*)\\s*"; + String[] pieces = PApplet.match(line, errorFormat); + //PApplet.println(pieces); + + // if it's something unexpected, die and print the mess to the console + if (pieces == null) { + exception = new RunnerException("Cannot parse error text: " + line); + exception.hideStackTrace(); + // Send out the rest of the error message to the console. + System.err.println(line); + while ((line = reader.readLine()) != null) { + System.err.println(line); + } + break; + } + + // translate the java filename and line number into a un-preprocessed + // location inside a source file or tab in the environment. + String dotJavaFilename = pieces[1]; + // Line numbers are 1-indexed from javac + int dotJavaLineIndex = PApplet.parseInt(pieces[2]) - 1; + String errorMessage = pieces[4]; + + int codeIndex = 0; //-1; + int codeLine = -1; + + // first check to see if it's a .java file + for (int i = 0; i < sketch.getCodeCount(); i++) { + SketchCode code = sketch.getCode(i); + if (code.isExtension("java")) { + if (dotJavaFilename.equals(code.getFileName())) { + codeIndex = i; + codeLine = dotJavaLineIndex; + } + } + } + + // if it's not a .java file, codeIndex will still be 0 + if (codeIndex == 0) { // main class, figure out which tab + //for (int i = 1; i < sketch.getCodeCount(); i++) { + for (int i = 0; i < sketch.getCodeCount(); i++) { + SketchCode code = sketch.getCode(i); + + if (code.isExtension("pde")) { + if (code.getPreprocOffset() <= dotJavaLineIndex) { + codeIndex = i; + //System.out.println("i'm thinkin file " + i); + codeLine = dotJavaLineIndex - code.getPreprocOffset(); + } + } + } + + //if (codeLine != -1) { + //codeLine = dotJavaLineIndex - sketch.getCode(codeIndex).getPreprocOffset(); + //} + } + //System.out.println("code line now " + codeLine); + exception = new RunnerException(errorMessage, codeIndex, codeLine, -1, false); + + // for a test case once message parsing is implemented, + // use new Font(...) since that wasn't getting picked up properly. + + /* + if (errorMessage.equals("cannot find symbol")) { + handleCannotFindSymbol(reader, exception); + + } else if (errorMessage.indexOf("is already defined") != -1) { + reader.readLine(); // repeats the line of code w/ error + int codeColumn = caretColumn(reader.readLine()); + exception = new RunnerException(errorMessage, + codeIndex, codeLine, codeColumn); + + } else if (errorMessage.startsWith("package") && + errorMessage.endsWith("does not exist")) { + // Because imports are stripped out and re-added to the 0th line of + // the preprocessed code, codeLine will always be wrong for imports. + exception = new RunnerException("P" + errorMessage.substring(1) + + ". You might be missing a library."); + } else { + exception = new RunnerException(errorMessage); + } + */ + if (errorMessage.startsWith("The import ") && + errorMessage.endsWith("cannot be resolved")) { + // The import poo cannot be resolved + //import poo.shoe.blah.*; + String what = errorMessage.substring("The import ".length()); + what = what.substring(0, what.indexOf(' ')); + System.err.println("Note that release 1.0, libraries must be " + + "installed in a folder named 'libraries' " + + "inside the 'sketchbook' folder."); + exception.setMessage("The package " + + "\u201C" + what + "\u201D" + + " does not exist. " + + "You might be missing a library."); + + // Actually create the folder and open it for the user + File sketchbookLibraries = Base.getSketchbookLibrariesFolder(); + if (!sketchbookLibraries.exists()) { + if (sketchbookLibraries.mkdirs()) { + Base.openFolder(sketchbookLibraries); + } + } + + } else if (errorMessage.endsWith("cannot be resolved to a type")) { + // xxx cannot be resolved to a type + //xxx c; + + String what = errorMessage.substring(0, errorMessage.indexOf(' ')); + + if (what.equals("BFont") || + what.equals("BGraphics") || + what.equals("BImage")) { + handleCrustyCode(exception); + + } else { + exception.setMessage("Cannot find a class or type " + + "named \u201C" + what + "\u201D"); + } + + } else if (errorMessage.endsWith("cannot be resolved")) { + // xxx cannot be resolved + //println(xxx); + + String what = errorMessage.substring(0, errorMessage.indexOf(' ')); + + if (what.equals("LINE_LOOP") || + what.equals("LINE_STRIP") || + what.equals("framerate")) { + handleCrustyCode(exception); + + } else { + exception.setMessage("Cannot find anything " + + "named \u201C" + what + "\u201D"); + } + + } else if (errorMessage.startsWith("Duplicate")) { + // "Duplicate nested type xxx" + // "Duplicate local variable xxx" + + } else { + String[] parts = null; + + // The method xxx(String) is undefined for the type Temporary_XXXX_XXXX + //xxx("blah"); + // The method xxx(String, int) is undefined for the type Temporary_XXXX_XXXX + //xxx("blah", 34); + // The method xxx(String, int) is undefined for the type PApplet + //PApplet.sub("ding"); + String undefined = + "The method (\\S+\\(.*\\)) is undefined for the type (.*)"; + parts = PApplet.match(errorMessage, undefined); + if (parts != null) { + if (parts[1].equals("framerate(int)") || + parts[1].equals("push()")) { + handleCrustyCode(exception); + } else { + String mess = "The function " + parts[1] + " does not exist."; + exception.setMessage(mess); + } + break; + } + } + if (exception != null) { + // The stack trace just shows that this happened inside the compiler, + // which is a red herring. Don't ever show it for compiler stuff. + exception.hideStackTrace(); + break; + } + } + } catch (IOException e) { + String bigSigh = "Error while compiling. (" + e.getMessage() + ")"; + exception = new RunnerException(bigSigh); + e.printStackTrace(); + success = false; + } + // In case there was something else. + if (exception != null) throw exception; + + return success; + } + + + /** + * Fire up 'ole javac based on this interface. + * + * @param sketch Sketch object to be compiled. + * @param buildPath Where the temporary files live and will be built from. + * @return + * @throws RunnerException Only if there's a problem. Only then. + */ +// public boolean compileJavac(Sketch sketch, +// String buildPath) throws RunnerException { +// // This will be filled in if anyone gets angry +// RunnerException exception = null; +// +// String baseCommand[] = new String[] { +// "-source", "1.5", +// "-target", "1.5", +// "-classpath", sketch.getClassPath(), +// "-nowarn", // we're not currently interested in warnings (ignored?) +// "-d", buildPath // output the classes in the buildPath +// }; +// //PApplet.println(baseCommand); +// +// // make list of code files that need to be compiled +// // (some files are skipped if they contain no class) +// String[] preprocNames = new String[sketch.getCodeCount()]; +// int preprocCount = 0; +// for (int i = 0; i < sketch.getCodeCount(); i++) { +// if (sketch.getCode(i).preprocName != null) { +// preprocNames[preprocCount++] = sketch.getCode(i).preprocName; +// } +// } +// String[] command = new String[baseCommand.length + preprocCount]; +// System.arraycopy(baseCommand, 0, command, 0, baseCommand.length); +// // append each of the files to the command string +// for (int i = 0; i < preprocCount; i++) { +// command[baseCommand.length + i] = +// buildPath + File.separator + preprocNames[i]; +// } +// //PApplet.println(command); +// +// int result = -1; // needs to be set bad by default, in case hits IOE below +// +// try { +// // Load errors into a local StringBuffer +// final StringBuffer errorBuffer = new StringBuffer(); +// +// // Create single method dummy writer class to slurp errors from javac +// Writer internalWriter = new Writer() { +// public void write(char[] buf, int off, int len) { +// errorBuffer.append(buf, off, len); +// } +// +// public void flush() { } +// +// public void close() { } +// }; +// // Wrap as a PrintWriter since that's what compile() wants +// PrintWriter writer = new PrintWriter(internalWriter); +// +// result = com.sun.tools.javac.Main.compile(command, writer); +// +// // Close out the stream for good measure +// writer.flush(); +// writer.close(); +// +//// BufferedReader reader = +//// new BufferedReader(new StringReader(errorBuffer.toString())); +// //System.err.println(errorBuffer.toString()); +// +//// String m = errorBuffer.toString(); +// //ParsePosition mp = new ParsePosition(0); +// +//// while (mp.getIndex() < m.length()) { // reading messages +// String line = null; +// int lineIndex = 0; +// String[] lines = PApplet.split(errorBuffer.toString(), '\n'); +// int lineCount = lines.length; +// while (lineIndex < lineCount) { +// //while ((line = reader.readLine()) != null) { +// //System.out.println("got line " + line); // debug +// +// /* +//compiler.misc.count.error=\ +// {0} error +//compiler.misc.count.error.plural=\ +// {0} errors +//compiler.misc.count.warn=\ +// {0} warning +//compiler.misc.count.warn.plural=\ +// {0} warnings +// */ +// // Check to see if this is the last line. +//// if ((PApplet.match(line, "\\d+ error[s]?") != null) || +//// (PApplet.match(line, "\\d+ warning[s]?") != null)) { +//// break; +//// } +// if (isCompilerMatch(line, "compiler.misc.count.error") || +// isCompilerMatch(line, "compiler.misc.count.error.plural") || +// isCompilerMatch(line, "compiler.misc.count.warn") || +// isCompilerMatch(line, "compiler.misc.count.warn.plural")) { +// break; +// } +// +// // Hide these because people are getting confused +// // http://dev.processing.org/bugs/show_bug.cgi?id=817 +// // com/sun/tools/javac/resources/compiler.properties +// //if (line.startsWith("Note: ")) { +// String compilerNote = compilerResources.getString("compiler.note.note"); +// MessageFormat noteFormat = new MessageFormat(compilerNote + " {0}"); +// Object[] noteFound; +// try { +// noteFound = noteFormat.parse(line); +// if (noteFound != null) { +// System.out.println("gefunden " + noteFound[0]); +// +// /* +// // if you mention serialVersionUID one more time, i'm kickin' you out +// if (line.indexOf("serialVersionUID") != -1) continue; +// // {0} uses unchecked or unsafe operations. +// // Some input files use unchecked or unsafe operations. +// if (line.indexOf("or unsafe operations") != -1) continue; +// // {0} uses or overrides a deprecated API. +// // Some input files use or override a deprecated API. +// if (line.indexOf("or override") != -1) continue; +// // Recompile with -Xlint:deprecation for details. +// // Recompile with -Xlint:unchecked for details. +// if (line.indexOf("Recompile with -Xlint:") != -1) continue; +// System.err.println(line); +// */ +// continue; +// } +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// +// // get first line, which contains file name, line number, +// // and at least the first line of the error message +// String errorFormat = "([\\w\\d_]+.java):(\\d+):\\s*(.*)\\s*"; +// String[] pieces = PApplet.match(line, errorFormat); +// +// // if it's something unexpected, die and print the mess to the console +// if (pieces == null) { +// exception = new RunnerException("Cannot parse error text: " + line); +// exception.hideStackTrace(); +// // Send out the rest of the error message to the console. +// System.err.println(line); +// //while ((line = reader.readLine()) != null) { +// for (int i = lineIndex; i < lineCount; i++) { +// System.err.println(lines[i]); +// } +// break; +// } +// +// // translate the java filename and line number into a un-preprocessed +// // location inside a source file or tab in the environment. +// String dotJavaFilename = pieces[0]; +// // Line numbers are 1-indexed from javac +// int dotJavaLineIndex = PApplet.parseInt(pieces[1]) - 1; +// String errorMessage = pieces[2]; +// +// int codeIndex = -1; +// int codeLine = -1; +// for (int i = 0; i < sketch.getCodeCount(); i++) { +// String name = sketch.getCode(i).preprocName; +// if ((name != null) && dotJavaFilename.equals(name)) { +// codeIndex = i; +// } +// } +// //System.out.println("code index/line are " + codeIndex + " " + codeLine); +// //System.out.println("java line number " + dotJavaLineIndex + " from " + dotJavaFilename); +// +// if (codeIndex == 0) { // main class, figure out which tab +// for (int i = 1; i < sketch.getCodeCount(); i++) { +// SketchCode code = sketch.getCode(i); +// +// if (code.flavor == Sketch.PDE) { +// if (code.preprocOffset <= dotJavaLineIndex) { +// codeIndex = i; +// //System.out.println("i'm thinkin file " + i); +// } +// } +// } +// } +// //System.out.println("preproc offset is " + sketch.getCode(codeIndex).preprocOffset); +// codeLine = dotJavaLineIndex - sketch.getCode(codeIndex).preprocOffset; +// //System.out.println("code line now " + codeLine); +// exception = new RunnerException(errorMessage, codeIndex, codeLine, -1, false); +// +// // for a test case once message parsing is implemented, +// // use new Font(...) since that wasn't getting picked up properly. +// +// if (errorMessage.equals("cannot find symbol")) { +// handleCannotFindSymbol(reader, exception); +// +// } else if (errorMessage.indexOf("is already defined") != -1) { +// reader.readLine(); // repeats the line of code w/ error +// int codeColumn = caretColumn(reader.readLine()); +// exception = new RunnerException(errorMessage, +// codeIndex, codeLine, codeColumn); +// +// } else if (errorMessage.startsWith("package") && +// errorMessage.endsWith("does not exist")) { +// // Because imports are stripped out and re-added to the 0th line of +// // the preprocessed code, codeLine will always be wrong for imports. +// exception = new RunnerException("P" + errorMessage.substring(1) + +// ". You might be missing a library."); +// } else { +// exception = new RunnerException(errorMessage); +// } +// if (exception != null) { +// // The stack trace just shows that this happened inside the compiler, +// // which is a red herring. Don't ever show it for compiler stuff. +// exception.hideStackTrace(); +// break; +// } +// } +// } catch (IOException e) { +// String bigSigh = "Error while compiling. (" + e.getMessage() + ")"; +// exception = new RunnerException(bigSigh); +// e.printStackTrace(); +// result = 1; +// } +// // In case there was something else. +// if (exception != null) throw exception; +// +// // Success means that 'result' is set to zero +// return (result == 0); +// } +// +// +// boolean isCompilerMatch(String line, String format) { +// return compilerMatch(line, format) != null; +// } +// +// +// Object[] compilerMatch(String line, String name) { +// String format = compilerResources.getString(name); +// MessageFormat mf = new MessageFormat(format); +// Object[] matches = null; +// try { +// matches = mf.parse(line); +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// return matches; +// } + + +// boolean isCompilerMatch(String line, ParsePosition pos, String format) { +// return compilerMatch(line, pos, format) != null; +// } +// +// +// Object[] compilerMatch(String line, ParsePosition pos, String name) { +// String format = compilerResources.getString(name); +// MessageFormat mf = new MessageFormat(format); +// Object[] matches = mf.parse(line, pos); +// return matches; +// } + + + // Tell-tale signs of old code copied and pasted from the web. + // Detect classes BFont, BGraphics, BImage; methods framerate, push; + // and variables LINE_LOOP and LINE_STRIP. +// static HashMap crusties = new HashMap(); +// static { +// crusties.put("BFont", new Object()); +// crusties.put("BGraphics", new Object()); +// crusties.put("BImage", new Object()); +// crusties.put("framerate", new Object()); +// crusties.put("push", new Object()); +// crusties.put("LINE_LOOP", new Object()); +// crusties.put("LINE_STRIP", new Object()); +// } + + +// void handleCannotFindSymbol(BufferedReader reader, +// RunnerException rex) throws IOException { +// String symbolLine = reader.readLine(); +// String locationLine = reader.readLine(); +// /*String codeLine =*/ reader.readLine(); +// String caretLine = reader.readLine(); +// rex.setCodeColumn(caretColumn(caretLine)); +// +// String[] pieces = +// PApplet.match(symbolLine, "symbol\\s*:\\s*(\\w+)\\s+(.*)"); +// if (pieces != null) { +// if (pieces[0].equals("class") || +// pieces[0].equals("variable")) { +// rex.setMessage("Cannot find a " + pieces[0] + " " + +// "named \u201C" + pieces[1] + "\u201D"); +// if (crusties.get(pieces[1]) != null) { +// handleCrustyCode(rex); +// } +// +// } else if (pieces[0].equals("method")) { +// int leftParen = pieces[1].indexOf("("); +// int rightParen = pieces[1].indexOf(")"); +// +// String methodName = pieces[1].substring(0, leftParen); +// String methodParams = pieces[1].substring(leftParen + 1, rightParen); +// +// String message = +// "Cannot find a function named \u201C" + methodName + "\u201D"; +// if (methodParams.length() > 0) { +// if (methodParams.indexOf(',') != -1) { +// message += " with parameters "; +// } else { +// message += " with parameter "; +// } +// message += methodParams; +// } +// +// String locationClass = "location: class "; +// if (locationLine.startsWith(locationClass) && +// // don't include the class name when it's a temp class +// locationLine.indexOf("Temporary_") == -1) { +// String className = locationLine.substring(locationClass.length()); +// // If no dot exists, -1 + 1 is 0, so this will have no effect. +// className = className.substring(className.lastIndexOf('.') + 1); +// int bracket = className.indexOf('['); +// if (bracket == -1) { +// message += " in class " + className; +// } else { +// className = className.substring(0, bracket); +// message += " for an array of " + className + " objects"; +// } +// } +// message += "."; +// rex.setMessage(message); +// +// // On second thought, make sure this isn't just some alpha/beta code +// if (crusties.get(methodName) != null) { +// handleCrustyCode(rex); +// } +// +// } else { +// System.out.println(symbolLine); +// } +// } +// } + + + void handleCrustyCode(RunnerException rex) { + rex.setMessage("This code needs to be updated, " + + "please read the \u201Cchanges\u201D reference."); + Base.showReference("changes.html"); + } + + + protected int caretColumn(String caretLine) { + return caretLine.indexOf("^"); + } + + + ///////////////////////////////////////////////////////////////////////////// + + + /** + * Given a folder, return a list of absolute paths to all jar or zip files + * inside that folder, separated by pathSeparatorChar. + * + * This will prepend a colon (or whatever the path separator is) + * so that it can be directly appended to another path string. + * + * As of 0136, this will no longer add the root folder as well. + * + * This function doesn't bother checking to see if there are any .class + * files in the folder or within a subfolder. + */ + static public String contentsToClassPath(File folder) { + if (folder == null) return ""; + + StringBuffer abuffer = new StringBuffer(); + String sep = System.getProperty("path.separator"); + + try { + String path = folder.getCanonicalPath(); + +// disabled as of 0136 + // add the folder itself in case any unzipped files +// abuffer.append(sep); +// abuffer.append(path); +// + // When getting the name of this folder, make sure it has a slash + // after it, so that the names of sub-items can be added. + if (!path.endsWith(File.separator)) { + path += File.separator; + } + + String list[] = folder.list(); + for (int i = 0; i < list.length; i++) { + // Skip . and ._ files. Prior to 0125p3, .jar files that had + // OS X AppleDouble files associated would cause trouble. + if (list[i].startsWith(".")) continue; + + if (list[i].toLowerCase().endsWith(".jar") || + list[i].toLowerCase().endsWith(".zip")) { + abuffer.append(sep); + abuffer.append(path); + abuffer.append(list[i]); + } + } + } catch (IOException e) { + e.printStackTrace(); // this would be odd + } + //System.out.println("included path is " + abuffer.toString()); + //packageListFromClassPath(abuffer.toString()); // WHY? + return abuffer.toString(); + } + + + /** + * A classpath, separated by the path separator, will contain + * a series of .jar/.zip files or directories containing .class + * files, or containing subdirectories that have .class files. + * + * @param path the input classpath + * @return array of possible package names + */ + static public String[] packageListFromClassPath(String path) { + Hashtable table = new Hashtable(); + String pieces[] = + PApplet.split(path, File.pathSeparatorChar); + + for (int i = 0; i < pieces.length; i++) { + //System.out.println("checking piece '" + pieces[i] + "'"); + if (pieces[i].length() == 0) continue; + + if (pieces[i].toLowerCase().endsWith(".jar") || + pieces[i].toLowerCase().endsWith(".zip")) { + //System.out.println("checking " + pieces[i]); + packageListFromZip(pieces[i], table); + + } else { // it's another type of file or directory + File dir = new File(pieces[i]); + if (dir.exists() && dir.isDirectory()) { + packageListFromFolder(dir, null, table); + //importCount = magicImportsRecursive(dir, null, + // table); + //imports, importCount); + } + } + } + int tableCount = table.size(); + String output[] = new String[tableCount]; + int index = 0; + Enumeration e = table.keys(); + while (e.hasMoreElements()) { + output[index++] = ((String) e.nextElement()).replace('/', '.'); + } + //System.arraycopy(imports, 0, output, 0, importCount); + //PApplet.printarr(output); + return output; + } + + + static private void packageListFromZip(String filename, Hashtable table) { + try { + ZipFile file = new ZipFile(filename); + Enumeration entries = file.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = (ZipEntry) entries.nextElement(); + + if (!entry.isDirectory()) { + String name = entry.getName(); + + if (name.endsWith(".class")) { + int slash = name.lastIndexOf('/'); + if (slash == -1) continue; + + String pname = name.substring(0, slash); + if (table.get(pname) == null) { + table.put(pname, new Object()); + } + } + } + } + } catch (IOException e) { + System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")"); + //e.printStackTrace(); + } + } + + + /** + * Make list of package names by traversing a directory hierarchy. + * Each time a class is found in a folder, add its containing set + * of folders to the package list. If another folder is found, + * walk down into that folder and continue. + */ + static private void packageListFromFolder(File dir, String sofar, + Hashtable table) { + //String imports[], + //int importCount) { + //System.err.println("checking dir '" + dir + "'"); + boolean foundClass = false; + String files[] = dir.list(); + + for (int i = 0; i < files.length; i++) { + if (files[i].equals(".") || files[i].equals("..")) continue; + + File sub = new File(dir, files[i]); + if (sub.isDirectory()) { + String nowfar = + (sofar == null) ? files[i] : (sofar + "." + files[i]); + packageListFromFolder(sub, nowfar, table); + //System.out.println(nowfar); + //imports[importCount++] = nowfar; + //importCount = magicImportsRecursive(sub, nowfar, + // imports, importCount); + } else if (!foundClass) { // if no classes found in this folder yet + if (files[i].endsWith(".class")) { + //System.out.println("unique class: " + files[i] + " for " + sofar); + table.put(sofar, new Object()); + foundClass = true; + } + } + } + } +} diff --git a/app/src/processing/app/debug/EventThread.java b/app/src/processing/app/debug/EventThread.java new file mode 100644 index 000000000..918600f1f --- /dev/null +++ b/app/src/processing/app/debug/EventThread.java @@ -0,0 +1,424 @@ +/* + * @(#)EventThread.java 1.4 03/01/23 + * + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ +/* + * Copyright (c) 1997-2001 by Sun Microsystems, Inc. All Rights Reserved. + * + * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, + * modify and redistribute this software in source and binary code form, + * provided that i) this copyright notice and license appear on all copies of + * the software; and ii) Licensee does not utilize the software in a manner + * which is disparaging to Sun. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY + * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR + * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE + * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS + * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, + * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER + * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF + * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * This software is not designed or intended for use in on-line control of + * aircraft, air traffic, aircraft navigation or aircraft communications; or in + * the design, construction, operation or maintenance of any nuclear + * facility. Licensee represents and warrants that it will not use or + * redistribute the Software for such purposes. + */ + +package processing.app.debug; + +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import com.sun.jdi.Field; +import com.sun.jdi.IncompatibleThreadStateException; +import com.sun.jdi.ThreadReference; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.event.ClassPrepareEvent; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.EventQueue; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.MethodEntryEvent; +import com.sun.jdi.event.MethodExitEvent; +import com.sun.jdi.event.ModificationWatchpointEvent; +import com.sun.jdi.event.StepEvent; +import com.sun.jdi.event.ThreadDeathEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMStartEvent; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.request.ModificationWatchpointRequest; +import com.sun.jdi.request.StepRequest; + +/** + * This class processes incoming JDI events and displays them + * + * @version @(#) EventThread.java 1.4 03/01/23 23:33:38 + * @author Robert Field + */ +public class EventThread extends Thread { + + private final Runner parent; + private final VirtualMachine vm; // Running VM + private final String[] excludes; // Packages to exclude + private final PrintWriter writer; // Where output goes + + static String nextBaseIndent = ""; // Starting indent for next thread + + private boolean connected = true; // Connected to VM + private boolean vmDied = true; // VMDeath occurred + + // Maps ThreadReference to ThreadTrace instances + private Map traceMap = new HashMap(); + + EventThread(Runner parent, VirtualMachine vm, String[] excludes, PrintWriter writer) { + super("event-handler"); + this.parent = parent; + this.vm = vm; + this.excludes = excludes; + this.writer = writer; + } + + /** + * Run the event handling thread. + * As long as we are connected, get event sets off + * the queue and dispatch the events within them. + */ + public void run() { + EventQueue queue = vm.eventQueue(); + while (connected) { + try { + EventSet eventSet = queue.remove(); + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + handleEvent(it.nextEvent()); + } + eventSet.resume(); + } catch (InterruptedException exc) { + // Ignore + } catch (VMDisconnectedException discExc) { + handleDisconnectedException(); + break; + } + } + } + + /** + * Create the desired event requests, and enable + * them so that we will get events. + * @param excludes Class patterns for which we don't want events + * @param watchFields Do we want to watch assignments to fields + */ + void setEventRequests(boolean watchFields) { + EventRequestManager mgr = vm.eventRequestManager(); + +// VMDeathRequest deathReq = mgr.createVMDeathRequest(); +// deathReq.setSuspendPolicy(EventRequest.SUSPEND_ALL); +// deathReq.enable(); + + // want all exceptions + ExceptionRequest excReq = mgr.createExceptionRequest(null, false, true); + //ExceptionRequest excReq = mgr.createExceptionRequest(null, true, true); + // suspend so we can step + excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL); + excReq.enable(); + + /* + MethodEntryRequest menr = mgr.createMethodEntryRequest(); + for (int i=0; i 0) { + indent.append("| "); + } + + EventRequestManager mgr = vm.eventRequestManager(); + mgr.deleteEventRequest(event.request()); + } + + void threadDeathEvent(ThreadDeathEvent event) { + indent = new StringBuffer(baseIndent); + println("====== " + thread.name() + " end ======"); + } + } + + /** + * Returns the ThreadTrace instance for the specified thread, + * creating one if needed. + */ + ThreadTrace threadTrace(ThreadReference thread) { + ThreadTrace trace = (ThreadTrace)traceMap.get(thread); + if (trace == null) { + trace = new ThreadTrace(thread); + traceMap.put(thread, trace); + } + return trace; + } + + /** + * Dispatch incoming events + */ + private void handleEvent(Event event) { + if (event instanceof ExceptionEvent) { + exceptionEvent((ExceptionEvent)event); + } else if (event instanceof ModificationWatchpointEvent) { + fieldWatchEvent((ModificationWatchpointEvent)event); + } else if (event instanceof MethodEntryEvent) { + methodEntryEvent((MethodEntryEvent)event); + } else if (event instanceof MethodExitEvent) { + methodExitEvent((MethodExitEvent)event); + } else if (event instanceof StepEvent) { + stepEvent((StepEvent)event); + } else if (event instanceof ThreadDeathEvent) { + threadDeathEvent((ThreadDeathEvent)event); + } else if (event instanceof ClassPrepareEvent) { + classPrepareEvent((ClassPrepareEvent)event); + } else if (event instanceof VMStartEvent) { + vmStartEvent((VMStartEvent)event); + } else if (event instanceof VMDeathEvent) { + vmDeathEvent((VMDeathEvent)event); + } else if (event instanceof VMDisconnectEvent) { + vmDisconnectEvent((VMDisconnectEvent)event); + } else { + throw new Error("Unexpected event type"); + } + } + + /*** + * A VMDisconnectedException has happened while dealing with + * another event. We need to flush the event queue, dealing only + * with exit events (VMDeath, VMDisconnect) so that we terminate + * correctly. + */ + synchronized void handleDisconnectedException() { + EventQueue queue = vm.eventQueue(); + while (connected) { + try { + EventSet eventSet = queue.remove(); + EventIterator iter = eventSet.eventIterator(); + while (iter.hasNext()) { + Event event = iter.nextEvent(); + if (event instanceof VMDeathEvent) { + vmDeathEvent((VMDeathEvent)event); + } else if (event instanceof VMDisconnectEvent) { + vmDisconnectEvent((VMDisconnectEvent)event); + } + } + eventSet.resume(); // Resume the VM + } catch (InterruptedException exc) { + // ignore + } + } + } + + private void vmStartEvent(VMStartEvent event) { + if (writer != null) writer.println("-- VM Started --"); + } + + // Forward event for thread specific processing + private void methodEntryEvent(MethodEntryEvent event) { + threadTrace(event.thread()).methodEntryEvent(event); + } + + // Forward event for thread specific processing + private void methodExitEvent(MethodExitEvent event) { + threadTrace(event.thread()).methodExitEvent(event); + } + + // Forward event for thread specific processing + private void stepEvent(StepEvent event) { + threadTrace(event.thread()).stepEvent(event); + } + + // Forward event for thread specific processing + private void fieldWatchEvent(ModificationWatchpointEvent event) { + threadTrace(event.thread()).fieldWatchEvent(event); + } + + void threadDeathEvent(ThreadDeathEvent event) { + ThreadTrace trace = (ThreadTrace)traceMap.get(event.thread()); + if (trace != null) { // only want threads we care about + trace.threadDeathEvent(event); // Forward event + } + } + + /** + * A new class has been loaded. + * Set watchpoints on each of its fields + */ + private void classPrepareEvent(ClassPrepareEvent event) { +// System.out.println(event); +// List list = event.referenceType().methodsByName("stop"); +// Object o = list.get(0); +// System.out.println("stop methods = " + list); +// System.out.println(o.getClass()); + + EventRequestManager mgr = vm.eventRequestManager(); + List fields = event.referenceType().visibleFields(); + for (Iterator it = fields.iterator(); it.hasNext(); ) { + Field field = (Field)it.next(); + ModificationWatchpointRequest req = + mgr.createModificationWatchpointRequest(field); + for (int i=0; i + * Different instances of MessageStream need to do different things with + * messages. In particular, a stream instance used for parsing output from + * the compiler compiler has to interpret its messages differently than one + * parsing output from the runtime. + *

+ * Classes which consume messages and do something with them + * should implement this interface. + */ +public interface MessageConsumer { + + public void message(String s); + +} diff --git a/app/src/processing/app/debug/MessageSiphon.java b/app/src/processing/app/debug/MessageSiphon.java new file mode 100644 index 000000000..60b3e8c32 --- /dev/null +++ b/app/src/processing/app/debug/MessageSiphon.java @@ -0,0 +1,87 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.debug; + +import java.io.*; + + +/** + * Slurps up messages from compiler. + */ +class MessageSiphon implements Runnable { + BufferedReader streamReader; + Thread thread; + MessageConsumer consumer; + + + public MessageSiphon(InputStream stream, MessageConsumer consumer) { + this.streamReader = new BufferedReader(new InputStreamReader(stream)); + this.consumer = consumer; + + thread = new Thread(this); + // don't set priority too low, otherwise exceptions won't + // bubble up in time (i.e. compile errors have a weird delay) + //thread.setPriority(Thread.MIN_PRIORITY); + thread.setPriority(Thread.MAX_PRIORITY-1); + //thread.start(); + } + + + public void run() { + try { + // process data until we hit EOF; this will happily block + // (effectively sleeping the thread) until new data comes in. + // when the program is finally done, null will come through. + // + String currentLine; + while ((currentLine = streamReader.readLine()) != null) { + // \n is added again because readLine() strips it out + //EditorConsole.systemOut.println("messaging in"); + consumer.message(currentLine + "\n"); + //EditorConsole.systemOut.println("messaging out"); + } + //EditorConsole.systemOut.println("messaging thread done"); + thread = null; + + } catch (NullPointerException npe) { + // Fairly common exception during shutdown + thread = null; + + } catch (Exception e) { + // On Linux and sometimes on Mac OS X, a "bad file descriptor" + // message comes up when closing an applet that's run externally. + // That message just gets supressed here.. + String mess = e.getMessage(); + if ((mess != null) && + (mess.indexOf("Bad file descriptor") != -1)) { + //if (e.getMessage().indexOf("Bad file descriptor") == -1) { + //System.err.println("MessageSiphon err " + e); + //e.printStackTrace(); + } else { + e.printStackTrace(); + } + thread = null; + } + } +} diff --git a/app/src/processing/app/debug/MessageStream.java b/app/src/processing/app/debug/MessageStream.java new file mode 100644 index 000000000..9ea7caeb9 --- /dev/null +++ b/app/src/processing/app/debug/MessageStream.java @@ -0,0 +1,62 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.debug; + +import java.io.*; + + +/** + * OutputStream to handle stdout/stderr messages. + *

+ * This is used by Editor, System.err is set to + * new PrintStream(new MessageStream()). + * It's also used by Compiler. + */ +class MessageStream extends OutputStream { + + MessageConsumer messageConsumer; + + public MessageStream(MessageConsumer messageConsumer) { + this.messageConsumer = messageConsumer; + } + + public void close() { } + + public void flush() { } + + public void write(byte b[]) { + // this never seems to get called + System.out.println("leech1: " + new String(b)); + } + + public void write(byte b[], int offset, int length) { + //System.out.println("leech2: " + new String(b)); + this.messageConsumer.message(new String(b, offset, length)); + } + + public void write(int b) { + // this never seems to get called + System.out.println("leech3: '" + ((char)b) + "'"); + } +} diff --git a/app/src/processing/app/debug/Runner.java b/app/src/processing/app/debug/Runner.java new file mode 100644 index 000000000..b63f6ed74 --- /dev/null +++ b/app/src/processing/app/debug/Runner.java @@ -0,0 +1,1039 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.debug; + +import processing.app.*; +import processing.core.*; + +import java.awt.Point; +import java.io.*; +import java.util.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.event.ExceptionEvent; + + +/** + * Runs a compiled sketch. As of release 0136, all sketches are run externally + * to the environment so that a debugging interface can be used. This opens up + * future options for a decent debugger, but in the meantime fixes several + * problems with output and error streams, messages getting lost on Mac OS X, + * the run/stop buttons not working, libraries not shutting down, exceptions + * not coming through, exceptions being printed twice, having to force quit + * if you make a bad while() loop, and so on. + */ +public class Runner implements MessageConsumer { + + private boolean presenting; + + // Object that listens for error messages or exceptions. + private RunnerListener listener; + + // Running remote VM + private VirtualMachine vm; + + // Thread transferring remote error stream to our error stream + private Thread errThread = null; + + // Thread transferring remote output stream to our output stream + private Thread outThread = null; + + // Mode for tracing the Trace program (default= 0 off) + private int debugTraceMode = 0; + + // Do we want to watch assignments to fields + private boolean watchFields = false; + + // Class patterns for which we don't want events + private String[] excludes = { + "java.*", "javax.*", "sun.*", "com.sun.*", + "apple.*", + "processing.*" + }; + + private RunnerException exception; + //private PrintStream leechErr; + + private Editor editor; + private Sketch sketch; + private String appletClassName; + +// private boolean newMessage; +// private int messageLineCount; +// private boolean foundMessageSource; +// +// private SystemOutSiphon processInput; +// private OutputStream processOutput; +// private MessageSiphon processError; + + + public Runner(Sketch sketch, String appletClassName, + boolean presenting, RunnerListener listener) { + this.sketch = sketch; + this.appletClassName = appletClassName; + this.presenting = presenting; + this.listener = listener; + + if (listener instanceof Editor) { + this.editor = (Editor) listener; + } + } + + + public void launch() { + // TODO entire class is a total mess as of release 0136. + // This will be cleaned up significantly over the next couple months. + + // all params have to be stored as separate items, + // so a growable array needs to be used. i.e. -Xms128m -Xmx1024m + // will throw an error if it's shoved into a single array element + //Vector params = new Vector(); + + // get around Apple's Java 1.5 bugs + //params.add("/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java"); + //params.add("java"); + //System.out.println("0"); + + String[] machineParamList = getMachineParams(); + String[] sketchParamList = getSketchParams(); + + vm = launchVirtualMachine(machineParamList, sketchParamList); + if (vm != null) { + generateTrace(null); +// try { +// generateTrace(new PrintWriter("/Users/fry/Desktop/output.txt")); +// } catch (Exception e) { +// e.printStackTrace(); +// } + } + } + + + protected String[] getMachineParams() { + ArrayList params = new ArrayList(); + + //params.add("-Xint"); // interpreted mode + //params.add("-Xprof"); // profiler + //params.add("-Xaprof"); // allocation profiler + //params.add("-Xrunhprof:cpu=samples"); // old-style profiler + + // TODO change this to use run.args = true, run.args.0, run.args.1, etc. + // so that spaces can be included in the arg names + String options = Preferences.get("run.options"); + if (options.length() > 0) { + String pieces[] = PApplet.split(options, ' '); + for (int i = 0; i < pieces.length; i++) { + String p = pieces[i].trim(); + if (p.length() > 0) { + params.add(p); + } + } + } + +// params.add("-Djava.ext.dirs=nuffing"); + + if (Preferences.getBoolean("run.options.memory")) { + params.add("-Xms" + Preferences.get("run.options.memory.initial") + "m"); + params.add("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); + } + + if (Base.isMacOS()) { + params.add("-Xdock:name=" + appletClassName); +// params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" + +// sketch.getMainClassName()); + } + // sketch.libraryPath might be "" + // librariesClassPath will always have sep char prepended + params.add("-Djava.library.path=" + + sketch.getLibraryPath() + + File.pathSeparator + + System.getProperty("java.library.path")); + + params.add("-cp"); + params.add(sketch.getClassPath()); +// params.add(sketch.getClassPath() + +// File.pathSeparator + +// Base.librariesClassPath); + + //PApplet.println(PApplet.split(sketch.classPath, ':')); + + String outgoing[] = new String[params.size()]; + params.toArray(outgoing); + + //PApplet.println(outgoing); +// PApplet.println(PApplet.split(outgoing[0], ":")); +// PApplet.println(); +// PApplet.println("class path"); +// PApplet.println(PApplet.split(outgoing[2], ":")); + + return outgoing; + //return (String[]) params.toArray(); + +// System.out.println("sketch class path"); +// PApplet.println(PApplet.split(sketch.classPath, ';')); +// System.out.println(); +// System.out.println("libraries class path"); +// PApplet.println(PApplet.split(Base.librariesClassPath, ';')); +// System.out.println(); + } + + + protected String[] getSketchParams() { + ArrayList params = new ArrayList(); + + params.add("processing.core.PApplet"); + + // If there was a saved location (this guy has been run more than once) + // then the location will be set to the last position of the sketch window. + // This will be passed to the PApplet runner using something like + // --location=30,20 + // Otherwise, the editor location will be passed, and the applet will + // figure out where to place itself based on the editor location. + // --editor-location=150,20 + if (editor != null) { // if running processing-cmd, don't do placement + Point windowLocation = editor.getSketchLocation(); + if (windowLocation != null) { + params.add(PApplet.ARGS_LOCATION + "=" + + windowLocation.x + "," + windowLocation.y); + } else { + Point editorLocation = editor.getLocation(); + params.add(PApplet.ARGS_EDITOR_LOCATION + "=" + + editorLocation.x + "," + editorLocation.y); + } + params.add(PApplet.ARGS_EXTERNAL); + } + + params.add(PApplet.ARGS_DISPLAY + "=" + + Preferences.get("run.display")); + params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + + sketch.getFolder().getAbsolutePath()); + + if (presenting) { + params.add(PApplet.ARGS_PRESENT); + if (Preferences.getBoolean("run.present.exclusive")) { + params.add(PApplet.ARGS_EXCLUSIVE); + } + params.add(PApplet.ARGS_STOP_COLOR + "=" + + Preferences.get("run.present.stop.color")); + params.add(PApplet.ARGS_BGCOLOR + "=" + + Preferences.get("run.present.bgcolor")); + } + + params.add(appletClassName); + +// String outgoing[] = new String[params.size()]; +// params.toArray(outgoing); +// return outgoing; + return (String[]) params.toArray(new String[0]); + } + + + /* + protected VirtualMachine launchVirtualMachine_sun(String[] vmParams, String[] classParams) { + //vm = launchTarget(sb.toString()); + LaunchingConnector connector = + findLaunchingConnector("com.sun.jdi.CommandLineLaunch"); + //Map arguments = connectorArguments(connector, mainArgs); + + PApplet.println(connector); // gets the defaults + + Map arguments = connector.defaultArguments(); + //System.out.println(arguments); + +// for (Iterator itr = arguments.keySet().iterator(); itr.hasNext(); ) { +// Connector.Argument argument = +// (Connector.Argument) arguments.get(itr.next()); +// System.out.println(argument); +// } + + //connector.transport(). + + Connector.Argument mainArg = + (Connector.Argument)arguments.get("main"); + if (mainArg == null) { + throw new Error("Bad launching connector"); + } + String mainArgs = ""; + //mainArgs = addArgument(mainArgs, className); + if (classParams != null) { + for (int i = 0; i < classParams.length; i++) { + mainArgs = addArgument(mainArgs, classParams[i], ' '); + } + } + mainArg.setValue(mainArgs); + + //System.out.println("main args are: "); + //System.out.println(mainArgs); + +// if (watchFields) { +// // We need a VM that supports watchpoints +// Connector.Argument optionArg = +// (Connector.Argument)arguments.get("options"); +// if (optionArg == null) { +// throw new Error("Bad launching connector"); +// } +// optionArg.setValue("-classic"); +// } + String optionArgs = ""; + for (int i = 0; i < vmParams.length; i++) { + optionArgs = addArgument(optionArgs, vmParams[i], ' '); + } + // prevent any incorrect transport address b.s. from being added + // -Xrunjdwp:transport=dt_socket,address=cincinnati118.ipcorporate.com:55422,suspend=y + //optionArgs = addArgument(optionArgs, "-agentlib:jdwp=transport=dt_socket,address=localhost:12345,suspend=y", ' '); + //optionArgs += " -Xrunjdwp:transport=dt_socket,address=localhost:55422,suspend=y"; + //optionArgs = optionArgs + " -agentlib:jdwp=transport=dt_socket"; + //optionArgs = addArgument(optionArgs, "-Xrunjdwp:transport=dt_socket,address=localhost:55422,suspend=y", ' '); + + //optionArgs = addArgument(optionArgs, "address=127.0.0.1:54321", ' '); + //optionArgs = addArgument(optionArgs, "localAddress", ' '); + + Connector.Argument optionArg = + (Connector.Argument)arguments.get("options"); + optionArg.setValue(optionArgs); + +// Connector.Argument addressArg = +// (Connector.Argument)arguments.get("address"); + //arguments.put("raw.address", new Connector.Argument("blah")); + //PApplet.println("it's gonna be " + addressArg); + + //arguments.put("address", "localhost"); + +// Connector.Argument addressArg = +// (Connector.Argument)arguments.get("address"); +// addressArg.setValue("localhost"); + +// System.out.println("option args are: "); +// System.out.println(arguments.get("options")); + + System.out.println("args are " + arguments); + + // com.sun.tools.jdi.SunCommandLineLauncher + + // http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#sunlaunch + try { + return connector.launch(arguments); + } catch (IOException exc) { + throw new Error("Unable to launch target VM: " + exc); + } catch (IllegalConnectorArgumentsException exc) { + throw new Error("Internal error: " + exc); + } catch (VMStartException exc) { + exc.printStackTrace(); + System.err.println(); + System.err.println("Could not run the sketch."); + System.err.println("Make sure that you haven't set the maximum available memory too high."); + System.err.println("For more information, read revisions.txt and Help -> Troubleshooting."); + //System.err.println("Target VM failed to initialize:"); + //System.err.println("msg is " + exc.getMessage()); + //exc.printStackTrace(); + //throw new Error("Target VM failed to initialize: " + + //exc.getMessage()); + //throw new Error(exc.getMessage()); + //throw new RunnerException(exc.getMessage()); + //editor.error(exc); + editor.error("Could not run the sketch."); + return null; + } + } + */ + + + protected VirtualMachine launchVirtualMachine(String[] vmParams, + String[] classParams) { + //vm = launchTarget(sb.toString()); + LaunchingConnector connector = + findLaunchingConnector("com.sun.jdi.RawCommandLineLaunch"); + //PApplet.println(connector); // gets the defaults + + //Map arguments = connectorArguments(connector, mainArgs); + Map arguments = connector.defaultArguments(); + + Connector.Argument commandArg = + (Connector.Argument)arguments.get("command"); + // Using localhost instead of 127.0.0.1 sometimes causes a + // "Transport Error 202" error message when trying to run. + // http://dev.processing.org/bugs/show_bug.cgi?id=895 + String addr = "127.0.0.1:" + (8000 + (int) (Math.random() * 1000)); + //String addr = "localhost:" + (8000 + (int) (Math.random() * 1000)); + //String addr = "" + (8000 + (int) (Math.random() * 1000)); + + String commandArgs = Base.isWindows() ? + "java -Xrunjdwp:transport=dt_shmem,address=" + addr + ",suspend=y " : + "java -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y "; + //String commandArgs = "java -agentlib:jdwp=transport=dt_socket,address=" + addr + ",suspend=y "; + //String commandArgs = "java -agentlib:jdwp=transport=dt_socket,address=" + addr + ",server=n,suspend=y "; + for (int i = 0; i < vmParams.length; i++) { + commandArgs = addArgument(commandArgs, vmParams[i], ' '); + } + if (classParams != null) { + for (int i = 0; i < classParams.length; i++) { + commandArgs = addArgument(commandArgs, classParams[i], ' '); + } + } + commandArg.setValue(commandArgs); + + Connector.Argument addressArg = + (Connector.Argument)arguments.get("address"); + addressArg.setValue(addr); + + //PApplet.println(connector); // prints the current + //com.sun.tools.jdi.AbstractLauncher al; + //com.sun.tools.jdi.RawCommandLineLauncher rcll; + + //System.out.println(PApplet.javaVersion); + // http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#sunlaunch + try { + return connector.launch(arguments); + } catch (IOException exc) { + throw new Error("Unable to launch target VM: " + exc); + } catch (IllegalConnectorArgumentsException exc) { + throw new Error("Internal error: " + exc); + } catch (VMStartException exc) { + Process p = exc.process(); + //System.out.println(p); + String[] errorStrings = PApplet.loadStrings(p.getErrorStream()); + /*String[] inputStrings =*/ PApplet.loadStrings(p.getInputStream()); + + if (errorStrings != null && errorStrings.length > 1) { + if (errorStrings[0].indexOf("Invalid maximum heap size") != -1) { + Base.showWarning("Way Too High", + "Please lower the value for \u201Cmaximum available memory\u201D in the\n" + + "Preferences window. For more information, read Help \u2192 Troubleshooting.", + exc); + } else { + PApplet.println(errorStrings); + System.err.println("Using startup command:"); + PApplet.println(arguments); + } + } else { + exc.printStackTrace(); + System.err.println("Could not run the sketch (Target VM failed to initialize)."); + if (Preferences.getBoolean("run.options.memory")) { + // Only mention this if they've even altered the memory setup + System.err.println("Make sure that you haven't set the maximum available memory too high."); + } + System.err.println("For more information, read revisions.txt and Help \u2192 Troubleshooting."); + } + if (editor != null) { + listener.statusError("Could not run the sketch."); + } + return null; + } + } + + + private static boolean hasWhitespace(String string) { + int length = string.length(); + for (int i = 0; i < length; i++) { + if (Character.isWhitespace(string.charAt(i))) { + return true; + } + } + return false; + } + + + private static String addArgument(String string, String argument, char sep) { + if (hasWhitespace(argument) || argument.indexOf(',') != -1) { + // Quotes were stripped out for this argument, add 'em back. + StringBuffer buffer = new StringBuffer(string); + buffer.append('"'); + for (int i = 0; i < argument.length(); i++) { + char c = argument.charAt(i); + if (c == '"') { + buffer.append('\\'); + } + buffer.append(c); + } + buffer.append('\"'); + buffer.append(sep); + return buffer.toString(); + } else { + return string + argument + String.valueOf(sep); + } + } + + + /** + * Generate the trace. + * Enable events, start thread to display events, + * start threads to forward remote error and output streams, + * resume the remote VM, wait for the final event, and shutdown. + */ + void generateTrace(PrintWriter writer) { + vm.setDebugTraceMode(debugTraceMode); + + EventThread eventThread = null; + //if (writer != null) { + eventThread = new EventThread(this, vm, excludes, writer); + eventThread.setEventRequests(watchFields); + eventThread.start(); + //} + + //redirectOutput(); + + Process process = vm.process(); + +// processInput = new SystemOutSiphon(process.getInputStream()); +// processError = new MessageSiphon(process.getErrorStream(), this); + + // Copy target's output and error to our output and error. +// errThread = new StreamRedirectThread("error reader", +// process.getErrorStream(), +// System.err); + MessageSiphon ms = new MessageSiphon(process.getErrorStream(), this); + errThread = ms.thread; + + outThread = new StreamRedirectThread("output reader", + process.getInputStream(), + System.out); + + errThread.start(); + outThread.start(); + + vm.resume(); + //System.out.println("done with resume"); + + // Shutdown begins when event thread terminates + try { + if (eventThread != null) eventThread.join(); + // Bug #852 tracked to this next line in the code. + // http://dev.processing.org/bugs/show_bug.cgi?id=852 + errThread.join(); // Make sure output is forwarded + outThread.join(); // before we exit + //System.out.println("out of it"); + + // At this point, disable the run button. + // This happens when the sketch is exited by hitting ESC, + // or the user manually closes the sketch window. + // TODO this should be handled better, should it not? + if (editor != null) { + editor.internalRunnerClosed(); + } + + } catch (InterruptedException exc) { + // we don't interrupt + } + //System.out.println("and leaving"); + if (writer != null) writer.close(); + } + + + /** + * Find a com.sun.jdi.CommandLineLaunch connector + */ + LaunchingConnector findLaunchingConnector(String connectorName) { + //VirtualMachineManager mgr = Bootstrap.virtualMachineManager(); + + // Get the default connector. + // Not useful here since they all need different args. +// System.out.println(Bootstrap.virtualMachineManager().defaultConnector()); +// return Bootstrap.virtualMachineManager().defaultConnector(); + + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + + // code to list available connectors +// Iterator iter2 = connectors.iterator(); +// while (iter2.hasNext()) { +// Connector connector = (Connector)iter2.next(); +// System.out.println("connector name is " + connector.name()); +// } + + Iterator iter = connectors.iterator(); + while (iter.hasNext()) { + Connector connector = (Connector)iter.next(); + if (connector.name().equals(connectorName)) { + return (LaunchingConnector)connector; + } + } + throw new Error("No launching connector"); + } + + + public void exception(ExceptionEvent event) { + ObjectReference or = event.exception(); + ReferenceType rt = or.referenceType(); + String exceptionName = rt.name(); + //Field messageField = Throwable.class.getField("detailMessage"); + Field messageField = rt.fieldByName("detailMessage"); +// System.out.println("field " + messageField); + Value messageValue = or.getValue(messageField); +// System.out.println("mess val " + messageValue); + + int last = exceptionName.lastIndexOf('.'); + String message = exceptionName.substring(last + 1); + if (messageValue != null) { + String messageStr = messageValue.toString(); + if (messageStr.startsWith("\"")) { + messageStr = messageStr.substring(1, messageStr.length() - 1); + } + message += ": " + messageStr; + } +// System.out.println("mess type " + messageValue.type()); + //StringReference messageReference = (StringReference) messageValue.type(); + +// System.out.println(or.referenceType().fields()); +// if (name.startsWith("java.lang.")) { +// name = name.substring(10); + if (exceptionName.equals("java.lang.OutOfMemoryError")) { + listener.statusError("OutOfMemoryError: You may need to increase the memory setting in Preferences."); + System.err.println("An OutOfMemoryError means that your code is either using up too much memory"); + System.err.println("because of a bug (e.g. creating an array that's too large, or unintentionally"); + System.err.println("loading thousands of images), or that your sketch may need more memory to run."); + System.err.println("If your sketch uses a lot of memory (for instance if it loads a lot of data files)"); + System.err.println("you can increase the memory available to your sketch using the Preferences window."); + + } else if (exceptionName.equals("java.lang.StackOverflowError")) { + listener.statusError("StackOverflowError: This sketch is attempting too much recursion."); + System.err.println("A StackOverflowError means that you have a bug that's causing a function"); + System.err.println("to be called recursively (it's calling itself and going in circles),"); + System.err.println("or you're intentionally calling a recursive function too much,"); + System.err.println("and your code should be rewritten in a more efficient manner."); + + } else if (exceptionName.equals("java.lang.UnsupportedClassVersionError")) { + listener.statusError("UnsupportedClassVersionError: A library is using code compiled with an unsupported version of Java."); + System.err.println("This version of Processing only supports libraries and JAR files compiled for Java 1.5."); + System.err.println("A library used by this sketch was compiled for Java 1.6 or later, "); + System.err.println("and needs to be recompiled to be compatible with Java 1.5."); + + } else if (exceptionName.equals("java.lang.NoSuchMethodError") || exceptionName.equals("java.lang.NoSuchFieldError")) { + listener.statusError(exceptionName.substring(10) + ": You're probably using a library that's incompatible with this version of Processing."); + + } else if (message.equals("ClassNotFoundException: quicktime.std.StdQTException")) { + listener.statusError("Could not find QuickTime, please reinstall QuickTime 7 or later."); + + } else { + reportException(message, event.thread()); + } + editor.internalRunnerClosed(); + } + + + // This may be called more than one time per error in the VM, + // presumably because exceptions might be wrapped inside others, + // and this will fire for both. + protected void reportException(String message, ThreadReference thread) { + try { + int codeIndex = -1; + int lineNumber = -1; + + // Any of the thread.blah() methods can throw an AbsentInformationEx + // if that bit of data is missing. If so, just write out the error + // message to the console. + List frames = thread.frames(); + for (StackFrame frame : frames) { + //System.out.println("frame: " + frame); + Location location = frame.location(); + String filename = null; + filename = location.sourceName(); + lineNumber = location.lineNumber(); + + String appletJavaFile = appletClassName + ".java"; + SketchCode errorCode = null; + if (filename.equals(appletJavaFile)) { + for (SketchCode code : sketch.getCode()) { + if (code.isExtension("pde")) { + if (lineNumber >= code.getPreprocOffset()) { + errorCode = code; + } + } + } + } else { + for (SketchCode code : sketch.getCode()) { + if (code.isExtension("java")) { + if (filename.equals(code.getFileName())) { + errorCode = code; + } + } + } + } + codeIndex = sketch.getCodeIndex(errorCode); + + if (codeIndex != -1) { + //System.out.println("got line num " + lineNumber); + // in case this was a tab that got embedded into the main .java + lineNumber -= sketch.getCode(codeIndex).getPreprocOffset(); + + // lineNumber is 1-indexed, but editor wants zero-indexed + lineNumber--; + + // getMessage() will be what's shown in the editor + exception = new RunnerException(message, codeIndex, lineNumber, -1); + exception.hideStackTrace(); + listener.statusError(exception); + return; + } + } + } catch (AbsentInformationException e) { + //e.printStackTrace(); // not useful + exception = new RunnerException(message); + exception.hideStackTrace(); + listener.statusError(exception); + + } catch (IncompatibleThreadStateException e) { + e.printStackTrace(); + } + } + + + public void close() { + // TODO make sure stop() has already been called to exit the sketch + + // TODO actually kill off the vm here + if (vm != null) { + try { + vm.exit(0); + + } catch (com.sun.jdi.VMDisconnectedException vmde) { + // if the vm has disconnected on its own, ignore message + //System.out.println("harmless disconnect " + vmde.getMessage()); + // TODO shouldn't need to do this, need to do more cleanup + } + vm = null; + } + + //if (window != null) window.hide(); +// if (window != null) { +// //System.err.println("disposing window"); +// window.dispose(); +// window = null; +// } + + /* + if (process != null) { + try { + process.destroy(); + } catch (Exception e) { + //System.err.println("(ignored) error while destroying"); + //e.printStackTrace(); + } + process = null; + } + */ + } + + + // made synchronized for rev 87 + // attempted to remove synchronized for 0136 to fix bug #775 (no luck tho) + // http://dev.processing.org/bugs/show_bug.cgi?id=775 + synchronized public void message(String s) { + //System.out.println("M" + s.length() + ":" + s.trim()); // + "MMM" + s.length()); + + // this eats the CRLFs on the lines.. oops.. do it later + //if (s.trim().length() == 0) return; + + // this is PApplet sending a message (via System.out.println) + // that signals that the applet has been quit. + if (s.indexOf(PApplet.EXTERNAL_STOP) == 0) { + //System.out.println("external: quit"); + editor.internalCloseRunner(); + return; + } + + // this is the PApplet sending us a message that the applet + // is being moved to a new window location + if (s.indexOf(PApplet.EXTERNAL_MOVE) == 0) { + String nums = s.substring(s.indexOf(' ') + 1).trim(); + int space = nums.indexOf(' '); + int left = Integer.parseInt(nums.substring(0, space)); + int top = Integer.parseInt(nums.substring(space + 1)); + editor.setSketchLocation(new Point(left, top)); + //System.out.println("external: move to " + left + " " + top); + return; + } + + // Removed while doing cleaning for 0145, + // it seems that this is never actually printed out. + /* + // this is PApplet sending a message saying "i'm about to spew + // a stack trace because an error occurred during PApplet.run()" + if (s.indexOf(PApplet.LEECH_WAKEUP) == 0) { + // newMessage being set to 'true' means that the next time + // message() is called, expect the first line of the actual + // error message & stack trace to be sent from the applet. + newMessage = true; + return; // this line ignored + } + */ + + // these are used for debugging, in case there are concerns + // that some errors aren't coming through properly + /* + if (s.length() > 2) { + System.err.println(newMessage); + System.err.println("message " + s.length() + ":" + s); + } + */ + // always shove out the mesage, since it might not fall under + // the same setup as we're expecting + System.err.print(s); + //System.err.println("[" + s.length() + "] " + s); + System.err.flush(); + +// // exit here because otherwise the exception name +// // may be titled with a blank string +// if (s.trim().length() == 0) return; +// +// // annoying, because it seems as though the terminators +// // aren't being sent properly +// //System.err.println(s); +// +// //if (newMessage && s.length() > 2) { +// if (newMessage) { +// exception = new RunnerException(s); // type of java ex +// exception.hideStackTrace(); +// //System.out.println("setting ex type to " + s); +// newMessage = false; +// foundMessageSource = false; +// messageLineCount = 0; +// +// } else { +// messageLineCount++; +// +// /* +//java.lang.NullPointerException +// at javatest.(javatest.java:5) +// at Temporary_2425_1153.draw(Temporary_2425_1153.java:11) +// at PApplet.nextFrame(PApplet.java:481) +// at PApplet.run(PApplet.java:428) +// at java.lang.Thread.run(Unknown Source) +// */ +// +// if (!foundMessageSource) { +// // " at javatest.(javatest.java:5)" +// // -> "javatest.(javatest.java:5)" +// int atIndex = s.indexOf("at "); +// if (atIndex == -1) { +// //System.err.println(s); // stop double-printing exceptions +// return; +// } +// s = s.substring(atIndex + 3); +// +// // added for 0124 to improve error handling +// // not highlighting lines if it's in the p5 code +// if (s.startsWith("processing.")) return; +// // no highlight if it's java.lang.whatever +// if (s.startsWith("java.")) return; +// +// // "javatest.(javatest.java:5)" +// // -> "javatest." and "(javatest.java:5)" +// int startParen = s.indexOf('('); +// // at javatest.(javatest.java:5) +// //String pkgClassFxn = null; +// //String fileLine = null; +// int codeIndex = -1; +// int lineNumber = -1; +// +// if (startParen == -1) { +// //pkgClassFxn = s; +// +// } else { +// //pkgClassFxn = s.substring(0, startParen); +// +// // "(javatest.java:5)" +// String fileAndLine = s.substring(startParen + 1); +// int stopParen = fileAndLine.indexOf(')'); +// //fileAndLine = fileAndLine.substring(0, fileAndLine.length() - 1); +// fileAndLine = fileAndLine.substring(0, stopParen); +// //System.out.println("file 'n line " + fileAndLine); +// +// //if (!fileAndLine.equals("Unknown Source")) { +// // "javatest.java:5" +// int colonIndex = fileAndLine.indexOf(':'); +// if (colonIndex != -1) { +// String filename = fileAndLine.substring(0, colonIndex); +// // "javatest.java" and "5" +// //System.out.println("filename = " + filename); +// //System.out.println("pre0 = " + sketch.code[0].preprocName); +// //for (int i = 0; i < sketch.codeCount; i++) { +// //System.out.println(i + " " + sketch.code[i].lineOffset + " " + +// // sketch.code[i].preprocName); +// //} +// lineNumber = +// Integer.parseInt(fileAndLine.substring(colonIndex + 1)) - 1; +// +// for (int i = 0; i < sketch.getCodeCount(); i++) { +// SketchCode code = sketch.getCode(i); +// //System.out.println(code.preprocName + " " + lineNumber + " " + +// // code.preprocOffset); +// if (((code.preprocName == null) && +// (lineNumber >= code.preprocOffset)) || +// ((code.preprocName != null) && +// code.preprocName.equals(filename))) { +// codeIndex = i; +// //System.out.println("got codeindex " + codeIndex); +// //break; +// //} else if ( +// } +// } +// +// if (codeIndex != -1) { +// //System.out.println("got line num " + lineNumber); +// // in case this was a tab that got embedded into the main .java +// lineNumber -= sketch.getCode(codeIndex).preprocOffset; +// +// // this may have a paren on the end, if so need to strip +// // down to just the digits +// /* +// int lastNumberIndex = colonIndex + 1; +// while ((lastNumberIndex < fileAndLine.length()) && +// Character.isDigit(fileAndLine.charAt(lastNumberIndex))) { +// lastNumberIndex++; +// } +// */ +// +// // lineNumber is 1-indexed, but editor wants zero-indexed +// // getMessage() will be what's shown in the editor +// exception = +// new RunnerException(exception.getMessage(), +// codeIndex, lineNumber, -1); +// exception.hideStackTrace(); +// foundMessageSource = true; +// } +// } +// } +// editor.error(exception); +// +// /* +// int index = s.indexOf(className + ".java"); +// if (index != -1) { +// int len = (className + ".java").length(); +// String lineNumberStr = s.substring(index + len + 1); +// index = lineNumberStr.indexOf(')'); +// lineNumberStr = lineNumberStr.substring(0, index); +// try { +// exception.line = Integer.parseInt(lineNumberStr) - 1; //2; +// } catch (NumberFormatException e) { } +// //e.printStackTrace(); // a recursive error waiting to happen? +// // if nfe occurs, who cares, still send the error on up +// editor.error(exception); +// */ +// +// /* +// // WARNING THESE ARE DISABLED!! +// } else if ((index = s.indexOf(className + ".class")) != -1) { +// // code to check for: +// // at Temporary_484_3845.loop(Compiled Code) +// // would also probably get: +// // at Temporary_484_3845.loop +// // which (i believe) is used by the mac and/or jview +// String functionStr = s.substring(index + +// (className + ".class").length() + 1); +// index = functionStr.indexOf('('); +// if (index != -1) { +// functionStr = functionStr.substring(0, index); +// } +// exception = new RunnerException(//"inside \"" + functionStr + "()\": " + +// exception.getMessage() + +// " inside " + functionStr + "() " + +// "[add Compiler.disable() to setup()]"); +// editor.error(exception); +// // this will fall through in tihs example: +// // at Temporary_4636_9696.pootie(Compiled Code) +// // at Temporary_4636_9696.loop(Temporary_4636_9696.java:24) +// // because pootie() (re)sets the exception title +// // and throws it, but then the line number gets set +// // because of the line that comes after +// */ +// +// } else if (messageLineCount > 10) { // 5 -> 10 for 0088 +// // this means the class name may not be mentioned +// // in the stack trace.. this is just a general purpose +// // error, but needs to make it through anyway. +// // so if five lines have gone past, might as well signal +// messageLineCount = -100; +// exception = new RunnerException(exception.getMessage()); +// exception.hideStackTrace(); +// editor.error(exception); +// +// } else { +// //System.err.print(s); +// } +// //System.out.println("got it " + s); +// } + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Siphons from an InputStream of System.out (from a Process) + * and sends it to the real System.out. + */ + class SystemOutSiphon implements Runnable { + InputStream input; + Thread thread; + + public SystemOutSiphon(InputStream input) { + this.input = input; + + thread = new Thread(this); + // unless this is set to min, it seems to hork the app + // since it's in charge of stuffing the editor console with strings + // maybe it's time to get rid of/fix that friggin console + // ...disabled for 0075, with 0074's fix for code folder hanging + // this only seems to make the console unresponsive + //thread.setPriority(Thread.MIN_PRIORITY); + thread.start(); + } + + public void run() { + byte boofer[] = new byte[256]; + + while (Thread.currentThread() == thread) { + try { + // can't use a buffered reader here because incremental + // print statements are interesting too.. causes some + // disparity with how System.err gets spewed, oh well. + int count = input.read(boofer, 0, boofer.length); + if (count == -1) { + thread = null; + + } else { + System.out.print(new String(boofer, 0, count)); + //System.out.flush(); + } + + } catch (IOException e) { + // this is prolly because the app was quit & the stream broken + //e.printStackTrace(System.out); + //e.printStackTrace(); + thread = null; + + } catch (Exception e) { + //System.out.println("SystemOutSiphon: i just died in your arms tonight"); + // on mac os x, this will spew a "Bad File Descriptor" ex + // each time an external app is shut down. + //e.printStackTrace(); + thread = null; + //System.out.println(""); + } + //System.out.println("SystemOutSiphon: out"); + //thread = null; + } + } + } +} diff --git a/app/src/processing/app/debug/RunnerException.java b/app/src/processing/app/debug/RunnerException.java new file mode 100644 index 000000000..0b4e59154 --- /dev/null +++ b/app/src/processing/app/debug/RunnerException.java @@ -0,0 +1,147 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.debug; + + +/** + * An exception with a line number attached that occurs + * during either compile time or run time. + */ +public class RunnerException extends Exception /*RuntimeException*/ { + protected String message; + protected int codeIndex; + protected int codeLine; + protected int codeColumn; + protected boolean showStackTrace; + + + public RunnerException(String message) { + this(message, -1, -1, -1, true); + } + + + public RunnerException(String message, int file, int line, int column) { + this(message, file, line, column, true); + } + + + public RunnerException(String message, int file, int line, int column, + boolean showStackTrace) { + this.message = message; + this.codeIndex = file; + this.codeLine = line; + this.codeColumn = column; + this.showStackTrace = showStackTrace; + } + + + /** + * Override getMessage() in Throwable, so that I can set + * the message text outside the constructor. + */ + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public int getCodeIndex() { + return codeIndex; + } + + + public void setCodeIndex(int index) { + codeIndex = index; + } + + + public boolean hasCodeIndex() { + return codeIndex != -1; + } + + + public int getCodeLine() { + return codeLine; + } + + + public void setCodeLine(int line) { + this.codeLine = line; + } + + + public boolean hasCodeLine() { + return codeLine != -1; + } + + + public void setCodeColumn(int column) { + this.codeColumn = column; + } + + + public int getCodeColumn() { + return codeColumn; + } + + + public void showStackTrace() { + showStackTrace = true; + } + + + public void hideStackTrace() { + showStackTrace = false; + } + + + /** + * Nix the java.lang crap out of an exception message + * because it scares the children. + *

+ * This function must be static to be used with super() + * in each of the constructors above. + */ + /* + static public final String massage(String msg) { + if (msg.indexOf("java.lang.") == 0) { + //int dot = msg.lastIndexOf('.'); + msg = msg.substring("java.lang.".length()); + } + return msg; + //return (dot == -1) ? msg : msg.substring(dot+1); + } + */ + + + public void printStackTrace() { + if (showStackTrace) { + super.printStackTrace(); + } + } +} diff --git a/app/src/processing/app/debug/RunnerListener.java b/app/src/processing/app/debug/RunnerListener.java new file mode 100644 index 000000000..1728d7972 --- /dev/null +++ b/app/src/processing/app/debug/RunnerListener.java @@ -0,0 +1,31 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.debug; + + +public interface RunnerListener { + + public void statusError(String message); + + public void statusError(Exception exception); +} \ No newline at end of file diff --git a/app/src/processing/app/debug/StreamRedirectThread.java b/app/src/processing/app/debug/StreamRedirectThread.java new file mode 100644 index 000000000..795e8c199 --- /dev/null +++ b/app/src/processing/app/debug/StreamRedirectThread.java @@ -0,0 +1,84 @@ +/* + * @(#)StreamRedirectThread.java 1.4 03/01/23 + * + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ +/* + * Copyright (c) 1997-2001 by Sun Microsystems, Inc. All Rights Reserved. + * + * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, + * modify and redistribute this software in source and binary code form, + * provided that i) this copyright notice and license appear on all copies of + * the software; and ii) Licensee does not utilize the software in a manner + * which is disparaging to Sun. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY + * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR + * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE + * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS + * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, + * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER + * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF + * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * This software is not designed or intended for use in on-line control of + * aircraft, air traffic, aircraft navigation or aircraft communications; or in + * the design, construction, operation or maintenance of any nuclear + * facility. Licensee represents and warrants that it will not use or + * redistribute the Software for such purposes. + */ +package processing.app.debug; + +import java.io.*; + +/** + * StreamRedirectThread is a thread which copies it's input to + * it's output and terminates when it completes. + * + * @version @(#) StreamRedirectThread.java 1.4 03/01/23 23:33:38 + * @author Robert Field + */ +public class StreamRedirectThread extends Thread { + + private final Reader in; + private final Writer out; + + private static final int BUFFER_SIZE = 2048; + + /** + * Set up for copy. + * @param name Name of the thread + * @param in Stream to copy from + * @param out Stream to copy to + */ + public StreamRedirectThread(String name, InputStream in, OutputStream out) { + super(name); + this.in = new InputStreamReader(in); + this.out = new OutputStreamWriter(out); + setPriority(Thread.MAX_PRIORITY-1); + } + + /** + * Copy. + */ + public void run() { + try { + char[] cbuf = new char[BUFFER_SIZE]; + int count; + //System.out.println("opening streamredirectthread"); + while ((count = in.read(cbuf, 0, BUFFER_SIZE)) >= 0) { + out.write(cbuf, 0, count); + // had to add the flush() here.. maybe shouldn't be using writer? [fry] + out.flush(); + } + //System.out.println("exiting streamredirectthread"); + out.flush(); + } catch(IOException exc) { + System.err.println("Child I/O Transfer - " + exc); + } + } +} diff --git a/app/src/processing/app/linux/Platform.java b/app/src/processing/app/linux/Platform.java new file mode 100644 index 000000000..7f227596f --- /dev/null +++ b/app/src/processing/app/linux/Platform.java @@ -0,0 +1,106 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.linux; + +import java.io.File; + +import javax.swing.UIManager; + +import processing.app.Preferences; + + +/** + * Used by Base for platform-specific tweaking, for instance finding the + * sketchbook location using the Windows registry, or OS X event handling. + */ +public class Platform extends processing.app.Platform { + + // TODO Need to be smarter here since KDE people ain't gonna like that GTK. + // It may even throw a weird exception at 'em for their trouble. + public void setLookAndFeel() throws Exception { + // Linux is by default even uglier than metal (Motif?). + // Actually, i'm using native menus, so they're even uglier + // and Motif-looking (Lesstif?). Ick. Need to fix this. + //String lfname = UIManager.getCrossPlatformLookAndFeelClassName(); + //UIManager.setLookAndFeel(lfname); + + // For 0120, trying out the gtk+ look and feel as the default. + // This is available in Java 1.4.2 and later, and it can't possibly + // be any worse than Metal. (Ocean might also work, but that's for + // Java 1.5, and we aren't going there yet) + UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); + } + + + public void openURL(String url) throws Exception { + if (openFolderAvailable()) { + String launcher = Preferences.get("launcher"); + if (launcher != null) { + Runtime.getRuntime().exec(new String[] { launcher, url }); + } + } + } + + + public boolean openFolderAvailable() { + if (Preferences.get("launcher") != null) { + return true; + } + + // Attempt to use gnome-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); + /*int result =*/ p.waitFor(); + // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) + Preferences.set("launcher", "gnome-open"); + return true; + } catch (Exception e) { } + + // Attempt with kde-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "kde-open" }); + /*int result =*/ p.waitFor(); + Preferences.set("launcher", "kde-open"); + return true; + } catch (Exception e) { } + + return false; + } + + + public void openFolder(File file) throws Exception { + if (openFolderAvailable()) { + String lunch = Preferences.get("launcher"); + try { + String[] params = new String[] { lunch, file.getAbsolutePath() }; + //processing.core.PApplet.println(params); + /*Process p =*/ Runtime.getRuntime().exec(params); + /*int result =*/ //p.waitFor(); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + System.out.println("not available"); + } + } +} diff --git a/app/src/processing/app/macosx/Platform.java b/app/src/processing/app/macosx/Platform.java new file mode 100644 index 000000000..0b440cb6a --- /dev/null +++ b/app/src/processing/app/macosx/Platform.java @@ -0,0 +1,184 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.macosx; + +import java.awt.Insets; +import java.io.File; +import java.io.FileNotFoundException; + +import javax.swing.UIManager; + +import com.apple.eio.FileManager; + +import processing.app.Base; + + +/** + * Platform handler for Mac OS X. + */ +public class Platform extends processing.app.Platform { + + public void setLookAndFeel() throws Exception { + // Use the Quaqua L & F on OS X to make JFileChooser less awful + UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel"); + // undo quaqua trying to fix the margins, since we've already + // hacked that in, bit by bit, over the years + UIManager.put("Component.visualMargin", new Insets(1, 1, 1, 1)); + } + + + public void init(Base base) { + ThinkDifferent.init(base); + /* + try { + String name = "processing.app.macosx.ThinkDifferent"; + Class osxAdapter = ClassLoader.getSystemClassLoader().loadClass(name); + + Class[] defArgs = { Base.class }; + Method registerMethod = osxAdapter.getDeclaredMethod("register", defArgs); + if (registerMethod != null) { + Object[] args = { this }; + registerMethod.invoke(osxAdapter, args); + } + } catch (NoClassDefFoundError e) { + // This will be thrown first if the OSXAdapter is loaded on a system without the EAWT + // because OSXAdapter extends ApplicationAdapter in its def + System.err.println("This version of Mac OS X does not support the Apple EAWT." + + "Application Menu handling has been disabled (" + e + ")"); + + } catch (ClassNotFoundException e) { + // This shouldn't be reached; if there's a problem with the OSXAdapter + // we should get the above NoClassDefFoundError first. + System.err.println("This version of Mac OS X does not support the Apple EAWT. " + + "Application Menu handling has been disabled (" + e + ")"); + } catch (Exception e) { + System.err.println("Exception while loading BaseOSX:"); + e.printStackTrace(); + } + */ + } + + + public File getSettingsFolder() throws Exception { + return new File(getLibraryFolder(), "Processing"); + } + + + public File getDefaultSketchbookFolder() throws Exception { + return new File(getDocumentsFolder(), "Processing"); + /* + // looking for /Users/blah/Documents/Processing + try { + Class clazz = Class.forName("processing.app.BaseMacOS"); + Method m = clazz.getMethod("getDocumentsFolder", new Class[] { }); + String documentsPath = (String) m.invoke(null, new Object[] { }); + sketchbookFolder = new File(documentsPath, "Processing"); + + } catch (Exception e) { + sketchbookFolder = promptSketchbookLocation(); + } + */ + } + + + public void openURL(String url) throws Exception { + if (!url.startsWith("http://")) { + // Assume this is a file instead, and just open it. + // Extension of http://dev.processing.org/bugs/show_bug.cgi?id=1010 + processing.core.PApplet.open(url); + + /* + // prepend file:// on this guy since it's a file + url = "file://" + url; + + // replace spaces with %20 for the file url + // otherwise the mac doesn't like to open it + // can't just use URLEncoder, since that makes slashes into + // %2F characters, which is no good. some might say "useless" + if (url.indexOf(' ') != -1) { + StringBuffer sb = new StringBuffer(); + char c[] = url.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == ' ') { + sb.append("%20"); + } else { + sb.append(c[i]); + } + } + url = sb.toString(); + } + */ + } + com.apple.eio.FileManager.openURL(url); + } + + + public boolean openFolderAvailable() { + return true; + } + + + public void openFolder(File file) throws Exception { + //openURL(file.getAbsolutePath()); // handles char replacement, etc + processing.core.PApplet.open(file.getAbsolutePath()); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + // Some of these are supposedly constants in com.apple.eio.FileManager, + // however they don't seem to link properly from Eclipse. + + static final int kDocumentsFolderType = + ('d' << 24) | ('o' << 16) | ('c' << 8) | 's'; + //static final int kPreferencesFolderType = + // ('p' << 24) | ('r' << 16) | ('e' << 8) | 'f'; + static final int kDomainLibraryFolderType = + ('d' << 24) | ('l' << 16) | ('i' << 8) | 'b'; + static final short kUserDomain = -32763; + + + // apple java extensions documentation + // http://developer.apple.com/documentation/Java/Reference/1.5.0 + // /appledoc/api/com/apple/eio/FileManager.html + + // carbon folder constants + // http://developer.apple.com/documentation/Carbon/Reference + // /Folder_Manager/folder_manager_ref/constant_6.html#/ + // /apple_ref/doc/uid/TP30000238/C006889 + + // additional information found int the local file: + // /System/Library/Frameworks/CoreServices.framework + // /Versions/Current/Frameworks/CarbonCore.framework/Headers/ + + + protected String getLibraryFolder() throws FileNotFoundException { + return FileManager.findFolder(kUserDomain, kDomainLibraryFolderType); + } + + + protected String getDocumentsFolder() throws FileNotFoundException { + return FileManager.findFolder(kUserDomain, kDocumentsFolderType); + } +} \ No newline at end of file diff --git a/app/src/processing/app/macosx/ThinkDifferent.java b/app/src/processing/app/macosx/ThinkDifferent.java new file mode 100644 index 000000000..38cb6cb9a --- /dev/null +++ b/app/src/processing/app/macosx/ThinkDifferent.java @@ -0,0 +1,126 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2007 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.macosx; + +import processing.app.Base; + +import com.apple.eawt.*; + + +/** + * Deal with issues related to thinking different. This handles the basic + * Mac OS X menu commands (and apple events) for open, about, prefs, etc. + * + * Based on OSXAdapter.java from Apple DTS. + * + * As of 0140, this code need not be built on platforms other than OS X, + * because of the new platform structure which isolates through reflection. + */ +public class ThinkDifferent implements ApplicationListener { + + // pseudo-singleton model; no point in making multiple instances + // of the EAWT application or our adapter + private static ThinkDifferent adapter; + // http://developer.apple.com/documentation/Java/Reference/1.4.2/appledoc/api/com/apple/eawt/Application.html + private static Application application; + + // reference to the app where the existing quit, about, prefs code is + private Base base; + + + static protected void init(Base base) { + if (application == null) { + application = new com.apple.eawt.Application(); + } + if (adapter == null) { + adapter = new ThinkDifferent(base); + } + application.addApplicationListener(adapter); + application.setEnabledAboutMenu(true); + application.setEnabledPreferencesMenu(true); + } + + + public ThinkDifferent(Base base) { + this.base = base; + } + + + // implemented handler methods. These are basically hooks into existing + // functionality from the main app, as if it came over from another platform. + public void handleAbout(ApplicationEvent ae) { + if (base != null) { + ae.setHandled(true); + base.handleAbout(); + } else { + throw new IllegalStateException("handleAbout: Base instance detached from listener"); + } + } + + + public void handlePreferences(ApplicationEvent ae) { + if (base != null) { + base.handlePrefs(); + ae.setHandled(true); + } else { + throw new IllegalStateException("handlePreferences: Base instance detached from listener"); + } + } + + + public void handleOpenApplication(ApplicationEvent ae) { + } + + + public void handleOpenFile(ApplicationEvent ae) { + String filename = ae.getFilename(); + base.handleOpen(filename); + ae.setHandled(true); + } + + + public void handlePrintFile(ApplicationEvent ae) { + // TODO implement os x print handler here (open app, call handlePrint, quit) + } + + + public void handleQuit(ApplicationEvent ae) { + if (base != null) { + /* + / You MUST setHandled(false) if you want to delay or cancel the quit. + / This is important for cross-platform development -- have a universal quit + / routine that chooses whether or not to quit, so the functionality is identical + / on all platforms. This example simply cancels the AppleEvent-based quit and + / defers to that universal method. + */ + boolean result = base.handleQuit(); + ae.setHandled(result); + } else { + throw new IllegalStateException("handleQuit: Base instance detached from listener"); + } + } + + + public void handleReOpenApplication(ApplicationEvent arg0) { + } +} \ No newline at end of file diff --git a/app/src/processing/app/preproc/.cvsignore b/app/src/processing/app/preproc/.cvsignore new file mode 100644 index 000000000..b010c249c --- /dev/null +++ b/app/src/processing/app/preproc/.cvsignore @@ -0,0 +1,9 @@ +*Lexer.java +*Recognizer.java +*TokenTypes.java +*TokenTypes.txt +*TreeParser.java +*TreeParserTokenTypes.java +*TreeParserTokenTypes.txt +expanded*.g + diff --git a/app/src/processing/app/preproc/PdeEmitter.java b/app/src/processing/app/preproc/PdeEmitter.java new file mode 100644 index 000000000..f4634f32e --- /dev/null +++ b/app/src/processing/app/preproc/PdeEmitter.java @@ -0,0 +1,936 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +package processing.app.preproc; + +import processing.app.*; +import processing.app.debug.RunnerException; + + +/* Based on original code copyright (c) 2003 Andy Tripp . + * shipped under GPL with permission. + */ + +//import antlr.*; +import antlr.collections.*; +//import antlr.collections.impl.*; +import java.io.*; +//import java.util.*; + +/** + * PDEEmitter: A class that can take an ANTLR Java AST and produce + * reasonably formatted Java code from it. To use it, create a + * PDEEmitter object, call setOut() if you want to print to something + * other than System.out, and then call print(), passing the + * AST. Typically, the AST node that you pass would be the root of a + * tree - the ROOT_ID node that represents a Java file. + */ + +@SuppressWarnings("unused") +public class PdeEmitter implements PdeTokenTypes +{ + private PrintStream out = System.out; + private PrintStream debug = System.err; + //private static int ALL = -1; + private java.util.Stack stack = new java.util.Stack(); + private static String[] tokenNames; + private final static int ROOT_ID = 0; + static { + setupTokenNames(); + } + + /* + private static Hashtable publicMethods; + private static final String publicMethodList[] = { + "setup", "draw", //"loop", + "mousePressed", "mouseReleased", "mouseClicked", + "mouseEntered", "mouseExited", + "mouseMoved", "mouseDragged", + "keyPressed", "keyReleased", "keyTyped" + }; + + static { + publicMethods = new Hashtable(); + for (int i = 0; i < publicMethodList.length; i++) { + publicMethods.put(publicMethodList[i], new Object()); + } + } + */ + + // Map each AST token type to a String + private static void setupTokenNames() { + tokenNames = new String[200]; + for (int i=0; i

+ * Current Preprocessor Subsitutions: + *

    + *
  • any function not specified as being protected or private will + * be made 'public'. this means that void setup() becomes + * public void setup(). This is important to note when + * coding with core.jar outside of the PDE. + *
  • compiler.substitute_floats (currently "substitute_f") + * treat doubles as floats, i.e. 12.3 becomes 12.3f so that people + * don't have to add f after their numbers all the time since it's + * confusing for beginners. + *
  • compiler.enhanced_casting byte(), char(), int(), float() + * works for casting. this is basic in the current implementation, but + * should be expanded as described above. color() works similarly to int(), + * however there is also a *function* called color(r, g, b) in p5. + *
  • compiler.color_datatype 'color' is aliased to 'int' + * as a datatype to represent ARGB packed into a single int, commonly + * used in p5 for pixels[] and other color operations. this is just a + * search/replace type thing, and it can be used interchangeably with int. + *
  • compiler.web_colors (currently "inline_web_colors") + * color c = #cc0080; should unpack to 0xffcc0080 (the ff at the top is + * so that the color is opaque), which is just an int. + *
+ * Other preprocessor functionality + *
    + *
  • detects what 'mode' the program is in: static (no function + * brackets at all, just assumes everything is in draw), active + * (setup plus draw or loop), and java mode (full java support). + * http://processing.org/reference/environment/ + *
+ *

+ * The PDE Preprocessor is based on the Java Grammar that comes with + * ANTLR 2.7.2. Moving it forward to a new version of the grammar + * shouldn't be too difficult. + *

+ * Here's some info about the various files in this directory: + *

+ * java.g: this is the ANTLR grammar for Java 1.3/1.4 from the + * ANTLR distribution. It is in the public domain. The only change to + * this file from the original this file is the uncommenting of the + * clauses required to support assert(). + *

+ * java.tree.g: this describes the Abstract Syntax Tree (AST) + * generated by java.g. It is only here as a reference for coders hacking + * on the preprocessor, it is not built or used at all. Note that pde.g + * overrides some of the java.g rules so that in PDE ASTs, there are a + * few minor differences. Also in the public domain. + *

+ * pde.g: this is the grammar and lexer for the PDE language + * itself. It subclasses the java.g grammar and lexer. There are a couple + * of overrides to java.g that I hope to convince the ANTLR folks to fold + * back into their grammar, but most of this file is highly specific to + * PDE itself. + * PdeEmitter.java: this class traverses the AST generated by + * the PDE Recognizer, and emits it as Java code, doing any necessary + * transformations along the way. It is based on JavaEmitter.java, + * available from antlr.org, written by Andy Tripp , + * who has given permission for it to be distributed under the GPL. + *

+ * ExtendedCommonASTWithHiddenTokens.java: this adds a necessary + * initialize() method, as well as a number of methods to allow for XML + * serialization of the parse tree in a such a way that the hidden tokens + * are visible. Much of the code is taken from the original + * CommonASTWithHiddenTokens class. I hope to convince the ANTLR folks + * to fold these changes back into that class so that this file will be + * unnecessary. + *

+ * TokenStreamCopyingHiddenTokenFilter.java: this class provides + * TokenStreamHiddenTokenFilters with the concept of tokens which can be + * copied so that they are seen by both the hidden token stream as well + * as the parser itself. This is useful when one wants to use an + * existing parser (like the Java parser included with ANTLR) that throws + * away some tokens to create a parse tree which can be used to spit out + * a copy of the code with only minor modifications. Partially derived + * from ANTLR code. I hope to convince the ANTLR folks to fold this + * functionality back into ANTLR proper as well. + *

+ * whitespace_test.pde: a torture test to ensure that the + * preprocessor is correctly preserving whitespace, comments, and other + * hidden tokens correctly. See the comments in the code for details about + * how to run the test. + *

+ * All other files in this directory are generated at build time by ANTLR + * itself. The ANTLR manual goes into a fair amount of detail about the + * what each type of file is for. + *

+ */ +public class PdePreprocessor { + + String[] defaultImports; + + // these ones have the .* at the end, since a class name might be at the end + // instead of .* which would make trouble other classes using this can lop + // off the . and anything after it to produce a package name consistently. + //public String extraImports[]; + ArrayList programImports; + + // imports just from the code folder, treated differently + // than the others, since the imports are auto-generated. + ArrayList codeFolderImports; + + static public final int STATIC = 0; // formerly BEGINNER + static public final int ACTIVE = 1; // formerly INTERMEDIATE + static public final int JAVA = 2; // formerly ADVANCED + + // static to make it easier for the antlr preproc to get at it + static public int programType; + static public boolean foundMain; + + String indent; + + PrintStream stream; + Reader programReader; + String buildPath; + String name; + + // used for calling the ASTFactory to get the root node + private static final int ROOT_ID = 0; + + /** + * Used by PdeEmitter.dumpHiddenTokens() + */ + public static TokenStreamCopyingHiddenTokenFilter filter; + + static String advClassName = ""; + + + /** + * Setup a new preprocessor. + */ + public PdePreprocessor() { } + + + public int writePrefix(String program, String buildPath, + String name, String codeFolderPackages[]) throws FileNotFoundException { + this.buildPath = buildPath; + this.name = name; + + int tabSize = Preferences.getInteger("editor.tabs.size"); + char[] indentChars = new char[tabSize]; + Arrays.fill(indentChars, ' '); + indent = new String(indentChars); + + // need to reset whether or not this has a main() + foundMain = false; + + // if the program ends with no CR or LF an OutOfMemoryError will happen. + // not gonna track down the bug now, so here's a hack for it: + // http://dev.processing.org/bugs/show_bug.cgi?id=5 + program += "\n"; + + // if the program ends with an unterminated multi-line comment, + // an OutOfMemoryError or NullPointerException will happen. + // again, not gonna bother tracking this down, but here's a hack. + // http://dev.processing.org/bugs/show_bug.cgi?id=16 + Sketch.scrubComments(program); + // this returns the scrubbed version, but more important for this + // function, it'll check to see if there are errors with the comments. + + if (Preferences.getBoolean("preproc.substitute_unicode")) { + // check for non-ascii chars (these will be/must be in unicode format) + char p[] = program.toCharArray(); + int unicodeCount = 0; + for (int i = 0; i < p.length; i++) { + if (p[i] > 127) unicodeCount++; + } + // if non-ascii chars are in there, convert to unicode escapes + if (unicodeCount != 0) { + // add unicodeCount * 5.. replacing each unicode char + // with six digit uXXXX sequence (xxxx is in hex) + // (except for nbsp chars which will be a replaced with a space) + int index = 0; + char p2[] = new char[p.length + unicodeCount*5]; + for (int i = 0; i < p.length; i++) { + if (p[i] < 128) { + p2[index++] = p[i]; + + } else if (p[i] == 160) { // unicode for non-breaking space + p2[index++] = ' '; + + } else { + int c = p[i]; + p2[index++] = '\\'; + p2[index++] = 'u'; + char str[] = Integer.toHexString(c).toCharArray(); + // add leading zeros, so that the length is 4 + //for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0'; + for (int m = 0; m < 4 - str.length; m++) p2[index++] = '0'; + System.arraycopy(str, 0, p2, index, str.length); + index += str.length; + } + } + program = new String(p2, 0, index); + } + } + + // These may change in-between (if the prefs panel adds this option) + // so grab them here on construction. + String prefsLine = Preferences.get("preproc.imports"); + defaultImports = PApplet.splitTokens(prefsLine, ", "); + + //String importRegexp = "(?:^|\\s|;)(import\\s+)(\\S+)(\\s*;)"; + String importRegexp = "(?:^|;)\\s*(import\\s+)(\\S+)(\\s*;)"; + programImports = new ArrayList(); + + do { + String[] pieces = PApplet.match(program, importRegexp); + // Stop the loop if we've removed all the importy lines + if (pieces == null) break; + + String piece = pieces[1] + pieces[2] + pieces[3]; + int len = piece.length(); // how much to trim out + + programImports.add(pieces[2]); // the package name + int idx = program.indexOf(piece); + // just remove altogether? + program = program.substring(0, idx) + program.substring(idx + len); + + } while (true); + + codeFolderImports = new ArrayList(); + if (codeFolderPackages != null) { + for (String item : codeFolderPackages) { + codeFolderImports.add(item + ".*"); + } + } + // do this after the program gets re-combobulated + this.programReader = new StringReader(program); + + File streamFile = new File(buildPath, name + ".java"); + stream = new PrintStream(new FileOutputStream(streamFile)); + int importsLength = writeImports(stream); + + // return the length of the imports plus the extra lines for declarations + return importsLength + 2; + } + + + /** + * preprocesses a pde file and write out a java file + * @return the classname of the exported Java + */ + //public String write(String program, String buildPath, String name, + // String extraImports[]) throws java.lang.Exception { + public String write() throws java.lang.Exception { + // create a lexer with the stream reader, and tell it to handle + // hidden tokens (eg whitespace, comments) since we want to pass these + // through so that the line numbers when the compiler reports errors + // match those that will be highlighted in the PDE IDE + // + PdeLexer lexer = new PdeLexer(programReader); + lexer.setTokenObjectClass("antlr.CommonHiddenStreamToken"); + + // create the filter for hidden tokens and specify which tokens to + // hide and which to copy to the hidden text + // + filter = new TokenStreamCopyingHiddenTokenFilter(lexer); + filter.hide(PdeRecognizer.SL_COMMENT); + filter.hide(PdeRecognizer.ML_COMMENT); + filter.hide(PdeRecognizer.WS); + filter.copy(PdeRecognizer.SEMI); + filter.copy(PdeRecognizer.LPAREN); + filter.copy(PdeRecognizer.RPAREN); + filter.copy(PdeRecognizer.LCURLY); + filter.copy(PdeRecognizer.RCURLY); + filter.copy(PdeRecognizer.COMMA); + filter.copy(PdeRecognizer.RBRACK); + filter.copy(PdeRecognizer.LBRACK); + filter.copy(PdeRecognizer.COLON); + + // create a parser and set what sort of AST should be generated + // + PdeRecognizer parser = new PdeRecognizer(filter); + + // use our extended AST class + // + parser.setASTNodeClass("antlr.ExtendedCommonASTWithHiddenTokens"); + + // start parsing at the compilationUnit non-terminal + // + parser.pdeProgram(); + + // set up the AST for traversal by PdeEmitter + // + ASTFactory factory = new ASTFactory(); + AST parserAST = parser.getAST(); + AST rootNode = factory.create(ROOT_ID, "AST ROOT"); + rootNode.setFirstChild(parserAST); + + // unclear if this actually works, but it's worth a shot + // + //((CommonAST)parserAST).setVerboseStringConversion( + // true, parser.getTokenNames()); + // (made to use the static version because of jikes 1.22 warning) + CommonAST.setVerboseStringConversion(true, parser.getTokenNames()); + + // if this is an advanced program, the classname is already defined. + // + if (programType == JAVA) { + name = getFirstClassName(parserAST); + } + + // if 'null' was passed in for the name, but this isn't + // a 'java' mode class, then there's a problem, so punt. + // + if (name == null) return null; + + // output the code + // + PdeEmitter emitter = new PdeEmitter(); + //writeHeader(stream, extraImports, name); + writeDeclaration(stream, name); + + emitter.setOut(stream); + emitter.print(rootNode); + + writeFooter(stream, name); + stream.close(); + + // if desired, serialize the parse tree to an XML file. can + // be viewed usefully with Mozilla or IE + + if (Preferences.getBoolean("preproc.output_parse_tree")) { + writeParseTree("parseTree.xml", parserAST); + } + + return name; + } + + + protected void writeParseTree(String filename, AST ast) { + try { + PrintStream stream = new PrintStream(new FileOutputStream(filename)); + stream.println(""); + stream.println(""); + OutputStreamWriter writer = new OutputStreamWriter(stream); + if (ast != null) { + ((CommonAST) ast).xmlSerialize(writer); + } + writer.flush(); + stream.println(""); + writer.close(); + } catch (IOException e) { + + } + } + + int writeImports(PrintStream out) { + out.println("import processing.core.*; "); + out.println("import processing.xml.*; "); + out.println(); + int count = 3; + + if (programImports.size() != 0) { + for (String item : programImports) { + out.println("import " + item + "; "); + } + out.println(); + count += programImports.size() + 1; + } + + if (codeFolderImports.size() != 0) { + for (String item : codeFolderImports) { + out.println("import " + item + "; "); + } + out.println(); + count += codeFolderImports.size() + 1; + } + + for (String item : defaultImports) { + out.println("import " + item + ".*; "); + } + out.println(); + count += defaultImports.length + 1; + + return count; + } + + + /** + * Write any required header material (eg imports, class decl stuff) + * + * @param out PrintStream to write it to. + * @param exporting Is this being exported from PDE? + * @param name Name of the class being created. + */ + void writeDeclaration(PrintStream out, String className) { + + String indent = " "; + + if (programType == JAVA) { + // Print two blank lines so that the offset doesn't change + out.println(); + out.println(); + + } else if (programType == ACTIVE) { + // Print an extra blank line so the offset is identical to the others + out.println("public class " + className + " extends PApplet {"); + out.println(); + + } else if (programType == STATIC) { + out.println("public class " + className + " extends PApplet {"); + out.print(indent + "public void setup() {"); + } + } + + /** + * Write any necessary closing text. + * + * @param out PrintStream to write it to. + */ + void writeFooter(PrintStream out, String className) { + + if (programType == STATIC) { + // close off draw() definition + out.println(indent + "noLoop();"); + out.println("} "); + } + + if ((programType == STATIC) || (programType == ACTIVE)) { + if (!PdePreprocessor.foundMain) { + out.println(indent + "static public void main(String args[]) {"); + out.print(indent + indent + "PApplet.main(new String[] { "); + + if (Preferences.getBoolean("export.application.fullscreen")) { + out.print("\"" + PApplet.ARGS_PRESENT + "\", "); + + String farbe = Preferences.get("run.present.bgcolor"); + out.print("\"" + PApplet.ARGS_BGCOLOR + "=" + farbe + "\", "); + + if (Preferences.getBoolean("export.application.stop")) { + farbe = Preferences.get("run.present.stop.color"); + out.print("\"" + PApplet.ARGS_STOP_COLOR + "=" + farbe + "\", "); + } else { + out.print("\"" + PApplet.ARGS_HIDE_STOP + "\", "); + } + } else { + String farbe = Preferences.get("run.window.bgcolor"); + out.print("\"" + PApplet.ARGS_BGCOLOR + "=" + farbe + "\", "); + } + out.println("\"" + className + "\" });"); + out.println(indent + "}"); + } + + // close off the class definition + out.println("}"); + } + } + + + public ArrayList getExtraImports() { + return programImports; + } + + + /** + * Find the first CLASS_DEF node in the tree, and return the name of the + * class in question. + * + * TODO [dmose] right now, we're using a little hack to the grammar to get + * this info. In fact, we should be descending the AST passed in. + */ + String getFirstClassName(AST ast) { + + String t = advClassName; + advClassName = ""; + + return t; + } +} diff --git a/app/src/processing/app/preproc/clean.sh b/app/src/processing/app/preproc/clean.sh new file mode 100755 index 000000000..a3db270b2 --- /dev/null +++ b/app/src/processing/app/preproc/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +rm -f *Lexer.java +rm -f *Recognizer.java +rm -f *TokenTypes.java +rm -f *TokenTypes.txt +rm -f *TreeParser.java +rm -f *TreeParserTokenTypes.java +rm -f *TreeParserTokenTypes.txt +rm -f expanded*.g + diff --git a/app/src/processing/app/preproc/make.sh b/app/src/processing/app/preproc/make.sh new file mode 100755 index 000000000..90324ddc9 --- /dev/null +++ b/app/src/processing/app/preproc/make.sh @@ -0,0 +1,3 @@ +java -cp ../../build/macosx/work/lib/antlr.jar antlr.Tool java.g +# now build the pde stuff that extends the java classes +java -cp ../../build/macosx/work/lib/antlr.jar antlr.Tool -glib java.g pde.g \ No newline at end of file diff --git a/app/src/processing/app/preproc/pde.g b/app/src/processing/app/preproc/pde.g new file mode 100644 index 000000000..fced570d4 --- /dev/null +++ b/app/src/processing/app/preproc/pde.g @@ -0,0 +1,304 @@ +/* -*- mode: antlr; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +header { +package processing.app.preproc; + +import processing.app.*; +} + +class PdeRecognizer extends JavaRecognizer; + +options { + importVocab = Java; + exportVocab = PdePartial; + + codeGenMakeSwitchThreshold=10; // this is set high for debugging + codeGenBitsetTestThreshold=10; // this is set high for debugging + + // developers may to want to set this to true for better + // debugging messages, however, doing so disables highlighting errors + // in the editor. + defaultErrorHandler = false; //true; +} + +tokens { + CONSTRUCTOR_CAST; EMPTY_FIELD; +} + +pdeProgram + // only java mode programs will have their own public classes or + // imports (and they must have at least one) + : ( "public" "class" | "import" ) => javaProgram + { PdePreprocessor.programType = PdePreprocessor.JAVA; } + + // the syntactic predicate here looks for any minimal (thus + // the non-greedy qualifier) number of fields, followed by + // the tokens that represent the definition of loop() or + // some other member function. java mode programs may have such + // definitions, but they won't reach this point, having already been + // selected in the previous alternative. static mode programs + // don't have member functions. + // + | ( ( options {greedy=false;}: possiblyEmptyField)* "void" IDENT LPAREN ) + => activeProgram + { PdePreprocessor.programType = PdePreprocessor.ACTIVE; } + + | staticProgram + { PdePreprocessor.programType = PdePreprocessor.STATIC; } + ; + +// advanced mode is really just a normal java file +javaProgram + : compilationUnit + ; + +activeProgram + : (possiblyEmptyField)+ + ; + +staticProgram + : (statement)* + ; + +// copy of the java.g rule with WEBCOLOR_LITERAL added +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + | NUM_LONG + | NUM_DOUBLE + | webcolor_literal + ; + +// of the form #cc008f in PDE +webcolor_literal + : w:WEBCOLOR_LITERAL + { Preferences.getBoolean("preproc.web_colors") && + w.getText().length() == 6 }? // must be exactly 6 hex digits + ; + +// copy of the java.g builtInType rule +builtInConsCastType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +// our types include the java types and "color". this is separated into two +// rules so that constructor casts can just use the original typelist, since +// we don't want to support the color type as a constructor cast. +// +builtInType + : builtInConsCastType + | "color" // aliased to an int in PDE + { Preferences.getBoolean("preproc.color_datatype") }? + ; + +// constructor style casts. +constructorCast! + : t:consCastTypeSpec[true] + LPAREN! + e:expression + RPAREN! + // if this is a string literal, make sure the type we're trying to cast + // to is one of the supported ones + // + { #e.getType() != STRING_LITERAL || + ( #t.getType() == LITERAL_byte || + #t.getType() == LITERAL_double || + #t.getType() == LITERAL_float || + #t.getType() == LITERAL_int || + #t.getType() == LITERAL_long || + #t.getType() == LITERAL_short ) }? + // create the node + // + {#constructorCast = #(#[CONSTRUCTOR_CAST,"CONSTRUCTOR_CAST"], t, e);} + ; + +// A list of types that be used as the destination type in a constructor-style +// cast. Ideally, this would include all class types, not just "String". +// Unfortunately, it's not possible to tell whether Foo(5) is supposed to be +// a method call or a constructor cast without have a table of all valid +// types or methods, which requires semantic analysis (eg processing of import +// statements). So we accept the set of built-in types plus "String". +// +consCastTypeSpec[boolean addImagNode] +// : stringTypeSpec[addImagNode] +// | builtInConsCastTypeSpec[addImagNode] + : builtInConsCastTypeSpec[addImagNode] +// trying to remove String() cast [fry] + ; + +//stringTypeSpec[boolean addImagNode] +// : id:IDENT { #id.getText().equals("String") }? +// { +// if ( addImagNode ) { +// #stringTypeSpec = #(#[TYPE,"TYPE"], +// #stringTypeSpec); +// } +// } +// ; + +builtInConsCastTypeSpec[boolean addImagNode] + : builtInConsCastType + { + if ( addImagNode ) { + #builtInConsCastTypeSpec = #(#[TYPE,"TYPE"], + #builtInConsCastTypeSpec); + } + } + ; + +// Since "color" tokens are lexed as LITERAL_color now, we need to have a rule +// that can generate a method call from an expression that starts with this +// token +// +colorMethodCall + : c:"color" {#c.setType(IDENT);} // this would default to LITERAL_color + lp:LPAREN^ {#lp.setType(METHOD_CALL);} + argList + RPAREN! + ; + +// copy of the java.g rule with added constructorCast and colorMethodCall +// alternatives +primaryExpression + : (consCastTypeSpec[false] LPAREN) => constructorCast + { Preferences.getBoolean("preproc.enhanced_casting") }? + | identPrimary ( options {greedy=true;} : DOT^ "class" )? + | constant + | "true" + | "false" + | "null" + | newExpression + | "this" + | "super" + | LPAREN! assignmentExpression RPAREN! + | colorMethodCall + // look for int.class and int[].class + | builtInType + ( lbt:LBRACK^ {#lbt.setType(ARRAY_DECLARATOR);} RBRACK! )* + DOT^ "class" + ; + +// the below variable rule hacks are needed so that it's possible for the +// emitter to correctly output variable declarations of the form "float a, b" +// from the AST. This means that our AST has a somewhat different form in +// these rules than the java one does, and this new form may have its own +// semantic issues. But it seems to fix the comma declaration issues. +// +variableDefinitions![AST mods, AST t] + : vd:variableDeclarator[getASTFactory().dupTree(mods), + getASTFactory().dupTree(t)] + {#variableDefinitions = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, + t, vd);} + ; +variableDeclarator[AST mods, AST t] + : ( id:IDENT (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* + v:varInitializer (COMMA!)? )+ + ; + +// java.g builds syntax trees with an inconsistent structure. override one of +// the rules there to fix this. +// +explicitConstructorInvocation! + : t:"this" LPAREN a1:argList RPAREN SEMI + {#explicitConstructorInvocation = #(#[CTOR_CALL, "CTOR_CALL"], + #t, #a1);} + | s:"super" LPAREN a2:argList RPAREN SEMI + {#explicitConstructorInvocation = #(#[SUPER_CTOR_CALL, + "SUPER_CTOR_CALL"], + #s, #a2);} + ; + +// quick-n-dirty hack to the get the advanced class name. we should +// really be getting it from the AST and not forking this rule from +// the java.g copy at all. Since this is a recursive descent parser, we get +// the last class name in the file so that we don't end up with the classname +// of an inner class. If there is more than one "outer" class in a file, +// this heuristic will fail. +// +classDefinition![AST modifiers] + : "class" i:IDENT + // it _might_ have a superclass... + sc:superClassClause + // it might implement some interfaces... + ic:implementsClause + // now parse the body of the class + cb:classBlock + {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"], + modifiers,i,sc,ic,cb); + PdePreprocessor.advClassName = i.getText();} + ; + +possiblyEmptyField + : field + | s:SEMI {#s.setType(EMPTY_FIELD);} + ; + +class PdeLexer extends JavaLexer; + +options { + importVocab=PdePartial; + exportVocab=Pde; +} + +// We need to preserve whitespace and commentary instead of ignoring +// like the supergrammar does. Otherwise Jikes won't be able to give +// us error messages that point to the equivalent PDE code. + +// WS, SL_COMMENT, ML_COMMENT are copies of the original productions, +// but with the SKIP assigment removed. + +WS : ( ' ' + | '\t' + | '\f' + // handle newlines + | ( options {generateAmbigWarnings=false;} + : "\r\n" // Evil DOS + | '\r' // Macintosh + | '\n' // Unix (the right way) + ) + { newline(); } + )+ + ; + +// Single-line comments +SL_COMMENT + : "//" + (~('\n'|'\r'))* ('\n'|'\r'('\n')?) + {newline();} + ; + +// multiple-line comments +ML_COMMENT + : "/*" + ( /* '\r' '\n' can be matched in one alternative or by matching + '\r' in one iteration and '\n' in another. I am trying to + handle any flavor of newline that comes in, but the language + that allows both "\r\n" and "\r" and "\n" to all be valid + newline is ambiguous. Consequently, the resulting grammar + must be ambiguous. I'm shutting this warning off. + */ + options { + generateAmbigWarnings=false; + } + : + { LA(2)!='/' }? '*' + | '\r' '\n' {newline();} + | '\r' {newline();} + | '\n' {newline();} + | ~('*'|'\n'|'\r') + )* + "*/" + ; + +WEBCOLOR_LITERAL + : '#'! (HEX_DIGIT)+ + ; diff --git a/app/src/processing/app/preproc/whitespace_test.pde b/app/src/processing/app/preproc/whitespace_test.pde new file mode 100644 index 000000000..290872db6 --- /dev/null +++ b/app/src/processing/app/preproc/whitespace_test.pde @@ -0,0 +1,150 @@ +// this is a whitespace and other invisible token torture test for the ANTLR-based +// preprocessor. edit pde.properties and set "editor.save_build_files" to true. +// then, build this in processing. next, use +// +// diff -u --strip-trailing-cr \ +// work/sketchbook/default/whitespace_test/whitespace_test.pde \ +// work/lib/build/MyDemo.java +// +// to compare the files before and after preprocessing. There should not be +// any differences. + +import // comment test + java.io.*; + +// comment 1 +public class // post-class comment + +// comment2 + +MyDemo extends BApplet implements // foo + java.lang. // bar + Cloneable { + + //argh + + public // foo + String // bar + fff = /*rheet */ "stuff"; + + static /*a*/ { + /*foo*/ + /*bar*/ + six = 6; + } /* b*/ + + static /*a*/ final /*b*/ int six; + + void setup() + { + size(200, 200); + background(255); + + this . fff = /* ook */ (String)/*foo*/"yo"; + rectMode(CENTER_DIAMETER); // comment 1a + noStroke(); + fill(255, 204, 0); + + int q = /*a*/ - /*b*/ 1; + + boolean c = /*a*/ ! /*b*/ true; + } + + int foo() /*a*/ throws /*b*/ java.lang.Exception /*c*/ + { + int b = 7; + switch /*a*/ ( /*b*/ b /*c*/ ) { + case /*d*/ 1 /*e*/: /*f*/ + int c=9; + /*g*/ + break; /*h*/ + default /*i*/ : + int d=9; + break; + } + + try { /* qq */ + loop(); /* rr */ + } catch /*ss*/ (java.lang.Exception ex) /*tt*/ { + b = 8; /*tut*/ + throw /*utu*/ ex; + } /*uu*/ finally /*vv*/ { + b = 9; + } /*ww*/ + + b /*aaa*/ = /*bbb*/ true /*ccc*/ ? /*ddd*/ 0 /*eee*/ + : /* fff*/ 1 /*ggg*/; + return /*a*/ 5 /*b*/; + } + + // comment 2 + void loop() + { + + int arr1 /* VVV */ [ /* XXX */] /*YYY*/ ; + int[] arr2 = { /*a*/ 2, 3 /*b*/ } /*c*/ ; + + for /*a*/ (/*b*/ int j=0 /*c*/; /*d*/ j<2/*e*/ ; /*f*/ j++ /*g*/) + /*h*/ + arr2[1] = 6; + + /*foo*/ + ; + /*bar*/ + rect(width-mouseX, height-mouseY, 50, 50); + rect(mouseX, mouseY, 50, 50); + + if (/*a*/ arr2[1] == 6/*b*/) { + /*c*/ + int d=7; + } /*d*/else /*e*/{ + int e=8; + /*f*/ + } + + int f; + if (/*aa*/ arr2[1] ==6 /*bb*/ ) + /*cc*/ + f=8; /*dd*/ + else /*ee*/ + f=10; /*ff*/ + + while ( /*aaa*/ f < 15) /*bbb*/ { + f ++; + } /*ggg*/ + + do /* aaaa */ { + f++; + } /*bbbb*/ while /*cccc*/ ( /*a*/ - /*b*/ 20 > f) /*dddd*/; + + f = 2 * 3 + 4; + + f = ( 2 * 3 ) + 4 + /*aa*/ -/*bb*/1; + + f = 2 * ( 3 + 4 ) ; + + fff = /*a*/ new /*b*/ String(/*c*/"foo"/*d*/) /*e*/; + + int arr3[] = /*a*/ new /*b*/ int/*c*/[/*d*/] /*e*/ {1/*f*/,2}; + int arr4[][] = new /*a*/int/*b*/[1][2]/*c*/; + + } + + class Shoe + { + Shoe(String brand) + { + println(brand); + } + } + + class NikeAir extends Shoe + { + NikeAir() + { + /*a*/ super /*b*/ ( /*c*/ "Nike" /*d*/ ) /*e*/ ; + + /*aa*/ ( /*bb*/ new /*cc*/ MyDemo /*dd*/ (/*ee*/)/*ff*/)/*gg*/./*hh*/super/*ii*/(/*jj*/5/*kk*/); + } + } +} diff --git a/app/src/processing/app/syntax/CTokenMarker.java b/app/src/processing/app/syntax/CTokenMarker.java new file mode 100644 index 000000000..1fdb33fe6 --- /dev/null +++ b/app/src/processing/app/syntax/CTokenMarker.java @@ -0,0 +1,274 @@ +/* + * CTokenMarker.java - C token marker + * Copyright (C) 1998, 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.text.Segment; + +/** + * C token marker. + * + * @author Slava Pestov + * @version $Id: CTokenMarker.java 1268 2005-04-09 02:30:37Z benfry $ + */ +public class CTokenMarker extends TokenMarker +{ + public CTokenMarker() + { + this(true,getKeywords()); + } + + public CTokenMarker(boolean cpp, KeywordMap keywords) + { + this.cpp = cpp; + this.keywords = keywords; + } + + public byte markTokensImpl(byte token, Segment line, int lineIndex) + { + char[] array = line.array; + int offset = line.offset; + lastOffset = offset; + lastKeyword = offset; + int mlength = line.count + offset; + boolean backslash = false; + +loop: for(int i = offset; i < mlength; i++) + { + int i1 = (i+1); + + char c = array[i]; + if(c == '\\') + { + backslash = !backslash; + continue; + } + + switch(token) + { + case Token.NULL: + switch(c) + { + case '#': + if(backslash) + backslash = false; + else if(cpp) + { + if(doKeyword(line,i,c)) + break; + addToken(i - lastOffset,token); + addToken(mlength - i,Token.KEYWORD2); + lastOffset = lastKeyword = mlength; + break loop; + } + break; + case '"': + doKeyword(line,i,c); + if(backslash) + backslash = false; + else + { + addToken(i - lastOffset,token); + token = Token.LITERAL1; + lastOffset = lastKeyword = i; + } + break; + case '\'': + doKeyword(line,i,c); + if(backslash) + backslash = false; + else + { + addToken(i - lastOffset,token); + token = Token.LITERAL2; + lastOffset = lastKeyword = i; + } + break; + case ':': + if(lastKeyword == offset) + { + if(doKeyword(line,i,c)) + break; + backslash = false; + addToken(i1 - lastOffset,Token.LABEL); + lastOffset = lastKeyword = i1; + } + else if(doKeyword(line,i,c)) + break; + break; + case '/': + backslash = false; + doKeyword(line,i,c); + if(mlength - i > 1) + { + switch(array[i1]) + { + case '*': + addToken(i - lastOffset,token); + lastOffset = lastKeyword = i; + if(mlength - i > 2 && array[i+2] == '*') + token = Token.COMMENT2; + else + token = Token.COMMENT1; + break; + case '/': + addToken(i - lastOffset,token); + addToken(mlength - i,Token.COMMENT1); + lastOffset = lastKeyword = mlength; + break loop; + } + } + break; + default: + backslash = false; + if(!Character.isLetterOrDigit(c) + && c != '_') + doKeyword(line,i,c); + break; + } + break; + case Token.COMMENT1: + case Token.COMMENT2: + backslash = false; + if(c == '*' && mlength - i > 1) + { + if(array[i1] == '/') + { + i++; + addToken((i+1) - lastOffset,token); + token = Token.NULL; + lastOffset = lastKeyword = i+1; + } + } + break; + case Token.LITERAL1: + if(backslash) + backslash = false; + else if(c == '"') + { + addToken(i1 - lastOffset,token); + token = Token.NULL; + lastOffset = lastKeyword = i1; + } + break; + case Token.LITERAL2: + if(backslash) + backslash = false; + else if(c == '\'') + { + addToken(i1 - lastOffset,Token.LITERAL1); + token = Token.NULL; + lastOffset = lastKeyword = i1; + } + break; + default: + throw new InternalError("Invalid state: " + + token); + } + } + + if(token == Token.NULL) + doKeyword(line,mlength,'\0'); + + switch(token) + { + case Token.LITERAL1: + case Token.LITERAL2: + addToken(mlength - lastOffset,Token.INVALID); + token = Token.NULL; + break; + case Token.KEYWORD2: + addToken(mlength - lastOffset,token); + if (!backslash) token = Token.NULL; + addToken(mlength - lastOffset,token); + break; + default: + addToken(mlength - lastOffset,token); + break; + } + + return token; + } + + public static KeywordMap getKeywords() + { + if(cKeywords == null) + { + cKeywords = new KeywordMap(false); + cKeywords.add("char",Token.KEYWORD3); + cKeywords.add("double",Token.KEYWORD3); + cKeywords.add("enum",Token.KEYWORD3); + cKeywords.add("float",Token.KEYWORD3); + cKeywords.add("int",Token.KEYWORD3); + cKeywords.add("long",Token.KEYWORD3); + cKeywords.add("short",Token.KEYWORD3); + cKeywords.add("signed",Token.KEYWORD3); + cKeywords.add("struct",Token.KEYWORD3); + cKeywords.add("typedef",Token.KEYWORD3); + cKeywords.add("union",Token.KEYWORD3); + cKeywords.add("unsigned",Token.KEYWORD3); + cKeywords.add("void",Token.KEYWORD3); + cKeywords.add("auto",Token.KEYWORD1); + cKeywords.add("const",Token.KEYWORD1); + cKeywords.add("extern",Token.KEYWORD1); + cKeywords.add("register",Token.KEYWORD1); + cKeywords.add("static",Token.KEYWORD1); + cKeywords.add("volatile",Token.KEYWORD1); + cKeywords.add("break",Token.KEYWORD1); + cKeywords.add("case",Token.KEYWORD1); + cKeywords.add("continue",Token.KEYWORD1); + cKeywords.add("default",Token.KEYWORD1); + cKeywords.add("do",Token.KEYWORD1); + cKeywords.add("else",Token.KEYWORD1); + cKeywords.add("for",Token.KEYWORD1); + cKeywords.add("goto",Token.KEYWORD1); + cKeywords.add("if",Token.KEYWORD1); + cKeywords.add("return",Token.KEYWORD1); + cKeywords.add("sizeof",Token.KEYWORD1); + cKeywords.add("switch",Token.KEYWORD1); + cKeywords.add("while",Token.KEYWORD1); + cKeywords.add("asm",Token.KEYWORD2); + cKeywords.add("asmlinkage",Token.KEYWORD2); + cKeywords.add("far",Token.KEYWORD2); + cKeywords.add("huge",Token.KEYWORD2); + cKeywords.add("inline",Token.KEYWORD2); + cKeywords.add("near",Token.KEYWORD2); + cKeywords.add("pascal",Token.KEYWORD2); + cKeywords.add("true",Token.LITERAL2); + cKeywords.add("false",Token.LITERAL2); + cKeywords.add("NULL",Token.LITERAL2); + } + return cKeywords; + } + + // private members + private static KeywordMap cKeywords; + + private boolean cpp; + private KeywordMap keywords; + private int lastOffset; + private int lastKeyword; + + private boolean doKeyword(Segment line, int i, char c) + { + int i1 = i+1; + + int len = i - lastKeyword; + byte id = keywords.lookup(line,lastKeyword,len); + if(id != Token.NULL) + { + if(lastKeyword != lastOffset) + addToken(lastKeyword - lastOffset,Token.NULL); + addToken(len,id); + lastOffset = i; + } + lastKeyword = i1; + return false; + } +} diff --git a/app/src/processing/app/syntax/DefaultInputHandler.java b/app/src/processing/app/syntax/DefaultInputHandler.java new file mode 100644 index 000000000..9814cf252 --- /dev/null +++ b/app/src/processing/app/syntax/DefaultInputHandler.java @@ -0,0 +1,374 @@ +/* + * DefaultInputHandler.java - Default implementation of an input handler + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.KeyStroke; +import java.awt.event.*; +import java.awt.Toolkit; +import java.util.Hashtable; +import java.util.StringTokenizer; + +/** + * The default input handler. It maps sequences of keystrokes into actions + * and inserts key typed events into the text area. + * @author Slava Pestov + * @version $Id: DefaultInputHandler.java 1438 2005-05-11 08:34:16Z benfry $ + */ +public class DefaultInputHandler extends InputHandler +{ + /** + * Creates a new input handler with no key bindings defined. + */ + public DefaultInputHandler() + { + bindings = currentBindings = new Hashtable(); + } + + /** + * Sets up the default key bindings. + */ + public void addDefaultKeyBindings() + { + addKeyBinding("BACK_SPACE",BACKSPACE); + addKeyBinding("C+BACK_SPACE",BACKSPACE_WORD); + addKeyBinding("DELETE",DELETE); + addKeyBinding("C+DELETE",DELETE_WORD); + + addKeyBinding("ENTER",INSERT_BREAK); + addKeyBinding("TAB",INSERT_TAB); + + addKeyBinding("INSERT",OVERWRITE); + addKeyBinding("C+\\",TOGGLE_RECT); + + addKeyBinding("HOME",HOME); + addKeyBinding("END",END); + addKeyBinding("S+HOME",SELECT_HOME); + addKeyBinding("S+END",SELECT_END); + addKeyBinding("C+HOME",DOCUMENT_HOME); + addKeyBinding("C+END",DOCUMENT_END); + addKeyBinding("CS+HOME",SELECT_DOC_HOME); + addKeyBinding("CS+END",SELECT_DOC_END); + + addKeyBinding("PAGE_UP",PREV_PAGE); + addKeyBinding("PAGE_DOWN",NEXT_PAGE); + addKeyBinding("S+PAGE_UP",SELECT_PREV_PAGE); + addKeyBinding("S+PAGE_DOWN",SELECT_NEXT_PAGE); + + addKeyBinding("LEFT",PREV_CHAR); + addKeyBinding("S+LEFT",SELECT_PREV_CHAR); + addKeyBinding("C+LEFT",PREV_WORD); + addKeyBinding("CS+LEFT",SELECT_PREV_WORD); + addKeyBinding("RIGHT",NEXT_CHAR); + addKeyBinding("S+RIGHT",SELECT_NEXT_CHAR); + addKeyBinding("C+RIGHT",NEXT_WORD); + addKeyBinding("CS+RIGHT",SELECT_NEXT_WORD); + addKeyBinding("UP",PREV_LINE); + addKeyBinding("S+UP",SELECT_PREV_LINE); + addKeyBinding("DOWN",NEXT_LINE); + addKeyBinding("S+DOWN",SELECT_NEXT_LINE); + + addKeyBinding("C+ENTER",REPEAT); + } + + /** + * Adds a key binding to this input handler. The key binding is + * a list of white space separated key strokes of the form + * [modifiers+]key where modifier is C for Control, A for Alt, + * or S for Shift, and key is either a character (a-z) or a field + * name in the KeyEvent class prefixed with VK_ (e.g., BACK_SPACE) + * @param keyBinding The key binding + * @param action The action + */ + public void addKeyBinding(String keyBinding, ActionListener action) + { + Hashtable current = bindings; + + StringTokenizer st = new StringTokenizer(keyBinding); + while(st.hasMoreTokens()) + { + KeyStroke keyStroke = parseKeyStroke(st.nextToken()); + if(keyStroke == null) + return; + + if(st.hasMoreTokens()) + { + Object o = current.get(keyStroke); + if(o instanceof Hashtable) + current = (Hashtable)o; + else + { + o = new Hashtable(); + current.put(keyStroke,o); + current = (Hashtable)o; + } + } + else + current.put(keyStroke,action); + } + } + + /** + * Removes a key binding from this input handler. This is not yet + * implemented. + * @param keyBinding The key binding + */ + public void removeKeyBinding(String keyBinding) + { + throw new InternalError("Not yet implemented"); + } + + /** + * Removes all key bindings from this input handler. + */ + public void removeAllKeyBindings() + { + bindings.clear(); + } + + /** + * Returns a copy of this input handler that shares the same + * key bindings. Setting key bindings in the copy will also + * set them in the original. + */ + public InputHandler copy() + { + return new DefaultInputHandler(this); + } + + /** + * Handle a key pressed event. This will look up the binding for + * the key stroke and execute it. + */ + public void keyPressed(KeyEvent evt) + { + int keyCode = evt.getKeyCode(); + int modifiers = evt.getModifiers(); + + // moved this earlier so it doesn't get random meta clicks + if (keyCode == KeyEvent.VK_CONTROL || + keyCode == KeyEvent.VK_SHIFT || + keyCode == KeyEvent.VK_ALT || + keyCode == KeyEvent.VK_META) { + return; + } + + // don't get command-s or other menu key equivs on mac + // unless it's something that's specifically bound (cmd-left or right) + //if ((modifiers & KeyEvent.META_MASK) != 0) return; + if ((modifiers & KeyEvent.META_MASK) != 0) { + KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCode, modifiers); + if (currentBindings.get(keyStroke) == null) { + return; + } + } + + /* + char keyChar = evt.getKeyChar(); + System.out.println("code=" + keyCode + " char=" + keyChar + + " charint=" + ((int)keyChar)); + System.out.println("other codes " + KeyEvent.VK_ALT + " " + + KeyEvent.VK_META); + */ + + if((modifiers & ~KeyEvent.SHIFT_MASK) != 0 + || evt.isActionKey() + || keyCode == KeyEvent.VK_BACK_SPACE + || keyCode == KeyEvent.VK_DELETE + || keyCode == KeyEvent.VK_ENTER + || keyCode == KeyEvent.VK_TAB + || keyCode == KeyEvent.VK_ESCAPE) + { + if(grabAction != null) + { + handleGrabAction(evt); + return; + } + + KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCode, + modifiers); + Object o = currentBindings.get(keyStroke); + if(o == null) + { + // Don't beep if the user presses some + // key we don't know about unless a + // prefix is active. Otherwise it will + // beep when caps lock is pressed, etc. + if(currentBindings != bindings) + { + Toolkit.getDefaultToolkit().beep(); + // F10 should be passed on, but C+e F10 + // shouldn't + repeatCount = 0; + repeat = false; + evt.consume(); + } + currentBindings = bindings; + return; + } + else if(o instanceof ActionListener) + { + currentBindings = bindings; + + executeAction(((ActionListener)o), + evt.getSource(),null); + + evt.consume(); + return; + } + else if(o instanceof Hashtable) + { + currentBindings = (Hashtable)o; + evt.consume(); + return; + } + } + } + + /** + * Handle a key typed event. This inserts the key into the text area. + */ + public void keyTyped(KeyEvent evt) + { + int modifiers = evt.getModifiers(); + char c = evt.getKeyChar(); + + // this is the apple/cmd key on macosx.. so menu commands + // were being passed through as legit keys.. added this line + // in an attempt to prevent. + if ((modifiers & KeyEvent.META_MASK) != 0) return; + + if (c != KeyEvent.CHAR_UNDEFINED) // && + // (modifiers & KeyEvent.ALT_MASK) == 0) + { + if(c >= 0x20 && c != 0x7f) + { + KeyStroke keyStroke = KeyStroke.getKeyStroke( + Character.toUpperCase(c)); + Object o = currentBindings.get(keyStroke); + + if(o instanceof Hashtable) + { + currentBindings = (Hashtable)o; + return; + } + else if(o instanceof ActionListener) + { + currentBindings = bindings; + executeAction((ActionListener)o, + evt.getSource(), + String.valueOf(c)); + return; + } + + currentBindings = bindings; + + if(grabAction != null) + { + handleGrabAction(evt); + return; + } + + // 0-9 adds another 'digit' to the repeat number + if(repeat && Character.isDigit(c)) + { + repeatCount *= 10; + repeatCount += (c - '0'); + return; + } + + executeAction(INSERT_CHAR,evt.getSource(), + String.valueOf(evt.getKeyChar())); + + repeatCount = 0; + repeat = false; + } + } + } + + /** + * Converts a string to a keystroke. The string should be of the + * form modifiers+shortcut where modifiers + * is any combination of A for Alt, C for Control, S for Shift + * or M for Meta, and shortcut is either a single character, + * or a keycode name from the KeyEvent class, without + * the VK_ prefix. + * @param keyStroke A string description of the key stroke + */ + public static KeyStroke parseKeyStroke(String keyStroke) + { + if(keyStroke == null) + return null; + int modifiers = 0; + int index = keyStroke.indexOf('+'); + if(index != -1) + { + for(int i = 0; i < index; i++) + { + switch(Character.toUpperCase(keyStroke + .charAt(i))) + { + case 'A': + modifiers |= InputEvent.ALT_MASK; + break; + case 'C': + modifiers |= InputEvent.CTRL_MASK; + break; + case 'M': + modifiers |= InputEvent.META_MASK; + break; + case 'S': + modifiers |= InputEvent.SHIFT_MASK; + break; + } + } + } + String key = keyStroke.substring(index + 1); + if(key.length() == 1) + { + char ch = Character.toUpperCase(key.charAt(0)); + if(modifiers == 0) + return KeyStroke.getKeyStroke(ch); + else + return KeyStroke.getKeyStroke(ch,modifiers); + } + else if(key.length() == 0) + { + System.err.println("Invalid key stroke: " + keyStroke); + return null; + } + else + { + int ch; + + try + { + ch = KeyEvent.class.getField("VK_".concat(key)) + .getInt(null); + } + catch(Exception e) + { + System.err.println("Invalid key stroke: " + + keyStroke); + return null; + } + + return KeyStroke.getKeyStroke(ch,modifiers); + } + } + + // private members + private Hashtable bindings; + private Hashtable currentBindings; + + private DefaultInputHandler(DefaultInputHandler copy) + { + bindings = currentBindings = copy.bindings; + } +} diff --git a/app/src/processing/app/syntax/InputHandler.java b/app/src/processing/app/syntax/InputHandler.java new file mode 100644 index 000000000..db7260da5 --- /dev/null +++ b/app/src/processing/app/syntax/InputHandler.java @@ -0,0 +1,1102 @@ +/* + * InputHandler.java - Manages key bindings and executes actions + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.text.*; +import javax.swing.JPopupMenu; +import java.awt.event.*; +import java.awt.Component; +import java.util.*; + +/** + * An input handler converts the user's key strokes into concrete actions. + * It also takes care of macro recording and action repetition.

+ * + * This class provides all the necessary support code for an input + * handler, but doesn't actually do any key binding logic. It is up + * to the implementations of this class to do so. + * + * @author Slava Pestov + * @version $Id: InputHandler.java 4168 2008-08-09 17:24:37Z fry $ + */ +public abstract class InputHandler extends KeyAdapter +{ + /** + * If this client property is set to Boolean.TRUE on the text area, + * the home/end keys will support 'smart' BRIEF-like behaviour + * (one press = start/end of line, two presses = start/end of + * viewscreen, three presses = start/end of document). By default, + * this property is not set. + */ + public static final String SMART_HOME_END_PROPERTY = "InputHandler.homeEnd"; + + public static final ActionListener BACKSPACE = new backspace(); + public static final ActionListener BACKSPACE_WORD = new backspace_word(); + public static final ActionListener DELETE = new delete(); + public static final ActionListener DELETE_WORD = new delete_word(); + public static final ActionListener END = new end(false); + public static final ActionListener DOCUMENT_END = new document_end(false); + public static final ActionListener SELECT_END = new end(true); + public static final ActionListener SELECT_DOC_END = new document_end(true); + public static final ActionListener INSERT_BREAK = new insert_break(); + public static final ActionListener INSERT_TAB = new insert_tab(); + public static final ActionListener HOME = new home(false); + public static final ActionListener DOCUMENT_HOME = new document_home(false); + public static final ActionListener SELECT_HOME = new home(true); + public static final ActionListener SELECT_DOC_HOME = new document_home(true); + public static final ActionListener NEXT_CHAR = new next_char(false); + public static final ActionListener NEXT_LINE = new next_line(false); + public static final ActionListener NEXT_PAGE = new next_page(false); + public static final ActionListener NEXT_WORD = new next_word(false); + public static final ActionListener SELECT_NEXT_CHAR = new next_char(true); + public static final ActionListener SELECT_NEXT_LINE = new next_line(true); + public static final ActionListener SELECT_NEXT_PAGE = new next_page(true); + public static final ActionListener SELECT_NEXT_WORD = new next_word(true); + public static final ActionListener OVERWRITE = new overwrite(); + public static final ActionListener PREV_CHAR = new prev_char(false); + public static final ActionListener PREV_LINE = new prev_line(false); + public static final ActionListener PREV_PAGE = new prev_page(false); + public static final ActionListener PREV_WORD = new prev_word(false); + public static final ActionListener SELECT_PREV_CHAR = new prev_char(true); + public static final ActionListener SELECT_PREV_LINE = new prev_line(true); + public static final ActionListener SELECT_PREV_PAGE = new prev_page(true); + public static final ActionListener SELECT_PREV_WORD = new prev_word(true); + public static final ActionListener REPEAT = new repeat(); + public static final ActionListener TOGGLE_RECT = new toggle_rect(); + + // Default action + public static final ActionListener INSERT_CHAR = new insert_char(); + + private static Hashtable actions; + + static + { + actions = new Hashtable(); + actions.put("backspace",BACKSPACE); + actions.put("backspace-word",BACKSPACE_WORD); + actions.put("delete",DELETE); + actions.put("delete-word",DELETE_WORD); + actions.put("end",END); + actions.put("select-end",SELECT_END); + actions.put("document-end",DOCUMENT_END); + actions.put("select-doc-end",SELECT_DOC_END); + actions.put("insert-break",INSERT_BREAK); + actions.put("insert-tab",INSERT_TAB); + actions.put("home",HOME); + actions.put("select-home",SELECT_HOME); + actions.put("document-home",DOCUMENT_HOME); + actions.put("select-doc-home",SELECT_DOC_HOME); + actions.put("next-char",NEXT_CHAR); + actions.put("next-line",NEXT_LINE); + actions.put("next-page",NEXT_PAGE); + actions.put("next-word",NEXT_WORD); + actions.put("select-next-char",SELECT_NEXT_CHAR); + actions.put("select-next-line",SELECT_NEXT_LINE); + actions.put("select-next-page",SELECT_NEXT_PAGE); + actions.put("select-next-word",SELECT_NEXT_WORD); + actions.put("overwrite",OVERWRITE); + actions.put("prev-char",PREV_CHAR); + actions.put("prev-line",PREV_LINE); + actions.put("prev-page",PREV_PAGE); + actions.put("prev-word",PREV_WORD); + actions.put("select-prev-char",SELECT_PREV_CHAR); + actions.put("select-prev-line",SELECT_PREV_LINE); + actions.put("select-prev-page",SELECT_PREV_PAGE); + actions.put("select-prev-word",SELECT_PREV_WORD); + actions.put("repeat",REPEAT); + actions.put("toggle-rect",TOGGLE_RECT); + actions.put("insert-char",INSERT_CHAR); + } + + /** + * Returns a named text area action. + * @param name The action name + */ + public static ActionListener getAction(String name) + { + return (ActionListener)actions.get(name); + } + + /** + * Returns the name of the specified text area action. + * @param listener The action + */ + public static String getActionName(ActionListener listener) + { + Enumeration en = getActions(); + while(en.hasMoreElements()) + { + String name = (String)en.nextElement(); + ActionListener _listener = getAction(name); + if(_listener == listener) { + return name; + } + } + return null; + } + + /** + * Returns an enumeration of all available actions. + */ + public static Enumeration getActions() + { + return actions.keys(); + } + + /** + * Adds the default key bindings to this input handler. + * This should not be called in the constructor of this + * input handler, because applications might load the + * key bindings from a file, etc. + */ + public abstract void addDefaultKeyBindings(); + + /** + * Adds a key binding to this input handler. + * @param keyBinding The key binding (the format of this is + * input-handler specific) + * @param action The action + */ + public abstract void addKeyBinding(String keyBinding, ActionListener action); + + /** + * Removes a key binding from this input handler. + * @param keyBinding The key binding + */ + public abstract void removeKeyBinding(String keyBinding); + + /** + * Removes all key bindings from this input handler. + */ + public abstract void removeAllKeyBindings(); + + /** + * Grabs the next key typed event and invokes the specified + * action with the key as a the action command. + */ + public void grabNextKeyStroke(ActionListener listener) + { + grabAction = listener; + } + + /** + * Returns if repeating is enabled. When repeating is enabled, + * actions will be executed multiple times. This is usually + * invoked with a special key stroke in the input handler. + */ + public boolean isRepeatEnabled() + { + return repeat; + } + + /** + * Enables repeating. When repeating is enabled, actions will be + * executed multiple times. Once repeating is enabled, the input + * handler should read a number from the keyboard. + */ + public void setRepeatEnabled(boolean repeat) + { + this.repeat = repeat; + } + + /** + * Returns the number of times the next action will be repeated. + */ + public int getRepeatCount() + { + return (repeat ? Math.max(1,repeatCount) : 1); + } + + /** + * Sets the number of times the next action will be repeated. + * @param repeatCount The repeat count + */ + public void setRepeatCount(int repeatCount) + { + this.repeatCount = repeatCount; + } + + /** + * Returns the macro recorder. If this is non-null, all executed + * actions should be forwarded to the recorder. + */ + public InputHandler.MacroRecorder getMacroRecorder() + { + return recorder; + } + + /** + * Sets the macro recorder. If this is non-null, all executed + * actions should be forwarded to the recorder. + * @param recorder The macro recorder + */ + public void setMacroRecorder(InputHandler.MacroRecorder recorder) + { + this.recorder = recorder; + } + + /** + * Returns a copy of this input handler that shares the same + * key bindings. Setting key bindings in the copy will also + * set them in the original. + */ + public abstract InputHandler copy(); + + /** + * Executes the specified action, repeating and recording it as + * necessary. + * @param listener The action listener + * @param source The event source + * @param actionCommand The action command + */ + public void executeAction(ActionListener listener, Object source, + String actionCommand) + { + // create event + ActionEvent evt = new ActionEvent(source, + ActionEvent.ACTION_PERFORMED, + actionCommand); + + // don't do anything if the action is a wrapper + // (like EditAction.Wrapper) + if(listener instanceof Wrapper) + { + listener.actionPerformed(evt); + return; + } + + // remember old values, in case action changes them + boolean _repeat = repeat; + int _repeatCount = getRepeatCount(); + + // execute the action + if(listener instanceof InputHandler.NonRepeatable) + listener.actionPerformed(evt); + else + { + for(int i = 0; i < Math.max(1,repeatCount); i++) + listener.actionPerformed(evt); + } + + // do recording. Notice that we do no recording whatsoever + // for actions that grab keys + if(grabAction == null) + { + if(recorder != null) + { + if(!(listener instanceof InputHandler.NonRecordable)) + { + if(_repeatCount != 1) + recorder.actionPerformed(REPEAT,String.valueOf(_repeatCount)); + + recorder.actionPerformed(listener,actionCommand); + } + } + + // If repeat was true originally, clear it + // Otherwise it might have been set by the action, etc + if(_repeat) + { + repeat = false; + repeatCount = 0; + } + } + } + + /** + * Returns the text area that fired the specified event. + * @param evt The event + */ + public static JEditTextArea getTextArea(EventObject evt) + { + if(evt != null) + { + Object o = evt.getSource(); + if(o instanceof Component) + { + // find the parent text area + Component c = (Component)o; + for(;;) + { + if(c instanceof JEditTextArea) + return (JEditTextArea)c; + else if(c == null) + break; + if(c instanceof JPopupMenu) + c = ((JPopupMenu)c) + .getInvoker(); + else + c = c.getParent(); + } + } + } + + // this shouldn't happen + System.err.println("BUG: getTextArea() returning null"); + System.err.println("Report this to Slava Pestov "); + return null; + } + + // protected members + + /** + * If a key is being grabbed, this method should be called with + * the appropriate key event. It executes the grab action with + * the typed character as the parameter. + */ + protected void handleGrabAction(KeyEvent evt) + { + // Clear it *before* it is executed so that executeAction() + // resets the repeat count + ActionListener _grabAction = grabAction; + grabAction = null; + executeAction(_grabAction,evt.getSource(), + String.valueOf(evt.getKeyChar())); + } + + // protected members + protected ActionListener grabAction; + protected boolean repeat; + protected int repeatCount; + protected InputHandler.MacroRecorder recorder; + + /** + * If an action implements this interface, it should not be repeated. + * Instead, it will handle the repetition itself. + */ + public interface NonRepeatable {} + + /** + * If an action implements this interface, it should not be recorded + * by the macro recorder. Instead, it will do its own recording. + */ + public interface NonRecordable {} + + /** + * For use by EditAction.Wrapper only. + * @since jEdit 2.2final + */ + public interface Wrapper {} + + /** + * Macro recorder. + */ + public interface MacroRecorder + { + void actionPerformed(ActionListener listener, + String actionCommand); + } + + public static class backspace implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + + if(!textArea.isEditable()) + { + textArea.getToolkit().beep(); + return; + } + + if(textArea.getSelectionStart() + != textArea.getSelectionStop()) + { + textArea.setSelectedText(""); + } + else + { + int caret = textArea.getCaretPosition(); + if(caret == 0) + { + textArea.getToolkit().beep(); + return; + } + try + { + textArea.getDocument().remove(caret - 1,1); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + } + } + } + + public static class backspace_word implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int start = textArea.getSelectionStart(); + if(start != textArea.getSelectionStop()) + { + textArea.setSelectedText(""); + } + + int line = textArea.getCaretLine(); + int lineStart = textArea.getLineStartOffset(line); + int caret = start - lineStart; + + String lineText = textArea.getLineText(textArea + .getCaretLine()); + + if(caret == 0) + { + if(lineStart == 0) + { + textArea.getToolkit().beep(); + return; + } + caret--; + } + else + { + String noWordSep = (String)textArea.getDocument().getProperty("noWordSep"); + caret = TextUtilities.findWordStart(lineText,caret,noWordSep); + } + + try + { + textArea.getDocument().remove( + caret + lineStart, + start - (caret + lineStart)); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + } + } + + public static class delete implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + + if(!textArea.isEditable()) + { + textArea.getToolkit().beep(); + return; + } + + if(textArea.getSelectionStart() + != textArea.getSelectionStop()) + { + textArea.setSelectedText(""); + } + else + { + int caret = textArea.getCaretPosition(); + if(caret == textArea.getDocumentLength()) + { + textArea.getToolkit().beep(); + return; + } + try + { + textArea.getDocument().remove(caret,1); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + } + } + } + + public static class delete_word implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int start = textArea.getSelectionStart(); + if(start != textArea.getSelectionStop()) + { + textArea.setSelectedText(""); + } + + int line = textArea.getCaretLine(); + int lineStart = textArea.getLineStartOffset(line); + int caret = start - lineStart; + + String lineText = textArea.getLineText(textArea + .getCaretLine()); + + if(caret == lineText.length()) + { + if(lineStart + caret == textArea.getDocumentLength()) + { + textArea.getToolkit().beep(); + return; + } + caret++; + } + else + { + String noWordSep = (String)textArea.getDocument().getProperty("noWordSep"); + caret = TextUtilities.findWordEnd(lineText,caret,noWordSep); + } + + try + { + textArea.getDocument().remove(start, + (caret + lineStart) - start); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + } + } + + public static class end implements ActionListener + { + private boolean select; + + public end(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + + int caret = textArea.getCaretPosition(); + + int lastOfLine = textArea.getLineStopOffset( + textArea.getCaretLine()) - 1; + int lastVisibleLine = textArea.getFirstLine() + + textArea.getVisibleLines(); + if(lastVisibleLine >= textArea.getLineCount()) + { + lastVisibleLine = Math.min(textArea.getLineCount() - 1, + lastVisibleLine); + } + else + lastVisibleLine -= (textArea.getElectricScroll() + 1); + + int lastVisible = textArea.getLineStopOffset(lastVisibleLine) - 1; + int lastDocument = textArea.getDocumentLength(); + + if(caret == lastDocument) + { + textArea.getToolkit().beep(); + return; + } + else if(!Boolean.TRUE.equals(textArea.getClientProperty( + SMART_HOME_END_PROPERTY))) + caret = lastOfLine; + else if(caret == lastVisible) + caret = lastDocument; + else if(caret == lastOfLine) + caret = lastVisible; + else + caret = lastOfLine; + + if(select) + textArea.select(textArea.getMarkPosition(),caret); + else + textArea.setCaretPosition(caret); + } + } + + public static class document_end implements ActionListener + { + private boolean select; + + public document_end(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + if(select) + textArea.select(textArea.getMarkPosition(), + textArea.getDocumentLength()); + else + textArea.setCaretPosition(textArea + .getDocumentLength()); + } + } + + public static class home implements ActionListener + { + private boolean select; + + public home(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + + int caret = textArea.getCaretPosition(); + + int firstLine = textArea.getFirstLine(); + + int firstOfLine = textArea.getLineStartOffset( + textArea.getCaretLine()); + int firstVisibleLine = (firstLine == 0 ? 0 : + firstLine + textArea.getElectricScroll()); + int firstVisible = textArea.getLineStartOffset( + firstVisibleLine); + + if(caret == 0) + { + textArea.getToolkit().beep(); + return; + } + else if(!Boolean.TRUE.equals(textArea.getClientProperty( + SMART_HOME_END_PROPERTY))) + caret = firstOfLine; + else if(caret == firstVisible) + caret = 0; + else if(caret == firstOfLine) + caret = firstVisible; + else + caret = firstOfLine; + + if(select) + textArea.select(textArea.getMarkPosition(),caret); + else + textArea.setCaretPosition(caret); + } + } + + public static class document_home implements ActionListener + { + private boolean select; + + public document_home(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + if(select) + textArea.select(textArea.getMarkPosition(),0); + else + textArea.setCaretPosition(0); + } + } + + public static class insert_break implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + + if(!textArea.isEditable()) + { + textArea.getToolkit().beep(); + return; + } + + textArea.setSelectedText("\n"); + } + } + + public static class insert_tab implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + + if(!textArea.isEditable()) + { + textArea.getToolkit().beep(); + return; + } + + textArea.overwriteSetSelectedText("\t"); + } + } + + public static class next_char implements ActionListener + { + private boolean select; + + public next_char(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int caret = textArea.getCaretPosition(); + + if(caret == textArea.getDocumentLength()) + { + if (textArea.getSelectionStart() != + textArea.getSelectionStop()) { + // just move to the end of the selection + textArea.select(caret, caret); + } else { + // beep at the user for being annoying + textArea.getToolkit().beep(); + } + + } else if (select) { + textArea.select(textArea.getMarkPosition(), caret+1); + + } else { + int start = textArea.getSelectionStart(); + int end = textArea.getSelectionStop(); + if (start != end) { + textArea.select(end, end); + } else { + textArea.setCaretPosition(caret + 1); + } + } + } + } + + public static class next_line implements ActionListener + { + private boolean select; + + public next_line(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int caret = textArea.getCaretPosition(); + int line = textArea.getCaretLine(); + + if(line == textArea.getLineCount() - 1) + { + //textArea.getToolkit().beep(); + int doc = textArea.getDocumentLength(); + if (select) { + textArea.select(textArea.getMarkPosition(), doc); + } else { + textArea.setCaretPosition(doc); + } + return; + } + + int magic = textArea.getMagicCaretPosition(); + if(magic == -1) + { + magic = textArea.offsetToX(line, + caret - textArea.getLineStartOffset(line)); + } + + caret = textArea.getLineStartOffset(line + 1) + + textArea.xToOffset(line + 1,magic); + if(select) + textArea.select(textArea.getMarkPosition(),caret); + else + textArea.setCaretPosition(caret); + textArea.setMagicCaretPosition(magic); + } + } + + public static class next_page implements ActionListener + { + private boolean select; + + public next_page(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int lineCount = textArea.getLineCount(); + int firstLine = textArea.getFirstLine(); + int visibleLines = textArea.getVisibleLines(); + int line = textArea.getCaretLine(); + + firstLine += visibleLines; + + if(firstLine + visibleLines >= lineCount - 1) + firstLine = lineCount - visibleLines; + + textArea.setFirstLine(firstLine); + + int caret = textArea.getLineStartOffset( + Math.min(textArea.getLineCount() - 1, + line + visibleLines)); + if(select) + textArea.select(textArea.getMarkPosition(),caret); + else + textArea.setCaretPosition(caret); + } + } + + public static class next_word implements ActionListener + { + private boolean select; + + public next_word(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int caret = textArea.getCaretPosition(); + int line = textArea.getCaretLine(); + int lineStart = textArea.getLineStartOffset(line); + caret -= lineStart; + + String lineText = textArea.getLineText(textArea + .getCaretLine()); + + if(caret == lineText.length()) + { + if(lineStart + caret == textArea.getDocumentLength()) + { + textArea.getToolkit().beep(); + return; + } + caret++; + } + else + { + String noWordSep = (String)textArea.getDocument().getProperty("noWordSep"); + caret = TextUtilities.findWordEnd(lineText,caret,noWordSep); + } + + if(select) + textArea.select(textArea.getMarkPosition(), + lineStart + caret); + else + textArea.setCaretPosition(lineStart + caret); + } + } + + public static class overwrite implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + textArea.setOverwriteEnabled( + !textArea.isOverwriteEnabled()); + } + } + + public static class prev_char implements ActionListener + { + private boolean select; + + public prev_char(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int caret = textArea.getCaretPosition(); + if(caret == 0) + { + textArea.getToolkit().beep(); + return; + } + + if (select) { + textArea.select(textArea.getMarkPosition(), caret-1); + } else { + int start = textArea.getSelectionStart(); + int end = textArea.getSelectionStop(); + if (start != end) { + textArea.select(start, start); + } else { + textArea.setCaretPosition(caret - 1); + } + } + } + } + + public static class prev_line implements ActionListener + { + private boolean select; + + public prev_line(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int caret = textArea.getCaretPosition(); + int line = textArea.getCaretLine(); + + if(line == 0) + { + if (select) { + if (textArea.getSelectionStart() != 0) { + textArea.select(textArea.getMarkPosition(), 0); + } + } else { + textArea.setCaretPosition(0); + } + //textArea.getToolkit().beep(); + return; + } + + int magic = textArea.getMagicCaretPosition(); + if(magic == -1) + { + magic = textArea.offsetToX(line, + caret - textArea.getLineStartOffset(line)); + } + + caret = textArea.getLineStartOffset(line - 1) + + textArea.xToOffset(line - 1,magic); + if(select) + textArea.select(textArea.getMarkPosition(),caret); + else + textArea.setCaretPosition(caret); + textArea.setMagicCaretPosition(magic); + } + } + + public static class prev_page implements ActionListener + { + private boolean select; + + public prev_page(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int firstLine = textArea.getFirstLine(); + int visibleLines = textArea.getVisibleLines(); + int line = textArea.getCaretLine(); + + if(firstLine < visibleLines) + firstLine = visibleLines; + + textArea.setFirstLine(firstLine - visibleLines); + + int caret = textArea.getLineStartOffset( + Math.max(0,line - visibleLines)); + if(select) + textArea.select(textArea.getMarkPosition(),caret); + else + textArea.setCaretPosition(caret); + } + } + + public static class prev_word implements ActionListener + { + private boolean select; + + public prev_word(boolean select) + { + this.select = select; + } + + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + int caret = textArea.getCaretPosition(); + int line = textArea.getCaretLine(); + int lineStart = textArea.getLineStartOffset(line); + caret -= lineStart; + + String lineText = textArea.getLineText(textArea + .getCaretLine()); + + if(caret == 0) + { + if(lineStart == 0) + { + textArea.getToolkit().beep(); + return; + } + caret--; + } + else + { + String noWordSep = (String)textArea.getDocument().getProperty("noWordSep"); + caret = TextUtilities.findWordStart(lineText,caret,noWordSep); + } + + if(select) + textArea.select(textArea.getMarkPosition(), + lineStart + caret); + else + textArea.setCaretPosition(lineStart + caret); + } + } + + public static class repeat implements ActionListener, + InputHandler.NonRecordable + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + textArea.getInputHandler().setRepeatEnabled(true); + String actionCommand = evt.getActionCommand(); + if(actionCommand != null) + { + textArea.getInputHandler().setRepeatCount( + Integer.parseInt(actionCommand)); + } + } + } + + public static class toggle_rect implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + textArea.setSelectionRectangular( + !textArea.isSelectionRectangular()); + } + } + + public static class insert_char implements ActionListener, + InputHandler.NonRepeatable + { + public void actionPerformed(ActionEvent evt) + { + JEditTextArea textArea = getTextArea(evt); + String str = evt.getActionCommand(); + int repeatCount = textArea.getInputHandler().getRepeatCount(); + + if(textArea.isEditable()) + { + StringBuffer buf = new StringBuffer(); + for(int i = 0; i < repeatCount; i++) + buf.append(str); + textArea.overwriteSetSelectedText(buf.toString()); + } + else + { + textArea.getToolkit().beep(); + } + } + } +} diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java new file mode 100644 index 000000000..af01ea16c --- /dev/null +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -0,0 +1,2259 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + * JEditTextArea.java - jEdit's text component + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import processing.app.*; + +import javax.swing.event.*; +import javax.swing.text.*; +import javax.swing.undo.*; +import javax.swing.*; +import java.awt.datatransfer.*; +import java.awt.event.*; +import java.awt.*; +import java.util.Enumeration; +import java.util.Vector; + +/** + * jEdit's text area component. It is more suited for editing program + * source code than JEditorPane, because it drops the unnecessary features + * (images, variable-width lines, and so on) and adds a whole bunch of + * useful goodies such as: + *

    + *
  • More flexible key binding scheme + *
  • Supports macro recorders + *
  • Rectangular selection + *
  • Bracket highlighting + *
  • Syntax highlighting + *
  • Command repetition + *
  • Block caret can be enabled + *
+ * It is also faster and doesn't have as many problems. It can be used + * in other applications; the only other part of jEdit it depends on is + * the syntax package.

+ * + * To use it in your app, treat it like any other component, for example: + *

JEditTextArea ta = new JEditTextArea();
+ * ta.setTokenMarker(new JavaTokenMarker());
+ * ta.setText("public class Test {\n"
+ *     + "    public static void main(String[] args) {\n"
+ *     + "        System.out.println(\"Hello World\");\n"
+ *     + "    }\n"
+ *     + "}");
+ * + * @author Slava Pestov + * @version $Id: JEditTextArea.java 5343 2008-11-29 17:22:59Z fry $ + */ +public class JEditTextArea extends JComponent +{ + /** + * Adding components with this name to the text area will place + * them left of the horizontal scroll bar. In jEdit, the status + * bar is added this way. + */ + public static String LEFT_OF_SCROLLBAR = "los"; + + /** + * Creates a new JEditTextArea with the default settings. + */ + /* + public JEditTextArea() + { + this(TextAreaDefaults.getDefaults()); + } + */ + + /** + * Creates a new JEditTextArea with the specified settings. + * @param defaults The default settings + */ + public JEditTextArea(TextAreaDefaults defaults) + { + // Enable the necessary events + enableEvents(AWTEvent.KEY_EVENT_MASK); + + // Initialize some misc. stuff + painter = new TextAreaPainter(this,defaults); + documentHandler = new DocumentHandler(); + eventListenerList = new EventListenerList(); + caretEvent = new MutableCaretEvent(); + lineSegment = new Segment(); + bracketLine = bracketPosition = -1; + blink = true; + + // Initialize the GUI + setLayout(new ScrollLayout()); + add(CENTER, painter); + add(RIGHT, vertical = new JScrollBar(JScrollBar.VERTICAL)); + add(BOTTOM, horizontal = new JScrollBar(JScrollBar.HORIZONTAL)); + + // Add some event listeners + vertical.addAdjustmentListener(new AdjustHandler()); + horizontal.addAdjustmentListener(new AdjustHandler()); + painter.addComponentListener(new ComponentHandler()); + painter.addMouseListener(new MouseHandler()); + painter.addMouseMotionListener(new DragHandler()); + addFocusListener(new FocusHandler()); + + // Load the defaults + setInputHandler(defaults.inputHandler); + setDocument(defaults.document); + editable = defaults.editable; + caretVisible = defaults.caretVisible; + caretBlinks = defaults.caretBlinks; + electricScroll = defaults.electricScroll; + + // We don't seem to get the initial focus event? + focusedComponent = this; + + addMouseWheelListener(new MouseWheelListener() { + public void mouseWheelMoved(MouseWheelEvent e) { + if (!scrollBarsInitialized) return; + int amt = e.getWheelRotation(); + vertical.setValue(vertical.getValue() + amt * 3); + } + }); + } + + + /** + * Get current position of the vertical scroll bar. [fry] + */ + public int getScrollPosition() { + return vertical.getValue(); + } + + + /** + * Set position of the vertical scroll bar. [fry] + */ + public void setScrollPosition(int what) { + vertical.setValue(what); + } + + + /** + * Returns if this component can be traversed by pressing + * the Tab key. This returns false. + */ + public final boolean isManagingFocus() { + return true; + } + + /** + * Returns the object responsible for painting this text area. + */ + public final TextAreaPainter getPainter() { + return painter; + } + + /** + * Returns the input handler. + */ + public final InputHandler getInputHandler() { + return inputHandler; + } + + /** + * Sets the input handler. + * @param inputHandler The new input handler + */ + public void setInputHandler(InputHandler inputHandler) { + this.inputHandler = inputHandler; + } + + /** + * Returns true if the caret is blinking, false otherwise. + */ + public final boolean isCaretBlinkEnabled() { + return caretBlinks; + } + + /** + * Toggles caret blinking. + * @param caretBlinks True if the caret should blink, false otherwise + */ + public void setCaretBlinkEnabled(boolean caretBlinks) { + this.caretBlinks = caretBlinks; + if(!caretBlinks) + blink = false; + + painter.invalidateSelectedLines(); + } + + /** + * Returns true if the caret is visible, false otherwise. + */ + public final boolean isCaretVisible() { + return (!caretBlinks || blink) && caretVisible; + } + + /** + * Sets if the caret should be visible. + * @param caretVisible True if the caret should be visible, false + * otherwise + */ + public void setCaretVisible(boolean caretVisible) { + this.caretVisible = caretVisible; + blink = true; + + painter.invalidateSelectedLines(); + } + + /** + * Blinks the caret. + */ + public final void blinkCaret() { + if (caretBlinks) { + blink = !blink; + painter.invalidateSelectedLines(); + } else { + blink = true; + } + } + + /** + * Returns the number of lines from the top and button of the + * text area that are always visible. + */ + public final int getElectricScroll() { + return electricScroll; + } + + /** + * Sets the number of lines from the top and bottom of the text + * area that are always visible + * @param electricScroll The number of lines always visible from + * the top or bottom + */ + public final void setElectricScroll(int electricScroll) { + this.electricScroll = electricScroll; + } + + + /** + * Updates the state of the scroll bars. This should be called + * if the number of lines in the document changes, or when the + * size of the text are changes. + */ + public void updateScrollBars() { + if (vertical != null && visibleLines != 0) { + vertical.setValues(firstLine,visibleLines,0,getLineCount()); + vertical.setUnitIncrement(2); + vertical.setBlockIncrement(visibleLines); + } + + //if (horizontal != null && width != 0) { + if ((horizontal != null) && (painter.getWidth() != 0)) { + //int value = horizontal.getValue(); + //System.out.println("updateScrollBars"); + //int width = painter.getWidth(); + int lineCount = getLineCount(); + int maxLineLength = 0; + for (int i = 0; i < lineCount; i++) { + int lineLength = getLineLength(i); + if (lineLength > maxLineLength) { + maxLineLength = lineLength; + } + } + int charWidth = painter.getFontMetrics().charWidth('w'); + int width = maxLineLength * charWidth; + int painterWidth = painter.getWidth(); + //System.out.println("max line len " + maxLineLength); + //System.out.println("width " + width); + //System.out.println("text area width " + painter.getWidth()); + + // this was the default, but it's enormous + //horizontal.setValues(-horizontalOffset,width,0,width * 5); + + // something more reasonable, though this is a bad solution + //horizontal.setValues(-horizontalOffset,width,0,width * 2); + + // in general.. time to start looking at that other syntax pkg + // since most code should fit the window horizontally, just use + // the default settings for the width, this is a nicer solution + // until a better update mechanism can be implemented [fry] + + //horizontal.setValues(0, width, 0, width); + //0, width - horizontalOffset); + // works, from pre-75 versions of p5 + //horizontal.setValues(-horizontalOffset, width, 0, width); + + // gets weird when writing to the end of lines + //horizontal.setValues(value, painterWidth, 0, width); + + // seems to work, implemented for 0075 + horizontal.setValues(-horizontalOffset, painterWidth, 0, width); + + //horizontal.setUnitIncrement(painter.getFontMetrics().charWidth('w')); + horizontal.setUnitIncrement(charWidth); + horizontal.setBlockIncrement(width / 2); + } + } + + /** + * Returns the line displayed at the text area's origin. + */ + public final int getFirstLine() { + return firstLine; + } + + /** + * Sets the line displayed at the text area's origin without + * updating the scroll bars. + */ + public void setFirstLine(int firstLine) { + if (firstLine == this.firstLine) return; + + this.firstLine = firstLine; + if (firstLine != vertical.getValue()) { + updateScrollBars(); + } + painter.repaint(); + } + + /** + * Returns the number of lines visible in this text area. + */ + public final int getVisibleLines() { + return visibleLines; + } + + /** + * Recalculates the number of visible lines. This should not + * be called directly. + */ + public final void recalculateVisibleLines() { + if (painter == null) return; + + int height = painter.getHeight(); + int lineHeight = painter.getFontMetrics().getHeight(); + visibleLines = height / lineHeight; + updateScrollBars(); + } + + /** + * Returns the horizontal offset of drawn lines. + */ + public final int getHorizontalOffset() { + return horizontalOffset; + } + + /** + * Sets the horizontal offset of drawn lines. This can be used to + * implement horizontal scrolling. + * @param horizontalOffset offset The new horizontal offset + */ + public void setHorizontalOffset(int horizontalOffset) + { + if(horizontalOffset == this.horizontalOffset) + return; + this.horizontalOffset = horizontalOffset; + if(horizontalOffset != horizontal.getValue()) + updateScrollBars(); + painter.repaint(); + } + + /** + * A fast way of changing both the first line and horizontal + * offset. + * @param firstLine The new first line + * @param horizontalOffset The new horizontal offset + * @return True if any of the values were changed, false otherwise + */ + public boolean setOrigin(int firstLine, int horizontalOffset) + { + boolean changed = false; + //int oldFirstLine = this.firstLine; + + if(horizontalOffset != this.horizontalOffset) + { + this.horizontalOffset = horizontalOffset; + changed = true; + } + + if(firstLine != this.firstLine) + { + this.firstLine = firstLine; + changed = true; + } + + if(changed) + { + updateScrollBars(); + painter.repaint(); + } + + return changed; + } + + /** + * Ensures that the caret is visible by scrolling the text area if + * necessary. + * @return True if scrolling was actually performed, false if the + * caret was already visible + */ + public boolean scrollToCaret() + { + int line = getCaretLine(); + int lineStart = getLineStartOffset(line); + int offset = Math.max(0,Math.min(getLineLength(line) - 1, + getCaretPosition() - lineStart)); + + return scrollTo(line,offset); + } + + /** + * Ensures that the specified line and offset is visible by scrolling + * the text area if necessary. + * @param line The line to scroll to + * @param offset The offset in the line to scroll to + * @return True if scrolling was actually performed, false if the + * line and offset was already visible + */ + public boolean scrollTo(int line, int offset) + { + // visibleLines == 0 before the component is realized + // we can't do any proper scrolling then, so we have + // this hack... + if (visibleLines == 0) { + setFirstLine(Math.max(0,line - electricScroll)); + return true; + } + + int newFirstLine = firstLine; + int newHorizontalOffset = horizontalOffset; + + if(line < firstLine + electricScroll) { + newFirstLine = Math.max(0,line - electricScroll); + + } else if(line + electricScroll >= firstLine + visibleLines) { + newFirstLine = (line - visibleLines) + electricScroll + 1; + if(newFirstLine + visibleLines >= getLineCount()) + newFirstLine = getLineCount() - visibleLines; + if(newFirstLine < 0) + newFirstLine = 0; + } + + int x = _offsetToX(line,offset); + int width = painter.getFontMetrics().charWidth('w'); + + if(x < 0) { + newHorizontalOffset = Math.min(0,horizontalOffset - x + width + 5); + } else if(x + width >= painter.getWidth()) { + newHorizontalOffset = horizontalOffset + + (painter.getWidth() - x) - width - 5; + } + + return setOrigin(newFirstLine,newHorizontalOffset); + } + + /** + * Converts a line index to a y co-ordinate. + * @param line The line + */ + public int lineToY(int line) + { + FontMetrics fm = painter.getFontMetrics(); + return (line - firstLine) * fm.getHeight() + - (fm.getLeading() + fm.getMaxDescent()); + } + + /** + * Converts a y co-ordinate to a line index. + * @param y The y co-ordinate + */ + public int yToLine(int y) + { + FontMetrics fm = painter.getFontMetrics(); + int height = fm.getHeight(); + return Math.max(0,Math.min(getLineCount() - 1, + y / height + firstLine)); + } + + /** + * Converts an offset in a line into an x co-ordinate. This is a + * slow version that can be used any time. + * @param line The line + * @param offset The offset, from the start of the line + */ + public final int offsetToX(int line, int offset) + { + // don't use cached tokens + painter.currentLineTokens = null; + return _offsetToX(line,offset); + } + + /** + * Converts an offset in a line into an x co-ordinate. This is a + * fast version that should only be used if no changes were made + * to the text since the last repaint. + * @param line The line + * @param offset The offset, from the start of the line + */ + public int _offsetToX(int line, int offset) + { + TokenMarker tokenMarker = getTokenMarker(); + + /* Use painter's cached info for speed */ + FontMetrics fm = painter.getFontMetrics(); + + getLineText(line,lineSegment); + + int segmentOffset = lineSegment.offset; + int x = horizontalOffset; + + /* If syntax coloring is disabled, do simple translation */ + if(tokenMarker == null) + { + lineSegment.count = offset; + return x + Utilities.getTabbedTextWidth(lineSegment, + fm,x,painter,0); + } + /* If syntax coloring is enabled, we have to do this because + * tokens can vary in width */ + else + { + Token tokens; + if(painter.currentLineIndex == line + && painter.currentLineTokens != null) + tokens = painter.currentLineTokens; + else + { + painter.currentLineIndex = line; + tokens = painter.currentLineTokens + = tokenMarker.markTokens(lineSegment,line); + } + + //Toolkit toolkit = painter.getToolkit(); + Font defaultFont = painter.getFont(); + SyntaxStyle[] styles = painter.getStyles(); + + for(;;) + { + byte id = tokens.id; + if(id == Token.END) + { + return x; + } + + if(id == Token.NULL) + fm = painter.getFontMetrics(); + else + fm = styles[id].getFontMetrics(defaultFont, this); + + int length = tokens.length; + + if(offset + segmentOffset < lineSegment.offset + length) + { + lineSegment.count = offset - (lineSegment.offset - segmentOffset); + return x + Utilities.getTabbedTextWidth( + lineSegment,fm,x,painter,0); + } + else + { + lineSegment.count = length; + x += Utilities.getTabbedTextWidth( + lineSegment,fm,x,painter,0); + lineSegment.offset += length; + } + tokens = tokens.next; + } + } + } + + /** + * Converts an x co-ordinate to an offset within a line. + * @param line The line + * @param x The x co-ordinate + */ + public int xToOffset(int line, int x) + { + TokenMarker tokenMarker = getTokenMarker(); + + /* Use painter's cached info for speed */ + FontMetrics fm = painter.getFontMetrics(); + + getLineText(line,lineSegment); + + char[] segmentArray = lineSegment.array; + int segmentOffset = lineSegment.offset; + int segmentCount = lineSegment.count; + + int width = horizontalOffset; + + if(tokenMarker == null) + { + for(int i = 0; i < segmentCount; i++) + { + char c = segmentArray[i + segmentOffset]; + int charWidth; + if(c == '\t') + charWidth = (int)painter.nextTabStop(width,i) + - width; + else + charWidth = fm.charWidth(c); + + if(painter.isBlockCaretEnabled()) + { + if(x - charWidth <= width) + return i; + } + else + { + if(x - charWidth / 2 <= width) + return i; + } + + width += charWidth; + } + + return segmentCount; + } + else + { + Token tokens; + if(painter.currentLineIndex == line && painter + .currentLineTokens != null) + tokens = painter.currentLineTokens; + else + { + painter.currentLineIndex = line; + tokens = painter.currentLineTokens + = tokenMarker.markTokens(lineSegment,line); + } + + int offset = 0; + //Toolkit toolkit = painter.getToolkit(); + Font defaultFont = painter.getFont(); + SyntaxStyle[] styles = painter.getStyles(); + + for(;;) + { + byte id = tokens.id; + if(id == Token.END) + return offset; + + if(id == Token.NULL) + fm = painter.getFontMetrics(); + else + fm = styles[id].getFontMetrics(defaultFont, this); + + int length = tokens.length; + + for(int i = 0; i < length; i++) + { + char c = segmentArray[segmentOffset + offset + i]; + int charWidth; + if(c == '\t') + charWidth = (int)painter.nextTabStop(width,offset + i) + - width; + else + charWidth = fm.charWidth(c); + + if(painter.isBlockCaretEnabled()) + { + if(x - charWidth <= width) + return offset + i; + } + else + { + if(x - charWidth / 2 <= width) + return offset + i; + } + + width += charWidth; + } + + offset += length; + tokens = tokens.next; + } + } + } + + /** + * Converts a point to an offset, from the start of the text. + * @param x The x co-ordinate of the point + * @param y The y co-ordinate of the point + */ + public int xyToOffset(int x, int y) + { + int line = yToLine(y); + int start = getLineStartOffset(line); + return start + xToOffset(line,x); + } + + /** + * Returns the document this text area is editing. + */ + public final SyntaxDocument getDocument() + { + return document; + } + + /** + * Sets the document this text area is editing. + * @param document The document + */ + public void setDocument(SyntaxDocument document) { + if (this.document == document) + return; + if (this.document != null) + this.document.removeDocumentListener(documentHandler); + this.document = document; + + document.addDocumentListener(documentHandler); + + select(0, 0); + updateScrollBars(); + painter.repaint(); + } + + + /** + * Set document with a twist, includes the old caret + * and scroll positions, added for p5. [fry] + */ + public void setDocument(SyntaxDocument document, + int start, int stop, int scroll) { + if (this.document == document) + return; + if (this.document != null) + this.document.removeDocumentListener(documentHandler); + this.document = document; + + document.addDocumentListener(documentHandler); + + select(start, stop); + updateScrollBars(); + setScrollPosition(scroll); + painter.repaint(); + } + + + /** + * Returns the document's token marker. Equivalent to calling + * getDocument().getTokenMarker(). + */ + public final TokenMarker getTokenMarker() + { + return document.getTokenMarker(); + } + + /** + * Sets the document's token marker. Equivalent to caling + * getDocument().setTokenMarker(). + * @param tokenMarker The token marker + */ + public final void setTokenMarker(TokenMarker tokenMarker) + { + document.setTokenMarker(tokenMarker); + } + + /** + * Returns the length of the document. Equivalent to calling + * getDocument().getLength(). + */ + public final int getDocumentLength() + { + return document.getLength(); + } + + /** + * Returns the number of lines in the document. + */ + public final int getLineCount() + { + return document.getDefaultRootElement().getElementCount(); + } + + /** + * Returns the line containing the specified offset. + * @param offset The offset + */ + public final int getLineOfOffset(int offset) + { + return document.getDefaultRootElement().getElementIndex(offset); + } + + /** + * Returns the start offset of the specified line. + * @param line The line + * @return The start offset of the specified line, or -1 if the line is + * invalid + */ + public int getLineStartOffset(int line) + { + Element lineElement = document.getDefaultRootElement() + .getElement(line); + if(lineElement == null) + return -1; + else + return lineElement.getStartOffset(); + } + + /** + * Returns the end offset of the specified line. + * @param line The line + * @return The end offset of the specified line, or -1 if the line is + * invalid. + */ + public int getLineStopOffset(int line) + { + Element lineElement = document.getDefaultRootElement() + .getElement(line); + if(lineElement == null) + return -1; + else + return lineElement.getEndOffset(); + } + + /** + * Returns the length of the specified line. + * @param line The line + */ + public int getLineLength(int line) + { + Element lineElement = document.getDefaultRootElement() + .getElement(line); + if(lineElement == null) + return -1; + else + return lineElement.getEndOffset() + - lineElement.getStartOffset() - 1; + } + + /** + * Returns the entire text of this text area. + */ + public String getText() + { + try + { + return document.getText(0,document.getLength()); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + return null; + } + } + + + /** + * Sets the entire text of this text area. + */ + public void setText(String text) + { + try { + document.beginCompoundEdit(); + document.remove(0,document.getLength()); + document.insertString(0,text,null); + + } catch (BadLocationException bl) { + bl.printStackTrace(); + + } finally { + document.endCompoundEdit(); + } + } + + + /** + * Returns the specified substring of the document. + * @param start The start offset + * @param len The length of the substring + * @return The substring, or null if the offsets are invalid + */ + public final String getText(int start, int len) + { + try + { + return document.getText(start,len); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + return null; + } + } + + /** + * Copies the specified substring of the document into a segment. + * If the offsets are invalid, the segment will contain a null string. + * @param start The start offset + * @param len The length of the substring + * @param segment The segment + */ + public final void getText(int start, int len, Segment segment) + { + try + { + document.getText(start,len,segment); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + segment.offset = segment.count = 0; + } + } + + /** + * Returns the text on the specified line. + * @param lineIndex The line + * @return The text, or null if the line is invalid + */ + public final String getLineText(int lineIndex) + { + int start = getLineStartOffset(lineIndex); + return getText(start,getLineStopOffset(lineIndex) - start - 1); + } + + /** + * Copies the text on the specified line into a segment. If the line + * is invalid, the segment will contain a null string. + * @param lineIndex The line + */ + public final void getLineText(int lineIndex, Segment segment) + { + int start = getLineStartOffset(lineIndex); + getText(start,getLineStopOffset(lineIndex) - start - 1,segment); + } + + /** + * Returns the selection start offset. + */ + public final int getSelectionStart() + { + return selectionStart; + } + + /** + * Returns the offset where the selection starts on the specified + * line. + */ + public int getSelectionStart(int line) + { + if(line == selectionStartLine) + return selectionStart; + else if(rectSelect) + { + Element map = document.getDefaultRootElement(); + int start = selectionStart - map.getElement(selectionStartLine) + .getStartOffset(); + + Element lineElement = map.getElement(line); + int lineStart = lineElement.getStartOffset(); + int lineEnd = lineElement.getEndOffset() - 1; + return Math.min(lineEnd,lineStart + start); + } + else + return getLineStartOffset(line); + } + + /** + * Returns the selection start line. + */ + public final int getSelectionStartLine() + { + return selectionStartLine; + } + + /** + * Sets the selection start. The new selection will be the new + * selection start and the old selection end. + * @param selectionStart The selection start + * @see #select(int,int) + */ + public final void setSelectionStart(int selectionStart) + { + select(selectionStart,selectionEnd); + } + + /** + * Returns the selection end offset. + */ + public final int getSelectionStop() + { + return selectionEnd; + } + + /** + * Returns the offset where the selection ends on the specified + * line. + */ + public int getSelectionStop(int line) + { + if(line == selectionEndLine) + return selectionEnd; + else if(rectSelect) + { + Element map = document.getDefaultRootElement(); + int end = selectionEnd - map.getElement(selectionEndLine) + .getStartOffset(); + + Element lineElement = map.getElement(line); + int lineStart = lineElement.getStartOffset(); + int lineEnd = lineElement.getEndOffset() - 1; + return Math.min(lineEnd,lineStart + end); + } + else + return getLineStopOffset(line) - 1; + } + + /** + * Returns the selection end line. + */ + public final int getSelectionStopLine() + { + return selectionEndLine; + } + + /** + * Sets the selection end. The new selection will be the old + * selection start and the bew selection end. + * @param selectionEnd The selection end + * @see #select(int,int) + */ + public final void setSelectionEnd(int selectionEnd) + { + select(selectionStart,selectionEnd); + } + + + public final boolean isSelectionActive() + { + return(selectionStart != selectionEnd); + } + + /** + * Returns the caret position. This will either be the selection + * start or the selection end, depending on which direction the + * selection was made in. + */ + public final int getCaretPosition() + { + return (biasLeft ? selectionStart : selectionEnd); + } + + /** + * Returns the caret line. + */ + public final int getCaretLine() + { + return (biasLeft ? selectionStartLine : selectionEndLine); + } + + /** + * Returns the mark position. This will be the opposite selection + * bound to the caret position. + * @see #getCaretPosition() + */ + public final int getMarkPosition() + { + return (biasLeft ? selectionEnd : selectionStart); + } + + /** + * Returns the mark line. + */ + public final int getMarkLine() + { + return (biasLeft ? selectionEndLine : selectionStartLine); + } + + /** + * Sets the caret position. The new selection will consist of the + * caret position only (hence no text will be selected) + * @param caret The caret position + * @see #select(int,int) + */ + public final void setCaretPosition(int caret) + { + select(caret,caret); + } + + /** + * Selects all text in the document. + */ + public final void selectAll() + { + select(0,getDocumentLength()); + } + + /** + * Moves the mark to the caret position. + */ + public final void selectNone() + { + select(getCaretPosition(),getCaretPosition()); + } + + /** + * Selects from the start offset to the end offset. This is the + * general selection method used by all other selecting methods. + * The caret position will be start if start < end, and end + * if end > start. + * @param start The start offset + * @param end The end offset + */ + public void select(int start, int end) + { + int newStart, newEnd; + boolean newBias; + if(start <= end) + { + newStart = start; + newEnd = end; + newBias = false; + } + else + { + newStart = end; + newEnd = start; + newBias = true; + } + + if(newStart < 0 || newEnd > getDocumentLength()) + { + throw new IllegalArgumentException("Bounds out of" + + " range: " + newStart + "," + + newEnd); + } + + // If the new position is the same as the old, we don't + // do all this crap, however we still do the stuff at + // the end (clearing magic position, scrolling) + if(newStart != selectionStart || newEnd != selectionEnd + || newBias != biasLeft) + { + int newStartLine = getLineOfOffset(newStart); + int newEndLine = getLineOfOffset(newEnd); + + if(painter.isBracketHighlightEnabled()) + { + if(bracketLine != -1) + painter.invalidateLine(bracketLine); + updateBracketHighlight(end); + if(bracketLine != -1) + painter.invalidateLine(bracketLine); + } + + painter.invalidateLineRange(selectionStartLine,selectionEndLine); + painter.invalidateLineRange(newStartLine,newEndLine); + + document.addUndoableEdit(new CaretUndo(selectionStart,selectionEnd)); + + selectionStart = newStart; + selectionEnd = newEnd; + selectionStartLine = newStartLine; + selectionEndLine = newEndLine; + biasLeft = newBias; + + fireCaretEvent(); + } + + // When the user is typing, etc, we don't want the caret + // to blink + blink = true; + caretTimer.restart(); + + // Disable rectangle select if selection start = selection end + if(selectionStart == selectionEnd) + rectSelect = false; + + // Clear the `magic' caret position used by up/down + magicCaret = -1; + + scrollToCaret(); + + // notify the line number feller + if (editorLineStatus != null) { + editorLineStatus.set(selectionStartLine, selectionEndLine); + //System.out.println("why " + selectionStartLine + " " + selectionEndLine); + //System.out.println(getLineOfOffset(start) + " " + + // getLineOfOffset(end)); + } + } + + + /** + * Returns the selected text, or null if no selection is active. + */ + public final String getSelectedText() + { + if(selectionStart == selectionEnd) + return null; + + if(rectSelect) + { + // Return each row of the selection on a new line + + Element map = document.getDefaultRootElement(); + + int start = selectionStart - map.getElement(selectionStartLine) + .getStartOffset(); + int end = selectionEnd - map.getElement(selectionEndLine) + .getStartOffset(); + + // Certain rectangles satisfy this condition... + if(end < start) + { + int tmp = end; + end = start; + start = tmp; + } + + StringBuffer buf = new StringBuffer(); + Segment seg = new Segment(); + + for(int i = selectionStartLine; i <= selectionEndLine; i++) + { + Element lineElement = map.getElement(i); + int lineStart = lineElement.getStartOffset(); + int lineEnd = lineElement.getEndOffset() - 1; + int lineLen = lineEnd - lineStart; + + lineStart = Math.min(lineStart + start,lineEnd); + lineLen = Math.min(end - start,lineEnd - lineStart); + + getText(lineStart,lineLen,seg); + buf.append(seg.array,seg.offset,seg.count); + + if(i != selectionEndLine) + buf.append('\n'); + } + + return buf.toString(); + } + else + { + return getText(selectionStart, + selectionEnd - selectionStart); + } + } + + /** + * Replaces the selection with the specified text. + * @param selectedText The replacement text for the selection + */ + public void setSelectedText(String selectedText) + { + if(!editable) + { + throw new InternalError("Text component" + + " read only"); + } + + document.beginCompoundEdit(); + + try + { + if(rectSelect) + { + Element map = document.getDefaultRootElement(); + + int start = selectionStart - map.getElement(selectionStartLine) + .getStartOffset(); + int end = selectionEnd - map.getElement(selectionEndLine) + .getStartOffset(); + + // Certain rectangles satisfy this condition... + if(end < start) + { + int tmp = end; + end = start; + start = tmp; + } + + int lastNewline = 0; + int currNewline = 0; + + for(int i = selectionStartLine; i <= selectionEndLine; i++) + { + Element lineElement = map.getElement(i); + int lineStart = lineElement.getStartOffset(); + int lineEnd = lineElement.getEndOffset() - 1; + int rectStart = Math.min(lineEnd,lineStart + start); + + document.remove(rectStart,Math.min(lineEnd - rectStart, + end - start)); + + if(selectedText == null) + continue; + + currNewline = selectedText.indexOf('\n',lastNewline); + if(currNewline == -1) + currNewline = selectedText.length(); + + document.insertString(rectStart,selectedText + .substring(lastNewline,currNewline),null); + + lastNewline = Math.min(selectedText.length(), + currNewline + 1); + } + + if(selectedText != null && + currNewline != selectedText.length()) + { + int offset = map.getElement(selectionEndLine) + .getEndOffset() - 1; + document.insertString(offset,"\n",null); + document.insertString(offset + 1,selectedText + .substring(currNewline + 1),null); + } + } + else + { + document.remove(selectionStart, + selectionEnd - selectionStart); + if(selectedText != null) + { + document.insertString(selectionStart, + selectedText,null); + } + } + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + throw new InternalError("Cannot replace" + + " selection"); + } + // No matter what happends... stops us from leaving document + // in a bad state + finally + { + document.endCompoundEdit(); + } + + setCaretPosition(selectionEnd); + } + + /** + * Returns true if this text area is editable, false otherwise. + */ + public final boolean isEditable() + { + return editable; + } + + /** + * Sets if this component is editable. + * @param editable True if this text area should be editable, + * false otherwise + */ + public final void setEditable(boolean editable) + { + this.editable = editable; + } + + /** + * Returns the right click popup menu. + */ + public final JPopupMenu getRightClickPopup() + { + return popup; + } + + /** + * Sets the right click popup menu. + * @param popup The popup + */ + //public final void setRightClickPopup(EditPopupMenu popup) + public final void setRightClickPopup(JPopupMenu popup) + { + this.popup = popup; + } + + + /** + * Returns the `magic' caret position. This can be used to preserve + * the column position when moving up and down lines. + */ + public final int getMagicCaretPosition() + { + return magicCaret; + } + + /** + * Sets the `magic' caret position. This can be used to preserve + * the column position when moving up and down lines. + * @param magicCaret The magic caret position + */ + public final void setMagicCaretPosition(int magicCaret) + { + this.magicCaret = magicCaret; + } + + /** + * Similar to setSelectedText(), but overstrikes the + * appropriate number of characters if overwrite mode is enabled. + * @param str The string + * @see #setSelectedText(String) + * @see #isOverwriteEnabled() + */ + public void overwriteSetSelectedText(String str) + { + // Don't overstrike if there is a selection + if(!overwrite || selectionStart != selectionEnd) + { + setSelectedText(str); + return; + } + + // Don't overstrike if we're on the end of + // the line + int caret = getCaretPosition(); + int caretLineEnd = getLineStopOffset(getCaretLine()); + if(caretLineEnd - caret <= str.length()) + { + setSelectedText(str); + return; + } + + document.beginCompoundEdit(); + + try + { + document.remove(caret,str.length()); + document.insertString(caret,str,null); + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + finally + { + document.endCompoundEdit(); + } + } + + /** + * Returns true if overwrite mode is enabled, false otherwise. + */ + public final boolean isOverwriteEnabled() + { + return overwrite; + } + + /** + * Sets if overwrite mode should be enabled. + * @param overwrite True if overwrite mode should be enabled, + * false otherwise. + */ + public final void setOverwriteEnabled(boolean overwrite) + { + this.overwrite = overwrite; + painter.invalidateSelectedLines(); + } + + /** + * Returns true if the selection is rectangular, false otherwise. + */ + public final boolean isSelectionRectangular() + { + return rectSelect; + } + + /** + * Sets if the selection should be rectangular. + * @param rectSelect True if the selection should be rectangular, + * false otherwise. + */ + public final void setSelectionRectangular(boolean rectSelect) + { + this.rectSelect = rectSelect; + painter.invalidateSelectedLines(); + } + + /** + * Returns the position of the highlighted bracket (the bracket + * matching the one before the caret) + */ + public final int getBracketPosition() + { + return bracketPosition; + } + + /** + * Returns the line of the highlighted bracket (the bracket + * matching the one before the caret) + */ + public final int getBracketLine() + { + return bracketLine; + } + + /** + * Adds a caret change listener to this text area. + * @param listener The listener + */ + public final void addCaretListener(CaretListener listener) + { + eventListenerList.add(CaretListener.class,listener); + } + + /** + * Removes a caret change listener from this text area. + * @param listener The listener + */ + public final void removeCaretListener(CaretListener listener) + { + eventListenerList.remove(CaretListener.class,listener); + } + + /** + * Deletes the selected text from the text area and places it + * into the clipboard. + */ + public void cut() + { + if(editable) + { + copy(); + setSelectedText(""); + } + } + + /** + * Places the selected text into the clipboard. + */ + public void copy() + { + if(selectionStart != selectionEnd) + { + Clipboard clipboard = getToolkit().getSystemClipboard(); + + String selection = getSelectedText(); + + int repeatCount = inputHandler.getRepeatCount(); + StringBuffer buf = new StringBuffer(); + for(int i = 0; i < repeatCount; i++) + buf.append(selection); + + clipboard.setContents(new StringSelection(buf.toString()),null); + } + } + + /** + * Inserts the clipboard contents into the text. + */ + public void paste() { + if (editable) { + Clipboard clipboard = getToolkit().getSystemClipboard(); + try { + // The MacOS MRJ doesn't convert \r to \n, so do it here + String selection = ((String)clipboard.getContents(this).getTransferData(DataFlavor.stringFlavor)).replace('\r','\n'); + + // particularly on macosx when pasting from safari, + // replace unicode x00A0 (non-breaking space) + // with just a plain space. [fry 030929] + selection = selection.replace('\u00A0', ' '); + + int repeatCount = inputHandler.getRepeatCount(); + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < repeatCount; i++) + buf.append(selection); + selection = buf.toString(); + setSelectedText(selection); + + } catch(Exception e) { + getToolkit().beep(); + System.err.println("Clipboard does not contain a string"); + } + } + } + + /** + * Called by the AWT when this component is removed from it's parent. + * This stops clears the currently focused component. + */ + public void removeNotify() + { + super.removeNotify(); + if(focusedComponent == this) + focusedComponent = null; + } + + /** + * Forwards key events directly to the input handler. + * This is slightly faster than using a KeyListener + * because some Swing overhead is avoided. + */ + public EditorListener editorListener; + + /** + * The component that tracks the current line number. + */ + public EditorLineStatus editorLineStatus; + + + public void processKeyEvent(KeyEvent evt) { + // this had to be added in Processing 007X, because the menu key + // events weren't making it up to the frame. + super.processKeyEvent(evt); + + //System.out.println("jedittextarea: " + evt); + //System.out.println(); + if (inputHandler == null) return; + + switch(evt.getID()) { + case KeyEvent.KEY_TYPED: + if ((editorListener == null) || !editorListener.keyTyped(evt)) { + inputHandler.keyTyped(evt); + } + break; + case KeyEvent.KEY_PRESSED: + if ((editorListener == null) || !editorListener.keyPressed(evt)) { + inputHandler.keyPressed(evt); + } + break; + case KeyEvent.KEY_RELEASED: + inputHandler.keyReleased(evt); + break; + } + } + + // protected members + protected static String CENTER = "center"; + protected static String RIGHT = "right"; + protected static String BOTTOM = "bottom"; + + protected static JEditTextArea focusedComponent; + protected static Timer caretTimer; + + protected TextAreaPainter painter; + + //protected EditPopupMenu popup; + protected JPopupMenu popup; + + protected EventListenerList eventListenerList; + protected MutableCaretEvent caretEvent; + + protected boolean caretBlinks; + protected boolean caretVisible; + protected boolean blink; + + protected boolean editable; + + protected int firstLine; + protected int visibleLines; + protected int electricScroll; + + protected int horizontalOffset; + + protected JScrollBar vertical; + protected JScrollBar horizontal; + protected boolean scrollBarsInitialized; + + protected InputHandler inputHandler; + protected SyntaxDocument document; + protected DocumentHandler documentHandler; + + protected Segment lineSegment; + + protected int selectionStart; + protected int selectionStartLine; + protected int selectionEnd; + protected int selectionEndLine; + protected boolean biasLeft; + + protected int bracketPosition; + protected int bracketLine; + + protected int magicCaret; + protected boolean overwrite; + protected boolean rectSelect; + + + protected void fireCaretEvent() + { + Object[] listeners = eventListenerList.getListenerList(); + for(int i = listeners.length - 2; i >= 0; i--) + { + if(listeners[i] == CaretListener.class) + { + ((CaretListener)listeners[i+1]).caretUpdate(caretEvent); + } + } + } + + protected void updateBracketHighlight(int newCaretPosition) + { + if(newCaretPosition == 0) + { + bracketPosition = bracketLine = -1; + return; + } + + try + { + int offset = TextUtilities.findMatchingBracket( + document,newCaretPosition - 1); + if(offset != -1) + { + bracketLine = getLineOfOffset(offset); + bracketPosition = offset - getLineStartOffset(bracketLine); + return; + } + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + + bracketLine = bracketPosition = -1; + } + + protected void documentChanged(DocumentEvent evt) + { + DocumentEvent.ElementChange ch = + evt.getChange(document.getDefaultRootElement()); + + int count; + if(ch == null) + count = 0; + else + count = ch.getChildrenAdded().length - + ch.getChildrenRemoved().length; + + int line = getLineOfOffset(evt.getOffset()); + if(count == 0) + { + painter.invalidateLine(line); + } + // do magic stuff + else if(line < firstLine) + { + setFirstLine(firstLine + count); + } + // end of magic stuff + else + { + painter.invalidateLineRange(line,firstLine + visibleLines); + updateScrollBars(); + } + } + + class ScrollLayout implements LayoutManager + { + //final int LEFT_EXTRA = 5; + + public void addLayoutComponent(String name, Component comp) + { + if(name.equals(CENTER)) + center = comp; + else if(name.equals(RIGHT)) + right = comp; + else if(name.equals(BOTTOM)) + bottom = comp; + else if(name.equals(LEFT_OF_SCROLLBAR)) + leftOfScrollBar.addElement(comp); + } + + public void removeLayoutComponent(Component comp) + { + if(center == comp) + center = null; + if(right == comp) + right = null; + if(bottom == comp) + bottom = null; + else + leftOfScrollBar.removeElement(comp); + } + + public Dimension preferredLayoutSize(Container parent) + { + Dimension dim = new Dimension(); + Insets insets = getInsets(); + dim.width = insets.left + insets.right; + dim.height = insets.top + insets.bottom; + + Dimension centerPref = center.getPreferredSize(); + dim.width += centerPref.width; + dim.height += centerPref.height; + Dimension rightPref = right.getPreferredSize(); + dim.width += rightPref.width; + Dimension bottomPref = bottom.getPreferredSize(); + dim.height += bottomPref.height; + + return dim; + } + + public Dimension minimumLayoutSize(Container parent) + { + Dimension dim = new Dimension(); + Insets insets = getInsets(); + dim.width = insets.left + insets.right; + dim.height = insets.top + insets.bottom; + + Dimension centerPref = center.getMinimumSize(); + dim.width += centerPref.width; + dim.height += centerPref.height; + Dimension rightPref = right.getMinimumSize(); + dim.width += rightPref.width; + Dimension bottomPref = bottom.getMinimumSize(); + dim.height += bottomPref.height; + + dim.height += 5; + + return dim; + } + + public void layoutContainer(Container parent) + { + Dimension size = parent.getSize(); + Insets insets = parent.getInsets(); + int itop = insets.top; + int ileft = insets.left; + int ibottom = insets.bottom; + int iright = insets.right; + + int rightWidth = right.getPreferredSize().width; + int bottomHeight = bottom.getPreferredSize().height; + int centerWidth = size.width - rightWidth - ileft - iright; + int centerHeight = size.height - bottomHeight - itop - ibottom; + + center.setBounds(ileft, // + LEFT_EXTRA, + itop, + centerWidth, // - LEFT_EXTRA, + centerHeight); + + right.setBounds(ileft + centerWidth, + itop, + rightWidth, + centerHeight); + + // Lay out all status components, in order + Enumeration status = leftOfScrollBar.elements(); + while (status.hasMoreElements()) { + Component comp = (Component)status.nextElement(); + Dimension dim = comp.getPreferredSize(); + comp.setBounds(ileft, + itop + centerHeight, + dim.width, + bottomHeight); + ileft += dim.width; + } + + bottom.setBounds(ileft, + itop + centerHeight, + size.width - rightWidth - ileft - iright, + bottomHeight); + } + + // private members + private Component center; + private Component right; + private Component bottom; + private Vector leftOfScrollBar = new Vector(); + } + + static class CaretBlinker implements ActionListener + { + public void actionPerformed(ActionEvent evt) + { + if(focusedComponent != null + && focusedComponent.hasFocus()) + focusedComponent.blinkCaret(); + } + } + + class MutableCaretEvent extends CaretEvent + { + MutableCaretEvent() + { + super(JEditTextArea.this); + } + + public int getDot() + { + return getCaretPosition(); + } + + public int getMark() + { + return getMarkPosition(); + } + } + +/* +#ifdef JDK14 + class WheelHandler implements MouseWheelListener { + + public void mouseWheelMoved(MouseWheelEvent e) { + if (!scrollBarsInitialized) return; + + int amt = e.getWheelRotation(); + //System.out.println(amt); + vertical.setValue(vertical.getValue() + amt * wheelMultiplier); + } + } +#endif +*/ + + class AdjustHandler implements AdjustmentListener + { + public void adjustmentValueChanged(final AdjustmentEvent evt) + { + if(!scrollBarsInitialized) + return; + + // If this is not done, mousePressed events accumilate + // and the result is that scrolling doesn't stop after + // the mouse is released + SwingUtilities.invokeLater(new Runnable() { + public void run() + { + if(evt.getAdjustable() == vertical) + setFirstLine(vertical.getValue()); + else + setHorizontalOffset(-horizontal.getValue()); + } + }); + } + } + + class ComponentHandler extends ComponentAdapter + { + public void componentResized(ComponentEvent evt) + { + recalculateVisibleLines(); + scrollBarsInitialized = true; + } + } + + class DocumentHandler implements DocumentListener + { + public void insertUpdate(DocumentEvent evt) + { + documentChanged(evt); + + int offset = evt.getOffset(); + int length = evt.getLength(); + + int newStart; + int newEnd; + + if (selectionStart > offset || + (selectionStart == selectionEnd && selectionStart == offset)) + newStart = selectionStart + length; + else + newStart = selectionStart; + + if(selectionEnd >= offset) + newEnd = selectionEnd + length; + else + newEnd = selectionEnd; + + select(newStart,newEnd); + } + + public void removeUpdate(DocumentEvent evt) + { + documentChanged(evt); + + int offset = evt.getOffset(); + int length = evt.getLength(); + + int newStart; + int newEnd; + + if(selectionStart > offset) + { + if(selectionStart > offset + length) + newStart = selectionStart - length; + else + newStart = offset; + } + else + newStart = selectionStart; + + if(selectionEnd > offset) + { + if(selectionEnd > offset + length) + newEnd = selectionEnd - length; + else + newEnd = offset; + } + else + newEnd = selectionEnd; + + select(newStart,newEnd); + } + + public void changedUpdate(DocumentEvent evt) + { + } + } + + class DragHandler implements MouseMotionListener + { + public void mouseDragged(MouseEvent evt) + { + if (popup != null && popup.isVisible()) return; + + setSelectionRectangular((evt.getModifiers() + & InputEvent.CTRL_MASK) != 0); + select(getMarkPosition(),xyToOffset(evt.getX(),evt.getY())); + } + + public void mouseMoved(MouseEvent evt) {} + } + + class FocusHandler implements FocusListener + { + public void focusGained(FocusEvent evt) + { + //System.out.println("JEditTextArea: focusGained"); + setCaretVisible(true); + focusedComponent = JEditTextArea.this; + } + + public void focusLost(FocusEvent evt) + { + //System.out.println("JEditTextArea: focusLost"); + setCaretVisible(false); + focusedComponent = null; + } + } + + class MouseHandler extends MouseAdapter + { + public void mousePressed(MouseEvent evt) + { + requestFocus(); + + // Focus events not fired sometimes? + setCaretVisible(true); + focusedComponent = JEditTextArea.this; + + // isPopupTrigger wasn't working for danh on windows + boolean trigger = (evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0; + // but it's required for macosx, since control-click does + // the same thing as a right-mouse click + if (!trigger && evt.isPopupTrigger()) trigger = true; + + if (trigger && (popup != null)) { + popup.show(painter,evt.getX(),evt.getY()); + return; + } + + int line = yToLine(evt.getY()); + int offset = xToOffset(line,evt.getX()); + int dot = getLineStartOffset(line) + offset; + + switch(evt.getClickCount()) { + + case 1: + doSingleClick(evt,line,offset,dot); + break; + + case 2: + // It uses the bracket matching stuff, so + // it can throw a BLE + try { + doDoubleClick(evt,line,offset,dot); + } catch(BadLocationException bl) { + bl.printStackTrace(); + } + break; + + case 3: + doTripleClick(evt,line,offset,dot); + break; + } + } + + + private void doSingleClick(MouseEvent evt, int line, + int offset, int dot) { + if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) { + rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0; + select(getMarkPosition(),dot); + } else { + setCaretPosition(dot); + } + } + + + private void doDoubleClick(MouseEvent evt, int line, + int offset, int dot) throws BadLocationException + { + // Ignore empty lines + if (getLineLength(line) == 0) + return; + + try { + int bracket = TextUtilities.findMatchingBracket(document, + Math.max(0,dot - 1)); + if (bracket != -1) { + int mark = getMarkPosition(); + // Hack + if (bracket > mark) { + bracket++; + mark--; + } + select(mark,bracket); + return; + } + } catch(BadLocationException bl) { + bl.printStackTrace(); + } + + String noWordSep = (String)document.getProperty("noWordSep"); + if(noWordSep == null) + noWordSep = ""; + + // Ok, it's not a bracket... select the word + String lineText = getLineText(line); + + int wordStart = 0; + int wordEnd = lineText.length(); + + char ch = lineText.charAt(Math.max(0,offset - 1)); + + // special case for whitespace (fry 0122, bug #348) + // this is really nasty.. turns out that double-clicking any non-letter + // or digit char gets lumped together.. sooo, this quickly gets messy, + // because really it needs to check whether the chars are of the same + // type.. so a double space or double - might be grouped together, + // but what about a +=1? do + and - get grouped but not the 1? blech, + // coming back to this later. it's not a difficult fix, just a + // time-consuming one to track down all the proper cases. + /* + if (ch == ' ') { + //System.out.println("yeehaa"); + + for(int i = offset - 1; i >= 0; i--) { + if (lineText.charAt(i) == ' ') { + wordStart = i; + } else { + break; + } + } + for(int i = offset; i < lineText.length(); i++) { + if (lineText.charAt(i) == ' ') { + wordEnd = i + 1; + } else { + break; + } + } + + } else { + */ + + // If the user clicked on a non-letter char, + // we select the surrounding non-letters + boolean selectNoLetter = (!Character.isLetterOrDigit(ch) + && noWordSep.indexOf(ch) == -1); + + for(int i = offset - 1; i >= 0; i--) { + ch = lineText.charAt(i); + if (selectNoLetter ^ (!Character.isLetterOrDigit(ch) && + noWordSep.indexOf(ch) == -1)) { + wordStart = i + 1; + break; + } + } + + for(int i = offset; i < lineText.length(); i++) { + ch = lineText.charAt(i); + if(selectNoLetter ^ (!Character.isLetterOrDigit(ch) && + noWordSep.indexOf(ch) == -1)) { + wordEnd = i; + break; + } + } + //} + + int lineStart = getLineStartOffset(line); + select(lineStart + wordStart,lineStart + wordEnd); + + /* + String lineText = getLineText(line); + String noWordSep = (String)document.getProperty("noWordSep"); + int wordStart = TextUtilities.findWordStart(lineText,offset,noWordSep); + int wordEnd = TextUtilities.findWordEnd(lineText,offset,noWordSep); + + int lineStart = getLineStartOffset(line); + select(lineStart + wordStart,lineStart + wordEnd); + */ + } + + private void doTripleClick(MouseEvent evt, int line, + int offset, int dot) + { + select(getLineStartOffset(line),getLineStopOffset(line)-1); + } + } + + class CaretUndo extends AbstractUndoableEdit + { + private int start; + private int end; + + CaretUndo(int start, int end) + { + this.start = start; + this.end = end; + } + + public boolean isSignificant() + { + return false; + } + + public String getPresentationName() + { + return "caret move"; + } + + public void undo() throws CannotUndoException + { + super.undo(); + + select(start,end); + } + + public void redo() throws CannotRedoException + { + super.redo(); + + select(start,end); + } + + public boolean addEdit(UndoableEdit edit) + { + if(edit instanceof CaretUndo) + { + CaretUndo cedit = (CaretUndo)edit; + start = cedit.start; + end = cedit.end; + cedit.die(); + + return true; + } + else + return false; + } + } + + static + { + caretTimer = new Timer(500,new CaretBlinker()); + caretTimer.setInitialDelay(500); + caretTimer.start(); + } +} diff --git a/app/src/processing/app/syntax/KeywordMap.java b/app/src/processing/app/syntax/KeywordMap.java new file mode 100644 index 000000000..065d92b3f --- /dev/null +++ b/app/src/processing/app/syntax/KeywordMap.java @@ -0,0 +1,140 @@ +/* + * KeywordMap.java - Fast keyword->id map + * Copyright (C) 1998, 1999 Slava Pestov + * Copyright (C) 1999 Mike Dillon + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.text.Segment; + +/** + * A KeywordMap is similar to a hashtable in that it maps keys + * to values. However, the `keys' are Swing segments. This allows lookups of + * text substrings without the overhead of creating a new string object. + *

+ * This class is used by CTokenMarker to map keywords to ids. + * + * @author Slava Pestov, Mike Dillon + * @version $Id: KeywordMap.java 2050 2006-03-11 00:50:01Z fry $ + */ +public class KeywordMap +{ + /** + * Creates a new KeywordMap. + * @param ignoreCase True if keys are case insensitive + */ + public KeywordMap(boolean ignoreCase) + { + this(ignoreCase, 52); + this.ignoreCase = ignoreCase; + } + + /** + * Creates a new KeywordMap. + * @param ignoreCase True if the keys are case insensitive + * @param mapLength The number of `buckets' to create. + * A value of 52 will give good performance for most maps. + */ + public KeywordMap(boolean ignoreCase, int mapLength) + { + this.mapLength = mapLength; + this.ignoreCase = ignoreCase; + map = new Keyword[mapLength]; + } + + /** + * Looks up a key. + * @param text The text segment + * @param offset The offset of the substring within the text segment + * @param length The length of the substring + */ + public byte lookup(Segment text, int offset, int length) + { + if(length == 0) + return Token.NULL; + Keyword k = map[getSegmentMapKey(text, offset, length)]; + while(k != null) + { + if(length != k.keyword.length) + { + k = k.next; + continue; + } + if(SyntaxUtilities.regionMatches(ignoreCase,text,offset, + k.keyword)) + return k.id; + k = k.next; + } + return Token.NULL; + } + + /** + * Adds a key-value mapping. + * @param keyword The key + * @param id The value + */ + public void add(String keyword, byte id) + { + int key = getStringMapKey(keyword); + map[key] = new Keyword(keyword.toCharArray(),id,map[key]); + } + + /** + * Returns true if the keyword map is set to be case insensitive, + * false otherwise. + */ + public boolean getIgnoreCase() + { + return ignoreCase; + } + + /** + * Sets if the keyword map should be case insensitive. + * @param ignoreCase True if the keyword map should be case + * insensitive, false otherwise + */ + public void setIgnoreCase(boolean ignoreCase) + { + this.ignoreCase = ignoreCase; + } + + // protected members + protected int mapLength; + + protected int getStringMapKey(String s) + { + return (Character.toUpperCase(s.charAt(0)) + + Character.toUpperCase(s.charAt(s.length()-1))) + % mapLength; + } + + protected int getSegmentMapKey(Segment s, int off, int len) + { + return (Character.toUpperCase(s.array[off]) + + Character.toUpperCase(s.array[off + len - 1])) + % mapLength; + } + + // private members + class Keyword + { + public Keyword(char[] keyword, byte id, Keyword next) + { + this.keyword = keyword; + this.id = id; + this.next = next; + } + + public char[] keyword; + public byte id; + public Keyword next; + } + + private Keyword[] map; + private boolean ignoreCase; +} diff --git a/app/src/processing/app/syntax/PdeKeywords.java b/app/src/processing/app/syntax/PdeKeywords.java new file mode 100644 index 000000000..610a1a995 --- /dev/null +++ b/app/src/processing/app/syntax/PdeKeywords.java @@ -0,0 +1,122 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeKeywords - handles text coloring and links to html reference + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.syntax; + +import processing.app.*; + +import java.io.*; +import java.util.*; + + +public class PdeKeywords extends CTokenMarker { + + // lookup table for the TokenMarker subclass, handles coloring + static KeywordMap keywordColoring; + + // lookup table that maps keywords to their html reference pages + static Hashtable keywordToReference; + + + public PdeKeywords() { + super(false, getKeywords()); + } + + + /** + * Handles loading of keywords file. + *

+ * Uses getKeywords() method because that's part of the + * TokenMarker classes. + *

+ * It is recommended that a # sign be used for comments + * inside keywords.txt. + */ + static public KeywordMap getKeywords() { + if (keywordColoring == null) { + try { + keywordColoring = new KeywordMap(false); + keywordToReference = new Hashtable(); + + InputStream input = Base.getLibStream("keywords.txt"); + InputStreamReader isr = new InputStreamReader(input); + BufferedReader reader = new BufferedReader(isr); + + String line = null; + while ((line = reader.readLine()) != null) { + //System.out.println("line is " + line); + // in case there's any garbage on the line + //if (line.trim().length() == 0) continue; + + String pieces[] = processing.core.PApplet.split(line, '\t'); + if (pieces.length >= 2) { + //int tab = line.indexOf('\t'); + // any line with no tab is ignored + // meaning that a comment is any line without a tab + //if (tab == -1) continue; + + String keyword = pieces[0].trim(); + //String keyword = line.substring(0, tab).trim(); + //String second = line.substring(tab + 1); + //tab = second.indexOf('\t'); + //String coloring = second.substring(0, tab).trim(); + //String htmlFilename = second.substring(tab + 1).trim(); + String coloring = pieces[1].trim(); + + if (coloring.length() > 0) { + // text will be KEYWORD or LITERAL + boolean isKey = (coloring.charAt(0) == 'K'); + // KEYWORD1 -> 0, KEYWORD2 -> 1, etc + int num = coloring.charAt(coloring.length() - 1) - '1'; + byte id = (byte) + ((isKey ? Token.KEYWORD1 : Token.LITERAL1) + num); + //System.out.println("got " + (isKey ? "keyword" : "literal") + + // (num+1) + " for " + keyword); + keywordColoring.add(keyword, id); + } + if (pieces.length >= 3) { + String htmlFilename = pieces[2].trim(); + if (htmlFilename.length() > 0) { + keywordToReference.put(keyword, htmlFilename); + } + } + } + } + reader.close(); + + } catch (Exception e) { + Base.showError("Problem loading keywords", + "Could not load keywords.txt,\n" + + "please re-install Processing.", e); + System.exit(1); + } + } + return keywordColoring; + } + + + static public String getReference(String keyword) { + return (String) keywordToReference.get(keyword); + } +} diff --git a/app/src/processing/app/syntax/PdeTextAreaDefaults.java b/app/src/processing/app/syntax/PdeTextAreaDefaults.java new file mode 100644 index 000000000..a2dda2b78 --- /dev/null +++ b/app/src/processing/app/syntax/PdeTextAreaDefaults.java @@ -0,0 +1,192 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeTextAreaDefaults - grabs font/color settings for the editor + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-03 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.syntax; + +import processing.app.*; + + +public class PdeTextAreaDefaults extends TextAreaDefaults { + + public PdeTextAreaDefaults() { + + inputHandler = new DefaultInputHandler(); + //inputHandler.addDefaultKeyBindings(); // 0122 + + // use option on mac for things that are ctrl on windows/linux + String mod = Base.isMacOS() ? "A" : "C"; + + // right now, ctrl-up/down is select up/down, but mod should be + // used instead, because the mac expects it to be option(alt) + + inputHandler.addKeyBinding("BACK_SPACE", InputHandler.BACKSPACE); + inputHandler.addKeyBinding("DELETE", InputHandler.DELETE); + + //inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.BACKSPACE); + // for 0122, shift-backspace is delete + inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.DELETE); + inputHandler.addKeyBinding("S+DELETE", InputHandler.DELETE); + + // the following two were changing for 0122 for better mac/pc compatability + inputHandler.addKeyBinding(mod+"+BACK_SPACE", InputHandler.BACKSPACE_WORD); + inputHandler.addKeyBinding(mod+"+DELETE", InputHandler.DELETE_WORD); + + // handled by listener, don't bother here + //inputHandler.addKeyBinding("ENTER", InputHandler.INSERT_BREAK); + //inputHandler.addKeyBinding("TAB", InputHandler.INSERT_TAB); + + inputHandler.addKeyBinding("INSERT", InputHandler.OVERWRITE); + // disabling for 0122, not sure what this does + //inputHandler.addKeyBinding("C+\\", InputHandler.TOGGLE_RECT); + + // for 0122, these have been changed for better compatability + // HOME and END now mean the beginning/end of the document + if (Base.isMacOS()) { + inputHandler.addKeyBinding("HOME", InputHandler.DOCUMENT_HOME); + inputHandler.addKeyBinding("END", InputHandler.DOCUMENT_END); + inputHandler.addKeyBinding("S+HOME", InputHandler.SELECT_DOC_HOME); + inputHandler.addKeyBinding("S+END", InputHandler.SELECT_DOC_END); + } else { + // for 0123 added the proper windows defaults + inputHandler.addKeyBinding("HOME", InputHandler.HOME); + inputHandler.addKeyBinding("END", InputHandler.END); + inputHandler.addKeyBinding("S+HOME", InputHandler.SELECT_HOME); + inputHandler.addKeyBinding("S+END", InputHandler.SELECT_END); + inputHandler.addKeyBinding("C+HOME", InputHandler.DOCUMENT_HOME); + inputHandler.addKeyBinding("C+END", InputHandler.DOCUMENT_END); + inputHandler.addKeyBinding("CS+HOME", InputHandler.SELECT_DOC_HOME); + inputHandler.addKeyBinding("CS+END", InputHandler.SELECT_DOC_END); + } + + if (Base.isMacOS()) { + inputHandler.addKeyBinding("M+LEFT", InputHandler.HOME); + inputHandler.addKeyBinding("M+RIGHT", InputHandler.END); + inputHandler.addKeyBinding("MS+LEFT", InputHandler.SELECT_HOME); // 0122 + inputHandler.addKeyBinding("MS+RIGHT", InputHandler.SELECT_END); // 0122 + } else { + inputHandler.addKeyBinding("C+LEFT", InputHandler.HOME); // 0122 + inputHandler.addKeyBinding("C+RIGHT", InputHandler.END); // 0122 + inputHandler.addKeyBinding("CS+HOME", InputHandler.SELECT_HOME); // 0122 + inputHandler.addKeyBinding("CS+END", InputHandler.SELECT_END); // 0122 + } + + inputHandler.addKeyBinding("PAGE_UP", InputHandler.PREV_PAGE); + inputHandler.addKeyBinding("PAGE_DOWN", InputHandler.NEXT_PAGE); + inputHandler.addKeyBinding("S+PAGE_UP", InputHandler.SELECT_PREV_PAGE); + inputHandler.addKeyBinding("S+PAGE_DOWN", InputHandler.SELECT_NEXT_PAGE); + + inputHandler.addKeyBinding("LEFT", InputHandler.PREV_CHAR); + inputHandler.addKeyBinding("S+LEFT", InputHandler.SELECT_PREV_CHAR); + inputHandler.addKeyBinding(mod + "+LEFT", InputHandler.PREV_WORD); + inputHandler.addKeyBinding(mod + "S+LEFT", InputHandler.SELECT_PREV_WORD); + inputHandler.addKeyBinding("RIGHT", InputHandler.NEXT_CHAR); + inputHandler.addKeyBinding("S+RIGHT", InputHandler.SELECT_NEXT_CHAR); + inputHandler.addKeyBinding(mod + "+RIGHT", InputHandler.NEXT_WORD); + inputHandler.addKeyBinding(mod + "S+RIGHT", InputHandler.SELECT_NEXT_WORD); + + inputHandler.addKeyBinding("UP", InputHandler.PREV_LINE); + inputHandler.addKeyBinding(mod + "+UP", InputHandler.PREV_LINE); // p5 + inputHandler.addKeyBinding("S+UP", InputHandler.SELECT_PREV_LINE); + inputHandler.addKeyBinding("DOWN", InputHandler.NEXT_LINE); + inputHandler.addKeyBinding(mod + "+DOWN", InputHandler.NEXT_LINE); // p5 + inputHandler.addKeyBinding("S+DOWN", InputHandler.SELECT_NEXT_LINE); + + inputHandler.addKeyBinding("MS+UP", InputHandler.SELECT_DOC_HOME); + inputHandler.addKeyBinding("CS+UP", InputHandler.SELECT_DOC_HOME); + inputHandler.addKeyBinding("MS+DOWN", InputHandler.SELECT_DOC_END); + inputHandler.addKeyBinding("CS+DOWN", InputHandler.SELECT_DOC_END); + + inputHandler.addKeyBinding(mod + "+ENTER", InputHandler.REPEAT); + + document = new SyntaxDocument(); + editable = true; + electricScroll = 3; + + cols = 80; + rows = 15; + + + // moved from SyntaxUtilities + //DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles(); + + styles = new SyntaxStyle[Token.ID_COUNT]; + + // comments + styles[Token.COMMENT1] = Theme.getStyle("comment1"); + styles[Token.COMMENT2] = Theme.getStyle("comment2"); + + // abstract, final, private + styles[Token.KEYWORD1] = Theme.getStyle("keyword1"); + + // beginShape, point, line + styles[Token.KEYWORD2] = Theme.getStyle("keyword2"); + + // byte, char, short, color + styles[Token.KEYWORD3] = Theme.getStyle("keyword3"); + + // constants: null, true, this, RGB, TWO_PI + styles[Token.LITERAL1] = Theme.getStyle("literal1"); + + // p5 built in variables: mouseX, width, pixels + styles[Token.LITERAL2] = Theme.getStyle("literal2"); + + // ?? + styles[Token.LABEL] = Theme.getStyle("label"); + + // + - = / + styles[Token.OPERATOR] = Theme.getStyle("operator"); + + // area that's not in use by the text (replaced with tildes) + styles[Token.INVALID] = Theme.getStyle("invalid"); + + + // moved from TextAreaPainter + + font = Preferences.getFont("editor.font"); + + fgcolor = Theme.getColor("editor.fgcolor"); + bgcolor = Theme.getColor("editor.bgcolor"); + + caretVisible = true; + caretBlinks = Preferences.getBoolean("editor.caret.blink"); + caretColor = Theme.getColor("editor.caret.color"); + + selectionColor = Theme.getColor("editor.selection.color"); + + lineHighlight = + Theme.getBoolean("editor.linehighlight"); + lineHighlightColor = + Theme.getColor("editor.linehighlight.color"); + + bracketHighlight = + Theme.getBoolean("editor.brackethighlight"); + bracketHighlightColor = + Theme.getColor("editor.brackethighlight.color"); + + eolMarkers = Theme.getBoolean("editor.eolmarkers"); + eolMarkerColor = Theme.getColor("editor.eolmarkers.color"); + + paintInvalid = Theme.getBoolean("editor.invalid"); + } +} diff --git a/app/src/processing/app/syntax/SyntaxDocument.java b/app/src/processing/app/syntax/SyntaxDocument.java new file mode 100644 index 000000000..7b07a4269 --- /dev/null +++ b/app/src/processing/app/syntax/SyntaxDocument.java @@ -0,0 +1,166 @@ +/* + * SyntaxDocument.java - Document that can be tokenized + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.event.*; +import javax.swing.text.*; +import javax.swing.undo.UndoableEdit; + +/** + * A document implementation that can be tokenized by the syntax highlighting + * system. + * + * @author Slava Pestov + * @version $Id: SyntaxDocument.java 1268 2005-04-09 02:30:37Z benfry $ + */ +public class SyntaxDocument extends PlainDocument +{ + /** + * Returns the token marker that is to be used to split lines + * of this document up into tokens. May return null if this + * document is not to be colorized. + */ + public TokenMarker getTokenMarker() + { + return tokenMarker; + } + + /** + * Sets the token marker that is to be used to split lines of + * this document up into tokens. May throw an exception if + * this is not supported for this type of document. + * @param tm The new token marker + */ + public void setTokenMarker(TokenMarker tm) + { + tokenMarker = tm; + if(tm == null) + return; + tokenMarker.insertLines(0,getDefaultRootElement() + .getElementCount()); + tokenizeLines(); + } + + /** + * Reparses the document, by passing all lines to the token + * marker. This should be called after the document is first + * loaded. + */ + public void tokenizeLines() + { + tokenizeLines(0,getDefaultRootElement().getElementCount()); + } + + /** + * Reparses the document, by passing the specified lines to the + * token marker. This should be called after a large quantity of + * text is first inserted. + * @param start The first line to parse + * @param len The number of lines, after the first one to parse + */ + public void tokenizeLines(int start, int len) + { + if(tokenMarker == null || !tokenMarker.supportsMultilineTokens()) + return; + + Segment lineSegment = new Segment(); + Element map = getDefaultRootElement(); + + len += start; + + try + { + for(int i = start; i < len; i++) + { + Element lineElement = map.getElement(i); + int lineStart = lineElement.getStartOffset(); + getText(lineStart,lineElement.getEndOffset() + - lineStart - 1,lineSegment); + tokenMarker.markTokens(lineSegment,i); + } + } + catch(BadLocationException bl) + { + bl.printStackTrace(); + } + } + + /** + * Starts a compound edit that can be undone in one operation. + * Subclasses that implement undo should override this method; + * this class has no undo functionality so this method is + * empty. + */ + public void beginCompoundEdit() {} + + /** + * Ends a compound edit that can be undone in one operation. + * Subclasses that implement undo should override this method; + * this class has no undo functionality so this method is + * empty. + */ + public void endCompoundEdit() {} + + /** + * Adds an undoable edit to this document's undo list. The edit + * should be ignored if something is currently being undone. + * @param edit The undoable edit + * + * @since jEdit 2.2pre1 + */ + public void addUndoableEdit(UndoableEdit edit) {} + + // protected members + protected TokenMarker tokenMarker; + + /** + * We overwrite this method to update the token marker + * state immediately so that any event listeners get a + * consistent token marker. + */ + protected void fireInsertUpdate(DocumentEvent evt) + { + if(tokenMarker != null) + { + DocumentEvent.ElementChange ch = evt.getChange( + getDefaultRootElement()); + if(ch != null) + { + tokenMarker.insertLines(ch.getIndex() + 1, + ch.getChildrenAdded().length - + ch.getChildrenRemoved().length); + } + } + + super.fireInsertUpdate(evt); + } + + /** + * We overwrite this method to update the token marker + * state immediately so that any event listeners get a + * consistent token marker. + */ + protected void fireRemoveUpdate(DocumentEvent evt) + { + if(tokenMarker != null) + { + DocumentEvent.ElementChange ch = evt.getChange( + getDefaultRootElement()); + if(ch != null) + { + tokenMarker.deleteLines(ch.getIndex() + 1, + ch.getChildrenRemoved().length - + ch.getChildrenAdded().length); + } + } + + super.fireRemoveUpdate(evt); + } +} diff --git a/app/src/processing/app/syntax/SyntaxStyle.java b/app/src/processing/app/syntax/SyntaxStyle.java new file mode 100644 index 000000000..56323c3cc --- /dev/null +++ b/app/src/processing/app/syntax/SyntaxStyle.java @@ -0,0 +1,138 @@ +/* + * SyntaxStyle.java - A simple text style class + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import java.awt.*; +import javax.swing.JComponent; + + +/** + * A simple text style class. It can specify the color, italic flag, + * and bold flag of a run of text. + * @author Slava Pestov + * @version $Id: SyntaxStyle.java 4824 2008-10-11 23:41:40Z fry $ + */ +public class SyntaxStyle +{ + /** + * Creates a new SyntaxStyle. + * @param color The text color + * @param italic True if the text should be italics + * @param bold True if the text should be bold + */ + public SyntaxStyle(Color color, boolean italic, boolean bold) + { + this.color = color; + this.italic = italic; + this.bold = bold; + } + + /** + * Returns the color specified in this style. + */ + public Color getColor() + { + return color; + } + + /** + * Returns true if no font styles are enabled. + */ + public boolean isPlain() + { + return !(bold || italic); + } + + /** + * Returns true if italics is enabled for this style. + */ + public boolean isItalic() + { + return italic; + } + + /** + * Returns true if boldface is enabled for this style. + */ + public boolean isBold() + { + return bold; + } + + /** + * Returns the specified font, but with the style's bold and + * italic flags applied. + */ + public Font getStyledFont(Font font) + { + if(font == null) + throw new NullPointerException("font param must not" + + " be null"); + if(font.equals(lastFont)) + return lastStyledFont; + lastFont = font; + lastStyledFont = new Font(font.getFamily(), + (bold ? Font.BOLD : 0) + | (italic ? Font.ITALIC : 0), + font.getSize()); + return lastStyledFont; + } + + /** + * Returns the font metrics for the styled font. + */ + public FontMetrics getFontMetrics(Font font, JComponent comp) + { + if(font == null) + throw new NullPointerException("font param must not" + + " be null"); + if(font.equals(lastFont) && fontMetrics != null) + return fontMetrics; + lastFont = font; + lastStyledFont = new Font(font.getFamily(), + (bold ? Font.BOLD : 0) + | (italic ? Font.ITALIC : 0), + font.getSize()); + //fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(lastStyledFont); + fontMetrics = comp.getFontMetrics(lastStyledFont); + return fontMetrics; + } + + /** + * Sets the foreground color and font of the specified graphics + * context to that specified in this style. + * @param gfx The graphics context + * @param font The font to add the styles to + */ + public void setGraphicsFlags(Graphics gfx, Font font) + { + Font _font = getStyledFont(font); + gfx.setFont(_font); + gfx.setColor(color); + } + + /** + * Returns a string representation of this object. + */ + public String toString() + { + return getClass().getName() + "[color=" + color + + (italic ? ",italic" : "") + + (bold ? ",bold" : "") + "]"; + } + + // private members + private Color color; + private boolean italic; + private boolean bold; + private Font lastFont; + private Font lastStyledFont; + private FontMetrics fontMetrics; +} diff --git a/app/src/processing/app/syntax/SyntaxUtilities.java b/app/src/processing/app/syntax/SyntaxUtilities.java new file mode 100644 index 000000000..5225d0b73 --- /dev/null +++ b/app/src/processing/app/syntax/SyntaxUtilities.java @@ -0,0 +1,163 @@ +/* + * SyntaxUtilities.java - Utility functions used by syntax colorizing + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.text.*; +import java.awt.*; + + +/** + * Class with several utility functions used by jEdit's syntax colorizing + * subsystem. + * + * @author Slava Pestov + * @version $Id: SyntaxUtilities.java 1268 2005-04-09 02:30:37Z benfry $ + */ +public class SyntaxUtilities +{ + /** + * Checks if a subregion of a Segment is equal to a + * string. + * @param ignoreCase True if case should be ignored, false otherwise + * @param text The segment + * @param offset The offset into the segment + * @param match The string to match + */ + public static boolean regionMatches(boolean ignoreCase, Segment text, + int offset, String match) + { + int length = offset + match.length(); + char[] textArray = text.array; + if(length > text.offset + text.count) + return false; + for(int i = offset, j = 0; i < length; i++, j++) + { + char c1 = textArray[i]; + char c2 = match.charAt(j); + if(ignoreCase) + { + c1 = Character.toUpperCase(c1); + c2 = Character.toUpperCase(c2); + } + if(c1 != c2) + return false; + } + return true; + } + + + /** + * Checks if a subregion of a Segment is equal to a + * character array. + * @param ignoreCase True if case should be ignored, false otherwise + * @param text The segment + * @param offset The offset into the segment + * @param match The character array to match + */ + public static boolean regionMatches(boolean ignoreCase, Segment text, + int offset, char[] match) + { + int length = offset + match.length; + char[] textArray = text.array; + if(length > text.offset + text.count) + return false; + for(int i = offset, j = 0; i < length; i++, j++) + { + char c1 = textArray[i]; + char c2 = match[j]; + if(ignoreCase) + { + c1 = Character.toUpperCase(c1); + c2 = Character.toUpperCase(c2); + } + if(c1 != c2) + return false; + } + return true; + } + + + /** + * Returns the default style table. This can be passed to the + * setStyles() method of SyntaxDocument + * to use the default syntax styles. + */ + public static SyntaxStyle[] getDefaultSyntaxStyles() + { + SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT]; + + styles[Token.COMMENT1] = new SyntaxStyle(Color.black,true,false); + styles[Token.COMMENT2] = new SyntaxStyle(new Color(0x990033),true,false); + styles[Token.KEYWORD1] = new SyntaxStyle(Color.black,false,true); + styles[Token.KEYWORD2] = new SyntaxStyle(Color.magenta,false,false); + styles[Token.KEYWORD3] = new SyntaxStyle(new Color(0x009600),false,false); + styles[Token.LITERAL1] = new SyntaxStyle(new Color(0x650099),false,false); + styles[Token.LITERAL2] = new SyntaxStyle(new Color(0x650099),false,true); + styles[Token.LABEL] = new SyntaxStyle(new Color(0x990033),false,true); + styles[Token.OPERATOR] = new SyntaxStyle(Color.black,false,true); + styles[Token.INVALID] = new SyntaxStyle(Color.red,false,true); + + return styles; + } + + + /** + * Paints the specified line onto the graphics context. Note that this + * method munges the offset and count values of the segment. + * @param line The line segment + * @param tokens The token list for the line + * @param styles The syntax style list + * @param expander The tab expander used to determine tab stops. May + * be null + * @param gfx The graphics context + * @param x The x co-ordinate + * @param y The y co-ordinate + * @return The x co-ordinate, plus the width of the painted string + */ + public static int paintSyntaxLine(Segment line, Token tokens, + SyntaxStyle[] styles, + TabExpander expander, Graphics gfx, + int x, int y) + { + Font defaultFont = gfx.getFont(); + Color defaultColor = gfx.getColor(); + + int offset = 0; + for(;;) + { + byte id = tokens.id; + if(id == Token.END) + break; + + int length = tokens.length; + if(id == Token.NULL) + { + if(!defaultColor.equals(gfx.getColor())) + gfx.setColor(defaultColor); + if(!defaultFont.equals(gfx.getFont())) + gfx.setFont(defaultFont); + } + else + styles[id].setGraphicsFlags(gfx,defaultFont); + + line.count = length; + x = Utilities.drawTabbedText(line,x,y,gfx,expander,0); + line.offset += length; + offset += length; + + tokens = tokens.next; + } + + return x; + } + + // private members + private SyntaxUtilities() {} +} diff --git a/app/src/processing/app/syntax/TextAreaDefaults.java b/app/src/processing/app/syntax/TextAreaDefaults.java new file mode 100644 index 000000000..c2e878578 --- /dev/null +++ b/app/src/processing/app/syntax/TextAreaDefaults.java @@ -0,0 +1,90 @@ +/* + * TextAreaDefaults.java - Encapsulates default values for various settings + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import java.awt.*; +//import javax.swing.JPopupMenu; + +/** + * Encapsulates default settings for a text area. This can be passed + * to the constructor once the necessary fields have been filled out. + * The advantage of doing this over calling lots of set() methods after + * creating the text area is that this method is faster. + */ +public class TextAreaDefaults +{ + private static TextAreaDefaults DEFAULTS; + + public InputHandler inputHandler; + public SyntaxDocument document; + public boolean editable; + + public boolean caretVisible; + public boolean caretBlinks; + public boolean blockCaret; + public int electricScroll; + + public int cols; + public int rows; + public SyntaxStyle[] styles; + public Color caretColor; + public Color selectionColor; + public Color lineHighlightColor; + public boolean lineHighlight; + public Color bracketHighlightColor; + public boolean bracketHighlight; + public Color eolMarkerColor; + public boolean eolMarkers; + public boolean paintInvalid; + + + // moved from TextAreaPainter [fry] + public Font font; + public Color fgcolor; + public Color bgcolor; + + //public JPopupMenu popup; + + + /** + * Returns a new TextAreaDefaults object with the default values filled + * in. + */ + public static TextAreaDefaults getDefaults() + { + if (DEFAULTS == null) { + DEFAULTS = new TextAreaDefaults(); + + DEFAULTS.inputHandler = new DefaultInputHandler(); + DEFAULTS.inputHandler.addDefaultKeyBindings(); + DEFAULTS.document = new SyntaxDocument(); + DEFAULTS.editable = true; + + DEFAULTS.caretVisible = true; + DEFAULTS.caretBlinks = true; + DEFAULTS.electricScroll = 3; + + DEFAULTS.cols = 80; + DEFAULTS.rows = 25; + DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles(); + DEFAULTS.caretColor = Color.red; + DEFAULTS.selectionColor = new Color(0xccccff); + DEFAULTS.lineHighlightColor = new Color(0xe0e0e0); + DEFAULTS.lineHighlight = true; + DEFAULTS.bracketHighlightColor = Color.black; + DEFAULTS.bracketHighlight = true; + DEFAULTS.eolMarkerColor = new Color(0x009999); + DEFAULTS.eolMarkers = true; + DEFAULTS.paintInvalid = true; + } + + return DEFAULTS; + } +} diff --git a/app/src/processing/app/syntax/TextAreaPainter.java b/app/src/processing/app/syntax/TextAreaPainter.java new file mode 100644 index 000000000..ef205b079 --- /dev/null +++ b/app/src/processing/app/syntax/TextAreaPainter.java @@ -0,0 +1,756 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + * TextAreaPainter.java - Paints the text area + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import processing.app.*; + +import javax.swing.ToolTipManager; +import javax.swing.text.*; +import javax.swing.JComponent; +import java.awt.event.MouseEvent; +import java.awt.*; +import java.awt.print.*; + +/** + * The text area repaint manager. It performs double buffering and paints + * lines of text. + * @author Slava Pestov + */ +public class TextAreaPainter extends JComponent +implements TabExpander, Printable +{ + /** True if inside printing, will handle disabling the highlight */ + boolean printing; + + /** + * Creates a new repaint manager. This should be not be called + * directly. + */ + public TextAreaPainter(JEditTextArea textArea, TextAreaDefaults defaults) + { + this.textArea = textArea; + + setAutoscrolls(true); + setDoubleBuffered(true); + setOpaque(true); + + ToolTipManager.sharedInstance().registerComponent(this); + + currentLine = new Segment(); + currentLineIndex = -1; + + setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); + + setFont(defaults.font); + setForeground(defaults.fgcolor); + setBackground(defaults.bgcolor); + + blockCaret = defaults.blockCaret; + styles = defaults.styles; + cols = defaults.cols; + rows = defaults.rows; + caretColor = defaults.caretColor; + selectionColor = defaults.selectionColor; + lineHighlightColor = defaults.lineHighlightColor; + lineHighlight = defaults.lineHighlight; + bracketHighlightColor = defaults.bracketHighlightColor; + bracketHighlight = defaults.bracketHighlight; + paintInvalid = defaults.paintInvalid; + eolMarkerColor = defaults.eolMarkerColor; + eolMarkers = defaults.eolMarkers; + } + + /** + * Returns if this component can be traversed by pressing the + * Tab key. This returns false. + */ + public final boolean isManagingFocus() + { + return false; + } + + /** + * Returns the syntax styles used to paint colorized text. Entry n + * will be used to paint tokens with id = n. + * @see processing.app.syntax.Token + */ + public final SyntaxStyle[] getStyles() + { + return styles; + } + + /** + * Sets the syntax styles used to paint colorized text. Entry n + * will be used to paint tokens with id = n. + * @param styles The syntax styles + * @see processing.app.syntax.Token + */ + public final void setStyles(SyntaxStyle[] styles) + { + this.styles = styles; + repaint(); + } + + /** + * Returns the caret color. + */ + public final Color getCaretColor() + { + return caretColor; + } + + /** + * Sets the caret color. + * @param caretColor The caret color + */ + public final void setCaretColor(Color caretColor) + { + this.caretColor = caretColor; + invalidateSelectedLines(); + } + + /** + * Returns the selection color. + */ + public final Color getSelectionColor() + { + return selectionColor; + } + + /** + * Sets the selection color. + * @param selectionColor The selection color + */ + public final void setSelectionColor(Color selectionColor) + { + this.selectionColor = selectionColor; + invalidateSelectedLines(); + } + + /** + * Returns the line highlight color. + */ + public final Color getLineHighlightColor() + { + return lineHighlightColor; + } + + /** + * Sets the line highlight color. + * @param lineHighlightColor The line highlight color + */ + public final void setLineHighlightColor(Color lineHighlightColor) + { + this.lineHighlightColor = lineHighlightColor; + invalidateSelectedLines(); + } + + /** + * Returns true if line highlight is enabled, false otherwise. + */ + public final boolean isLineHighlightEnabled() + { + return lineHighlight; + } + + /** + * Enables or disables current line highlighting. + * @param lineHighlight True if current line highlight + * should be enabled, false otherwise + */ + public final void setLineHighlightEnabled(boolean lineHighlight) + { + this.lineHighlight = lineHighlight; + invalidateSelectedLines(); + } + + /** + * Returns the bracket highlight color. + */ + public final Color getBracketHighlightColor() + { + return bracketHighlightColor; + } + + /** + * Sets the bracket highlight color. + * @param bracketHighlightColor The bracket highlight color + */ + public final void setBracketHighlightColor(Color bracketHighlightColor) + { + this.bracketHighlightColor = bracketHighlightColor; + invalidateLine(textArea.getBracketLine()); + } + + /** + * Returns true if bracket highlighting is enabled, false otherwise. + * When bracket highlighting is enabled, the bracket matching the + * one before the caret (if any) is highlighted. + */ + public final boolean isBracketHighlightEnabled() + { + return bracketHighlight; + } + + /** + * Enables or disables bracket highlighting. + * When bracket highlighting is enabled, the bracket matching the + * one before the caret (if any) is highlighted. + * @param bracketHighlight True if bracket highlighting should be + * enabled, false otherwise + */ + public final void setBracketHighlightEnabled(boolean bracketHighlight) + { + this.bracketHighlight = bracketHighlight; + invalidateLine(textArea.getBracketLine()); + } + + /** + * Returns true if the caret should be drawn as a block, false otherwise. + */ + public final boolean isBlockCaretEnabled() + { + return blockCaret; + } + + /** + * Sets if the caret should be drawn as a block, false otherwise. + * @param blockCaret True if the caret should be drawn as a block, + * false otherwise. + */ + public final void setBlockCaretEnabled(boolean blockCaret) + { + this.blockCaret = blockCaret; + invalidateSelectedLines(); + } + + /** + * Returns the EOL marker color. + */ + public final Color getEOLMarkerColor() + { + return eolMarkerColor; + } + + /** + * Sets the EOL marker color. + * @param eolMarkerColor The EOL marker color + */ + public final void setEOLMarkerColor(Color eolMarkerColor) + { + this.eolMarkerColor = eolMarkerColor; + repaint(); + } + + /** + * Returns true if EOL markers are drawn, false otherwise. + */ + public final boolean getEOLMarkersPainted() + { + return eolMarkers; + } + + /** + * Sets if EOL markers are to be drawn. + * @param eolMarkers True if EOL markers should be drawn, false otherwise + */ + public final void setEOLMarkersPainted(boolean eolMarkers) + { + this.eolMarkers = eolMarkers; + repaint(); + } + + /** + * Returns true if invalid lines are painted as red tildes (~), + * false otherwise. + */ + public boolean getInvalidLinesPainted() + { + return paintInvalid; + } + + /** + * Sets if invalid lines are to be painted as red tildes. + * @param paintInvalid True if invalid lines should be drawn, false otherwise + */ + public void setInvalidLinesPainted(boolean paintInvalid) + { + this.paintInvalid = paintInvalid; + } + + /** + * Adds a custom highlight painter. + * @param highlight The highlight + */ + public void addCustomHighlight(Highlight highlight) + { + highlight.init(textArea,highlights); + highlights = highlight; + } + + /** + * Highlight interface. + */ + public interface Highlight + { + /** + * Called after the highlight painter has been added. + * @param textArea The text area + * @param next The painter this one should delegate to + */ + void init(JEditTextArea textArea, Highlight next); + + /** + * This should paint the highlight and delgate to the + * next highlight painter. + * @param gfx The graphics context + * @param line The line number + * @param y The y co-ordinate of the line + */ + void paintHighlight(Graphics gfx, int line, int y); + + /** + * Returns the tool tip to display at the specified + * location. If this highlighter doesn't know what to + * display, it should delegate to the next highlight + * painter. + * @param evt The mouse event + */ + String getToolTipText(MouseEvent evt); + } + + /** + * Returns the tool tip to display at the specified location. + * @param evt The mouse event + */ + public String getToolTipText(MouseEvent evt) + { + if(highlights != null) + return highlights.getToolTipText(evt); + else + return null; + } + + /** + * Returns the font metrics used by this component. + */ + public FontMetrics getFontMetrics() + { + return fm; + } + + /** + * Sets the font for this component. This is overridden to update the + * cached font metrics and to recalculate which lines are visible. + * @param font The font + */ + public void setFont(Font font) + { + super.setFont(font); + fm = super.getFontMetrics(font); + textArea.recalculateVisibleLines(); + } + + /** + * Repaints the text. + * @param gfx The graphics context + */ + public void paint(Graphics gfx) + { + if (Base.isMacOS()) { + Graphics2D g2 = (Graphics2D) gfx; + g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + } + + tabSize = fm.charWidth(' ') * ((Integer)textArea.getDocument().getProperty(PlainDocument.tabSizeAttribute)).intValue(); + + Rectangle clipRect = gfx.getClipBounds(); + + gfx.setColor(getBackground()); + gfx.fillRect(clipRect.x,clipRect.y,clipRect.width,clipRect.height); + + // We don't use yToLine() here because that method doesn't + // return lines past the end of the document + int height = fm.getHeight(); + int firstLine = textArea.getFirstLine(); + int firstInvalid = firstLine + clipRect.y / height; + // Because the clipRect's height is usually an even multiple + // of the font height, we subtract 1 from it, otherwise one + // too many lines will always be painted. + int lastInvalid = firstLine + (clipRect.y + clipRect.height - 1) / height; + + try { + TokenMarker tokenMarker = textArea.getDocument().getTokenMarker(); + int x = textArea.getHorizontalOffset(); + + for (int line = firstInvalid; line <= lastInvalid; line++) { + paintLine(gfx,tokenMarker,line,x); + } + + if (tokenMarker != null && tokenMarker.isNextLineRequested()) { + int h = clipRect.y + clipRect.height; + repaint(0,h,getWidth(),getHeight() - h); + } + } catch (Exception e) { + System.err.println("Error repainting line" + + " range {" + firstInvalid + "," + + lastInvalid + "}:"); + e.printStackTrace(); + } + } + + + public int print(Graphics g, PageFormat pageFormat, int pageIndex) { + int lineHeight = fm.getHeight(); + int linesPerPage = (int) (pageFormat.getImageableHeight() / lineHeight); + int lineCount = textArea.getLineCount(); + int lastPage = lineCount / linesPerPage; + + if (pageIndex > lastPage) { + return NO_SUCH_PAGE; + + } else { + Graphics2D g2d = (Graphics2D)g; + TokenMarker tokenMarker = textArea.getDocument().getTokenMarker(); + int firstLine = pageIndex*linesPerPage; + g2d.translate(Math.max(54, pageFormat.getImageableX()), + pageFormat.getImageableY() - firstLine*lineHeight); + printing = true; + for (int line = firstLine; line < firstLine + linesPerPage; line++) { + paintLine(g2d, tokenMarker, line, 0); + } + printing = false; + return PAGE_EXISTS; + } + } + + + /** + * Marks a line as needing a repaint. + * @param line The line to invalidate + */ + public final void invalidateLine(int line) + { + repaint(0,textArea.lineToY(line) + fm.getMaxDescent() + fm.getLeading(), + getWidth(),fm.getHeight()); + } + + /** + * Marks a range of lines as needing a repaint. + * @param firstLine The first line to invalidate + * @param lastLine The last line to invalidate + */ + public final void invalidateLineRange(int firstLine, int lastLine) + { + repaint(0,textArea.lineToY(firstLine) + + fm.getMaxDescent() + fm.getLeading(), + getWidth(),(lastLine - firstLine + 1) * fm.getHeight()); + } + + /** + * Repaints the lines containing the selection. + */ + public final void invalidateSelectedLines() + { + invalidateLineRange(textArea.getSelectionStartLine(), + textArea.getSelectionStopLine()); + } + + /** + * Implementation of TabExpander interface. Returns next tab stop after + * a specified point. + * @param x The x co-ordinate + * @param tabOffset Ignored + * @return The next tab stop after x + */ + public float nextTabStop(float x, int tabOffset) + { + int offset = textArea.getHorizontalOffset(); + int ntabs = ((int)x - offset) / tabSize; + return (ntabs + 1) * tabSize + offset; + } + + /** + * Returns the painter's preferred size. + */ + public Dimension getPreferredSize() + { + Dimension dim = new Dimension(); + dim.width = fm.charWidth('w') * cols; + dim.height = fm.getHeight() * rows; + return dim; + } + + + /** + * Returns the painter's minimum size. + */ + public Dimension getMinimumSize() + { + return getPreferredSize(); + } + + // package-private members + int currentLineIndex; + Token currentLineTokens; + Segment currentLine; + + /** + * Accessor used by tools that want to hook in and grab the formatting. + */ + public int getCurrentLineIndex() { + return currentLineIndex; + } + + /** + * Accessor used by tools that want to hook in and grab the formatting. + */ + public void setCurrentLineIndex(int what) { + currentLineIndex = what; + } + + /** + * Accessor used by tools that want to hook in and grab the formatting. + */ + public Token getCurrentLineTokens() { + return currentLineTokens; + } + + /** + * Accessor used by tools that want to hook in and grab the formatting. + */ + public void setCurrentLineTokens(Token tokens) { + currentLineTokens = tokens; + } + + /** + * Accessor used by tools that want to hook in and grab the formatting. + */ + public Segment getCurrentLine() { + return currentLine; + } + + + // protected members + protected JEditTextArea textArea; + + protected SyntaxStyle[] styles; + protected Color caretColor; + protected Color selectionColor; + protected Color lineHighlightColor; + protected Color bracketHighlightColor; + protected Color eolMarkerColor; + + protected boolean blockCaret; + protected boolean lineHighlight; + protected boolean bracketHighlight; + protected boolean paintInvalid; + protected boolean eolMarkers; + protected int cols; + protected int rows; + + protected int tabSize; + protected FontMetrics fm; + + protected Highlight highlights; + + protected void paintLine(Graphics gfx, TokenMarker tokenMarker, + int line, int x) + { + Font defaultFont = getFont(); + Color defaultColor = getForeground(); + + currentLineIndex = line; + int y = textArea.lineToY(line); + + if (line < 0 || line >= textArea.getLineCount()) { + if (paintInvalid) { + paintHighlight(gfx,line,y); + styles[Token.INVALID].setGraphicsFlags(gfx,defaultFont); + gfx.drawString("~",0,y + fm.getHeight()); + } + } else if(tokenMarker == null) { + paintPlainLine(gfx,line,defaultFont,defaultColor,x,y); + } else { + paintSyntaxLine(gfx,tokenMarker,line,defaultFont, + defaultColor,x,y); + } + } + + protected void paintPlainLine(Graphics gfx, int line, Font defaultFont, + Color defaultColor, int x, int y) + { + paintHighlight(gfx,line,y); + textArea.getLineText(line,currentLine); + + gfx.setFont(defaultFont); + gfx.setColor(defaultColor); + + y += fm.getHeight(); + x = Utilities.drawTabbedText(currentLine,x,y,gfx,this,0); + + if (eolMarkers) { + gfx.setColor(eolMarkerColor); + gfx.drawString(".",x,y); + } + } + + protected void paintSyntaxLine(Graphics gfx, TokenMarker tokenMarker, + int line, Font defaultFont, + Color defaultColor, int x, int y) + { + textArea.getLineText(currentLineIndex,currentLine); + currentLineTokens = tokenMarker.markTokens(currentLine, + currentLineIndex); + + paintHighlight(gfx,line,y); + + gfx.setFont(defaultFont); + gfx.setColor(defaultColor); + y += fm.getHeight(); + x = SyntaxUtilities.paintSyntaxLine(currentLine, + currentLineTokens, + styles, this, gfx, x, y); + + if (eolMarkers) { + gfx.setColor(eolMarkerColor); + gfx.drawString(".",x,y); + } + } + + protected void paintHighlight(Graphics gfx, int line, int y) + { + if (!printing) { + if (line >= textArea.getSelectionStartLine() + && line <= textArea.getSelectionStopLine()) + paintLineHighlight(gfx,line,y); + + if (highlights != null) + highlights.paintHighlight(gfx,line,y); + + if (bracketHighlight && line == textArea.getBracketLine()) + paintBracketHighlight(gfx,line,y); + + if (line == textArea.getCaretLine()) + paintCaret(gfx,line,y); + } + } + + protected void paintLineHighlight(Graphics gfx, int line, int y) + { + int height = fm.getHeight(); + y += fm.getLeading() + fm.getMaxDescent(); + + int selectionStart = textArea.getSelectionStart(); + int selectionEnd = textArea.getSelectionStop(); + + if (selectionStart == selectionEnd) { + if (lineHighlight) { + gfx.setColor(lineHighlightColor); + gfx.fillRect(0,y,getWidth(),height); + } + } else { + gfx.setColor(selectionColor); + + int selectionStartLine = textArea.getSelectionStartLine(); + int selectionEndLine = textArea.getSelectionStopLine(); + int lineStart = textArea.getLineStartOffset(line); + + int x1, x2; + if (textArea.isSelectionRectangular()) { + int lineLen = textArea.getLineLength(line); + x1 = textArea._offsetToX(line,Math.min(lineLen, selectionStart - textArea.getLineStartOffset(selectionStartLine))); + x2 = textArea._offsetToX(line,Math.min(lineLen, selectionEnd - textArea.getLineStartOffset(selectionEndLine))); + if (x1 == x2) + x2++; + } else if(selectionStartLine == selectionEndLine) { + x1 = textArea._offsetToX(line, selectionStart - lineStart); + x2 = textArea._offsetToX(line, selectionEnd - lineStart); + } else if(line == selectionStartLine) { + x1 = textArea._offsetToX(line, selectionStart - lineStart); + x2 = getWidth(); + } else if(line == selectionEndLine) { + //x1 = 0; + // hack from stendahl to avoid doing weird side selection thing + x1 = textArea._offsetToX(line, 0); + // attempt at getting the gutter too, but doesn't seem to work + //x1 = textArea._offsetToX(line, -textArea.getHorizontalOffset()); + x2 = textArea._offsetToX(line, selectionEnd - lineStart); + } else { + //x1 = 0; + // hack from stendahl to avoid doing weird side selection thing + x1 = textArea._offsetToX(line, 0); + // attempt at getting the gutter too, but doesn't seem to work + //x1 = textArea._offsetToX(line, -textArea.getHorizontalOffset()); + x2 = getWidth(); + } + + // "inlined" min/max() + gfx.fillRect(x1 > x2 ? x2 : x1,y,x1 > x2 ? + (x1 - x2) : (x2 - x1),height); + } + + } + + protected void paintBracketHighlight(Graphics gfx, int line, int y) + { + int position = textArea.getBracketPosition(); + if(position == -1) + return; + y += fm.getLeading() + fm.getMaxDescent(); + int x = textArea._offsetToX(line,position); + gfx.setColor(bracketHighlightColor); + // Hack!!! Since there is no fast way to get the character + // from the bracket matching routine, we use ( since all + // brackets probably have the same width anyway + gfx.drawRect(x,y,fm.charWidth('(') - 1, + fm.getHeight() - 1); + } + + protected void paintCaret(Graphics gfx, int line, int y) + { + //System.out.println("painting caret " + line + " " + y); + if (textArea.isCaretVisible()) { + //System.out.println("caret is visible"); + int offset = + textArea.getCaretPosition() - textArea.getLineStartOffset(line); + int caretX = textArea._offsetToX(line, offset); + int caretWidth = ((blockCaret || + textArea.isOverwriteEnabled()) ? + fm.charWidth('w') : 1); + y += fm.getLeading() + fm.getMaxDescent(); + int height = fm.getHeight(); + + //System.out.println("caretX, width = " + caretX + " " + caretWidth); + + gfx.setColor(caretColor); + + if (textArea.isOverwriteEnabled()) { + gfx.fillRect(caretX,y + height - 1, caretWidth,1); + + } else { + // some machines don't like the drawRect for the single + // pixel caret.. this caused a lot of hell because on that + // minority of machines, the caret wouldn't show up past + // the first column. the fix is to use drawLine() in + // those cases, as a workaround. + if (caretWidth == 1) { + gfx.drawLine(caretX, y, caretX, y + height - 1); + } else { + gfx.drawRect(caretX, y, caretWidth - 1, height - 1); + } + //gfx.drawRect(caretX, y, caretWidth, height - 1); + } + } + } +} diff --git a/app/src/processing/app/syntax/TextUtilities.java b/app/src/processing/app/syntax/TextUtilities.java new file mode 100644 index 000000000..d31f8f3b7 --- /dev/null +++ b/app/src/processing/app/syntax/TextUtilities.java @@ -0,0 +1,184 @@ +/* + * TextUtilities.java - Utility functions used by the text area classes + * Copyright (C) 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.text.*; + +/** + * Class with several utility functions used by the text area component. + * @author Slava Pestov + * @version $Id: TextUtilities.java 1268 2005-04-09 02:30:37Z benfry $ + */ +public class TextUtilities +{ + /** + * Returns the offset of the bracket matching the one at the + * specified offset of the document, or -1 if the bracket is + * unmatched (or if the character is not a bracket). + * @param doc The document + * @param offset The offset + * @exception BadLocationException If an out-of-bounds access + * was attempted on the document text + */ + public static int findMatchingBracket(Document doc, int offset) + throws BadLocationException + { + if(doc.getLength() == 0) + return -1; + char c = doc.getText(offset,1).charAt(0); + char cprime; // c` - corresponding character + boolean direction; // true = back, false = forward + + switch(c) + { + case '(': cprime = ')'; direction = false; break; + case ')': cprime = '('; direction = true; break; + case '[': cprime = ']'; direction = false; break; + case ']': cprime = '['; direction = true; break; + case '{': cprime = '}'; direction = false; break; + case '}': cprime = '{'; direction = true; break; + default: return -1; + } + + int count; + + // How to merge these two cases is left as an exercise + // for the reader. + + // Go back or forward + if(direction) + { + // Count is 1 initially because we have already + // `found' one closing bracket + count = 1; + + // Get text[0,offset-1]; + String text = doc.getText(0,offset); + + // Scan backwards + for(int i = offset - 1; i >= 0; i--) + { + // If text[i] == c, we have found another + // closing bracket, therefore we will need + // two opening brackets to complete the + // match. + char x = text.charAt(i); + if(x == c) + count++; + + // If text[i] == cprime, we have found a + // opening bracket, so we return i if + // --count == 0 + else if(x == cprime) + { + if(--count == 0) + return i; + } + } + } + else + { + // Count is 1 initially because we have already + // `found' one opening bracket + count = 1; + + // So we don't have to + 1 in every loop + offset++; + + // Number of characters to check + int len = doc.getLength() - offset; + + // Get text[offset+1,len]; + String text = doc.getText(offset,len); + + // Scan forwards + for(int i = 0; i < len; i++) + { + // If text[i] == c, we have found another + // opening bracket, therefore we will need + // two closing brackets to complete the + // match. + char x = text.charAt(i); + + if(x == c) + count++; + + // If text[i] == cprime, we have found an + // closing bracket, so we return i if + // --count == 0 + else if(x == cprime) + { + if(--count == 0) + return i + offset; + } + } + } + + // Nothing found + return -1; + } + + /** + * Locates the start of the word at the specified position. + * @param line The text + * @param pos The position + */ + public static int findWordStart(String line, int pos, String noWordSep) + { + char ch = line.charAt(pos - 1); + + if(noWordSep == null) + noWordSep = ""; + boolean selectNoLetter = (!Character.isLetterOrDigit(ch) + && noWordSep.indexOf(ch) == -1); + + int wordStart = 0; + for(int i = pos - 1; i >= 0; i--) + { + ch = line.charAt(i); + if(selectNoLetter ^ (!Character.isLetterOrDigit(ch) && + noWordSep.indexOf(ch) == -1)) + { + wordStart = i + 1; + break; + } + } + + return wordStart; + } + + /** + * Locates the end of the word at the specified position. + * @param line The text + * @param pos The position + */ + public static int findWordEnd(String line, int pos, String noWordSep) + { + char ch = line.charAt(pos); + + if(noWordSep == null) + noWordSep = ""; + boolean selectNoLetter = (!Character.isLetterOrDigit(ch) + && noWordSep.indexOf(ch) == -1); + + int wordEnd = line.length(); + for(int i = pos; i < line.length(); i++) + { + ch = line.charAt(i); + if(selectNoLetter ^ (!Character.isLetterOrDigit(ch) && + noWordSep.indexOf(ch) == -1)) + { + wordEnd = i; + break; + } + } + return wordEnd; + } +} diff --git a/app/src/processing/app/syntax/Token.java b/app/src/processing/app/syntax/Token.java new file mode 100644 index 000000000..a0f73bebf --- /dev/null +++ b/app/src/processing/app/syntax/Token.java @@ -0,0 +1,149 @@ +/* + * Token.java - Generic token + * Copyright (C) 1998, 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +/** + * A linked list of tokens. Each token has three fields - a token + * identifier, which is a byte value that can be looked up in the + * array returned by SyntaxDocument.getColors() + * to get a color value, a length value which is the length of the + * token in the text, and a pointer to the next token in the list. + * + * @author Slava Pestov + * @version $Id: Token.java 1268 2005-04-09 02:30:37Z benfry $ + */ +public class Token +{ + /** + * Normal text token id. This should be used to mark + * normal text. + */ + public static final byte NULL = 0; + + /** + * Comment 1 token id. This can be used to mark a comment. + */ + public static final byte COMMENT1 = 1; + + /** + * Comment 2 token id. This can be used to mark a comment. + */ + public static final byte COMMENT2 = 2; + + + /** + * Literal 1 token id. This can be used to mark a string + * literal (eg, C mode uses this to mark "..." literals) + */ + public static final byte LITERAL1 = 3; + + /** + * Literal 2 token id. This can be used to mark an object + * literal (eg, Java mode uses this to mark true, false, etc) + */ + public static final byte LITERAL2 = 4; + + /** + * Label token id. This can be used to mark labels + * (eg, C mode uses this to mark ...: sequences) + */ + public static final byte LABEL = 5; + + /** + * Keyword 1 token id. This can be used to mark a + * keyword. This should be used for general language + * constructs. + */ + public static final byte KEYWORD1 = 6; + + /** + * Keyword 2 token id. This can be used to mark a + * keyword. This should be used for preprocessor + * commands, or variables. + */ + public static final byte KEYWORD2 = 7; + + /** + * Keyword 3 token id. This can be used to mark a + * keyword. This should be used for data types. + */ + public static final byte KEYWORD3 = 8; + + /** + * Operator token id. This can be used to mark an + * operator. (eg, SQL mode marks +, -, etc with this + * token type) + */ + public static final byte OPERATOR = 9; + + /** + * Invalid token id. This can be used to mark invalid + * or incomplete tokens, so the user can easily spot + * syntax errors. + */ + public static final byte INVALID = 10; + + /** + * The total number of defined token ids. + */ + public static final byte ID_COUNT = 11; + + /** + * The first id that can be used for internal state + * in a token marker. + */ + public static final byte INTERNAL_FIRST = 100; + + /** + * The last id that can be used for internal state + * in a token marker. + */ + public static final byte INTERNAL_LAST = 126; + + /** + * The token type, that along with a length of 0 + * marks the end of the token list. + */ + public static final byte END = 127; + + /** + * The length of this token. + */ + public int length; + + /** + * The id of this token. + */ + public byte id; + + /** + * The next token in the linked list. + */ + public Token next; + + /** + * Creates a new token. + * @param length The length of the token + * @param id The id of the token + */ + public Token(int length, byte id) + { + this.length = length; + this.id = id; + } + + /** + * Returns a string representation of this token. + */ + public String toString() + { + return "[id=" + id + ",length=" + length + "]"; + } +} diff --git a/app/src/processing/app/syntax/TokenMarker.java b/app/src/processing/app/syntax/TokenMarker.java new file mode 100644 index 000000000..9244556d3 --- /dev/null +++ b/app/src/processing/app/syntax/TokenMarker.java @@ -0,0 +1,341 @@ +/* + * TokenMarker.java - Generic token marker + * Copyright (C) 1998, 1999 Slava Pestov + * + * You may use and modify this package for any purpose. Redistribution is + * permitted, in both source and binary form, provided that this notice + * remains intact in all source distributions of this package. + */ + +package processing.app.syntax; + +import javax.swing.text.Segment; + +/** + * A token marker that splits lines of text into tokens. Each token carries + * a length field and an indentification tag that can be mapped to a color + * for painting that token.

+ * + * For performance reasons, the linked list of tokens is reused after each + * line is tokenized. Therefore, the return value of markTokens + * should only be used for immediate painting. Notably, it cannot be + * cached. + * + * @author Slava Pestov + */ +public abstract class TokenMarker +{ + /** + * A wrapper for the lower-level markTokensImpl method + * that is called to split a line up into tokens. + * @param line The line + * @param lineIndex The line number + */ + public Token markTokens(Segment line, int lineIndex) + { + if(lineIndex >= length) + { + throw new IllegalArgumentException("Tokenizing invalid line: " + + lineIndex); + } + + lastToken = null; + + LineInfo info = lineInfo[lineIndex]; + LineInfo prev; + if(lineIndex == 0) + prev = null; + else + prev = lineInfo[lineIndex - 1]; + + byte oldToken = info.token; + byte token = markTokensImpl(prev == null ? + Token.NULL : prev.token,line,lineIndex); + + info.token = token; + + /* + * This is a foul hack. It stops nextLineRequested + * from being cleared if the same line is marked twice. + * + * Why is this necessary? It's all JEditTextArea's fault. + * When something is inserted into the text, firing a + * document event, the insertUpdate() method shifts the + * caret (if necessary) by the amount inserted. + * + * All caret movement is handled by the select() method, + * which eventually pipes the new position to scrollTo() + * and calls repaint(). + * + * Note that at this point in time, the new line hasn't + * yet been painted; the caret is moved first. + * + * scrollTo() calls offsetToX(), which tokenizes the line + * unless it is being called on the last line painted + * (in which case it uses the text area's painter cached + * token list). What scrollTo() does next is irrelevant. + * + * After scrollTo() has done it's job, repaint() is + * called, and eventually we end up in paintLine(), whose + * job is to paint the changed line. It, too, calls + * markTokens(). + * + * The problem was that if the line started a multiline + * token, the first markTokens() (done in offsetToX()) + * would set nextLineRequested (because the line end + * token had changed) but the second would clear it + * (because the line was the same that time) and therefore + * paintLine() would never know that it needed to repaint + * subsequent lines. + * + * This bug took me ages to track down, that's why I wrote + * all the relevant info down so that others wouldn't + * duplicate it. + */ + if(!(lastLine == lineIndex && nextLineRequested)) + nextLineRequested = (oldToken != token); + + lastLine = lineIndex; + + addToken(0,Token.END); + + return firstToken; + } + + /** + * An abstract method that splits a line up into tokens. It + * should parse the line, and call addToken() to + * add syntax tokens to the token list. Then, it should return + * the initial token type for the next line.

+ * + * For example if the current line contains the start of a + * multiline comment that doesn't end on that line, this method + * should return the comment token type so that it continues on + * the next line. + * + * @param token The initial token type for this line + * @param line The line to be tokenized + * @param lineIndex The index of the line in the document, + * starting at 0 + * @return The initial token type for the next line + */ + protected abstract byte markTokensImpl(byte token, Segment line, + int lineIndex); + + /** + * Returns if the token marker supports tokens that span multiple + * lines. If this is true, the object using this token marker is + * required to pass all lines in the document to the + * markTokens() method (in turn).

+ * + * The default implementation returns true; it should be overridden + * to return false on simpler token markers for increased speed. + */ + public boolean supportsMultilineTokens() + { + return true; + } + + /** + * Informs the token marker that lines have been inserted into + * the document. This inserts a gap in the lineInfo + * array. + * @param index The first line number + * @param lines The number of lines + */ + public void insertLines(int index, int lines) + { + if(lines <= 0) + return; + length += lines; + ensureCapacity(length); + int len = index + lines; + System.arraycopy(lineInfo,index,lineInfo,len, + lineInfo.length - len); + + for(int i = index + lines - 1; i >= index; i--) + { + lineInfo[i] = new LineInfo(); + } + } + + /** + * Informs the token marker that line have been deleted from + * the document. This removes the lines in question from the + * lineInfo array. + * @param index The first line number + * @param lines The number of lines + */ + public void deleteLines(int index, int lines) + { + if (lines <= 0) + return; + int len = index + lines; + length -= lines; + System.arraycopy(lineInfo,len,lineInfo, + index,lineInfo.length - len); + } + + /** + * Returns the number of lines in this token marker. + */ + public int getLineCount() + { + return length; + } + + /** + * Returns true if the next line should be repainted. This + * will return true after a line has been tokenized that starts + * a multiline token that continues onto the next line. + */ + public boolean isNextLineRequested() + { + return nextLineRequested; + } + + // protected members + + /** + * The first token in the list. This should be used as the return + * value from markTokens(). + */ + protected Token firstToken; + + /** + * The last token in the list. New tokens are added here. + * This should be set to null before a new line is to be tokenized. + */ + protected Token lastToken; + + /** + * An array for storing information about lines. It is enlarged and + * shrunk automatically by the insertLines() and + * deleteLines() methods. + */ + protected LineInfo[] lineInfo; + + /** + * The number of lines in the model being tokenized. This can be + * less than the length of the lineInfo array. + */ + protected int length; + + /** + * The last tokenized line. + */ + protected int lastLine; + + /** + * True if the next line should be painted. + */ + protected boolean nextLineRequested; + + /** + * Creates a new TokenMarker. This DOES NOT create + * a lineInfo array; an initial call to insertLines() + * does that. + */ + protected TokenMarker() + { + lastLine = -1; + } + + /** + * Ensures that the lineInfo array can contain the + * specified index. This enlarges it if necessary. No action is + * taken if the array is large enough already.

+ * + * It should be unnecessary to call this under normal + * circumstances; insertLine() should take care of + * enlarging the line info array automatically. + * + * @param index The array index + */ + protected void ensureCapacity(int index) + { + if(lineInfo == null) + lineInfo = new LineInfo[index + 1]; + else if(lineInfo.length <= index) + { + LineInfo[] lineInfoN = new LineInfo[(index + 1) * 2]; + System.arraycopy(lineInfo,0,lineInfoN,0, + lineInfo.length); + lineInfo = lineInfoN; + } + } + + /** + * Adds a token to the token list. + * @param length The length of the token + * @param id The id of the token + */ + protected void addToken(int length, byte id) + { + if(id >= Token.INTERNAL_FIRST && id <= Token.INTERNAL_LAST) + throw new InternalError("Invalid id: " + id); + + if(length == 0 && id != Token.END) + return; + + if(firstToken == null) + { + firstToken = new Token(length,id); + lastToken = firstToken; + } + else if(lastToken == null) + { + lastToken = firstToken; + firstToken.length = length; + firstToken.id = id; + } + else if(lastToken.next == null) + { + lastToken.next = new Token(length,id); + lastToken = lastToken.next; + } + else + { + lastToken = lastToken.next; + lastToken.length = length; + lastToken.id = id; + } + } + + /** + * Inner class for storing information about tokenized lines. + */ + public class LineInfo + { + /** + * Creates a new LineInfo object with token = Token.NULL + * and obj = null. + */ + public LineInfo() + { + } + + /** + * Creates a new LineInfo object with the specified + * parameters. + */ + public LineInfo(byte token, Object obj) + { + this.token = token; + this.obj = obj; + } + + /** + * The id of the last token of the line. + */ + public byte token; + + /** + * This is for use by the token marker implementations + * themselves. It can be used to store anything that + * is an object and that needs to exist on a per-line + * basis. + */ + public Object obj; + } +} diff --git a/app/src/processing/app/syntax/readme.txt b/app/src/processing/app/syntax/readme.txt new file mode 100644 index 000000000..07a825cd7 --- /dev/null +++ b/app/src/processing/app/syntax/readme.txt @@ -0,0 +1,46 @@ +OLDSYNTAX PACKAGE README + +I am placing the jEdit 2.2.1 syntax highlighting package in the public +domain. This means it can be integrated into commercial programs, etc. + +This package requires at least Java 1.1 and Swing 1.1. Syntax +highlighting for the following file types is supported: + +- C++, C +- CORBA IDL +- Eiffel +- HTML +- Java +- Java properties +- JavaScript +- MS-DOS INI +- MS-DOS batch files +- Makefile +- PHP +- Perl +- Python +- TeX +- Transact-SQL +- Unix patch/diff +- Unix shell script +- XML + +This package is undocumented; read the source (start by taking a look at +JEditTextArea.java) to find out how to use it; it's really simple. Feel +free to e-mail questions, queries, etc. to me, but keep in mind that +this code is very old and I no longer maintain it. So if you find a bug, +don't bother me about it; fix it yourself. + +* Copyright + +The jEdit 2.2.1 syntax highlighting package contains code that is +Copyright 1998-1999 Slava Pestov, Artur Biesiadowski, Clancy Malcolm, +Jonathan Revusky, Juha Lindfors and Mike Dillon. + +You may use and modify this package for any purpose. Redistribution is +permitted, in both source and binary form, provided that this notice +remains intact in all source distributions of this package. + +-- Slava Pestov +25 September 2000 + diff --git a/app/src/processing/app/tools/Archiver.java b/app/src/processing/app/tools/Archiver.java new file mode 100755 index 000000000..9eb9655ff --- /dev/null +++ b/app/src/processing/app/tools/Archiver.java @@ -0,0 +1,184 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Archiver - plugin tool for archiving sketches + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import processing.app.*; + +import java.awt.FileDialog; +import java.io.*; +import java.text.*; +import java.util.*; +import java.util.zip.*; + + +public class Archiver implements Tool { + Editor editor; + + // someday these will be settable + boolean useDate; + int digits = 3; + + NumberFormat numberFormat; + SimpleDateFormat dateFormat; + + + public String getMenuTitle() { + return "Archive Sketch"; + } + + + public void init(Editor editor) { + this.editor = editor; + + numberFormat = NumberFormat.getInstance(); + numberFormat.setGroupingUsed(false); // no commas + numberFormat.setMinimumIntegerDigits(digits); + + dateFormat = new SimpleDateFormat("yyMMdd"); + } + + + public void run() { + Sketch sketch = editor.getSketch(); + + // first save the sketch so that things don't archive strangely + boolean success = false; + try { + success = sketch.save(); + } catch (Exception e) { + e.printStackTrace(); + } + if (!success) { + Base.showWarning("Couldn't archive sketch", + "Archiving the sketch has been canceled because\n" + + "the sketch couldn't save properly.", null); + return; + } + + File location = sketch.getFolder(); + String name = location.getName(); + File parent = new File(location.getParent()); + + //System.out.println("loc " + location); + //System.out.println("par " + parent); + + File newbie = null; + String namely = null; + int index = 0; + do { + // only use the date if the sketch name isn't the default name + useDate = !name.startsWith("sketch_"); + + if (useDate) { + String purty = dateFormat.format(new Date()); + String stamp = purty + ((char) ('a' + index)); + namely = name + "-" + stamp; + newbie = new File(parent, namely + ".zip"); + + } else { + String diggie = numberFormat.format(index + 1); + namely = name + "-" + diggie; + newbie = new File(parent, namely + ".zip"); + } + index++; + } while (newbie.exists()); + + // open up a prompt for where to save this fella + FileDialog fd = + new FileDialog(editor, "Archive sketch as:", FileDialog.SAVE); + fd.setDirectory(parent.getAbsolutePath()); + fd.setFile(newbie.getName()); + fd.setVisible(true); + + String directory = fd.getDirectory(); + String filename = fd.getFile(); + + // only write the file if not canceled + if (filename != null) { + newbie = new File(directory, filename); + + try { + //System.out.println(newbie); + FileOutputStream zipOutputFile = new FileOutputStream(newbie); + ZipOutputStream zos = new ZipOutputStream(zipOutputFile); + + // recursively fill the zip file + buildZip(location, name, zos); + + // close up the jar file + zos.flush(); + zos.close(); + + editor.statusNotice("Created archive " + newbie.getName() + "."); + + } catch (IOException e) { + e.printStackTrace(); + } + } else { + editor.statusNotice("Archive sketch canceled."); + } + } + + + public void buildZip(File dir, String sofar, + ZipOutputStream zos) throws IOException { + String files[] = dir.list(); + for (int i = 0; i < files.length; i++) { + if (files[i].equals(".") || + files[i].equals("..")) continue; + + File sub = new File(dir, files[i]); + String nowfar = (sofar == null) ? + files[i] : (sofar + "/" + files[i]); + + if (sub.isDirectory()) { + // directories are empty entries and have / at the end + ZipEntry entry = new ZipEntry(nowfar + "/"); + //System.out.println(entry); + zos.putNextEntry(entry); + zos.closeEntry(); + buildZip(sub, nowfar, zos); + + } else { + ZipEntry entry = new ZipEntry(nowfar); + entry.setTime(sub.lastModified()); + zos.putNextEntry(entry); + zos.write(Base.loadBytesRaw(sub)); + zos.closeEntry(); + } + } + } +} + + + /* + int index = 0; + SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd"); + String purty = formatter.format(new Date()); + do { + newbieName = "sketch_" + purty + ((char) ('a' + index)); + newbieDir = new File(newbieParentDir, newbieName); + index++; + } while (newbieDir.exists()); + */ diff --git a/app/src/processing/app/tools/AutoFormat.java b/app/src/processing/app/tools/AutoFormat.java new file mode 100644 index 000000000..2397967c5 --- /dev/null +++ b/app/src/processing/app/tools/AutoFormat.java @@ -0,0 +1,946 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-06 Ben Fry and Casey Reas + Copyright (c) 2003 Martin Gomez, Ateneo de Manila University + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import processing.app.*; + +import java.io.*; + + +/** + * Alternate handler for dealing with auto format. + * Contributed by Martin Gomez, additional bug fixes by Ben Fry. + */ +public class AutoFormat implements Tool { + Editor editor; + + static final int BLOCK_MAXLEN = 1024; + + StringBuffer strOut; + //String formattedText; + int indentValue; + String indentChar; + //String uhOh = null; + //String theStuff; + int EOF; + BufferedInputStream bin = null; + int nBytesRead, indexBlock, lineLength, lineNumber; + byte bArray[]; + String strBlock; + int s_level[]; + int c_level; + int sp_flg[][]; + int s_ind[][]; + int s_if_lev[]; + int s_if_flg[]; + int if_lev, if_flg, level; + int ind[]; + int e_flg, paren; + static int p_flg[]; + char l_char, p_char; + int a_flg, q_flg, ct; + int s_tabs[][]; + String w_if_, w_else, w_for, w_ds, w_case, w_cpp_comment, w_jdoc; + int jdoc, j; + char string[]; + byte bstring[]; + byte bblank; + char cc; + int s_flg, b_flg; + int peek; + char peekc; + int tabs; + char next_char, last_char; + char lastc0, lastc1; + char c, c0; + char w_kptr; + + String line_feed; + + //static int outfil; // temporary + + + public void init(Editor editor) { + this.editor = editor; + } + + + public String getMenuTitle() { + return "Auto Format"; + } + + public void comment() throws IOException { + int save_s_flg; + save_s_flg = s_flg; + + int done = 0; + c = string[j++] = getchr(); // extra char + while (done == 0) { + c = string[j++] = getchr(); + while ((c != '/') && (j < string.length)) { + if(c == '\n' || c == '\r') { + lineNumber++; + putcoms(); + s_flg = 1; + } + c = string[j++] = getchr(); + } + //String tmpstr = new String(string); + if (j>1 && string[j-2] == '*') { + done = 1; + jdoc = 0; + } + } + + putcoms(); + s_flg = save_s_flg; + jdoc = 0; + return; + } + + + public char get_string() throws IOException { + char ch; + ch = '*'; + while (true) { + switch (ch) { + default: + ch = string[j++] = getchr(); + if (ch == '\\') { + string[j++] = getchr(); + break; + } + if (ch == '\'' || ch == '"') { + cc = string[j++] = getchr(); + while (cc != ch) { + if (cc == '\\') string[j++] = getchr(); + cc = string[j++] = getchr(); + } + break; + } + if (ch == '\n' || ch == '\r') { + indent_puts(); + a_flg = 1; + break; + } else { + return(ch); + } + } + } + } + + + public void indent_puts() { + string[j] = '\0'; + if (j > 0) { + if (s_flg != 0) { + if((tabs > 0) && (string[0] != '{') && (a_flg == 1)) { + tabs++; + } + p_tabs(); + s_flg = 0; + if ((tabs > 0) && (string[0] != '{') && (a_flg == 1)) { + tabs--; + } + a_flg = 0; + } + String j_string = new String(string); + strOut.append(j_string.substring(0,j)); + for (int i=0; i 0) + { + if(s_flg != 0) + { + p_tabs(); + s_flg = 0; + } + string[j] = '\0'; + i = 0; + while (string[i] == ' ') i++; + if (lookup_com(w_jdoc) == 1) jdoc = 1; + String strBuffer = new String(string,0,j); + if (string[i] == '/' && string[i+1]=='*') + { + if ((last_char != ';') && (sav_s_flg==1) ) + { + //fprintf(outfil, strBuffer.substring(i,j)); + fprintf(strBuffer.substring(i,j)); + } + else + { + //fprintf(outfil, strBuffer); + fprintf(strBuffer); + } + } + else + { + if (string[i]=='*' || jdoc == 0) + //fprintf (outfil, " "+strBuffer.substring(i,j)); + fprintf (" "+strBuffer.substring(i,j)); + else + //fprintf (outfil, " * "+strBuffer.substring(i,j)); + fprintf (" * "+strBuffer.substring(i,j)); + } + j = 0; + string[0] = '\0'; + } + } + + public void cpp_comment() throws IOException + { + c = getchr(); + while(c != '\n' && c != '\r' && j<133) + { + string[j++] = c; + c = getchr(); + } + lineNumber++; + indent_puts(); + s_flg = 1; + } + + + /* expand indentValue into tabs and spaces */ + public void p_tabs() + { + int i,k; + + if (tabs<0) tabs = 0; + if (tabs==0) return; + i = tabs * indentValue; // calc number of spaces + //j = i/8; /* calc number of tab chars */ + + for (k=0; k < i; k++) { + strOut.append(indentChar); + } + } + + + public char getchr() throws IOException + { + if((peek < 0) && (last_char != ' ') && (last_char != '\t')) + { + if((last_char != '\n') && (last_char != '\r')) + p_char = last_char; + } + if(peek > 0) /* char was read previously */ + { + last_char = peekc; + peek = -1; + } + else /* read next char in string */ + { + indexBlock++; + if (indexBlock >= lineLength) + { + for (int ib=0; ib 0) + { + nBytesRead = bin.read(bArray); + lineLength = nBytesRead; + strBlock = new String(bArray); + indexBlock = 0; + last_char = strBlock.charAt(indexBlock); + peek = -1; + peekc = '`'; + } + else + { + //System.out.println("eof a"); + EOF = 1; + peekc = '\0'; + } + //} + //catch(IOException ioe) + //{ + //System.out.println(ioe.toString()); + //} + } + else + { + last_char = strBlock.charAt(indexBlock); + } + } + peek = -1; + if (last_char == '\r') + { + last_char = getchr(); + } + + return last_char; + } + + /* else processing */ + public void gotelse() + { + tabs = s_tabs[c_level][if_lev]; + p_flg[level] = sp_flg[c_level][if_lev]; + ind[level] = s_ind[c_level][if_lev]; + if_flg = 1; + } + + /* read to new_line */ + public int getnl() throws IOException + { + int save_s_flg; + save_s_flg = tabs; + peekc = getchr(); + //while ((peekc == '\t' || peekc == ' ') && + // (j < string.length)) { + while (peekc == '\t' || peekc == ' ') { + string[j++] = peekc; + peek = -1; + peekc = '`'; + peekc = getchr(); + peek = 1; + } + peek = 1; + + if (peekc == '/') + { + peek = -1; + peekc = '`'; + peekc = getchr(); + if (peekc == '*') + { + string[j++] = '/'; + string[j++] = '*'; + peek = -1; + peekc = '`'; + comment(); + } + else if (peekc == '/') + { + string[j++] = '/'; + string[j++] = '/'; + peek = -1; + peekc = '`'; + cpp_comment(); + return (1); + } + else + { + string[j++] = '/'; + peek = 1; + } + } + peekc = getchr(); + if(peekc == '\n') + { + lineNumber++; + peek = -1; + peekc = '`'; + tabs = save_s_flg; + return(1); + } + else + { + peek = 1; + } + return 0; + } + + public int lookup (String keyword) + { + char r; + int l,kk; //,k,i; + String j_string = new String(string); + + if (j<1) return (0); + kk=0; + while(string[kk] == ' ')kk++; + l=0; + l = j_string.indexOf(keyword); + if (l<0 || l!=kk) + { + return 0; + } + r = string[kk+keyword.length()]; + if(r >= 'a' && r <= 'z') return(0); + if(r >= 'A' && r <= 'Z') return(0); + if(r >= '0' && r <= '9') return(0); + if(r == '_' || r == '&') return(0); + return (1); + } + + public int lookup_com (String keyword) + { + //char r; + int l,kk; //,k,i; + String j_string = new String(string); + + if (j<1) return (0); + kk=0; + while(string[kk] == ' ')kk++; + l=0; + l = j_string.indexOf(keyword); + if (l<0 || l!=kk) + { + return 0; + } + return (1); + } + + + public void run() { + StringBuffer onechar; + + // Adding an additional newline as a hack around other errors + String originalText = editor.getText() + "\n"; + strOut = new StringBuffer(); + indentValue = Preferences.getInteger("editor.tabs.size"); + indentChar = new String(" "); + + lineNumber = 0; + //BLOCK_MAXLEN = 256; + c_level = if_lev = level = e_flg = paren = 0; + a_flg = q_flg = j = b_flg = tabs = 0; + if_flg = peek = -1; + peekc = '`'; + s_flg = 1; + bblank = ' '; + jdoc = 0; + + s_level = new int[10]; + sp_flg = new int[20][10]; + s_ind = new int[20][10]; + s_if_lev = new int[10]; + s_if_flg = new int[10]; + ind = new int[10]; + p_flg = new int[10]; + s_tabs = new int[20][10]; + + w_else = new String ("else"); + w_if_ = new String ("if"); + w_for = new String ("for"); + w_ds = new String ("default"); + w_case = new String ("case"); + w_cpp_comment = new String ("//"); + w_jdoc = new String ("/**"); + line_feed = new String ("\n"); + + // read as long as there is something to read + EOF = 0; // = 1 set in getchr when EOF + + bArray = new byte[BLOCK_MAXLEN]; + string = new char[BLOCK_MAXLEN]; + try { // the whole process + // open for input + ByteArrayInputStream in = + new ByteArrayInputStream(originalText.getBytes()); + + // add buffering to that InputStream + bin = new BufferedInputStream(in); + + for (int ib = 0; ib < BLOCK_MAXLEN; ib++) bArray[ib] = '\0'; + + lineLength = nBytesRead = 0; + // read up a block - remember how many bytes read + nBytesRead = bin.read(bArray); + strBlock = new String(bArray); + + lineLength = nBytesRead; + lineNumber = 1; + indexBlock = -1; + j = 0; + while (EOF == 0) + { + c = getchr(); + switch(c) + { + default: + string[j++] = c; + if(c != ',') + { + l_char = c; + } + break; + + case ' ': + case '\t': + if(lookup(w_else) == 1) + { + gotelse(); + if(s_flg == 0 || j > 0)string[j++] = c; + indent_puts(); + s_flg = 0; + break; + } + if(s_flg == 0 || j > 0)string[j++] = c; + break; + + case '\r': // for MS Windows 95 + case '\n': + lineNumber++; + if (EOF==1) + { + break; + } + //String j_string = new String(string); + + e_flg = lookup(w_else); + if(e_flg == 1) gotelse(); + if (lookup_com(w_cpp_comment) == 1) + { + if (string[j] == '\n') + { + string[j] = '\0'; + j--; + } + } + + indent_puts(); + //fprintf(outfil, line_feed); + fprintf(line_feed); + s_flg = 1; + if(e_flg == 1) + { + p_flg[level]++; + tabs++; + } + else + if(p_char == l_char) + { + a_flg = 1; + } + break; + + case '{': + if(lookup(w_else) == 1)gotelse(); + s_if_lev[c_level] = if_lev; + s_if_flg[c_level] = if_flg; + if_lev = if_flg = 0; + c_level++; + if(s_flg == 1 && p_flg[level] != 0) + { + p_flg[level]--; + tabs--; + } + string[j++] = c; + indent_puts(); + getnl() ; + indent_puts(); + //fprintf(outfil,"\n"); + fprintf("\n"); + tabs++; + s_flg = 1; + if(p_flg[level] > 0) + { + ind[level] = 1; + level++; + s_level[level] = c_level; + } + break; + + case '}': + c_level--; + if (c_level < 0) + { + EOF = 1; + //System.out.println("eof b"); + string[j++] = c; + indent_puts(); + break; + } + if ((if_lev = s_if_lev[c_level]-1) < 0) + if_lev = 0; + if_flg = s_if_flg[c_level]; + indent_puts(); + tabs--; + p_tabs(); + peekc = getchr(); + if( peekc == ';') + { + onechar = new StringBuffer(); + onechar.append(c); // the } + onechar.append(';'); + //fprintf(outfil, onechar.toString()); + fprintf(onechar.toString()); + peek = -1; + peekc = '`'; + } + else + { + onechar = new StringBuffer(); + onechar.append(c); + //fprintf(outfil, onechar.toString()); + fprintf(onechar.toString()); + peek = 1; + } + getnl(); + indent_puts(); + //fprintf(outfil,"\n"); + fprintf("\n"); + s_flg = 1; + if(c_level < s_level[level]) + if(level > 0) level--; + if(ind[level] != 0) + { + tabs -= p_flg[level]; + p_flg[level] = 0; + ind[level] = 0; + } + break; + + case '"': + case '\'': + string[j++] = c; + cc = getchr(); + while(cc != c) + { + // max. length of line should be 256 + string[j++] = cc; + + if(cc == '\\') + { + cc = string[j++] = getchr(); + } + if(cc == '\n') + { + lineNumber++; + indent_puts(); + s_flg = 1; + } + cc = getchr(); + + } + string[j++] = cc; + if(getnl() == 1) + { + l_char = cc; + peek = 1; + peekc = '\n'; + } + break; + + case ';': + string[j++] = c; + indent_puts(); + if(p_flg[level] > 0 && ind[level] == 0) + { + tabs -= p_flg[level]; + p_flg[level] = 0; + } + getnl(); + indent_puts(); + //fprintf(outfil,"\n"); + fprintf("\n"); + s_flg = 1; + if(if_lev > 0) + if(if_flg == 1) + { + if_lev--; + if_flg = 0; + } + else if_lev = 0; + break; + + case '\\': + string[j++] = c; + string[j++] = getchr(); + break; + + case '?': + q_flg = 1; + string[j++] = c; + break; + + case ':': + string[j++] = c; + peekc = getchr(); + if(peekc == ':') + { + indent_puts(); + //fprintf (outfil,":"); + fprintf(":"); + peek = -1; + peekc = '`'; + break; + } + else + { + //int double_colon = 0; + peek = 1; + } + + if(q_flg == 1) + { + q_flg = 0; + break; + } + if(lookup(w_ds) == 0 && lookup(w_case) == 0) + { + s_flg = 0; + indent_puts(); + } + else + { + tabs--; + indent_puts(); + tabs++; + } + peekc = getchr(); + if(peekc == ';') + { + //fprintf(outfil,";"); + fprintf(";"); + peek = -1; + peekc = '`'; + } + else + { + peek = 1; + } + getnl(); + indent_puts(); + //fprintf(outfil,"\n"); + fprintf("\n"); + s_flg = 1; + break; + + case '/': + c0 = string[j]; + string[j++] = c; + peekc = getchr(); + + if(peekc == '/') + { + string[j++] = peekc; + peekc = '`'; + peek = -1; + cpp_comment(); + //fprintf(outfil,"\n"); + fprintf("\n"); + break; + } + else + { + peek = 1; + } + + if(peekc != '*') { + break; + } + else + { + if (j > 0) string[j--] = '\0'; + if (j > 0) indent_puts(); + string[j++] = '/'; + string[j++] = '*'; + peek = -1; + peekc = '`'; + comment(); + break; + } + + case '#': + string[j++] = c; + cc = getchr(); + while(cc != '\n') + { + string[j++] = cc; + cc = getchr(); + } + string[j++] = cc; + s_flg = 0; + indent_puts(); + s_flg = 1; + break; + + case ')': + paren--; + if (paren < 0) + { + EOF = 1; + //System.out.println("eof c"); + } + string[j++] = c; + indent_puts(); + if(getnl() == 1) + { + peekc = '\n'; + peek = 1; + if(paren != 0) + { + a_flg = 1; + } + else if(tabs > 0) + { + p_flg[level]++; + tabs++; + ind[level] = 0; + } + } + break; + + case '(': + string[j++] = c; + paren++; + if ((lookup(w_for) == 1)) + { + c = get_string(); + while(c != ';') c = get_string(); + ct=0; + int for_done = 0; + while (for_done==0) + { + c = get_string(); + while(c != ')') + { + if(c == '(') ct++; + c = get_string(); + } + if(ct != 0) + { + ct--; + } + else for_done = 1; + } // endwhile for_done + paren--; + if (paren < 0) + { + EOF = 1; + //System.out.println("eof d"); + } + indent_puts(); + if(getnl() == 1) + { + peekc = '\n'; + peek = 1; + p_flg[level]++; + tabs++; + ind[level] = 0; + } + break; + } + + if(lookup(w_if_) == 1) + { + indent_puts(); + s_tabs[c_level][if_lev] = tabs; + sp_flg[c_level][if_lev] = p_flg[level]; + s_ind[c_level][if_lev] = ind[level]; + if_lev++; + if_flg = 1; + } + } // end switch + + //System.out.println("string len is " + string.length); + //if (EOF == 1) System.out.println(string); + //String j_string = new String(string); + + } // end while not EOF + + /* + int bad; + while ((bad = bin.read()) != -1) { + System.out.print((char) bad); + } + */ + /* + char bad; + //while ((bad = getchr()) != 0) { + while (true) { + getchr(); + if (peek != -1) { + System.out.print(last_char); + } else { + break; + } + } + */ + + // save current (rough) selection point + int selectionEnd = editor.getSelectionStop(); + + // make sure the caret would be past the end of the text + if (strOut.length() < selectionEnd - 1) { + selectionEnd = strOut.length() - 1; + } + + bin.close(); // close buff + + String formattedText = strOut.toString(); + if (formattedText.equals(originalText)) { + editor.statusNotice("No changes necessary for Auto Format."); + + } else if (paren != 0) { + // warn user if there are too many parens in either direction + editor.statusError("Auto Format Canceled: Too many " + + ((paren < 0) ? "right" : "left") + + " parentheses."); + + } else if (c_level != 0) { // check braces only if parens are ok + editor.statusError("Auto Format Canceled: Too many " + + ((c_level < 0) ? "right" : "left") + + " curly braces."); + + } else { + // replace with new bootiful text + // selectionEnd hopefully at least in the neighborhood + editor.setText(formattedText); + editor.setSelection(selectionEnd, selectionEnd); + editor.getSketch().setModified(true); + // mark as finished + editor.statusNotice("Auto Format finished."); + } + + } catch (Exception e) { + editor.statusError(e); + } + } +} diff --git a/app/src/processing/app/tools/ColorSelector.java b/app/src/processing/app/tools/ColorSelector.java new file mode 100644 index 000000000..d4843d18a --- /dev/null +++ b/app/src/processing/app/tools/ColorSelector.java @@ -0,0 +1,596 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2006-08 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import processing.app.*; +import processing.core.*; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import javax.swing.text.*; + + +/** + * Color selector tool for the Tools menu. + *

+ * Using the keyboard shortcuts, you can copy/paste the values for the + * colors and paste them into your program. We didn't do any sort of + * auto-insert of colorMode() or fill() or stroke() code cuz we couldn't + * decide on a good way to do this.. your contributions welcome). + */ +public class ColorSelector implements Tool, DocumentListener { + + Editor editor; + JFrame frame; + + int hue, saturation, brightness; // range 360, 100, 100 + int red, green, blue; // range 256, 256, 256 + + ColorRange range; + ColorSlider slider; + + JTextField hueField, saturationField, brightnessField; + JTextField redField, greenField, blueField; + + JTextField hexField; + + JPanel colorPanel; + + + public String getMenuTitle() { + return "Color Selector"; + } + + + public void init(Editor editor) { + this.editor = editor; + + frame = new JFrame("Color Selector"); + frame.getContentPane().setLayout(new BorderLayout()); + + Box box = Box.createHorizontalBox(); + box.setBorder(new EmptyBorder(12, 12, 12, 12)); + + range = new ColorRange(); + range.init(); + Box rangeBox = new Box(BoxLayout.Y_AXIS); + rangeBox.setAlignmentY(0); + rangeBox.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); + rangeBox.add(range); + box.add(rangeBox); + box.add(Box.createHorizontalStrut(10)); + + slider = new ColorSlider(); + slider.init(); + Box sliderBox = new Box(BoxLayout.Y_AXIS); + sliderBox.setAlignmentY(0); + sliderBox.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); + sliderBox.add(slider); + box.add(sliderBox); + box.add(Box.createHorizontalStrut(10)); + + box.add(createColorFields()); + box.add(Box.createHorizontalStrut(10)); + + frame.getContentPane().add(box, BorderLayout.CENTER); + frame.pack(); + frame.setResizable(false); + + // these don't help either.. they fix the component size but + // leave a gap where the component is located + //range.setSize(256, 256); + //slider.setSize(256, 20); + + Dimension size = frame.getSize(); + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + frame.setLocation((screen.width - size.width) / 2, + (screen.height - size.height) / 2); + + frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + frame.setVisible(false); + } + }); + Base.registerWindowCloseKeys(frame.getRootPane(), new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + frame.setVisible(false); + } + }); + Base.setIcon(frame); + + hueField.getDocument().addDocumentListener(this); + saturationField.getDocument().addDocumentListener(this); + brightnessField.getDocument().addDocumentListener(this); + redField.getDocument().addDocumentListener(this); + greenField.getDocument().addDocumentListener(this); + blueField.getDocument().addDocumentListener(this); + hexField.getDocument().addDocumentListener(this); + + hexField.setText("FFFFFF"); + } + + + public void run() { + frame.setVisible(true); + // You've got to be f--ing kidding me.. why did the following line + // get deprecated for the pile of s-- that follows it? + //frame.setCursor(Cursor.CROSSHAIR_CURSOR); + frame.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); + } + + + public void changedUpdate(DocumentEvent e) { + //System.out.println("changed"); + } + + public void removeUpdate(DocumentEvent e) { + //System.out.println("remove"); + } + + + boolean updating; + + public void insertUpdate(DocumentEvent e) { + if (updating) return; // don't update forever recursively + updating = true; + + Document doc = e.getDocument(); + if (doc == hueField.getDocument()) { + hue = bounded(hue, hueField, 359); + updateRGB(); + updateHex(); + + } else if (doc == saturationField.getDocument()) { + saturation = bounded(saturation, saturationField, 99); + updateRGB(); + updateHex(); + + } else if (doc == brightnessField.getDocument()) { + brightness = bounded(brightness, brightnessField, 99); + updateRGB(); + updateHex(); + + } else if (doc == redField.getDocument()) { + red = bounded(red, redField, 255); + updateHSB(); + updateHex(); + + } else if (doc == greenField.getDocument()) { + green = bounded(green, greenField, 255); + updateHSB(); + updateHex(); + + } else if (doc == blueField.getDocument()) { + blue = bounded(blue, blueField, 255); + updateHSB(); + updateHex(); + + } else if (doc == hexField.getDocument()) { + String str = hexField.getText(); + while (str.length() < 6) { + str += "0"; + } + if (str.length() > 6) { + str = str.substring(0, 6); + } + updateRGB2(Integer.parseInt(str, 16)); + updateHSB(); + } + range.redraw(); + slider.redraw(); + colorPanel.repaint(); + updating = false; + } + + + /** + * Set the RGB values based on the current HSB values. + */ + protected void updateRGB() { + int rgb = Color.HSBtoRGB((float)hue / 359f, + (float)saturation / 99f, + (float)brightness / 99f); + updateRGB2(rgb); + } + + + /** + * Set the RGB values based on a calculated ARGB int. + * Used by both updateRGB() to set the color from the HSB values, + * and by updateHex(), to unpack the hex colors and assign them. + */ + protected void updateRGB2(int rgb) { + red = (rgb >> 16) & 0xff; + green = (rgb >> 8) & 0xff; + blue = rgb & 0xff; + + redField.setText(String.valueOf(red)); + greenField.setText(String.valueOf(green)); + blueField.setText(String.valueOf(blue)); + } + + + /** + * Set the HSB values based on the current RGB values. + */ + protected void updateHSB() { + float hsb[] = new float[3]; + Color.RGBtoHSB(red, green, blue, hsb); + + hue = (int) (hsb[0] * 359.0f); + saturation = (int) (hsb[1] * 99.0f); + brightness = (int) (hsb[2] * 99.0f); + + hueField.setText(String.valueOf(hue)); + saturationField.setText(String.valueOf(saturation)); + brightnessField.setText(String.valueOf(brightness)); + } + + + protected void updateHex() { + hexField.setText(PApplet.hex(red, 2) + + PApplet.hex(green, 2) + + PApplet.hex(blue, 2)); + } + + + /** + * Get the bounded value for a specific range. If the value is outside + * the max, you can't edit right away, so just act as if it's already + * been bounded and return the bounded value, then fire an event to set + * it to the value that was just returned. + */ + protected int bounded(int current, final JTextField field, final int max) { + String text = field.getText(); + if (text.length() == 0) { + return 0; + } + try { + int value = Integer.parseInt(text); + if (value > max) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + field.setText(String.valueOf(max)); + } + }); + return max; + } + return value; + + } catch (NumberFormatException e) { + return current; // should not be reachable + } + } + + + protected Container createColorFields() { + Box box = Box.createVerticalBox(); + box.setAlignmentY(0); + + colorPanel = new JPanel() { + public void paintComponent(Graphics g) { + g.setColor(new Color(red, green, blue)); + Dimension size = getSize(); + g.fillRect(0, 0, size.width, size.height); + } + }; + colorPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); + Dimension dim = new Dimension(60, 40); + colorPanel.setMinimumSize(dim); + //colorPanel.setMaximumSize(dim); + //colorPanel.setPreferredSize(dim); + box.add(colorPanel); + box.add(Box.createVerticalStrut(10)); + + Box row; + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("H:")); + row.add(hueField = new NumberField(4, false)); + row.add(new JLabel(" \u00B0")); // degree symbol + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(5)); + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("S:")); + row.add(saturationField = new NumberField(4, false)); + row.add(new JLabel(" %")); + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(5)); + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("B:")); + row.add(brightnessField = new NumberField(4, false)); + row.add(new JLabel(" %")); + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(10)); + + // + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("R:")); + row.add(redField = new NumberField(4, false)); + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(5)); + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("G:")); + row.add(greenField = new NumberField(4, false)); + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(5)); + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("B:")); + row.add(blueField = new NumberField(4, false)); + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(10)); + + // + + row = Box.createHorizontalBox(); + row.add(createFixedLabel("#")); + row.add(hexField = new NumberField(5, true)); + row.add(Box.createHorizontalGlue()); + box.add(row); + box.add(Box.createVerticalStrut(10)); + + box.add(Box.createVerticalGlue()); + return box; + } + + + int labelH; + + /** + * return a label of a fixed width + */ + protected JLabel createFixedLabel(String title) { + JLabel label = new JLabel(title); + if (labelH == 0) { + labelH = label.getPreferredSize().height; + } + Dimension dim = new Dimension(20, labelH); + label.setPreferredSize(dim); + label.setMinimumSize(dim); + label.setMaximumSize(dim); + return label; + } + + + public class ColorRange extends PApplet { + + static final int WIDE = 256; + static final int HIGH = 256; + + int lastX, lastY; + + + public void setup() { + size(WIDE, HIGH, P3D); + noLoop(); + + colorMode(HSB, 360, 256, 256); + noFill(); + rectMode(CENTER); + } + + public void draw() { + if ((g == null) || (g.pixels == null)) return; + if ((width != WIDE) || (height < HIGH)) { + //System.out.println("bad size " + width + " " + height); + return; + } + + int index = 0; + for (int j = 0; j < 256; j++) { + for (int i = 0; i < 256; i++) { + g.pixels[index++] = color(hue, i, 255 - j); + } + } + + stroke((brightness > 50) ? 0 : 255); + rect(lastX, lastY, 9, 9); + } + + public void mousePressed() { + updateMouse(); + } + + public void mouseDragged() { + updateMouse(); + } + + public void updateMouse() { + if ((mouseX >= 0) && (mouseX < 256) && + (mouseY >= 0) && (mouseY < 256)) { + int nsaturation = (int) (100 * (mouseX / 255.0f)); + int nbrightness = 100 - ((int) (100 * (mouseY / 255.0f))); + saturationField.setText(String.valueOf(nsaturation)); + brightnessField.setText(String.valueOf(nbrightness)); + + lastX = mouseX; + lastY = mouseY; + } + } + + public Dimension getPreferredSize() { + //System.out.println("getting pref " + WIDE + " " + HIGH); + return new Dimension(WIDE, HIGH); + } + + public Dimension getMinimumSize() { + //System.out.println("getting min " + WIDE + " " + HIGH); + return new Dimension(WIDE, HIGH); + } + + public Dimension getMaximumSize() { + //System.out.println("getting max " + WIDE + " " + HIGH); + return new Dimension(WIDE, HIGH); + } + } + + + public class ColorSlider extends PApplet { + + static final int WIDE = 20; + static final int HIGH = 256; + + public void setup() { + size(WIDE, HIGH, P3D); + colorMode(HSB, 255, 100, 100); + noLoop(); + } + + public void draw() { + if ((g == null) || (g.pixels == null)) return; + if ((width != WIDE) || (height < HIGH)) { + //System.out.println("bad size " + width + " " + height); + return; + } + + int index = 0; + int sel = 255 - (int) (255 * (hue / 359f)); + for (int j = 0; j < 256; j++) { + int c = color(255 - j, 100, 100); + if (j == sel) c = 0xFF000000; + for (int i = 0; i < WIDE; i++) { + g.pixels[index++] = c; + } + } + } + + public void mousePressed() { + updateMouse(); + } + + public void mouseDragged() { + updateMouse(); + } + + public void updateMouse() { + if ((mouseX >= 0) && (mouseX < 256) && + (mouseY >= 0) && (mouseY < 256)) { + int nhue = 359 - (int) (359 * (mouseY / 255.0f)); + hueField.setText(String.valueOf(nhue)); + } + } + + public Dimension getPreferredSize() { + //System.out.println("s getting pref " + WIDE + " " + HIGH); + return new Dimension(WIDE, HIGH); + } + + public Dimension getMinimumSize() { + //System.out.println("s getting min " + WIDE + " " + HIGH); + return new Dimension(WIDE, HIGH); + } + + public Dimension getMaximumSize() { + //System.out.println("s getting max " + WIDE + " " + HIGH); + return new Dimension(WIDE, HIGH); + } + } + + + /** + * Extension of JTextField that only allows numbers + */ + class NumberField extends JTextField { + + public boolean allowHex; + + public NumberField(int cols, boolean allowHex) { + super(cols); + this.allowHex = allowHex; + } + + protected Document createDefaultModel() { + return new NumberDocument(this); + } + + public Dimension getPreferredSize() { + if (!allowHex) { + return new Dimension(35, super.getPreferredSize().height); + } + return super.getPreferredSize(); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public Dimension getMaximumSize() { + return getPreferredSize(); + } + } + + + /** + * Document model to go with JTextField that only allows numbers. + */ + class NumberDocument extends PlainDocument { + + NumberField parentField; + + public NumberDocument(NumberField parentField) { + this.parentField = parentField; + //System.out.println("setting parent to " + parentSelector); + } + + public void insertString(int offs, String str, AttributeSet a) + throws BadLocationException { + + if (str == null) return; + + char chars[] = str.toCharArray(); + int charCount = 0; + // remove any non-digit chars + for (int i = 0; i < chars.length; i++) { + boolean ok = Character.isDigit(chars[i]); + if (parentField.allowHex) { + if ((chars[i] >= 'A') && (chars[i] <= 'F')) ok = true; + if ((chars[i] >= 'a') && (chars[i] <= 'f')) ok = true; + } + if (ok) { + if (charCount != i) { // shift if necessary + chars[charCount] = chars[i]; + } + charCount++; + } + } + super.insertString(offs, new String(chars, 0, charCount), a); + // can't call any sort of methods on the enclosing class here + // seems to have something to do with how Document objects are set up + } + } +} diff --git a/app/src/processing/app/tools/CreateFont.java b/app/src/processing/app/tools/CreateFont.java new file mode 100644 index 000000000..663798985 --- /dev/null +++ b/app/src/processing/app/tools/CreateFont.java @@ -0,0 +1,345 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-06 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import processing.app.*; +import processing.core.*; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; + +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; + + +/** + * gui interface to font creation heaven/hell. + */ +public class CreateFont extends JFrame implements Tool { + Editor editor; + //Sketch sketch; + + Dimension windowSize; + + JList fontSelector; + //JComboBox styleSelector; + JTextField sizeSelector; + JCheckBox allBox; + JCheckBox smoothBox; + JTextArea sample; + JButton okButton; + JTextField filenameField; + + Hashtable table; + boolean smooth = true; + boolean all = false; + + Font font; + + String[] list; + int selection = -1; + + + //static { + //System.out.println("yep yep yep"); + //} + //static final String styles[] = { + //"Plain", "Bold", "Italic", "Bold Italic" + //}; + + + public CreateFont() { + super("Create Font"); + } + + + public String getMenuTitle() { + return "Create Font..."; + } + + + public void init(Editor editor) { + this.editor = editor; + + Container paine = getContentPane(); + paine.setLayout(new BorderLayout()); //10, 10)); + + JPanel pain = new JPanel(); + pain.setBorder(new EmptyBorder(13, 13, 13, 13)); + paine.add(pain, BorderLayout.CENTER); + + pain.setLayout(new BoxLayout(pain, BoxLayout.Y_AXIS)); + + String labelText = + "Use this tool to create bitmap fonts for your program.\n" + + "Select a font and size, and click 'OK' to generate the font.\n" + + "It will be added to the data folder of the current sketch."; + + JTextArea textarea = new JTextArea(labelText); + textarea.setBorder(new EmptyBorder(10, 10, 20, 10)); + textarea.setBackground(null); + textarea.setEditable(false); + textarea.setHighlighter(null); + textarea.setFont(new Font("Dialog", Font.PLAIN, 12)); + pain.add(textarea); + + // don't care about families starting with . or # + // also ignore dialog, dialoginput, monospaced, serif, sansserif + + // getFontList is deprecated in 1.4, so this has to be used + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + + Font fonts[] = ge.getAllFonts(); + + String flist[] = new String[fonts.length]; + table = new Hashtable(); + + int index = 0; + for (int i = 0; i < fonts.length; i++) { + //String psname = fonts[i].getPSName(); + //if (psname == null) System.err.println("ps name is null"); + + flist[index++] = fonts[i].getPSName(); + table.put(fonts[i].getPSName(), fonts[i]); + } + + list = new String[index]; + System.arraycopy(flist, 0, list, 0, index); + + fontSelector = new JList(list); + fontSelector.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (e.getValueIsAdjusting() == false) { + selection = fontSelector.getSelectedIndex(); + okButton.setEnabled(true); + update(); + } + } + }); + + fontSelector.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + fontSelector.setVisibleRowCount(12); + JScrollPane fontScroller = new JScrollPane(fontSelector); + pain.add(fontScroller); + + Dimension d1 = new Dimension(13, 13); + pain.add(new Box.Filler(d1, d1, d1)); + + // see http://rinkworks.com/words/pangrams.shtml + sample = new JTextArea("The quick brown fox blah blah.") { + // Forsaking monastic tradition, twelve jovial friars gave up their + // vocation for a questionable existence on the flying trapeze. + public void paintComponent(Graphics g) { + //System.out.println("disabling aa"); + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + smooth ? + RenderingHints.VALUE_TEXT_ANTIALIAS_ON : + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + super.paintComponent(g2); + } + }; + // Seems that in some instances, no default font is set + // http://dev.processing.org/bugs/show_bug.cgi?id=777 + sample.setFont(new Font("Dialog", Font.PLAIN, 12)); + + pain.add(sample); + + Dimension d2 = new Dimension(6, 6); + pain.add(new Box.Filler(d2, d2, d2)); + + JPanel panel = new JPanel(); + panel.add(new JLabel("Size:")); + sizeSelector = new JTextField(" 48 "); + sizeSelector.getDocument().addDocumentListener(new DocumentListener() { + public void insertUpdate(DocumentEvent e) { update(); } + public void removeUpdate(DocumentEvent e) { update(); } + public void changedUpdate(DocumentEvent e) { } + }); + panel.add(sizeSelector); + + smoothBox = new JCheckBox("Smooth"); + smoothBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + smooth = smoothBox.isSelected(); + update(); + } + }); + smoothBox.setSelected(smooth); + panel.add(smoothBox); + + allBox = new JCheckBox("All Characters"); + allBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + all = allBox.isSelected(); + } + }); + allBox.setSelected(all); + panel.add(allBox); + + pain.add(panel); + + JPanel filestuff = new JPanel(); + filestuff.add(new JLabel("Filename:")); + filestuff.add(filenameField = new JTextField(20)); + filestuff.add(new JLabel(".vlw")); + pain.add(filestuff); + + JPanel buttons = new JPanel(); + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + build(); + } + }); + okButton.setEnabled(false); + + buttons.add(cancelButton); + buttons.add(okButton); + pain.add(buttons); + + JRootPane root = getRootPane(); + root.setDefaultButton(okButton); + ActionListener disposer = new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + setVisible(false); + } + }; + Base.registerWindowCloseKeys(root, disposer); + Base.setIcon(this); + + pack(); + + // do this after pack so it doesn't affect layout + sample.setFont(new Font(list[0], Font.PLAIN, 48)); + + fontSelector.setSelectedIndex(0); + + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + windowSize = getSize(); + + setLocation((screen.width - windowSize.width) / 2, + (screen.height - windowSize.height) / 2); + } + + + public void run() { + setVisible(true); + } + + + /** + * make the window vertically resizable + */ + public Dimension getMaximumSize() { + return new Dimension(windowSize.width, 2000); + } + + public Dimension getMinimumSize() { + return windowSize; + } + + + /* + public void show(File targetFolder) { + this.targetFolder = targetFolder; + show(); + } + */ + + + public void update() { + int fontsize = 0; + try { + fontsize = Integer.parseInt(sizeSelector.getText().trim()); + //System.out.println("'" + sizeSelector.getText() + "'"); + } catch (NumberFormatException e2) { } + + // if a deselect occurred, selection will be -1 + if ((fontsize > 0) && (fontsize < 256) && (selection != -1)) { + //font = new Font(list[selection], Font.PLAIN, fontsize); + Font instance = (Font) table.get(list[selection]); + font = instance.deriveFont(Font.PLAIN, fontsize); + //System.out.println("setting font to " + font); + sample.setFont(font); + + String filenameSuggestion = list[selection].replace(' ', '_'); + filenameSuggestion += "-" + fontsize; + filenameField.setText(filenameSuggestion); + } + } + + + public void build() { + int fontsize = 0; + try { + fontsize = Integer.parseInt(sizeSelector.getText().trim()); + } catch (NumberFormatException e) { } + + if (fontsize <= 0) { + JOptionPane.showMessageDialog(this, "Bad font size, try again.", + "Badness", JOptionPane.WARNING_MESSAGE); + return; + } + + String filename = filenameField.getText(); + if (filename.length() == 0) { + JOptionPane.showMessageDialog(this, "Enter a file name for the font.", + "Lameness", JOptionPane.WARNING_MESSAGE); + return; + } + if (!filename.endsWith(".vlw")) { + filename += ".vlw"; + } + + try { + Font instance = (Font) table.get(list[selection]); + font = instance.deriveFont(Font.PLAIN, fontsize); + PFont f = new PFont(font, smooth, all ? null : PFont.DEFAULT_CHARSET); + + // make sure the 'data' folder exists + File folder = editor.getSketch().prepareDataFolder(); + f.save(new FileOutputStream(new File(folder, filename))); + + } catch (IOException e) { + JOptionPane.showMessageDialog(this, + "An error occurred while creating font.", + "No font for you", + JOptionPane.WARNING_MESSAGE); + e.printStackTrace(); + } + + setVisible(false); + } +} diff --git a/app/src/processing/app/tools/DiscourseFormat.java b/app/src/processing/app/tools/DiscourseFormat.java new file mode 100644 index 000000000..5de4c0074 --- /dev/null +++ b/app/src/processing/app/tools/DiscourseFormat.java @@ -0,0 +1,225 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-06 Ignacio Manuel Gonzalez Moreta. + Copyright (c) 2006-08 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import java.awt.*; +import java.awt.datatransfer.*; +import javax.swing.text.Segment; + +import processing.app.*; +import processing.app.syntax.*; +import processing.core.PApplet; + +/** + * Format for Discourse Tool + *

+ * Original code by owd. + * Revised and updated for revision 0108 by Ben Fry (10 March 2006). + * This code may later be moved to its own 'Tool' plugin, but is included + * with release 0108+ while features for the "Tools" menu are in testing. + *

+ * Updated for 0122 to simply copy the code directly to the clipboard, + * rather than opening a new window. + *

+ * Updated for 0144 to only format the selected lines. + *

+ * Notes from the original source: + * Discourse.java This is a dirty-mix source. + * NOTE that: No macs and no keyboard. Unreliable source. + * Only format processing code using fontMetrics. + * It works under my windows XP + PentiumIV + Processing 0091. + */ +public class DiscourseFormat { + + Editor editor; + // JTextArea of the actual Editor + JEditTextArea textarea; + + + /** + * Creates a new window with the formated (YaBB tags) sketchcode + * from the actual Processing Tab ready to send to the processing discourse + * web (copy & paste) + */ + public DiscourseFormat(Editor editor) { + this.editor = editor; + this.textarea = editor.getTextArea(); + } + + + /** + * Format and render sketch code. + */ + public void show() { + // [code] tag cancels other tags, using [quote] + StringBuffer cf = new StringBuffer("[quote]\n"); + + int selStart = textarea.getSelectionStart(); + int selStop = textarea.getSelectionStop(); + + int startLine = textarea.getSelectionStartLine(); + int stopLine = textarea.getSelectionStopLine(); + + // If no selection, convert all the lines + if (selStart == selStop) { + startLine = 0; + stopLine = textarea.getLineCount() - 1; + } else { + // Make sure the selection doesn't end at the beginning of the last line + if (textarea.getLineStartOffset(stopLine) == selStop) { + stopLine--; + } + } + + // Read the code line by line + for (int i = startLine; i <= stopLine; i++) { + appendFormattedLine(cf, i); + } + + cf.append("\n[/quote]"); + + StringSelection formatted = new StringSelection(cf.toString()); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(formatted, new ClipboardOwner() { + public void lostOwnership(Clipboard clipboard, Transferable contents) { + // i don't care about ownership + } + }); + + editor.statusNotice("Code formatted for processing.org/discourse " + + "has been copied to the clipboard."); + } + + + // A terrible headache... + public void appendFormattedLine(StringBuffer cf, int line) { + Segment segment = new Segment(); + + TextAreaPainter painter = textarea.getPainter(); + TokenMarker tokenMarker = textarea.getTokenMarker(); + + // Use painter's cached info for speed +// FontMetrics fm = painter.getFontMetrics(); + + // get line text from parent text area + textarea.getLineText(line, segment); + + char[] segmentArray = segment.array; + int limit = segment.getEndIndex(); + int segmentOffset = segment.offset; + int segmentCount = segment.count; +// int width = 0; + + // If syntax coloring is disabled, do simple translation + if (tokenMarker == null) { + for (int j = 0; j < segmentCount; j++) { + char c = segmentArray[j + segmentOffset]; + cf = cf.append(c); +// int charWidth; +// if (c == '\t') { +// charWidth = (int) painter.nextTabStop(width, j) - width; +// } else { +// charWidth = fm.charWidth(c); +// } +// width += charWidth; + } + + } else { + // If syntax coloring is enabled, we have to do this + // because tokens can vary in width + Token tokens; + if ((painter.getCurrentLineIndex() == line) && + (painter.getCurrentLineTokens() != null)) { + tokens = painter.getCurrentLineTokens(); + + } else { + painter.setCurrentLineIndex(line); + painter.setCurrentLineTokens(tokenMarker.markTokens(segment, line)); + tokens = painter.getCurrentLineTokens(); + } + + int offset = 0; +// Font defaultFont = painter.getFont(); + SyntaxStyle[] styles = painter.getStyles(); + + for (;;) { + byte id = tokens.id; + if (id == Token.END) { + char c = segmentArray[segmentOffset + offset]; + if (segmentOffset + offset < limit) { + cf.append(c); + } else { + cf.append('\n'); + } + return; // cf.toString(); + } + if (id == Token.NULL) { +// fm = painter.getFontMetrics(); + } else { + // Place open tags [] + cf.append("[color=#"); + cf.append(PApplet.hex(styles[id].getColor().getRGB() & 0xFFFFFF, 6)); + cf.append("]"); + + if (styles[id].isBold()) + cf.append("[b]"); + +// fm = styles[id].getFontMetrics(defaultFont); + } + int length = tokens.length; + + for (int j = 0; j < length; j++) { + char c = segmentArray[segmentOffset + offset + j]; + if (offset == 0 && c == ' ') { + // Works on Safari but not Camino 1.6.3 or Firefox 2.x on OS X. + cf.append('\u00A0'); //   +// if ((j % 2) == 1) { +// cf.append("[b]\u00A0[/b]"); +// } else { +// cf.append(' '); +// } + } else { + cf.append(c); + } + // Place close tags [/] + if (j == (length - 1) && id != Token.NULL && styles[id].isBold()) + cf.append("[/b]"); + if (j == (length - 1) && id != Token.NULL) + cf.append("[/color]"); +// int charWidth; +// if (c == '\t') { +// charWidth = (int) painter +// .nextTabStop(width, offset + j) +// - width; +// } else { +// charWidth = fm.charWidth(c); +// } +// width += charWidth; + } + offset += length; + tokens = tokens.next; + } + } + } +} \ No newline at end of file diff --git a/app/src/processing/app/tools/FixEncoding.java b/app/src/processing/app/tools/FixEncoding.java new file mode 100644 index 000000000..ecdfc6df9 --- /dev/null +++ b/app/src/processing/app/tools/FixEncoding.java @@ -0,0 +1,99 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import javax.swing.JOptionPane; + +import processing.app.*; + + +public class FixEncoding implements Tool { + Editor editor; + + + public String getMenuTitle() { + return "Fix Encoding & Reload"; + } + + + public void init(Editor editor) { + this.editor = editor; + } + + + public void run() { + Sketch sketch = editor.getSketch(); + //SketchCode code = sketch.current; + + if (sketch.isModified()) { + int result = + JOptionPane.showConfirmDialog(editor, + "Discard all changes and reload sketch?", + "Fix Encoding & Reload", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + + if (result == JOptionPane.NO_OPTION) { + return; + } + } + try { + for (int i = 0; i < sketch.getCodeCount(); i++) { + SketchCode code = sketch.getCode(i); + code.setProgram(loadWithLocalEncoding(code.getFile())); + code.setModified(true); // yes, because we want them to save this + } + // Update the currently visible program with its code + editor.setText(sketch.getCurrentCode().getProgram()); + + } catch (IOException e) { + String msg = + "An error occurred while trying to fix the file encoding.\n" + + "Do not attempt to save this sketch as it may overwrite\n" + + "the old version. Use Open to re-open the sketch and try again.\n" + + e.getMessage(); + Base.showWarning("Fix Encoding & Reload", msg, e); + } + } + + + protected String loadWithLocalEncoding(File file) throws IOException { + // FileReader uses the default encoding, which is what we want. + FileReader fr = new FileReader(file); + BufferedReader reader = new BufferedReader(fr); + + StringBuffer buffer = new StringBuffer(); + String line = null; + while ((line = reader.readLine()) != null) { + buffer.append(line); + buffer.append('\n'); + } + reader.close(); + return buffer.toString(); + } +} \ No newline at end of file diff --git a/app/src/processing/app/tools/Tool.java b/app/src/processing/app/tools/Tool.java new file mode 100644 index 000000000..7278452e0 --- /dev/null +++ b/app/src/processing/app/tools/Tool.java @@ -0,0 +1,44 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Tool - interface implementation for the Processing tools menu + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import processing.app.Editor; + + +/** + * Interface for items to be shown in the Tools menu. + */ +public interface Tool extends Runnable { + + public void init(Editor editor); + + public void run(); + + // Not doing shortcuts for now, no way to resolve between tools. + // Also would need additional modifiers for shift and alt. + //public char getShortcutKey(); + + public String getMenuTitle(); +} + diff --git a/app/src/processing/app/tools/format/src/AutoFormat.java b/app/src/processing/app/tools/format/src/AutoFormat.java new file mode 100644 index 000000000..e047e9371 --- /dev/null +++ b/app/src/processing/app/tools/format/src/AutoFormat.java @@ -0,0 +1,159 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2006 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.tools; + +import processing.app.*; +import processing.core.*; + +import java.io.*; + + +/** + * Tool for auto-formatting code that interfaces to + * Jalopy. This is to replace + * the buggy code formatter found in previous releases. + */ +public class AutoFormat { + Editor editor; + + + public AutoFormat(Editor editor) { + this.editor = editor; + } + + + public void show() { + String originalText = editor.textarea.getText(); + int indentSize = Preferences.getInteger("editor.tabs.size"); + + // + + String formattedText = null; //strOut.toString(); + if (formattedText.equals(originalText)) { + editor.message("No changes necessary for Auto Format."); + + } else { + // replace with new bootiful text + // selectionEnd hopefully at least in the neighborhood + editor.setText(formattedText, selectionEnd, selectionEnd); + editor.sketch.setModified(true); + + /* + // warn user if there are too many parens in either direction + if (paren != 0) { + editor.error("Warning: Too many " + + ((paren < 0) ? "right" : "left") + + " parentheses."); + + } else if (c_level != 0) { // check braces only if parens are ok + editor.error("Warning: Too many " + + ((c_level < 0) ? "right" : "left") + + " curly braces."); + } else { + editor.message("Auto Format finished."); + } + */ + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + private static class PluginImpl extends AbstractPlugin { + JEditStatusBar statusBar; + Project project; + + + /** + * Creates a new PluginImpl object. + */ + public PluginImpl() + { + super(new JEditAppender()); + } + + + public Project getActiveProject() + { + if (this.project == null) + { + this.project = new JEditProject(); + } + + return this.project; + } + + + public FileFormat getFileFormat() + { + // there is a bug(?) in jEdit's text area whereas inserting text with + // DOS file format results in displaying EOF characters, so we always + // use UNIX format and let jEdit handle the specified file format upon + // file saving + return FileFormat.UNIX; + } + + + public Frame getMainWindow() + { + return jEdit.getActiveView(); + } + + + public StatusBar getStatusBar() + { + return this.statusBar; + } + + + public void afterEnd() + { + super.afterEnd(); + MessageView.getInstance().update(); + } + + + /** + * Formats the currently active buffer. + */ + public void formatActive() + { + // only perform the action if the current Buffer contains + // a Java source file + //if (isJava(jEdit.getActiveView().getBuffer())) + //{ + performAction(Action.FORMAT_ACTIVE); + //} + } + + + /** + * Formats the currently open buffers. + */ + public void formatOpen() + { + performAction(Action.FORMAT_OPEN); + } + } +} diff --git a/app/src/processing/app/tools/format/tool/jalopy.jar b/app/src/processing/app/tools/format/tool/jalopy.jar new file mode 100644 index 000000000..fe51ce230 Binary files /dev/null and b/app/src/processing/app/tools/format/tool/jalopy.jar differ diff --git a/app/src/processing/app/tools/format/tool/log4j.jar b/app/src/processing/app/tools/format/tool/log4j.jar new file mode 100644 index 000000000..493a3ccc1 Binary files /dev/null and b/app/src/processing/app/tools/format/tool/log4j.jar differ diff --git a/app/src/processing/app/windows/Advapi32.java b/app/src/processing/app/windows/Advapi32.java new file mode 100644 index 000000000..0534d6b21 --- /dev/null +++ b/app/src/processing/app/windows/Advapi32.java @@ -0,0 +1,335 @@ +package processing.app.windows; + +/* + * Advapi32.java + * + * Created on 6. August 2007, 11:24 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +import com.sun.jna.*; +import com.sun.jna.ptr.*; +import com.sun.jna.win32.*; + +/** + * + * @author TB + */ +public interface Advapi32 extends StdCallLibrary { + Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32", Advapi32.class, Options.UNICODE_OPTIONS); + +/* +BOOL WINAPI LookupAccountName( + LPCTSTR lpSystemName, + LPCTSTR lpAccountName, + PSID Sid, + LPDWORD cbSid, + LPTSTR ReferencedDomainName, + LPDWORD cchReferencedDomainName, + PSID_NAME_USE peUse +);*/ + public boolean LookupAccountName(String lpSystemName, String lpAccountName, + byte[] Sid, IntByReference cbSid, char[] ReferencedDomainName, + IntByReference cchReferencedDomainName, PointerByReference peUse); + +/* +BOOL WINAPI LookupAccountSid( + LPCTSTR lpSystemName, + PSID lpSid, + LPTSTR lpName, + LPDWORD cchName, + LPTSTR lpReferencedDomainName, + LPDWORD cchReferencedDomainName, + PSID_NAME_USE peUse +);*/ + public boolean LookupAccountSid(String lpSystemName, byte[] Sid, + char[] lpName, IntByReference cchName, char[] ReferencedDomainName, + IntByReference cchReferencedDomainName, PointerByReference peUse); + +/* +BOOL ConvertSidToStringSid( + PSID Sid, + LPTSTR* StringSid +);*/ + public boolean ConvertSidToStringSid(byte[] Sid, PointerByReference StringSid); + +/* +BOOL WINAPI ConvertStringSidToSid( + LPCTSTR StringSid, + PSID* Sid +);*/ + public boolean ConvertStringSidToSid(String StringSid, PointerByReference Sid); + +/* +SC_HANDLE WINAPI OpenSCManager( + LPCTSTR lpMachineName, + LPCTSTR lpDatabaseName, + DWORD dwDesiredAccess +);*/ + public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName, int dwDesiredAccess); + +/* +BOOL WINAPI CloseServiceHandle( + SC_HANDLE hSCObject +);*/ + public boolean CloseServiceHandle(Pointer hSCObject); + +/* +SC_HANDLE WINAPI OpenService( + SC_HANDLE hSCManager, + LPCTSTR lpServiceName, + DWORD dwDesiredAccess +);*/ + public Pointer OpenService(Pointer hSCManager, String lpServiceName, int dwDesiredAccess); + +/* +BOOL WINAPI StartService( + SC_HANDLE hService, + DWORD dwNumServiceArgs, + LPCTSTR* lpServiceArgVectors +);*/ + public boolean StartService(Pointer hService, int dwNumServiceArgs, char[] lpServiceArgVectors); + +/* +BOOL WINAPI ControlService( + SC_HANDLE hService, + DWORD dwControl, + LPSERVICE_STATUS lpServiceStatus +);*/ + public boolean ControlService(Pointer hService, int dwControl, SERVICE_STATUS lpServiceStatus); + +/* +BOOL WINAPI StartServiceCtrlDispatcher( + const SERVICE_TABLE_ENTRY* lpServiceTable +);*/ + public boolean StartServiceCtrlDispatcher(Structure[] lpServiceTable); + +/* +SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandler( + LPCTSTR lpServiceName, + LPHANDLER_FUNCTION lpHandlerProc +);*/ + public Pointer RegisterServiceCtrlHandler(String lpServiceName, Handler lpHandlerProc); + +/* +SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerEx( + LPCTSTR lpServiceName, + LPHANDLER_FUNCTION_EX lpHandlerProc, + LPVOID lpContext +);*/ + public Pointer RegisterServiceCtrlHandlerEx(String lpServiceName, HandlerEx lpHandlerProc, Pointer lpContext); + +/* +BOOL WINAPI SetServiceStatus( + SERVICE_STATUS_HANDLE hServiceStatus, + LPSERVICE_STATUS lpServiceStatus +);*/ + public boolean SetServiceStatus(Pointer hServiceStatus, SERVICE_STATUS lpServiceStatus); + +/* +SC_HANDLE WINAPI CreateService( + SC_HANDLE hSCManager, + LPCTSTR lpServiceName, + LPCTSTR lpDisplayName, + DWORD dwDesiredAccess, + DWORD dwServiceType, + DWORD dwStartType, + DWORD dwErrorControl, + LPCTSTR lpBinaryPathName, + LPCTSTR lpLoadOrderGroup, + LPDWORD lpdwTagId, + LPCTSTR lpDependencies, + LPCTSTR lpServiceStartName, + LPCTSTR lpPassword +);*/ + public Pointer CreateService(Pointer hSCManager, String lpServiceName, String lpDisplayName, + int dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl, + String lpBinaryPathName, String lpLoadOrderGroup, IntByReference lpdwTagId, + String lpDependencies, String lpServiceStartName, String lpPassword); + +/* +BOOL WINAPI DeleteService( + SC_HANDLE hService +);*/ + public boolean DeleteService(Pointer hService); + +/* +BOOL WINAPI ChangeServiceConfig2( + SC_HANDLE hService, + DWORD dwInfoLevel, + LPVOID lpInfo +);*/ + public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel, ChangeServiceConfig2Info lpInfo); + +/* +LONG WINAPI RegOpenKeyEx( + HKEY hKey, + LPCTSTR lpSubKey, + DWORD ulOptions, + REGSAM samDesired, + PHKEY phkResult +);*/ + public int RegOpenKeyEx(int hKey, String lpSubKey, int ulOptions, int samDesired, IntByReference phkResult); + +/* +LONG WINAPI RegQueryValueEx( + HKEY hKey, + LPCTSTR lpValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData +);*/ + public int RegQueryValueEx(int hKey, String lpValueName, IntByReference lpReserved, IntByReference lpType, byte[] lpData, IntByReference lpcbData); + +/* +LONG WINAPI RegCloseKey( + HKEY hKey +);*/ + public int RegCloseKey(int hKey); + +/* +LONG WINAPI RegDeleteValue( + HKEY hKey, + LPCTSTR lpValueName +);*/ + public int RegDeleteValue(int hKey, String lpValueName); + +/* +LONG WINAPI RegSetValueEx( + HKEY hKey, + LPCTSTR lpValueName, + DWORD Reserved, + DWORD dwType, + const BYTE* lpData, + DWORD cbData +);*/ + public int RegSetValueEx(int hKey, String lpValueName, int Reserved, int dwType, byte[] lpData, int cbData); + +/* +LONG WINAPI RegCreateKeyEx( + HKEY hKey, + LPCTSTR lpSubKey, + DWORD Reserved, + LPTSTR lpClass, + DWORD dwOptions, + REGSAM samDesired, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + PHKEY phkResult, + LPDWORD lpdwDisposition +);*/ + public int RegCreateKeyEx(int hKey, String lpSubKey, int Reserved, String lpClass, int dwOptions, + int samDesired, WINBASE.SECURITY_ATTRIBUTES lpSecurityAttributes, IntByReference phkResult, + IntByReference lpdwDisposition); + +/* +LONG WINAPI RegDeleteKey( + HKEY hKey, + LPCTSTR lpSubKey +);*/ + public int RegDeleteKey(int hKey, String name); + +/* +LONG WINAPI RegEnumKeyEx( + HKEY hKey, + DWORD dwIndex, + LPTSTR lpName, + LPDWORD lpcName, + LPDWORD lpReserved, + LPTSTR lpClass, + LPDWORD lpcClass, + PFILETIME lpftLastWriteTime +);*/ + public int RegEnumKeyEx(int hKey, int dwIndex, char[] lpName, IntByReference lpcName, IntByReference reserved, + char[] lpClass, IntByReference lpcClass, WINBASE.FILETIME lpftLastWriteTime); + +/* +LONG WINAPI RegEnumValue( + HKEY hKey, + DWORD dwIndex, + LPTSTR lpValueName, + LPDWORD lpcchValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData +);*/ + public int RegEnumValue(int hKey, int dwIndex, char[] lpValueName, IntByReference lpcchValueName, IntByReference reserved, + IntByReference lpType, byte[] lpData, IntByReference lpcbData); + + interface SERVICE_MAIN_FUNCTION extends StdCallCallback { + /* + VOID WINAPI ServiceMain( + DWORD dwArgc, + LPTSTR* lpszArgv + );*/ + public void callback(int dwArgc, Pointer lpszArgv); + } + + interface Handler extends StdCallCallback { + /* + VOID WINAPI Handler( + DWORD fdwControl + );*/ + public void callback(int fdwControl); + } + + interface HandlerEx extends StdCallCallback { + /* + DWORD WINAPI HandlerEx( + DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext + );*/ + public void callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext); + } + +/* +typedef struct _SERVICE_STATUS { + DWORD dwServiceType; + DWORD dwCurrentState; + DWORD dwControlsAccepted; + DWORD dwWin32ExitCode; + DWORD dwServiceSpecificExitCode; + DWORD dwCheckPoint; + DWORD dwWaitHint; +} SERVICE_STATUS, + *LPSERVICE_STATUS;*/ + public static class SERVICE_STATUS extends Structure { + public int dwServiceType; + public int dwCurrentState; + public int dwControlsAccepted; + public int dwWin32ExitCode; + public int dwServiceSpecificExitCode; + public int dwCheckPoint; + public int dwWaitHint; + } + +/* +typedef struct _SERVICE_TABLE_ENTRY { + LPTSTR lpServiceName; + LPSERVICE_MAIN_FUNCTION lpServiceProc; +} SERVICE_TABLE_ENTRY, + *LPSERVICE_TABLE_ENTRY;*/ + public static class SERVICE_TABLE_ENTRY extends Structure { + public String lpServiceName; + public SERVICE_MAIN_FUNCTION lpServiceProc; + } + + public static class ChangeServiceConfig2Info extends Structure { + } + +/* + typedef struct _SERVICE_DESCRIPTION { + LPTSTR lpDescription; +} SERVICE_DESCRIPTION, + *LPSERVICE_DESCRIPTION;*/ + public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info { + public String lpDescription; + } +} + + diff --git a/app/src/processing/app/windows/Options.java b/app/src/processing/app/windows/Options.java new file mode 100644 index 000000000..f5cff2888 --- /dev/null +++ b/app/src/processing/app/windows/Options.java @@ -0,0 +1,27 @@ +/* + * Options.java + * + * Created on 8. August 2007, 17:07 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package processing.app.windows; + +import static com.sun.jna.Library.*; +import com.sun.jna.win32.*; +import java.util.*; + +/** + * + * @author TB + */ +public interface Options { + Map UNICODE_OPTIONS = new HashMap() { + { + put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE); + put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE); + } + }; +} diff --git a/app/src/processing/app/windows/Platform.java b/app/src/processing/app/windows/Platform.java new file mode 100644 index 000000000..278244447 --- /dev/null +++ b/app/src/processing/app/windows/Platform.java @@ -0,0 +1,268 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package processing.app.windows; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import processing.app.Base; +import processing.app.Preferences; +import processing.app.windows.Registry.REGISTRY_ROOT_KEY; +import processing.core.PApplet; + + +// http://developer.apple.com/documentation/QuickTime/Conceptual/QT7Win_Update_Guide/Chapter03/chapter_3_section_1.html +// HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\QuickTime\QTSysDir + +// HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion -> 1.6 (String) +// HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion\1.6\JavaHome -> c:\jdk-1.6.0_05 + +public class Platform extends processing.app.Platform { + + static final String openCommand = + System.getProperty("user.dir").replace('/', '\\') + + "\\processing.exe \"%1\""; + static final String DOC = "Processing.Document"; + + public void init(Base base) { + super.init(base); + + checkAssociations(); + checkQuickTime(); + checkPath(); + } + + + /** + * Make sure that .pde files are associated with processing.exe. + */ + protected void checkAssociations() { + try { + String knownCommand = + Registry.getStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, + DOC + "\\shell\\open\\command", ""); + if (knownCommand == null) { + if (Preferences.getBoolean("platform.auto_file_type_associations")) { + setAssociations(); + } + + } else if (!knownCommand.equals(openCommand)) { + // If the value is set differently, just change the registry setting. + if (Preferences.getBoolean("platform.auto_file_type_associations")) { + setAssociations(); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * Associate .pde files with this version of Processing. + */ + protected void setAssociations() throws UnsupportedEncodingException { + if (Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, + "", ".pde") && + Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, + ".pde", "", DOC) && + + Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, "", DOC) && + Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, DOC, "", + "Processing Source Code") && + + Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, + DOC, "shell") && + Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, + DOC + "\\shell", "open") && + Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, + DOC + "\\shell\\open", "command") && + Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, + DOC + "\\shell\\open\\command", "", + openCommand)) { + // everything ok + // hooray! + + } else { + Preferences.setBoolean("platform.auto_file_type_associations", false); + } + } + + + /** + * Find QuickTime for Java installation. + */ + protected void checkQuickTime() { + try { + String qtsystemPath = + Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE, + "Software\\Apple Computer, Inc.\\QuickTime", + "QTSysDir"); + // Could show a warning message here if QT not installed, but that + // would annoy people who don't want anything to do with QuickTime. + if (qtsystemPath != null) { + File qtjavaZip = new File(qtsystemPath, "QTJava.zip"); + if (qtjavaZip.exists()) { + String qtjavaZipPath = qtjavaZip.getAbsolutePath(); + String cp = System.getProperty("java.class.path"); + System.setProperty("java.class.path", + cp + File.pathSeparator + qtjavaZipPath); + } + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + + /** + * Remove extra quotes, slashes, and garbage from the Windows PATH. + */ + protected void checkPath() { + String path = System.getProperty("java.library.path"); + String[] pieces = PApplet.split(path, File.pathSeparatorChar); + String[] legit = new String[pieces.length]; + int legitCount = 0; + for (String item : pieces) { + if (item.startsWith("\"")) { + item = item.substring(1); + } + if (item.endsWith("\"")) { + item = item.substring(0, item.length() - 1); + } + if (item.endsWith(File.separator)) { + item = item.substring(0, item.length() - File.separator.length()); + } + File directory = new File(item); + if (!directory.exists()) { + continue; + } + if (item.trim().length() == 0) { + continue; + } + legit[legitCount++] = item; + } + legit = PApplet.subset(legit, 0, legitCount); + String newPath = PApplet.join(legit, File.pathSeparator); + if (!newPath.equals(path)) { + System.setProperty("java.library.path", newPath); + } + } + + + // looking for Documents and Settings/blah/Application Data/Processing + public File getSettingsFolder() throws Exception { + // HKEY_CURRENT_USER\Software\Microsoft + // \Windows\CurrentVersion\Explorer\Shell Folders + // Value Name: AppData + // Value Type: REG_SZ + // Value Data: path + + String keyPath = + "Software\\Microsoft\\Windows\\CurrentVersion" + + "\\Explorer\\Shell Folders"; + String appDataPath = + Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "AppData"); + + File dataFolder = new File(appDataPath, "Processing"); + return dataFolder; + } + + + // looking for Documents and Settings/blah/My Documents/Processing + // (though using a reg key since it's different on other platforms) + public File getDefaultSketchbookFolder() throws Exception { + + // http://support.microsoft.com/?kbid=221837&sd=RMVP + // http://support.microsoft.com/kb/242557/en-us + + // The path to the My Documents folder is stored in the following + // registry key, where path is the complete path to your storage location + + // HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders + // Value Name: Personal + // Value Type: REG_SZ + // Value Data: path + + // in some instances, this may be overridden by a policy, in which case check: + // HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders + + String keyPath = + "Software\\Microsoft\\Windows\\CurrentVersion" + + "\\Explorer\\Shell Folders"; + String personalPath = + Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "Personal"); + + return new File(personalPath, "Processing"); + } + + + public void openURL(String url) throws Exception { + // this is not guaranteed to work, because who knows if the + // path will always be c:\progra~1 et al. also if the user has + // a different browser set as their default (which would + // include me) it'd be annoying to be dropped into ie. + //Runtime.getRuntime().exec("c:\\progra~1\\intern~1\\iexplore " + // + currentDir + + // the following uses a shell execute to launch the .html file + // note that under cygwin, the .html files have to be chmodded +x + // after they're unpacked from the zip file. i don't know why, + // and don't understand what this does in terms of windows + // permissions. without the chmod, the command prompt says + // "Access is denied" in both cygwin and the "dos" prompt. + //Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" + + // referenceFile + ".html"); + if (url.startsWith("http://")) { + // open dos prompt, give it 'start' command, which will + // open the url properly. start by itself won't work since + // it appears to need cmd + Runtime.getRuntime().exec("cmd /c start " + url); + } else { + // just launching the .html file via the shell works + // but make sure to chmod +x the .html files first + // also place quotes around it in case there's a space + // in the user.dir part of the url + Runtime.getRuntime().exec("cmd /c \"" + url + "\""); + } + } + + + public boolean openFolderAvailable() { + return true; + } + + + public void openFolder(File file) throws Exception { + String folder = file.getAbsolutePath(); + + // doesn't work + //Runtime.getRuntime().exec("cmd /c \"" + folder + "\""); + + // works fine on winxp, prolly win2k as well + Runtime.getRuntime().exec("explorer \"" + folder + "\""); + + // not tested + //Runtime.getRuntime().exec("start explorer \"" + folder + "\""); + } +} diff --git a/app/src/processing/app/windows/Registry.java b/app/src/processing/app/windows/Registry.java new file mode 100644 index 000000000..71fa5eebe --- /dev/null +++ b/app/src/processing/app/windows/Registry.java @@ -0,0 +1,456 @@ +package processing.app.windows; + +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.TreeMap; +import java.util.TreeSet; + +import com.sun.jna.ptr.IntByReference; + +/** + * Methods for accessing the Windows Registry. Only String and DWORD values supported at the moment. + */ +public class Registry { + public static enum REGISTRY_ROOT_KEY{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE, USERS}; + private final static HashMap rootKeyMap = new HashMap(); + + static { + rootKeyMap.put(REGISTRY_ROOT_KEY.CLASSES_ROOT, WINREG.HKEY_CLASSES_ROOT); + rootKeyMap.put(REGISTRY_ROOT_KEY.CURRENT_USER, WINREG.HKEY_CURRENT_USER); + rootKeyMap.put(REGISTRY_ROOT_KEY.LOCAL_MACHINE, WINREG.HKEY_LOCAL_MACHINE); + rootKeyMap.put(REGISTRY_ROOT_KEY.USERS, WINREG.HKEY_USERS); + } + + /** + * Testing. + * + * @param args arguments + * @throws java.lang.Exception on error + */ + public static void main(String[] args) throws Exception { + } + + /** + * Gets one of the root keys. + * + * @param key key type + * @return root key + */ + private static int getRegistryRootKey(REGISTRY_ROOT_KEY key) { + Advapi32 advapi32; + IntByReference pHandle; + int handle = 0; + + advapi32 = Advapi32.INSTANCE; + pHandle = new IntByReference(); + + if(advapi32.RegOpenKeyEx(rootKeyMap.get(key), null, 0, 0, pHandle) == WINERROR.ERROR_SUCCESS) { + handle = pHandle.getValue(); + } + return(handle); + } + + /** + * Opens a key. + * + * @param rootKey root key + * @param subKeyName name of the key + * @param access access mode + * @return handle to the key or 0 + */ + private static int openKey(REGISTRY_ROOT_KEY rootKey, String subKeyName, int access) { + Advapi32 advapi32; + IntByReference pHandle; + int rootKeyHandle; + + advapi32 = Advapi32.INSTANCE; + rootKeyHandle = getRegistryRootKey(rootKey); + pHandle = new IntByReference(); + + if(advapi32.RegOpenKeyEx(rootKeyHandle, subKeyName, 0, access, pHandle) == WINERROR.ERROR_SUCCESS) { + return(pHandle.getValue()); + + } else { + return(0); + } + } + + /** + * Converts a Windows buffer to a Java String. + * + * @param buf buffer + * @throws java.io.UnsupportedEncodingException on error + * @return String + */ + private static String convertBufferToString(byte[] buf) throws UnsupportedEncodingException { + return(new String(buf, 0, buf.length - 2, "UTF-16LE")); + } + + /** + * Converts a Windows buffer to an int. + * + * @param buf buffer + * @return int + */ + private static int convertBufferToInt(byte[] buf) { + return(((int)(buf[0] & 0xff)) + (((int)(buf[1] & 0xff)) << 8) + (((int)(buf[2] & 0xff)) << 16) + (((int)(buf[3] & 0xff)) << 24)); + } + + /** + * Read a String value. + * + * @param rootKey root key + * @param subKeyName key name + * @param name value name + * @throws java.io.UnsupportedEncodingException on error + * @return String or null + */ + public static String getStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) throws UnsupportedEncodingException { + Advapi32 advapi32; + IntByReference pType, lpcbData; + byte[] lpData = new byte[1]; + int handle = 0; + String ret = null; + + advapi32 = Advapi32.INSTANCE; + pType = new IntByReference(); + lpcbData = new IntByReference(); + handle = openKey(rootKey, subKeyName, WINNT.KEY_READ); + + if(handle != 0) { + + if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) { + lpData = new byte[lpcbData.getValue()]; + + if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) { + ret = convertBufferToString(lpData); + } + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Read an int value. + * + * + * @return int or 0 + * @param rootKey root key + * @param subKeyName key name + * @param name value name + */ + public static int getIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) { + Advapi32 advapi32; + IntByReference pType, lpcbData; + byte[] lpData = new byte[1]; + int handle = 0; + int ret = 0; + + advapi32 = Advapi32.INSTANCE; + pType = new IntByReference(); + lpcbData = new IntByReference(); + handle = openKey(rootKey, subKeyName, WINNT.KEY_READ); + + if(handle != 0) { + + if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) { + lpData = new byte[lpcbData.getValue()]; + + if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) { + ret = convertBufferToInt(lpData); + } + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Delete a value. + * + * @param rootKey root key + * @param subKeyName key name + * @param name value name + * @return true on success + */ + public static boolean deleteValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) { + Advapi32 advapi32; + int handle; + boolean ret = true; + + advapi32 = Advapi32.INSTANCE; + + handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE); + + if(handle != 0) { + if(advapi32.RegDeleteValue(handle, name) == WINERROR.ERROR_SUCCESS) { + ret = true; + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Writes a String value. + * + * @param rootKey root key + * @param subKeyName key name + * @param name value name + * @param value value + * @throws java.io.UnsupportedEncodingException on error + * @return true on success + */ + public static boolean setStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, String value) throws UnsupportedEncodingException { + Advapi32 advapi32; + int handle; + byte[] data; + boolean ret = false; + + // appears to be Java 1.6 syntax, removing [fry] + //data = Arrays.copyOf(value.getBytes("UTF-16LE"), value.length() * 2 + 2); + data = new byte[value.length() * 2 + 2]; + byte[] src = value.getBytes("UTF-16LE"); + System.arraycopy(src, 0, data, 0, src.length); + + advapi32 = Advapi32.INSTANCE; + handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE); + + if(handle != 0) { + if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_SZ, data, data.length) == WINERROR.ERROR_SUCCESS) { + ret = true; + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Writes an int value. + * + * + * @return true on success + * @param rootKey root key + * @param subKeyName key name + * @param name value name + * @param value value + */ + public static boolean setIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, int value) { + Advapi32 advapi32; + int handle; + byte[] data; + boolean ret = false; + + data = new byte[4]; + data[0] = (byte)(value & 0xff); + data[1] = (byte)((value >> 8) & 0xff); + data[2] = (byte)((value >> 16) & 0xff); + data[3] = (byte)((value >> 24) & 0xff); + advapi32 = Advapi32.INSTANCE; + handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE); + + if(handle != 0) { + + if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_DWORD, data, data.length) == WINERROR.ERROR_SUCCESS) { + ret = true; + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Check for existence of a value. + * + * @param rootKey root key + * @param subKeyName key name + * @param name value name + * @return true if exists + */ + public static boolean valueExists(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) { + Advapi32 advapi32; + IntByReference pType, lpcbData; + byte[] lpData = new byte[1]; + int handle = 0; + boolean ret = false; + + advapi32 = Advapi32.INSTANCE; + pType = new IntByReference(); + lpcbData = new IntByReference(); + handle = openKey(rootKey, subKeyName, WINNT.KEY_READ); + + if(handle != 0) { + + if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) != WINERROR.ERROR_FILE_NOT_FOUND) { + ret = true; + + } else { + ret = false; + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Create a new key. + * + * @param rootKey root key + * @param parent name of parent key + * @param name key name + * @return true on success + */ + public static boolean createKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) { + Advapi32 advapi32; + IntByReference hkResult, dwDisposition; + int handle = 0; + boolean ret = false; + + advapi32 = Advapi32.INSTANCE; + hkResult = new IntByReference(); + dwDisposition = new IntByReference(); + handle = openKey(rootKey, parent, WINNT.KEY_READ); + + if(handle != 0) { + + if(advapi32.RegCreateKeyEx(handle, name, 0, null, WINNT.REG_OPTION_NON_VOLATILE, WINNT.KEY_READ, null, + hkResult, dwDisposition) == WINERROR.ERROR_SUCCESS) { + ret = true; + advapi32.RegCloseKey(hkResult.getValue()); + + } else { + ret = false; + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Delete a key. + * + * @param rootKey root key + * @param parent name of parent key + * @param name key name + * @return true on success + */ + public static boolean deleteKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) { + Advapi32 advapi32; + int handle = 0; + boolean ret = false; + + advapi32 = Advapi32.INSTANCE; + handle = openKey(rootKey, parent, WINNT.KEY_READ); + + if(handle != 0) { + + if(advapi32.RegDeleteKey(handle, name) == WINERROR.ERROR_SUCCESS) { + ret = true; + + } else { + ret = false; + } + advapi32.RegCloseKey(handle); + } + return(ret); + } + + /** + * Get all sub keys of a key. + * + * @param rootKey root key + * @param parent key name + * @return array with all sub key names + */ + public static String[] getSubKeys(REGISTRY_ROOT_KEY rootKey, String parent) { + Advapi32 advapi32; + int handle = 0, dwIndex; + char[] lpName; + IntByReference lpcName; + WINBASE.FILETIME lpftLastWriteTime; + TreeSet subKeys = new TreeSet(); + + advapi32 = Advapi32.INSTANCE; + handle = openKey(rootKey, parent, WINNT.KEY_READ); + lpName = new char[256]; + lpcName = new IntByReference(256); + lpftLastWriteTime = new WINBASE.FILETIME(); + + if(handle != 0) { + dwIndex = 0; + + while(advapi32.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, + null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) { + subKeys.add(new String(lpName, 0, lpcName.getValue())); + lpcName.setValue(256); + dwIndex++; + } + advapi32.RegCloseKey(handle); + } + + return(subKeys.toArray(new String[]{})); + } + + /** + * Get all values under a key. + * + * @param rootKey root key + * @param key jey name + * @throws java.io.UnsupportedEncodingException on error + * @return TreeMap with name and value pairs + */ + public static TreeMap getValues(REGISTRY_ROOT_KEY rootKey, String key) throws UnsupportedEncodingException { + Advapi32 advapi32; + int handle = 0, dwIndex, result = 0; + char[] lpValueName; + byte[] lpData; + IntByReference lpcchValueName, lpType, lpcbData; + String name; + TreeMap values = new TreeMap(String.CASE_INSENSITIVE_ORDER); + + advapi32 = Advapi32.INSTANCE; + handle = openKey(rootKey, key, WINNT.KEY_READ); + lpValueName = new char[16384]; + lpcchValueName = new IntByReference(16384); + lpType = new IntByReference(); + lpData = new byte[1]; + lpcbData = new IntByReference(); + + if(handle != 0) { + dwIndex = 0; + + do { + lpcbData.setValue(0); + result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null, + lpType, lpData, lpcbData); + + if(result == WINERROR.ERROR_MORE_DATA) { + lpData = new byte[lpcbData.getValue()]; + lpcchValueName = new IntByReference(16384); + result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null, + lpType, lpData, lpcbData); + + if(result == WINERROR.ERROR_SUCCESS) { + name = new String(lpValueName, 0, lpcchValueName.getValue()); + + switch(lpType.getValue()) { + case WINNT.REG_SZ: + values.put(name, convertBufferToString(lpData)); + break; + case WINNT.REG_DWORD: + values.put(name, convertBufferToInt(lpData)); + break; + default: + break; + } + } + } + dwIndex++; + } while(result == WINERROR.ERROR_SUCCESS); + + advapi32.RegCloseKey(handle); + } + return(values); + } +} diff --git a/app/src/processing/app/windows/WINBASE.java b/app/src/processing/app/windows/WINBASE.java new file mode 100644 index 000000000..c4807cc90 --- /dev/null +++ b/app/src/processing/app/windows/WINBASE.java @@ -0,0 +1,43 @@ +/* + * WINBASE.java + * + * Created on 5. September 2007, 11:24 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package processing.app.windows; + +import com.sun.jna.Pointer; +import com.sun.jna.Structure; + +/** + * + * @author TB + */ +public interface WINBASE { +/* +typedef struct _SECURITY_ATTRIBUTES { + DWORD nLength; + LPVOID lpSecurityDescriptor; + BOOL bInheritHandle; +} SECURITY_ATTRIBUTES, + *PSECURITY_ATTRIBUTES, + *LPSECURITY_ATTRIBUTES;*/ + public static class SECURITY_ATTRIBUTES extends Structure { + public int nLength; + public Pointer lpSecurityDescriptor; + public boolean bInheritHandle; + } + +/* +typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME, *PFILETIME, *LPFILETIME;*/ + public static class FILETIME extends Structure { + public int dwLowDateTime; + public int dwHighDateTime; + } +} diff --git a/app/src/processing/app/windows/WINERROR.java b/app/src/processing/app/windows/WINERROR.java new file mode 100644 index 000000000..3e1146e93 --- /dev/null +++ b/app/src/processing/app/windows/WINERROR.java @@ -0,0 +1,22 @@ +/* + * WINERROR.java + * + * Created on 7. August 2007, 08:09 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package processing.app.windows; + + +/** + * + * @author TB + */ +public interface WINERROR { + public final static int ERROR_SUCCESS = 0; + public final static int NO_ERROR = 0; + public final static int ERROR_FILE_NOT_FOUND = 2; + public final static int ERROR_MORE_DATA = 234; +} diff --git a/app/src/processing/app/windows/WINNT.java b/app/src/processing/app/windows/WINNT.java new file mode 100644 index 000000000..89aa36168 --- /dev/null +++ b/app/src/processing/app/windows/WINNT.java @@ -0,0 +1,73 @@ +/* + * WINNT.java + * + * Created on 8. August 2007, 13:41 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package processing.app.windows; + +/** + * + * @author TB + */ +public interface WINNT { + public final static int DELETE = 0x00010000; + public final static int READ_CONTROL = 0x00020000; + public final static int WRITE_DAC = 0x00040000; + public final static int WRITE_OWNER = 0x00080000; + public final static int SYNCHRONIZE = 0x00100000; + + public final static int STANDARD_RIGHTS_REQUIRED = 0x000F0000; + + public final static int STANDARD_RIGHTS_READ = READ_CONTROL; + public final static int STANDARD_RIGHTS_WRITE = READ_CONTROL; + public final static int STANDARD_RIGHTS_EXECUTE = READ_CONTROL; + + public final static int STANDARD_RIGHTS_ALL = 0x001F0000; + + public final static int SPECIFIC_RIGHTS_ALL = 0x0000FFFF; + + public final static int GENERIC_EXECUTE = 0x20000000; + + public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010; + + public final static int KEY_QUERY_VALUE = 0x0001; + public final static int KEY_SET_VALUE = 0x0002; + public final static int KEY_CREATE_SUB_KEY = 0x0004; + public final static int KEY_ENUMERATE_SUB_KEYS = 0x0008; + public final static int KEY_NOTIFY = 0x0010; + public final static int KEY_CREATE_LINK = 0x0020; + + public final static int KEY_READ = ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE)); + public final static int KEY_WRITE = ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE)); + + public final static int REG_NONE = 0; // No value type + public final static int REG_SZ = 1; // Unicode nul terminated string + public final static int REG_EXPAND_SZ = 2; // Unicode nul terminated string + // (with environment variable references) + public final static int REG_BINARY = 3; // Free form binary + public final static int REG_DWORD = 4; // 32-bit number + public final static int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD) + public final static int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number + public final static int REG_LINK = 6; // Symbolic Link (unicode) + public final static int REG_MULTI_SZ = 7; // Multiple Unicode strings + public final static int REG_RESOURCE_LIST = 8; // Resource list in the resource map + public final static int REG_FULL_RESOURCE_DESCRIPTOR = 9; // Resource list in the hardware description + public final static int REG_RESOURCE_REQUIREMENTS_LIST = 10; + + public final static int REG_OPTION_RESERVED = 0x00000000; // Parameter is reserved + public final static int REG_OPTION_NON_VOLATILE = 0x00000000; // Key is preserved + // when system is rebooted + public final static int REG_OPTION_VOLATILE = 0x00000001; // Key is not preserved + // when system is rebooted + public final static int REG_OPTION_CREATE_LINK = 0x00000002; // Created key is a + // symbolic link + public final static int REG_OPTION_BACKUP_RESTORE = 0x00000004; // open for backup or restore + // special access rules + // privilege required + public final static int REG_OPTION_OPEN_LINK = 0x00000008; // Open symbolic link + +} diff --git a/app/src/processing/app/windows/WINREG.java b/app/src/processing/app/windows/WINREG.java new file mode 100644 index 000000000..988f7ef36 --- /dev/null +++ b/app/src/processing/app/windows/WINREG.java @@ -0,0 +1,21 @@ +/* + * WINREG.java + * + * Created on 17. August 2007, 14:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package processing.app.windows; + +/** + * + * @author TB + */ +public interface WINREG { + public final static int HKEY_CLASSES_ROOT = 0x80000000; + public final static int HKEY_CURRENT_USER = 0x80000001; + public final static int HKEY_LOCAL_MACHINE = 0x80000002; + public final static int HKEY_USERS = 0x80000003; +} diff --git a/build/cmd/dist.sh b/build/cmd/dist.sh new file mode 100755 index 000000000..38d295365 --- /dev/null +++ b/build/cmd/dist.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +# only needed for core.jar and pde.jar, hmm +ARCH=`uname` +if [ $ARCH == "Darwin" ] +then + BUILD=../macosx + REVISION=`head -1 ../../todo.txt | cut -c 1-4` +elif [ $ARCH == "Cygwin" ] +then + BUILD=../windows + REVISION=`head -c 4 ../../todo.txt` +else + BUILD=../linux + REVISION=`head -c 4 ../../todo.txt` +fi + +echo Creating command-line distribution for revision $REVISION... + +# remove any old boogers +rm -rf processing +rm -rf processing-* + +mkdir processing +cp -r ../shared/lib processing/ +cp -r ../shared/libraries processing/ +cp ../../app/lib/antlr.jar processing/lib/ +cp ../../app/lib/ecj.jar processing/lib/ +cp ../../app/lib/jna.jar processing/lib/ +cp ../shared/revisions.txt processing/ + +# add the libraries folder with source +cp -r ../../net processing/libraries/ +cp -r ../../opengl processing/libraries/ +cp -r ../../serial processing/libraries/ +cp -r ../../pdf processing/libraries/ +cp -r ../../dxf processing/libraries/ +cp -r ../../xml processing/libraries/ +cp -r ../../candy processing/libraries/ +cp -r ../../video processing/libraries/ + +# grab pde.jar and export from the working dir +cp $BUILD/work/lib/pde.jar processing/lib/ +cp $BUILD/work/lib/core.jar processing/lib/ + +# get platform-specific goodies from the dist dir +install -m 755 dist/processing processing/processing + +# remove boogers +find processing -name "*~" -exec rm -f {} ';' +find processing -name ".DS_Store" -exec rm -f {} ';' +find processing -name "._*" -exec rm -f {} ';' +find processing -name "Thumbs.db" -exec rm -f {} ';' + +# clean out the cvs entries +find processing -name "CVS" -exec rm -rf {} ';' 2> /dev/null +find processing -name ".cvsignore" -exec rm -rf {} ';' +find processing -name ".svn" -exec rm -rf {} 2> /dev/null ';' + +# zip it all up for release +echo Creating tarball and finishing... +P5=processing-cmd-$REVISION +mv processing $P5 + +zip -rq $P5.zip $P5 +#tar cfz $P5.tgz $P5 +# nah, keep the new directory around +#rm -rf $P5 + +#echo Done. diff --git a/build/cmd/dist/processing b/build/cmd/dist/processing new file mode 100644 index 000000000..8f6944154 --- /dev/null +++ b/build/cmd/dist/processing @@ -0,0 +1,20 @@ + #!/bin/sh + +APPDIR="$(dirname -- "${0}")" + +# includes java/* in case a Java install is available +for LIB in \ + java/lib/rt.jar \ + java/lib/tools.jar \ + lib/*.jar \ + ; +do + CLASSPATH="${CLASSPATH}:${APPDIR}/${LIB}" +done +export CLASSPATH + +export PATH="${APPDIR}/java/bin:${PATH}" + +#java processing.app.Commander $* +# if you know a better way to do this, submit it to dev.processing.org/bugs +java processing.app.Commander "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" diff --git a/build/howto.txt b/build/howto.txt new file mode 100755 index 000000000..d2103b03c --- /dev/null +++ b/build/howto.txt @@ -0,0 +1,167 @@ +HOW TO BUILD PROCESSING ON YOUR FAVORITE PLATFORM + +If you have questions about the contents of this document, +ask questions at the discourse section of the site: +http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_core_pde + + +//////////////////////////////////////////////////////////////////// + +//// Steps for First Time Setup + + +1. INSTALL DEVELOPMENT TOOLS + +1a. On Windows, install Cygwin. It's downloadable from + www.cygwin.com or specifically: www.cygwin.com/setup.exe + +** of the packages, begin with the defaults, and add: + ++ subversion - used for version control + ++ make, gcc-mingw, and g++ - used to build processing.exe + (this will also pull in gcc-core) + ++ perl - use this version from cygwin, activestate or other windows + perl distributions have trouble + ++ unzip, zip - for dealing with archives + ++ included in the defaults, but make sure: coreutils, gzip, tar + ++ not required but useful: + openssh - command line ssh client + nano - handy/simple text editor (gnu pico ripoff) + +** and be sure to leave the option selected for 'unix line endings' + +the cygwin installer is sometimes a little flakey, so it may take more +than one try to get everything in there. in fact, it's often best to +run the installer once, and let it install all its defaults, then run +it again, and select the items above. it's also useful to run the +installer every few months to keep things fresh. + + +1b. On Mac OS X, install Apple's Developer Tools (Xcode). + + You'll also need subversion: http://subversion.tigris.org/ + Install it from Fink, Darwinports, or download as a package: + http://metissian.com/projects/macosx/subversion/ + + +1c. On Linux, you're pretty much on your own.. You need a pretty + standard development setup along with Subversion. + + +2. GRAB THE CODE FROM DEV.PROCESSING.ORG + +As of August 12, 2005, we're no longer using CVS and have moved on to +the brave new world of Subversion. This is scary but hopefully will +alleviate some of the CVS annoyances. + +To get the code, type this from a prompt: +svn co svn://processing.org/trunk/processing + +That part may take a while, especially for people outside the US or +who have a slow internet connection. (The JRE binaries are stored in +SVN so that we can properly test on the exact platform/runtime setup +that we'll be releasing.) + + +3. INSTALL QUICKTIME FOR JAVA (Windows users only) + +* You'll also need to install QuickTime for Java. Grab the QuickTime + (and iTunes) installer from: http://www.apple.com/quicktime/download/ + or a version that doesn't include iTunes from here: + http://www.apple.com/quicktime/download/standalone.html + As of QuickTime 7 (iTunes 6), QuickTime for Java is mercifully + included by default. + +* QuickTime 6 is no longer supported. QuickTime Alternative has + never been supported. Just use QuickTime 7. + + +4. BUILD IT + +# now to build for the first time: +cd /path/to/processing/build/windows + +# or if you're on linux +cd /path/to/processing/build/linux + +# let's say you're into black turtlenecks and jeans +cd /path/to/processing/build/macosx + +# and then.. +./make.sh + +# if everything went well, you'll have no errors. (feel free to make +# suggestions for things to include here for common problems) + +# then to run it +./run.sh + +# each time you make a change, use make to build the thing +# and run to get it up and running. + + +//////////////////////////////////////////////////////////////////// + +//// Updating to the Latest Version + + +5a. Each time you want to update to latest version: + +cd /path/to/processing +svn update + + +5b. If you're getting strange errors when you try to build, especially + if new folders have been added to the Processing repository, remove + your 'work' folder and rebuild. Generally, this is a good idea to + do whenever a new release has been made, since that will involve + files that may have been changed (or folders that have been moved). + +# get to the processing folder +cd /path/to/processing + +# remove the work directory +cd build/yourplatform +rm -rf work + +# and try again +./make.sh + +Unfortunately there isn't a way to know if new folders have +since been added. but if you're getting "class not found" errors +while building, then that's a good indicator that something is +missing from a subfolder. + + +//////////////////////////////////////////////////////////////////// + +//// The Frequently Asked Question + +- What about Eclipse? What about Ant? Command line sucks. + +The command line stuff isn't as scary as it might initially +seem. Hopefully it's just a matter of following the instructions above +(and being patient). If not, let us know (via the discourse board) +where you have trouble so we can fix things. + +We're slowly moving development over to Eclipse, which will probably +include Ant because of cross-platform dependencies. As of release 0140, +major changes are being implemented to simplify the build process, +which should mean that we're pretty close. The environment and all +the libraries build properly with Eclipse, however we won't be +documenting it until the dust has settled. + +Some progress has been made by John Houck to get the scripts working +under ANT, progress can be tracked here: +http://dev.processing.org/bugs/show_bug.cgi?id=151 + + +//////////////////////////////////////////////////////////////////// + + +Ben Fry - Updated 10 June 2008 diff --git a/build/javadoc/core/allclasses-frame.html b/build/javadoc/core/allclasses-frame.html new file mode 100644 index 000000000..ae3faeefb --- /dev/null +++ b/build/javadoc/core/allclasses-frame.html @@ -0,0 +1,87 @@ + + + + + +All Classes + + + + + + + + + + +All Classes +
+ + + + + +
PApplet +
+PApplet.RendererChangeException +
+PConstants +
+PFont +
+PGraphics +
+PGraphics2D +
+PGraphics3D +
+PGraphicsJava2D +
+PImage +
+PLine +
+PMatrix +
+PMatrix2D +
+PMatrix3D +
+PPolygon +
+PShape +
+PShapeSVG +
+PSmoothTriangle +
+PStyle +
+PTriangle +
+PVector +
+StdXMLBuilder +
+StdXMLParser +
+StdXMLReader +
+XMLElement +
+XMLEntityResolver +
+XMLException +
+XMLParseException +
+XMLValidationException +
+XMLValidator +
+XMLWriter +
+
+ + + diff --git a/build/javadoc/core/allclasses-noframe.html b/build/javadoc/core/allclasses-noframe.html new file mode 100644 index 000000000..ccc1bc8b4 --- /dev/null +++ b/build/javadoc/core/allclasses-noframe.html @@ -0,0 +1,87 @@ + + + + + +All Classes + + + + + + + + + + +All Classes +
+ + + + + +
PApplet +
+PApplet.RendererChangeException +
+PConstants +
+PFont +
+PGraphics +
+PGraphics2D +
+PGraphics3D +
+PGraphicsJava2D +
+PImage +
+PLine +
+PMatrix +
+PMatrix2D +
+PMatrix3D +
+PPolygon +
+PShape +
+PShapeSVG +
+PSmoothTriangle +
+PStyle +
+PTriangle +
+PVector +
+StdXMLBuilder +
+StdXMLParser +
+StdXMLReader +
+XMLElement +
+XMLEntityResolver +
+XMLException +
+XMLParseException +
+XMLValidationException +
+XMLValidator +
+XMLWriter +
+
+ + + diff --git a/build/javadoc/core/constant-values.html b/build/javadoc/core/constant-values.html new file mode 100644 index 000000000..b4b099de8 --- /dev/null +++ b/build/javadoc/core/constant-values.html @@ -0,0 +1,1605 @@ + + + + + +Constant Field Values + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +


+
+

+Constant Field Values

+
+
+Contents + + + + + + +
+processing.core.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PApplet
+public static final java.lang.StringARGS_BGCOLOR"--bgcolor"
+public static final java.lang.StringARGS_DISPLAY"--display"
+public static final java.lang.StringARGS_EDITOR_LOCATION"--editor-location"
+public static final java.lang.StringARGS_EXCLUSIVE"--exclusive"
+public static final java.lang.StringARGS_EXTERNAL"--external"
+public static final java.lang.StringARGS_HIDE_STOP"--hide-stop"
+public static final java.lang.StringARGS_LOCATION"--location"
+public static final java.lang.StringARGS_PRESENT"--present"
+public static final java.lang.StringARGS_SKETCH_FOLDER"--sketch-path"
+public static final java.lang.StringARGS_STOP_COLOR"--stop-color"
+public static final intDEFAULT_HEIGHT100
+public static final intDEFAULT_WIDTH100
+public static final java.lang.StringEXTERNAL_MOVE"__MOVE__"
+public static final java.lang.StringEXTERNAL_STOP"__STOP__"
+public static final intMIN_WINDOW_HEIGHT128
+public static final intMIN_WINDOW_WIDTH128
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PConstants
+public static final intA6
+public static final intAB27
+public static final intADD2
+public static final intAG26
+public static final intALPHA4
+public static final intALPHA_MASK-16777216
+public static final intALT18
+public static final intAMBIENT0
+public static final intAR25
+public static final intARC32
+public static final intARGB2
+public static final intARROW0
+public static final intB5
+public static final charBACKSPACE8
+public static final intBASELINE0
+public static final intBEEN_LIT35
+public static final intBEVEL32
+public static final intBLEND1
+public static final intBLUE_MASK255
+public static final intBLUR11
+public static final intBOTTOM102
+public static final intBOX41
+public static final intBURN8192
+public static final intCENTER3
+public static final intCENTER_DIAMETER3
+public static final intCENTER_RADIUS2
+public static final intCHATTER0
+public static final intCLOSE2
+public static final intCMYK5
+public static final intCODED65535
+public static final intCOMPLAINT1
+public static final intCONTROL17
+public static final intCORNER0
+public static final intCORNERS1
+public static final intCROSS1
+public static final intCUSTOM0
+public static final intDA6
+public static final intDARKEST16
+public static final intDB5
+public static final floatDEG_TO_RAD0.01745329238474369f
+public static final charDELETE127
+public static final intDG4
+public static final intDIAMETER3
+public static final intDIFFERENCE32
+public static final intDILATE18
+public static final intDIRECTIONAL1
+public static final intDISABLE_ACCURATE_TEXTURES-7
+public static final intDISABLE_DEPTH_SORT-5
+public static final intDISABLE_DEPTH_TEST4
+public static final intDISABLE_OPENGL_2X_SMOOTH1
+public static final intDISABLE_OPENGL_ERROR_REPORT6
+public static final intDODGE4096
+public static final intDOWN40
+public static final intDR3
+public static final java.lang.StringDXF"processing.dxf.RawDXF"
+public static final intEB34
+public static final intEDGE12
+public static final intEG33
+public static final intELLIPSE31
+public static final intENABLE_ACCURATE_TEXTURES7
+public static final intENABLE_DEPTH_SORT5
+public static final intENABLE_DEPTH_TEST-4
+public static final intENABLE_NATIVE_FONTS3
+public static final intENABLE_OPENGL_2X_SMOOTH-1
+public static final intENABLE_OPENGL_4X_SMOOTH2
+public static final intENABLE_OPENGL_ERROR_REPORT-6
+public static final charENTER10
+public static final floatEPSILON9.999999747378752E-5f
+public static final intER32
+public static final intERODE17
+public static final java.lang.StringERROR_BACKGROUND_IMAGE_FORMAT"background images should be RGB or ARGB"
+public static final java.lang.StringERROR_BACKGROUND_IMAGE_SIZE"background image must be the same size as your application"
+public static final java.lang.StringERROR_PUSHMATRIX_OVERFLOW"Too many calls to pushMatrix()."
+public static final java.lang.StringERROR_PUSHMATRIX_UNDERFLOW"Too many calls to popMatrix(), and not enough to pushMatrix()."
+public static final java.lang.StringERROR_TEXTFONT_NULL_PFONT"A null PFont was passed to textFont()"
+public static final charESC27
+public static final intEXCLUSION64
+public static final intG4
+public static final intGIF3
+public static final intGRAY12
+public static final intGREEN_MASK65280
+public static final floatHALF_PI1.5707963705062866f
+public static final intHAND12
+public static final intHARD_LIGHT1024
+public static final intHINT_COUNT10
+public static final intHSB3
+public static final intIMAGE2
+public static final intINVERT13
+public static final java.lang.StringJAVA2D"processing.core.PGraphicsJava2D"
+public static final intJPEG2
+public static final intLEFT37
+public static final intLIGHTEST8
+public static final intLINE4
+public static final intLINES4
+public static final intLINUX3
+public static final intMACOSX2
+public static final floatMAX_FLOAT3.4028234663852886E38f
+public static final intMAX_INT2147483647
+public static final floatMIN_FLOAT-3.4028234663852886E38f
+public static final intMIN_INT-2147483648
+public static final intMITER8
+public static final intMODEL4
+public static final intMOVE13
+public static final intMULTIPLY128
+public static final intNORMAL1
+public static final intNORMALIZED1
+public static final intNX9
+public static final intNY10
+public static final intNZ11
+public static final intOPAQUE14
+public static final intOPEN1
+public static final java.lang.StringOPENGL"processing.opengl.PGraphicsOpenGL"
+public static final intORTHOGRAPHIC2
+public static final intOTHER0
+public static final intOVERLAY512
+public static final java.lang.StringP2D"processing.core.PGraphics2D"
+public static final java.lang.StringP3D"processing.core.PGraphics3D"
+public static final intPATH21
+public static final java.lang.StringPDF"processing.pdf.PGraphicsPDF"
+public static final intPERSPECTIVE3
+public static final floatPI3.1415927410125732f
+public static final intPOINT2
+public static final intPOINTS2
+public static final intPOLYGON20
+public static final intPOSTERIZE15
+public static final intPROBLEM2
+public static final intPROJECT4
+public static final intQUAD16
+public static final intQUAD_STRIP17
+public static final intQUADS16
+public static final floatQUARTER_PI0.7853981852531433f
+public static final intR3
+public static final floatRAD_TO_DEG57.2957763671875f
+public static final intRADIUS2
+public static final intRECT30
+public static final intRED_MASK16711680
+public static final intREPLACE0
+public static final charRETURN13
+public static final intRGB1
+public static final intRIGHT39
+public static final intROUND2
+public static final intSA16
+public static final intSB15
+public static final intSCREEN256
+public static final intSG14
+public static final intSHAPE5
+public static final intSHIFT16
+public static final intSHINE31
+public static final intSOFT_LIGHT2048
+public static final intSPB30
+public static final intSPG29
+public static final intSPHERE40
+public static final intSPOT3
+public static final intSPR28
+public static final intSQUARE1
+public static final intSR13
+public static final intSUBTRACT4
+public static final intSW17
+public static final charTAB9
+public static final intTARGA1
+public static final intTEXT2
+public static final floatTHIRD_PI1.0471975803375244f
+public static final intTHRESHOLD16
+public static final intTIFF0
+public static final intTOP101
+public static final intTRIANGLE8
+public static final intTRIANGLE_FAN11
+public static final intTRIANGLE_STRIP10
+public static final intTRIANGLES9
+public static final floatTWO_PI6.2831854820251465f
+public static final intTX18
+public static final intTY19
+public static final intTZ20
+public static final intU7
+public static final intUP38
+public static final intV8
+public static final intVERTEX_FIELD_COUNT36
+public static final intVW24
+public static final intVX21
+public static final intVY22
+public static final intVZ23
+public static final intWAIT3
+public static final java.lang.StringWHITESPACE" \t\n\r\f\u00a0"
+public static final intWINDOWS1
+public static final intX0
+public static final intY1
+public static final intZ2
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PGraphics3D
+public static final intMAX_LIGHTS8
+public static final intTRI_COLOR_COUNT7
+public static final intTRI_DIFFUSE_A3
+public static final intTRI_DIFFUSE_B2
+public static final intTRI_DIFFUSE_G1
+public static final intTRI_DIFFUSE_R0
+public static final intTRI_SPECULAR_B6
+public static final intTRI_SPECULAR_G5
+public static final intTRI_SPECULAR_R4
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PShape
+public static final intBEZIER_VERTEX1
+public static final intBREAK3
+public static final intCURVE_VERTEX2
+public static final intGEOMETRY3
+public static final intGROUP0
+public static final intPATH2
+public static final intPRIMITIVE1
+public static final intVERTEX0
+ +

+ +

+ + + + + +
+processing.xml.*
+ +

+ + + + + + + + + + + + +
processing.xml.XMLElement
+public static final intNO_LINE-1
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.xml.XMLValidationException
+public static final intATTRIBUTE_WITH_INVALID_VALUE5
+public static final intMISC_ERROR0
+public static final intMISSING_ATTRIBUTE3
+public static final intMISSING_ELEMENT1
+public static final intMISSING_PCDATA6
+public static final intUNEXPECTED_ATTRIBUTE4
+public static final intUNEXPECTED_ELEMENT2
+public static final intUNEXPECTED_PCDATA7
+ +

+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/deprecated-list.html b/build/javadoc/core/deprecated-list.html new file mode 100644 index 000000000..9323d4dfc --- /dev/null +++ b/build/javadoc/core/deprecated-list.html @@ -0,0 +1,194 @@ + + + + + +Deprecated List + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents + + + + + + + + + + + + + + + +
+Deprecated Fields
processing.core.PConstants.CENTER_DIAMETER +
+          Use DIAMETER instead. 
processing.core.PConstants.CENTER_RADIUS +
+          Use RADIUS instead. 
processing.core.PConstants.NORMALIZED +
+          use NORMAL instead 
+  +

+ + + + + + + + + + + + + + + + + +
+Deprecated Methods
processing.core.PApplet.arraycopy(Object, int, Object, int, int) +
+          Use arrayCopy() instead. 
processing.core.PApplet.arraycopy(Object, Object) +
+          Use arrayCopy() instead. 
processing.core.PApplet.arraycopy(Object, Object, int) +
+          Use arrayCopy() instead. 
processing.core.PApplet.openStream(String) +
+          As of release 0136, use createInput() instead. 
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/help-doc.html b/build/javadoc/core/help-doc.html new file mode 100644 index 000000000..95e3d1459 --- /dev/null +++ b/build/javadoc/core/help-doc.html @@ -0,0 +1,212 @@ + + + + + +API Help + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Overview

+
+ +

+The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

    +
  • Interfaces (italic)
  • Classes
  • Enums
  • Exceptions
  • Errors
  • Annotation Types
+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description +

    +

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary +

    +

  • Field Detail
  • Constructor Detail
  • Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

    +
  • Annotation Type declaration
  • Annotation Type description
  • Required Element Summary
  • Optional Element Summary
  • Element Detail
+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

    +
  • Enum declaration
  • Enum description
  • Enum Constant Summary
  • Enum Constant Detail
+
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
    +
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/index-all.html b/build/javadoc/core/index-all.html new file mode 100644 index 000000000..15efbfc21 --- /dev/null +++ b/build/javadoc/core/index-all.html @@ -0,0 +1,5954 @@ + + + + + +Index + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+

+A

+
+
A - +Static variable in interface processing.core.PConstants +
  +
AB - +Static variable in interface processing.core.PConstants +
  +
abs(float) - +Static method in class processing.core.PApplet +
  +
abs(int) - +Static method in class processing.core.PApplet +
  +
acos(float) - +Static method in class processing.core.PApplet +
  +
add(Object, Method) - +Method in class processing.core.PApplet.RegisteredMethods +
  +
ADD - +Static variable in interface processing.core.PConstants +
  +
add(PVector) - +Method in class processing.core.PVector +
Add a vector to this vector +
add(float, float, float) - +Method in class processing.core.PVector +
  +
add(PVector, PVector) - +Static method in class processing.core.PVector +
Add two vectors +
add(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
Add two vectors into a target vector +
addAttribute(String, String, String, String, String) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a new attribute of an XML element is + encountered. +
addChild(PShape) - +Method in class processing.core.PShape +
  +
addChild(XMLElement) - +Method in class processing.xml.XMLElement +
Adds a child element. +
addExternalEntity(String, String, String) - +Method in class processing.xml.XMLEntityResolver +
Adds an external entity. +
addInternalEntity(String, String) - +Method in class processing.xml.XMLEntityResolver +
Adds an internal entity. +
addListeners() - +Method in class processing.core.PApplet +
  +
addPCData(Reader, String, int) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a PCDATA element is encountered. +
AG - +Static variable in interface processing.core.PConstants +
  +
alpha(int) - +Method in class processing.core.PApplet +
  +
ALPHA - +Static variable in interface processing.core.PConstants +
  +
alpha(int) - +Method in class processing.core.PGraphics +
  +
ALPHA_MASK - +Static variable in interface processing.core.PConstants +
  +
ALT - +Static variable in interface processing.core.PConstants +
  +
ambient(int) - +Method in class processing.core.PApplet +
  +
ambient(float) - +Method in class processing.core.PApplet +
  +
ambient(float, float, float) - +Method in class processing.core.PApplet +
  +
AMBIENT - +Static variable in interface processing.core.PConstants +
  +
ambient(int) - +Method in class processing.core.PGraphics +
  +
ambient(float) - +Method in class processing.core.PGraphics +
  +
ambient(float, float, float) - +Method in class processing.core.PGraphics +
  +
ambientB - +Variable in class processing.core.PGraphics +
  +
ambientB - +Variable in class processing.core.PStyle +
  +
ambientG - +Variable in class processing.core.PGraphics +
  +
ambientG - +Variable in class processing.core.PStyle +
  +
ambientLight(float, float, float) - +Method in class processing.core.PApplet +
  +
ambientLight(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
ambientLight(float, float, float) - +Method in class processing.core.PGraphics +
  +
ambientLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
ambientLight(float, float, float) - +Method in class processing.core.PGraphics3D +
Add an ambient light based on the current color mode. +
ambientLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Add an ambient light based on the current color mode. +
ambientR - +Variable in class processing.core.PGraphics +
  +
ambientR - +Variable in class processing.core.PStyle +
  +
angleBetween(PVector, PVector) - +Static method in class processing.core.PVector +
Calculate the angle between two vectors, using the dot product +
append(byte[], byte) - +Static method in class processing.core.PApplet +
  +
append(char[], char) - +Static method in class processing.core.PApplet +
  +
append(int[], int) - +Static method in class processing.core.PApplet +
  +
append(float[], float) - +Static method in class processing.core.PApplet +
  +
append(String[], String) - +Static method in class processing.core.PApplet +
  +
append(Object, Object) - +Static method in class processing.core.PApplet +
  +
apply(PMatrix) - +Method in interface processing.core.PMatrix +
Multiply this matrix by another. +
apply(PMatrix2D) - +Method in interface processing.core.PMatrix +
  +
apply(PMatrix3D) - +Method in interface processing.core.PMatrix +
  +
apply(float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
apply(PMatrix) - +Method in class processing.core.PMatrix2D +
  +
apply(PMatrix2D) - +Method in class processing.core.PMatrix2D +
  +
apply(PMatrix3D) - +Method in class processing.core.PMatrix2D +
  +
apply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
apply(PMatrix) - +Method in class processing.core.PMatrix3D +
  +
apply(PMatrix2D) - +Method in class processing.core.PMatrix3D +
  +
apply(PMatrix3D) - +Method in class processing.core.PMatrix3D +
  +
apply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
apply(PMatrix3D) - +Method in class processing.core.PShape +
  +
applyMatrix(PMatrix) - +Method in class processing.core.PApplet +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PApplet +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
applyMatrix(PMatrix3D) - +Method in class processing.core.PApplet +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
applyMatrix(PMatrix) - +Method in class processing.core.PGraphics +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PGraphics +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Apply a 3x2 affine transformation matrix. +
applyMatrix(PMatrix3D) - +Method in class processing.core.PGraphics +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Apply a 4x4 transformation matrix. +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
Apply a 3x2 affine transformation matrix. +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PGraphics3D +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
applyMatrix(PMatrix3D) - +Method in class processing.core.PGraphics3D +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Apply a 4x4 transformation matrix. +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
applyMatrix(PMatrix) - +Method in class processing.core.PShape +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PShape +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PShape +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PShape +
  +
AR - +Static variable in interface processing.core.PConstants +
  +
arc(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
ARC - +Static variable in interface processing.core.PConstants +
  +
arc(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Identical parameters and placement to ellipse, + but draws only an arc of that ellipse. +
ARGB - +Static variable in interface processing.core.PConstants +
  +
args - +Variable in class processing.core.PApplet +
Command line options passed in from main(). +
ARGS_BGCOLOR - +Static variable in class processing.core.PApplet +
  +
ARGS_DISPLAY - +Static variable in class processing.core.PApplet +
  +
ARGS_EDITOR_LOCATION - +Static variable in class processing.core.PApplet +
Position of the upper-lefthand corner of the editor window + that launched this applet. +
ARGS_EXCLUSIVE - +Static variable in class processing.core.PApplet +
  +
ARGS_EXTERNAL - +Static variable in class processing.core.PApplet +
Location for where to position the applet window on screen. +
ARGS_HIDE_STOP - +Static variable in class processing.core.PApplet +
  +
ARGS_LOCATION - +Static variable in class processing.core.PApplet +
  +
ARGS_PRESENT - +Static variable in class processing.core.PApplet +
  +
ARGS_SKETCH_FOLDER - +Static variable in class processing.core.PApplet +
Allows the user or PdeEditor to set a specific sketch folder path. +
ARGS_STOP_COLOR - +Static variable in class processing.core.PApplet +
  +
array() - +Method in class processing.core.PVector +
Return a representation of this vector as a float array. +
arrayCopy(Object, int, Object, int, int) - +Static method in class processing.core.PApplet +
Calls System.arraycopy(), included here so that we can + avoid people needing to learn about the System object + before they can just copy an array. +
arrayCopy(Object, Object, int) - +Static method in class processing.core.PApplet +
Convenience method for arraycopy(). +
arrayCopy(Object, Object) - +Static method in class processing.core.PApplet +
Shortcut to copy the entire contents of + the source into the destination array. +
arraycopy(Object, int, Object, int, int) - +Static method in class processing.core.PApplet +
Deprecated. Use arrayCopy() instead. +
arraycopy(Object, Object, int) - +Static method in class processing.core.PApplet +
Deprecated. Use arrayCopy() instead. +
arraycopy(Object, Object) - +Static method in class processing.core.PApplet +
Deprecated. Use arrayCopy() instead. +
ARROW - +Static variable in interface processing.core.PConstants +
  +
ascent - +Variable in class processing.core.PFont +
  +
ascent() - +Method in class processing.core.PFont +
Returns the ascent of this font from the baseline. +
asin(float) - +Static method in class processing.core.PApplet +
  +
atan(float) - +Static method in class processing.core.PApplet +
  +
atan2(float, float) - +Static method in class processing.core.PApplet +
  +
atEOF() - +Method in class processing.xml.StdXMLReader +
Returns true if there are no more characters left to be read. +
atEOFOfCurrentStream() - +Method in class processing.xml.StdXMLReader +
Returns true if the current stream has no more characters left to be + read. +
ATTRIBUTE_WITH_INVALID_VALUE - +Static variable in exception processing.xml.XMLValidationException +
An attribute has an invalid value. +
attributeAdded(String, String, String, int) - +Method in class processing.xml.XMLValidator +
Indicates that an attribute has been added to the current element. +
+
+

+B

+
+
B - +Static variable in interface processing.core.PConstants +
  +
background(int) - +Method in class processing.core.PApplet +
  +
background(int, float) - +Method in class processing.core.PApplet +
  +
background(float) - +Method in class processing.core.PApplet +
  +
background(float, float) - +Method in class processing.core.PApplet +
  +
background(float, float, float) - +Method in class processing.core.PApplet +
  +
background(float, float, float, float) - +Method in class processing.core.PApplet +
  +
background(PImage) - +Method in class processing.core.PApplet +
  +
background(int) - +Method in class processing.core.PGraphics +
Set the background to a gray or ARGB color. +
background(int, float) - +Method in class processing.core.PGraphics +
See notes about alpha in background(x, y, z, a). +
background(float) - +Method in class processing.core.PGraphics +
Set the background to a grayscale value, based on the + current colorMode. +
background(float, float) - +Method in class processing.core.PGraphics +
See notes about alpha in background(x, y, z, a). +
background(float, float, float) - +Method in class processing.core.PGraphics +
Set the background to an r, g, b or h, s, b value, + based on the current colorMode. +
background(float, float, float, float) - +Method in class processing.core.PGraphics +
Clear the background with a color that includes an alpha value. +
background(PImage) - +Method in class processing.core.PGraphics +
Takes an RGB or ARGB image and sets it as the background. +
backgroundColor - +Variable in class processing.core.PGraphics +
Last background color that was set, zero if an image +
backgroundImpl() - +Method in class processing.core.PGraphicsJava2D +
  +
BACKSPACE - +Static variable in interface processing.core.PConstants +
  +
BASELINE - +Static variable in interface processing.core.PConstants +
Default vertical alignment for text placement +
BEEN_LIT - +Static variable in interface processing.core.PConstants +
  +
beginCamera() - +Method in class processing.core.PApplet +
  +
beginCamera() - +Method in class processing.core.PGraphics +
  +
beginCamera() - +Method in class processing.core.PGraphics3D +
Set matrix mode to the camera matrix (instead of the current + transformation matrix). +
beginDraw() - +Method in class processing.core.PGraphics +
Prepares the PGraphics for drawing. +
beginDraw() - +Method in class processing.core.PGraphics2D +
  +
beginDraw() - +Method in class processing.core.PGraphics3D +
  +
beginDraw() - +Method in class processing.core.PGraphicsJava2D +
  +
beginRaw(String, String) - +Method in class processing.core.PApplet +
Begin recording raw shape data to a renderer of the specified type, + using the width and height of the main drawing surface. +
beginRaw(PGraphics) - +Method in class processing.core.PApplet +
Begin recording raw shape data to the specified renderer. +
beginRaw(PGraphics) - +Method in class processing.core.PGraphics +
Record individual lines and triangles by echoing them to another renderer. +
beginRaw(PGraphics) - +Method in class processing.core.PGraphicsJava2D +
  +
beginRecord(String, String) - +Method in class processing.core.PApplet +
Begin recording to a new renderer of the specified type, using the width + and height of the main drawing surface. +
beginRecord(PGraphics) - +Method in class processing.core.PApplet +
Begin recording (echoing) commands to the specified PGraphics object. +
beginShape() - +Method in class processing.core.PApplet +
  +
beginShape(int) - +Method in class processing.core.PApplet +
  +
beginShape() - +Method in class processing.core.PGraphics +
Start a new shape of type POLYGON +
beginShape(int) - +Method in class processing.core.PGraphics +
Start a new shape. +
beginShape(int) - +Method in class processing.core.PGraphics2D +
  +
beginShape(int) - +Method in class processing.core.PGraphics3D +
  +
beginShape(int) - +Method in class processing.core.PGraphicsJava2D +
  +
BEVEL - +Static variable in interface processing.core.PConstants +
  +
bezier(float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezier(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Draw a cubic bezier curve. +
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
BEZIER_VERTEX - +Static variable in class processing.core.PShape +
  +
bezierDetail(int) - +Method in class processing.core.PApplet +
  +
bezierDetail - +Variable in class processing.core.PGraphics +
  +
bezierDetail(int) - +Method in class processing.core.PGraphics +
  +
bezierDetail(int) - +Method in class processing.core.PGraphicsJava2D +
Ignored (not needed) in Java 2D. +
bezierPoint(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierPoint(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Evalutes quadratic bezier at point t for points a, b, c, d. +
bezierTangent(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierTangent(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Provide the tangent at the given point on the bezier curve. +
bezierVertex(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierVertex(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierVertex(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
bezierVertex(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
bezierVertex(float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
bezierVertex(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
binary(byte) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of a byte. +
binary(char) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of a char. +
binary(int) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of an int. +
binary(int, int) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of an int. +
blend(int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
blend(PImage, int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
BLEND - +Static variable in interface processing.core.PConstants +
  +
blend(int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Blends one area of this image to another area. +
blend(PImage, int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Copies area of one image into another PImage object. +
blendColor(int, int, int) - +Static method in class processing.core.PApplet +
  +
blendColor(int, int, int) - +Static method in class processing.core.PImage +
Blend two colors based on a particular mode. +
blue(int) - +Method in class processing.core.PApplet +
  +
blue(int) - +Method in class processing.core.PGraphics +
  +
BLUE_MASK - +Static variable in interface processing.core.PConstants +
  +
BLUR - +Static variable in interface processing.core.PConstants +
  +
BOTTOM - +Static variable in interface processing.core.PConstants +
Align text from the bottom, using the baseline. +
box(float) - +Method in class processing.core.PApplet +
  +
box(float, float, float) - +Method in class processing.core.PApplet +
  +
BOX - +Static variable in interface processing.core.PConstants +
  +
box(float) - +Method in class processing.core.PGraphics +
  +
box(float, float, float) - +Method in class processing.core.PGraphics +
  +
box(float) - +Method in class processing.core.PGraphics2D +
  +
box(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
box(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
box(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
BREAK - +Static variable in class processing.core.PShape +
  +
breakShape() - +Method in class processing.core.PApplet +
  +
breakShape() - +Method in class processing.core.PGraphics +
This feature is in testing, do not use or rely upon its implementation +
breakShape() - +Method in class processing.core.PGraphics2D +
  +
breakShape() - +Method in class processing.core.PGraphicsJava2D +
  +
brightness(int) - +Method in class processing.core.PApplet +
  +
brightness(int) - +Method in class processing.core.PGraphics +
  +
BURN - +Static variable in interface processing.core.PConstants +
  +
+
+

+C

+
+
camera() - +Method in class processing.core.PApplet +
  +
camera(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
camera() - +Method in class processing.core.PGraphics +
  +
camera(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
camera - +Variable in class processing.core.PGraphics3D +
The camera matrix, the modelview will be set to this on beginDraw. +
camera() - +Method in class processing.core.PGraphics3D +
Set camera to the default settings. +
camera(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
More flexible method for dealing with camera(). +
cameraAspect - +Variable in class processing.core.PGraphics3D +
Aspect ratio of camera's view. +
cameraFar - +Variable in class processing.core.PGraphics3D +
  +
cameraFOV - +Variable in class processing.core.PGraphics3D +
Camera field of view. +
cameraNear - +Variable in class processing.core.PGraphics3D +
  +
cameraX - +Variable in class processing.core.PGraphics3D +
Position of the camera. +
cameraY - +Variable in class processing.core.PGraphics3D +
Position of the camera. +
cameraZ - +Variable in class processing.core.PGraphics3D +
Position of the camera. +
canDraw() - +Method in class processing.core.PGraphics +
Some renderers have requirements re: when they are ready to draw. +
canDraw() - +Method in class processing.core.PGraphics2D +
  +
canDraw() - +Method in class processing.core.PGraphicsJava2D +
  +
ceil(float) - +Static method in class processing.core.PApplet +
  +
CENTER - +Static variable in interface processing.core.PConstants +
Draw from the center, using second pair of values as the diameter. +
CENTER_DIAMETER - +Static variable in interface processing.core.PConstants +
Deprecated. Use DIAMETER instead. +
CENTER_RADIUS - +Static variable in interface processing.core.PConstants +
Deprecated. Use RADIUS instead. +
charCount - +Variable in class processing.core.PFont +
  +
CHATTER - +Static variable in interface processing.core.PConstants +
  +
clone() - +Method in class processing.core.PImage +
Duplicate an image, returns new PImage object. +
CLOSE - +Static variable in interface processing.core.PConstants +
  +
CMYK - +Static variable in interface processing.core.PConstants +
  +
CODED - +Static variable in interface processing.core.PConstants +
  +
color(int) - +Method in class processing.core.PApplet +
  +
color(float) - +Method in class processing.core.PApplet +
  +
color(int, int) - +Method in class processing.core.PApplet +
As of 0116 this also takes color(#FF8800, alpha) +
color(float, float) - +Method in class processing.core.PApplet +
  +
color(int, int, int) - +Method in class processing.core.PApplet +
  +
color(float, float, float) - +Method in class processing.core.PApplet +
  +
color(int, int, int, int) - +Method in class processing.core.PApplet +
  +
color(float, float, float, float) - +Method in class processing.core.PApplet +
  +
color(int) - +Method in class processing.core.PGraphics +
  +
color(float) - +Method in class processing.core.PGraphics +
  +
color(int, int) - +Method in class processing.core.PGraphics +
  +
color(int, float) - +Method in class processing.core.PGraphics +
  +
color(float, float) - +Method in class processing.core.PGraphics +
  +
color(int, int, int) - +Method in class processing.core.PGraphics +
  +
color(float, float, float) - +Method in class processing.core.PGraphics +
  +
color(int, int, int, int) - +Method in class processing.core.PGraphics +
  +
color(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
colorMode(int) - +Method in class processing.core.PApplet +
  +
colorMode(int, float) - +Method in class processing.core.PApplet +
  +
colorMode(int, float, float, float) - +Method in class processing.core.PApplet +
  +
colorMode(int, float, float, float, float) - +Method in class processing.core.PApplet +
  +
colorMode - +Variable in class processing.core.PGraphics +
The current colorMode +
colorMode(int) - +Method in class processing.core.PGraphics +
Callback to handle clearing the background when begin/endRaw is in use. +
colorMode(int, float) - +Method in class processing.core.PGraphics +
  +
colorMode(int, float, float, float) - +Method in class processing.core.PGraphics +
Set the colorMode and the maximum values for (r, g, b) + or (h, s, b). +
colorMode(int, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
colorMode - +Variable in class processing.core.PStyle +
  +
colorModeA - +Variable in class processing.core.PGraphics +
Max value for alpha set by colorMode +
colorModeA - +Variable in class processing.core.PStyle +
  +
colorModeX - +Variable in class processing.core.PGraphics +
Max value for red (or hue) set by colorMode +
colorModeX - +Variable in class processing.core.PStyle +
  +
colorModeY - +Variable in class processing.core.PGraphics +
Max value for green (or saturation) set by colorMode +
colorModeY - +Variable in class processing.core.PStyle +
  +
colorModeZ - +Variable in class processing.core.PGraphics +
Max value for blue (or value) set by colorMode +
colorModeZ - +Variable in class processing.core.PStyle +
  +
COMPLAINT - +Static variable in interface processing.core.PConstants +
  +
concat(boolean[], boolean[]) - +Static method in class processing.core.PApplet +
  +
concat(byte[], byte[]) - +Static method in class processing.core.PApplet +
  +
concat(char[], char[]) - +Static method in class processing.core.PApplet +
  +
concat(int[], int[]) - +Static method in class processing.core.PApplet +
  +
concat(float[], float[]) - +Static method in class processing.core.PApplet +
  +
concat(String[], String[]) - +Static method in class processing.core.PApplet +
  +
concat(Object, Object) - +Static method in class processing.core.PApplet +
  +
constrain(int, int, int) - +Static method in class processing.core.PApplet +
  +
constrain(float, float, float) - +Static method in class processing.core.PApplet +
  +
CONTROL - +Static variable in interface processing.core.PConstants +
  +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
copy(PImage, int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Copy things from one area of this image + to another area in the same image. +
copy(PImage, int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Copies area of one image into another PImage object. +
CORNER - +Static variable in interface processing.core.PConstants +
Draw mode convention to use (x, y) to (width, height) +
CORNERS - +Static variable in interface processing.core.PConstants +
Draw mode convention to use (x1, y1) to (x2, y2) coordinates +
cos(float) - +Static method in class processing.core.PApplet +
  +
createElement(String, String) - +Method in class processing.xml.XMLElement +
Creates an empty element. +
createElement(String, String, String, int) - +Method in class processing.xml.XMLElement +
Creates an empty element. +
createFont(String, float) - +Method in class processing.core.PApplet +
  +
createFont(String, float, boolean) - +Method in class processing.core.PApplet +
  +
createFont(String, float, boolean, char[]) - +Method in class processing.core.PApplet +
Create a .vlw font on the fly from either a font name that's + installed on the system, or from a .ttf or .otf that's inside + the data folder of this sketch. +
createGraphics(int, int, String) - +Method in class processing.core.PApplet +
Create an offscreen PGraphics object for drawing. +
createGraphics(int, int, String, String) - +Method in class processing.core.PApplet +
Create an offscreen graphics surface for drawing, in this case + for a renderer that writes to a file (such as PDF or DXF). +
createImage(int, int, int) - +Method in class processing.core.PApplet +
Preferred method of creating new PImage objects, ensures that a + reference to the parent PApplet is included, which makes save() work + without needing an absolute path. +
createInput(String) - +Method in class processing.core.PApplet +
Simplified method to open a Java InputStream. +
createInput(File) - +Static method in class processing.core.PApplet +
  +
createInputRaw(String) - +Method in class processing.core.PApplet +
Call openStream() without automatic gzip decompression. +
createOutput(String) - +Method in class processing.core.PApplet +
Similar to createInput() (formerly openStream), this creates a Java + OutputStream for a given filename or path. +
createOutput(File) - +Static method in class processing.core.PApplet +
  +
createPath(String) - +Static method in class processing.core.PApplet +
Takes a path and creates any in-between folders if they don't + already exist. +
createPath(File) - +Static method in class processing.core.PApplet +
  +
createPCDataElement() - +Method in class processing.xml.XMLElement +
Creates an element to be used for #PCDATA content. +
createReader(String) - +Method in class processing.core.PApplet +
I want to read lines from a file. +
createReader(File) - +Static method in class processing.core.PApplet +
I want to read lines from a file. +
createReader(InputStream) - +Static method in class processing.core.PApplet +
I want to read lines from a stream. +
createWriter(String) - +Method in class processing.core.PApplet +
I want to print lines to a file. +
createWriter(File) - +Static method in class processing.core.PApplet +
I want to print lines to a file. +
createWriter(OutputStream) - +Static method in class processing.core.PApplet +
I want to print lines to a file. +
CROSS - +Static variable in interface processing.core.PConstants +
  +
cross(PVector) - +Method in class processing.core.PVector +
Return a vector composed of the cross product between this and another. +
cross(PVector, PVector) - +Method in class processing.core.PVector +
Perform cross product between this and another vector, and store the + result in 'target'. +
cross(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
  +
currentLightFalloffConstant - +Variable in class processing.core.PGraphics3D +
Current light falloff +
currentLightFalloffLinear - +Variable in class processing.core.PGraphics3D +
  +
currentLightFalloffQuadratic - +Variable in class processing.core.PGraphics3D +
  +
currentLightSpecular - +Variable in class processing.core.PGraphics3D +
Current specular color for lighting +
cursor(int) - +Method in class processing.core.PApplet +
Set the cursor type +
cursor(PImage) - +Method in class processing.core.PApplet +
Replace the cursor with the specified PImage. +
cursor(PImage, int, int) - +Method in class processing.core.PApplet +
Set a custom cursor to an image with a specific hotspot. +
cursor() - +Method in class processing.core.PApplet +
Show the cursor after noCursor() was called. +
curve(float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curve(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curve(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Draws a segment of Catmull-Rom curve. +
curve(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
curve(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
CURVE_VERTEX - +Static variable in class processing.core.PShape +
  +
curveDetail(int) - +Method in class processing.core.PApplet +
  +
curveDetail(int) - +Method in class processing.core.PGraphics +
  +
curveDetail(int) - +Method in class processing.core.PGraphicsJava2D +
Ignored (not needed) in Java 2D. +
curvePoint(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curvePoint(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Get a location along a catmull-rom curve segment. +
curveTangent(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curveTangent(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Calculate the tangent at a t value (0..1) on a Catmull-Rom curve. +
curveTightness(float) - +Method in class processing.core.PApplet +
  +
curveTightness - +Variable in class processing.core.PGraphics +
  +
curveTightness(float) - +Method in class processing.core.PGraphics +
  +
curveVertex(float, float) - +Method in class processing.core.PApplet +
  +
curveVertex(float, float, float) - +Method in class processing.core.PApplet +
  +
curveVertex(float, float) - +Method in class processing.core.PGraphics +
  +
curveVertex(float, float, float) - +Method in class processing.core.PGraphics +
  +
curveVertex(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
CUSTOM - +Static variable in interface processing.core.PConstants +
  +
+
+

+D

+
+
DA - +Static variable in interface processing.core.PConstants +
  +
DARKEST - +Static variable in interface processing.core.PConstants +
  +
dataFile(String) - +Method in class processing.core.PApplet +
Return a full path to an item in the data folder as a File object. +
dataPath(String) - +Method in class processing.core.PApplet +
Return a full path to an item in the data folder. +
day() - +Static method in class processing.core.PApplet +
Get the current day of the month (1 through 31). +
DB - +Static variable in interface processing.core.PConstants +
  +
DEFAULT_CHARSET - +Static variable in class processing.core.PFont +
The default Processing character set. +
DEFAULT_HEIGHT - +Static variable in class processing.core.PApplet +
  +
DEFAULT_WIDTH - +Static variable in class processing.core.PApplet +
Default width and height for applet when not specified +
defaultSize - +Variable in class processing.core.PApplet +
true if no size() command has been executed. +
DEG_TO_RAD - +Static variable in interface processing.core.PConstants +
  +
degrees(float) - +Static method in class processing.core.PApplet +
  +
delay(int) - +Method in class processing.core.PApplet +
The delay() function causes the program to halt for a specified time. +
DELETE - +Static variable in interface processing.core.PConstants +
  +
descent - +Variable in class processing.core.PFont +
  +
descent() - +Method in class processing.core.PFont +
Returns how far this font descends from the baseline. +
destroy() - +Method in class processing.core.PApplet +
Called by the browser or applet viewer to inform this applet + that it is being reclaimed and that it should destroy + any resources that it has allocated. +
determinant() - +Method in interface processing.core.PMatrix +
  +
determinant() - +Method in class processing.core.PMatrix2D +
  +
determinant() - +Method in class processing.core.PMatrix3D +
  +
DG - +Static variable in interface processing.core.PConstants +
  +
DIAMETER - +Static variable in interface processing.core.PConstants +
Synonym for the CENTER constant. +
die(String) - +Method in class processing.core.PApplet +
Function for an applet/application to kill itself and + display an error. +
die(String, Exception) - +Method in class processing.core.PApplet +
Same as above but with an exception. +
DIFFERENCE - +Static variable in interface processing.core.PConstants +
  +
DILATE - +Static variable in interface processing.core.PConstants +
  +
DIRECTIONAL - +Static variable in interface processing.core.PConstants +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
DISABLE_ACCURATE_TEXTURES - +Static variable in interface processing.core.PConstants +
  +
DISABLE_DEPTH_SORT - +Static variable in interface processing.core.PConstants +
  +
DISABLE_DEPTH_TEST - +Static variable in interface processing.core.PConstants +
  +
DISABLE_OPENGL_2X_SMOOTH - +Static variable in interface processing.core.PConstants +
  +
DISABLE_OPENGL_ERROR_REPORT - +Static variable in interface processing.core.PConstants +
  +
disableStyle() - +Method in class processing.core.PShape +
Overrides this shape's style information and uses PGraphics styles and + colors. +
displayable() - +Method in class processing.core.PApplet +
  +
displayable() - +Method in class processing.core.PGraphics +
Return true if this renderer should be drawn to the screen. +
dispose() - +Method in class processing.core.PGraphics +
Handle any takedown for this graphics context. +
dist(float, float, float, float) - +Static method in class processing.core.PApplet +
  +
dist(float, float, float, float, float, float) - +Static method in class processing.core.PApplet +
  +
dist(PVector) - +Method in class processing.core.PVector +
Calculate the Euclidean distance between two points (considering a point as a vector object) +
dist(PVector, PVector) - +Static method in class processing.core.PVector +
Calculate the Euclidean distance between two points (considering a point as a vector object) +
div(float) - +Method in class processing.core.PVector +
Divide this vector by a scalar +
div(PVector, float) - +Static method in class processing.core.PVector +
Divide a vector by a scalar and return the result in a new vector. +
div(PVector, float, PVector) - +Static method in class processing.core.PVector +
  +
div(PVector) - +Method in class processing.core.PVector +
Divide each element of one vector by the elements of another vector. +
div(PVector, PVector) - +Static method in class processing.core.PVector +
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +
div(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
Divide each element of one vector by the individual elements of another + vector, and write the result into a target vector. +
DODGE - +Static variable in interface processing.core.PConstants +
  +
dot(PVector) - +Method in class processing.core.PVector +
Calculate the dot product with another vector +
dot(float, float, float) - +Method in class processing.core.PVector +
  +
DOWN - +Static variable in interface processing.core.PConstants +
  +
DR - +Static variable in interface processing.core.PConstants +
  +
draw() - +Method in class processing.core.PApplet +
  +
draw() - +Method in class processing.core.PLine +
  +
draw(PGraphics) - +Method in class processing.core.PShape +
Called by the following (the shape() command adds the g) + PShape s = loadShapes("blah.svg"); + shape(s); +
drawImpl(PGraphics) - +Method in class processing.core.PShape +
Draws the SVG document. +
DXF - +Static variable in interface processing.core.PConstants +
  +
+
+

+E

+
+
EB - +Static variable in interface processing.core.PConstants +
  +
edge(boolean) - +Method in class processing.core.PApplet +
  +
EDGE - +Static variable in interface processing.core.PConstants +
  +
edge - +Variable in class processing.core.PGraphics +
  +
edge(boolean) - +Method in class processing.core.PGraphics +
Sets whether the upcoming vertex is part of an edge. +
EG - +Static variable in interface processing.core.PConstants +
  +
elementAttributesProcessed(String, String, String) - +Method in class processing.xml.StdXMLBuilder +
This method is called when the attributes of an XML element have been + processed. +
elementAttributesProcessed(String, Properties, String, int) - +Method in class processing.xml.XMLValidator +
This method is called when the attributes of an XML element have been + processed. +
elementEnded(String, String, int) - +Method in class processing.xml.XMLValidator +
Indicates that the current element has ended. +
elementStarted(String, String, int) - +Method in class processing.xml.XMLValidator +
Indicates that an element has been started. +
ellipse(float, float, float, float) - +Method in class processing.core.PApplet +
  +
ELLIPSE - +Static variable in interface processing.core.PConstants +
  +
ellipse(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
ellipseMode(int) - +Method in class processing.core.PApplet +
  +
ellipseMode - +Variable in class processing.core.PGraphics +
The current ellipse mode (read-only) +
ellipseMode(int) - +Method in class processing.core.PGraphics +
  +
ellipseMode - +Variable in class processing.core.PStyle +
  +
emissive(int) - +Method in class processing.core.PApplet +
  +
emissive(float) - +Method in class processing.core.PApplet +
  +
emissive(float, float, float) - +Method in class processing.core.PApplet +
  +
emissive(int) - +Method in class processing.core.PGraphics +
  +
emissive(float) - +Method in class processing.core.PGraphics +
  +
emissive(float, float, float) - +Method in class processing.core.PGraphics +
  +
emissiveB - +Variable in class processing.core.PGraphics +
  +
emissiveB - +Variable in class processing.core.PStyle +
  +
emissiveG - +Variable in class processing.core.PGraphics +
  +
emissiveG - +Variable in class processing.core.PStyle +
  +
emissiveR - +Variable in class processing.core.PGraphics +
  +
emissiveR - +Variable in class processing.core.PStyle +
  +
ENABLE_ACCURATE_TEXTURES - +Static variable in interface processing.core.PConstants +
  +
ENABLE_DEPTH_SORT - +Static variable in interface processing.core.PConstants +
  +
ENABLE_DEPTH_TEST - +Static variable in interface processing.core.PConstants +
  +
ENABLE_NATIVE_FONTS - +Static variable in interface processing.core.PConstants +
  +
ENABLE_OPENGL_2X_SMOOTH - +Static variable in interface processing.core.PConstants +
  +
ENABLE_OPENGL_4X_SMOOTH - +Static variable in interface processing.core.PConstants +
  +
ENABLE_OPENGL_ERROR_REPORT - +Static variable in interface processing.core.PConstants +
  +
enableStyle() - +Method in class processing.core.PShape +
Re-enables style information (fill and stroke) set in the shape. +
endCamera() - +Method in class processing.core.PApplet +
  +
endCamera() - +Method in class processing.core.PGraphics +
  +
endCamera() - +Method in class processing.core.PGraphics3D +
Record the current settings into the camera matrix, and set + the matrix mode back to the current transformation matrix. +
endDraw() - +Method in class processing.core.PGraphics +
This will finalize rendering so that it can be shown on-screen. +
endDraw() - +Method in class processing.core.PGraphics2D +
  +
endDraw() - +Method in class processing.core.PGraphics3D +
See notes in PGraphics. +
endDraw() - +Method in class processing.core.PGraphicsJava2D +
  +
endElement(String, String, String) - +Method in class processing.xml.StdXMLBuilder +
This method is called when the end of an XML elemnt is encountered. +
endRaw() - +Method in class processing.core.PApplet +
Stop recording raw shape data to the specified renderer. +
endRaw() - +Method in class processing.core.PGraphics +
  +
endRaw() - +Method in class processing.core.PGraphicsJava2D +
  +
endRecord() - +Method in class processing.core.PApplet +
  +
endShape() - +Method in class processing.core.PApplet +
  +
endShape(int) - +Method in class processing.core.PApplet +
  +
endShape() - +Method in class processing.core.PGraphics +
  +
endShape(int) - +Method in class processing.core.PGraphics +
  +
endShape(int) - +Method in class processing.core.PGraphics2D +
  +
endShape(int) - +Method in class processing.core.PGraphics3D +
  +
endShape(int) - +Method in class processing.core.PGraphicsJava2D +
  +
ENTER - +Static variable in interface processing.core.PConstants +
  +
enumerateAttributeNames() - +Method in class processing.xml.XMLElement +
Returns an enumeration of all attribute names. +
enumerateChildren() - +Method in class processing.xml.XMLElement +
Returns an enumeration of all child elements. +
EPSILON - +Static variable in interface processing.core.PConstants +
  +
equals(Object) - +Method in class processing.xml.XMLElement +
Returns true if the element equals another element. +
equalsXMLElement(XMLElement) - +Method in class processing.xml.XMLElement +
Returns true if the element equals another element. +
ER - +Static variable in interface processing.core.PConstants +
  +
ERODE - +Static variable in interface processing.core.PConstants +
  +
ERROR_BACKGROUND_IMAGE_FORMAT - +Static variable in interface processing.core.PConstants +
  +
ERROR_BACKGROUND_IMAGE_SIZE - +Static variable in interface processing.core.PConstants +
  +
ERROR_PUSHMATRIX_OVERFLOW - +Static variable in interface processing.core.PConstants +
  +
ERROR_PUSHMATRIX_UNDERFLOW - +Static variable in interface processing.core.PConstants +
  +
ERROR_TEXTFONT_NULL_PFONT - +Static variable in interface processing.core.PConstants +
  +
ESC - +Static variable in interface processing.core.PConstants +
  +
EXCLUSION - +Static variable in interface processing.core.PConstants +
  +
exec(String[]) - +Static method in class processing.core.PApplet +
  +
exit() - +Method in class processing.core.PApplet +
Call to safely exit the sketch when finished. +
exp(float) - +Static method in class processing.core.PApplet +
  +
expand(boolean[]) - +Static method in class processing.core.PApplet +
  +
expand(boolean[], int) - +Static method in class processing.core.PApplet +
  +
expand(byte[]) - +Static method in class processing.core.PApplet +
  +
expand(byte[], int) - +Static method in class processing.core.PApplet +
  +
expand(char[]) - +Static method in class processing.core.PApplet +
  +
expand(char[], int) - +Static method in class processing.core.PApplet +
  +
expand(int[]) - +Static method in class processing.core.PApplet +
  +
expand(int[], int) - +Static method in class processing.core.PApplet +
  +
expand(float[]) - +Static method in class processing.core.PApplet +
  +
expand(float[], int) - +Static method in class processing.core.PApplet +
  +
expand(String[]) - +Static method in class processing.core.PApplet +
  +
expand(String[], int) - +Static method in class processing.core.PApplet +
  +
expand(Object) - +Static method in class processing.core.PApplet +
  +
expand(Object, int) - +Static method in class processing.core.PApplet +
  +
EXTERNAL_MOVE - +Static variable in class processing.core.PApplet +
When run externally to a PDE Editor, this is sent by the applet + whenever the window is moved. +
EXTERNAL_STOP - +Static variable in class processing.core.PApplet +
When run externally to a PdeEditor, + this is sent by the applet when it quits. +
+
+

+F

+
+
fileReader(String) - +Static method in class processing.xml.StdXMLReader +
Creates a new reader using a file as input. +
fill(int) - +Method in class processing.core.PApplet +
  +
fill(int, float) - +Method in class processing.core.PApplet +
  +
fill(float) - +Method in class processing.core.PApplet +
  +
fill(float, float) - +Method in class processing.core.PApplet +
  +
fill(float, float, float) - +Method in class processing.core.PApplet +
  +
fill(float, float, float, float) - +Method in class processing.core.PApplet +
  +
fill - +Variable in class processing.core.PGraphics +
true if fill() is enabled, (read-only) +
fill(int) - +Method in class processing.core.PGraphics +
Set the fill to either a grayscale value or an ARGB int. +
fill(int, float) - +Method in class processing.core.PGraphics +
  +
fill(float) - +Method in class processing.core.PGraphics +
  +
fill(float, float) - +Method in class processing.core.PGraphics +
  +
fill(float, float, float) - +Method in class processing.core.PGraphics +
  +
fill(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
fill - +Variable in class processing.core.PStyle +
  +
fillColor - +Variable in class processing.core.PGraphics +
fill that was last set (read-only) +
fillColor - +Variable in class processing.core.PStyle +
  +
fillGradient - +Variable in class processing.core.PGraphicsJava2D +
  +
fillGradientObject - +Variable in class processing.core.PGraphicsJava2D +
  +
filter(int) - +Method in class processing.core.PApplet +
  +
filter(int, float) - +Method in class processing.core.PApplet +
  +
filter(int) - +Method in class processing.core.PImage +
Method to apply a variety of basic filters to this image. +
filter(int, float) - +Method in class processing.core.PImage +
Method to apply a variety of basic filters to this image. +
findChild(String) - +Method in class processing.core.PShape +
Same as getChild(name), except that it first walks all the way up the + hierarchy to the farthest parent, so that children can be found anywhere. +
findFont() - +Method in class processing.core.PFont +
Attempt to find the native version of this font. +
findFont(String) - +Static method in class processing.core.PFont +
Starting with Java 1.5, Apple broke the ability to specify most fonts. +
finished - +Variable in class processing.core.PApplet +
true if this applet has had it. +
firstMouse - +Variable in class processing.core.PApplet +
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump. +
floor(float) - +Static method in class processing.core.PApplet +
  +
flush() - +Method in class processing.core.PApplet +
  +
flush() - +Method in class processing.core.PGraphics +
  +
flush() - +Method in class processing.core.PGraphics3D +
Emit any sorted geometry that's been collected on this frame. +
focused - +Variable in class processing.core.PApplet +
Gets set to true/false as the applet gains/loses focus. +
focusGained() - +Method in class processing.core.PApplet +
  +
focusGained(FocusEvent) - +Method in class processing.core.PApplet +
  +
focusLost() - +Method in class processing.core.PApplet +
  +
focusLost(FocusEvent) - +Method in class processing.core.PApplet +
  +
format - +Variable in class processing.core.PImage +
Format for this image, one of RGB, ARGB or ALPHA. +
frame - +Variable in class processing.core.PApplet +
The frame containing this applet (if any) +
frameCount - +Variable in class processing.core.PApplet +
How many frames have been displayed since the applet started. +
frameRate - +Variable in class processing.core.PApplet +
The current value of frames per second. +
frameRate(float) - +Method in class processing.core.PApplet +
Set a target frameRate. +
frustum(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
frustum(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
frustum(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Same as glFrustum(), except that it wipes out (rather than + multiplies against) the current perspective matrix. +
+
+

+G

+
+
g - +Variable in class processing.core.PApplet +
The PGraphics renderer associated with this PApplet +
G - +Static variable in interface processing.core.PConstants +
  +
g2 - +Variable in class processing.core.PGraphicsJava2D +
  +
GEOMETRY - +Static variable in class processing.core.PShape +
Collections of vertices created with beginShape(). +
get(int, int) - +Method in class processing.core.PApplet +
  +
get(int, int, int, int) - +Method in class processing.core.PApplet +
  +
get() - +Method in class processing.core.PApplet +
  +
get(int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
get() - +Method in class processing.core.PGraphicsJava2D +
  +
get(int, int) - +Method in class processing.core.PImage +
Returns an ARGB "color" type (a packed 32 bit int with the color. +
get(int, int, int, int) - +Method in class processing.core.PImage +
Grab a subsection of a PImage, and copy it into a fresh PImage. +
get() - +Method in class processing.core.PImage +
Returns a copy of this PImage. +
get() - +Method in interface processing.core.PMatrix +
Returns a copy of this PMatrix. +
get(float[]) - +Method in interface processing.core.PMatrix +
Copies the matrix contents into a float array. +
get() - +Method in class processing.core.PMatrix2D +
Returns a copy of this PMatrix. +
get(float[]) - +Method in class processing.core.PMatrix2D +
Copies the matrix contents into a 6 entry float array. +
get() - +Method in class processing.core.PMatrix3D +
Returns a copy of this PMatrix. +
get(float[]) - +Method in class processing.core.PMatrix3D +
Copies the matrix contents into a 16 entry float array. +
get() - +Method in class processing.core.PVector +
Get a copy of this vector. +
get(float[]) - +Method in class processing.core.PVector +
  +
getAttribute(String) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getAttribute(String, String) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getAttribute(String, String, String) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getAttributeCount() - +Method in class processing.xml.XMLElement +
Returns the number of attributes. +
getAttributeName() - +Method in exception processing.xml.XMLValidationException +
Returns the name of the attribute in which the validation is violated. +
getAttributeNamespace(String) - +Method in class processing.xml.XMLElement +
Returns the namespace of an attribute. +
getAttributes() - +Method in class processing.xml.XMLElement +
Returns all attributes as a Properties object. +
getAttributesInNamespace(String) - +Method in class processing.xml.XMLElement +
Returns all attributes in a specific namespace as a Properties object. +
getAttributeType(String) - +Method in class processing.xml.XMLElement +
Returns the type of an attribute. +
getAttributeType(String, String) - +Method in class processing.xml.XMLElement +
Returns the type of an attribute. +
getAttributeValue() - +Method in exception processing.xml.XMLValidationException +
Returns the value of the attribute in which the validation is violated. +
getBuilder() - +Method in class processing.xml.StdXMLParser +
Returns the builder which creates the logical structure of the XML data. +
getCache(Object) - +Method in class processing.core.PApplet +
  +
getCache(Object) - +Method in class processing.core.PImage +
Get cache storage data for the specified renderer. +
getChild(int) - +Method in class processing.core.PShape +
  +
getChild(String) - +Method in class processing.core.PShape +
  +
getChild(String) - +Method in class processing.core.PShapeSVG +
Get a particular element based on its SVG ID. +
getChild(int) - +Method in class processing.xml.XMLElement +
Quick accessor for an element at a particular index. +
getChild(String) - +Method in class processing.xml.XMLElement +
Get a child by its name or path. +
getChildAtIndex(int) - +Method in class processing.xml.XMLElement +
Returns the child at a specific index. +
getChildCount() - +Method in class processing.core.PShape +
  +
getChildCount() - +Method in class processing.xml.XMLElement +
Returns the number of children. +
getChildren() - +Method in class processing.xml.XMLElement +
Returns an array containing all the child elements. +
getChildren(String) - +Method in class processing.xml.XMLElement +
Get any children that match this name or path. +
getContent() - +Method in class processing.xml.XMLElement +
Return the #PCDATA content of the element. +
getDoubleAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getDoubleAttribute(String, double) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getDoubleAttribute(String, String, double) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getElementName() - +Method in exception processing.xml.XMLValidationException +
Returns the name of the element in which the validation is violated. +
getEntity(StdXMLReader, String) - +Method in class processing.xml.XMLEntityResolver +
Returns a Java reader containing the value of an entity. +
getException() - +Method in exception processing.xml.XMLException +
Returns the encapsulated exception, or null if no exception is + encapsulated. +
getFloatAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getFloatAttribute(String, float) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getFloatAttribute(String, String, float) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getFont() - +Method in class processing.core.PFont +
Return the native java.awt.Font associated with this PFont (if any). +
getHeight() - +Method in class processing.core.PShape +
Get the height of the drawing area (not necessarily the shape boundary). +
getImage() - +Method in class processing.core.PImage +
Returns a BufferedImage from this PImage. +
getImpl(int, int, int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
getIntAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getIntAttribute(String, int) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getIntAttribute(String, String, int) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getLineNr() - +Method in class processing.xml.StdXMLReader +
Returns the line number of the data in the current stream. +
getLineNr() - +Method in class processing.xml.XMLElement +
Returns the line number in the data where the element started. +
getLineNr() - +Method in exception processing.xml.XMLException +
Returns the line number in the XML data where the exception occurred. +
getLocalName() - +Method in class processing.xml.XMLElement +
Returns the name of the element. +
getMatrix() - +Method in class processing.core.PApplet +
  +
getMatrix(PMatrix2D) - +Method in class processing.core.PApplet +
  +
getMatrix(PMatrix3D) - +Method in class processing.core.PApplet +
  +
getMatrix() - +Method in class processing.core.PGraphics +
  +
getMatrix(PMatrix2D) - +Method in class processing.core.PGraphics +
Copy the current transformation matrix into the specified target. +
getMatrix(PMatrix3D) - +Method in class processing.core.PGraphics +
Copy the current transformation matrix into the specified target. +
getMatrix() - +Method in class processing.core.PGraphics3D +
  +
getMatrix(PMatrix3D) - +Method in class processing.core.PGraphics3D +
  +
getMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
getMatrix(PMatrix2D) - +Method in class processing.core.PGraphicsJava2D +
  +
getMatrix(PMatrix3D) - +Method in class processing.core.PGraphicsJava2D +
  +
getName() - +Method in class processing.core.PShape +
  +
getName() - +Method in class processing.xml.XMLElement +
Returns the full name (i.e. +
getNamespace() - +Method in class processing.xml.XMLElement +
Returns the namespace of the element. +
getParameterEntityResolver() - +Method in class processing.xml.XMLValidator +
Returns the parameter entity resolver. +
getParent() - +Method in class processing.xml.XMLElement +
Returns the parent element. +
getPublicID() - +Method in class processing.xml.StdXMLReader +
Returns the current public ID. +
getReader() - +Method in class processing.xml.StdXMLParser +
Returns the reader from which the parser retrieves its data. +
getResolver() - +Method in class processing.xml.StdXMLParser +
Returns the entity resolver. +
getResult() - +Method in class processing.xml.StdXMLBuilder +
Returns the result of the building process. +
getSketchHeight() - +Method in class processing.core.PApplet +
  +
getSketchRenderer() - +Method in class processing.core.PApplet +
  +
getSketchWidth() - +Method in class processing.core.PApplet +
  +
getStreamLevel() - +Method in class processing.xml.StdXMLReader +
Returns the current "level" of the stream on the stack of streams. +
getStringAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getStringAttribute(String, String) - +Method in class processing.xml.XMLElement +
  +
getStringAttribute(String, String, String) - +Method in class processing.xml.XMLElement +
  +
getStyle() - +Method in class processing.core.PGraphics +
  +
getStyle(PStyle) - +Method in class processing.core.PGraphics +
  +
getSystemID() - +Method in class processing.xml.StdXMLReader +
Returns the current system ID. +
getSystemID() - +Method in class processing.xml.XMLElement +
Returns the system ID of the data where the element started. +
getSystemID() - +Method in exception processing.xml.XMLException +
Returns the system ID of the XML data where the exception occurred. +
getValidator() - +Method in class processing.xml.StdXMLParser +
Returns the validator that validates the XML data. +
getWidth() - +Method in class processing.core.PShape +
Get the width of the drawing area (not necessarily the shape boundary). +
GIF - +Static variable in interface processing.core.PConstants +
  +
GRAY - +Static variable in interface processing.core.PConstants +
  +
green(int) - +Method in class processing.core.PApplet +
  +
green(int) - +Method in class processing.core.PGraphics +
  +
GREEN_MASK - +Static variable in interface processing.core.PConstants +
  +
GROUP - +Static variable in class processing.core.PShape +
Generic, only draws its child objects. +
+
+

+H

+
+
HALF_PI - +Static variable in interface processing.core.PConstants +
  +
HAND - +Static variable in interface processing.core.PConstants +
  +
handle() - +Method in class processing.core.PApplet.RegisteredMethods +
  +
handle(Object[]) - +Method in class processing.core.PApplet.RegisteredMethods +
  +
handleDraw() - +Method in class processing.core.PApplet +
  +
HARD_LIGHT - +Static variable in interface processing.core.PConstants +
  +
hasAttribute(String) - +Method in class processing.xml.XMLElement +
Returns whether an attribute exists. +
hasAttribute(String, String) - +Method in class processing.xml.XMLElement +
Returns whether an attribute exists. +
hasChildren() - +Method in class processing.xml.XMLElement +
Returns whether the element has children. +
heading2D() - +Method in class processing.core.PVector +
Calculate the angle of rotation for this vector (only 2D vectors) +
height - +Variable in class processing.core.PApplet +
height of this applet's associated PGraphics +
height - +Variable in class processing.core.PFont +
  +
height - +Variable in class processing.core.PImage +
  +
height - +Variable in class processing.core.PShape +
  +
hex(byte) - +Static method in class processing.core.PApplet +
  +
hex(char) - +Static method in class processing.core.PApplet +
  +
hex(int) - +Static method in class processing.core.PApplet +
  +
hex(int, int) - +Static method in class processing.core.PApplet +
  +
hint(int) - +Method in class processing.core.PApplet +
  +
hint(int) - +Method in class processing.core.PGraphics +
Enable a hint option. +
hint(int) - +Method in class processing.core.PGraphics3D +
  +
HINT_COUNT - +Static variable in interface processing.core.PConstants +
  +
hour() - +Static method in class processing.core.PApplet +
Hour position of the current time in international format (0-23). +
HSB - +Static variable in interface processing.core.PConstants +
  +
hue(int) - +Method in class processing.core.PApplet +
  +
hue(int) - +Method in class processing.core.PGraphics +
  +
+
+

+I

+
+
ICON_IMAGE - +Static variable in class processing.core.PApplet +
GIF image of the Processing logo. +
image(PImage, float, float) - +Method in class processing.core.PApplet +
  +
image(PImage, float, float, float, float) - +Method in class processing.core.PApplet +
  +
image(PImage, float, float, float, float, int, int, int, int) - +Method in class processing.core.PApplet +
  +
IMAGE - +Static variable in interface processing.core.PConstants +
texture coordinates based on image width/height +
image - +Variable in class processing.core.PGraphics +
Java AWT Image object associated with this renderer. +
image(PImage, float, float) - +Method in class processing.core.PGraphics +
  +
image(PImage, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
image(PImage, float, float, float, float, int, int, int, int) - +Method in class processing.core.PGraphics +
Draw an image(), also specifying u/v coordinates. +
imageMode(int) - +Method in class processing.core.PApplet +
  +
imageMode - +Variable in class processing.core.PGraphics +
The current image alignment (read-only) +
imageMode(int) - +Method in class processing.core.PGraphics +
The mode can only be set to CORNERS, CORNER, and CENTER. +
imageMode - +Variable in class processing.core.PStyle +
  +
images - +Variable in class processing.core.PFont +
  +
index(char) - +Method in class processing.core.PFont +
Get index for the char (convert from unicode to bagel charset). +
init() - +Method in class processing.core.PApplet +
  +
init(int, int, int) - +Method in class processing.core.PImage +
Function to be used by subclasses of PImage to init later than + at the constructor, or re-init later when things changes. +
insertChild(XMLElement, int) - +Method in class processing.xml.XMLElement +
Inserts a child element. +
INTERPOLATE_ALPHA - +Variable in class processing.core.PLine +
  +
INTERPOLATE_ALPHA - +Variable in class processing.core.PTriangle +
  +
INTERPOLATE_RGB - +Variable in class processing.core.PLine +
  +
INTERPOLATE_RGB - +Variable in class processing.core.PTriangle +
  +
INTERPOLATE_THICK - +Variable in class processing.core.PLine +
  +
INTERPOLATE_UV - +Variable in class processing.core.PTriangle +
  +
INTERPOLATE_Z - +Variable in class processing.core.PLine +
  +
INVERT - +Static variable in interface processing.core.PConstants +
  +
invert() - +Method in interface processing.core.PMatrix +
Invert this matrix. +
invert() - +Method in class processing.core.PMatrix2D +
Invert this matrix. +
invert() - +Method in class processing.core.PMatrix3D +
Invert this matrix. +
is2D() - +Method in class processing.core.PGraphics +
Return true if this renderer supports 2D drawing. +
is2D() - +Method in class processing.core.PGraphics3D +
  +
is3D() - +Method in class processing.core.PGraphics +
Return true if this renderer supports 2D drawing. +
is3D() - +Method in class processing.core.PGraphics3D +
  +
isExternalEntity(String) - +Method in class processing.xml.XMLEntityResolver +
Returns true if an entity is external. +
isLeaf() - +Method in class processing.xml.XMLElement +
Returns whether the element is a leaf element. +
isModified() - +Method in class processing.core.PImage +
  +
isVisible() - +Method in class processing.core.PShape +
  +
+
+

+J

+
+
JAVA2D - +Static variable in interface processing.core.PConstants +
  +
javaVersion - +Static variable in class processing.core.PApplet +
Version of Java that's in use, whether 1.1 or 1.3 or whatever, + stored as a float. +
javaVersionName - +Static variable in class processing.core.PApplet +
Full name of the Java version (i.e. +
join(String[], char) - +Static method in class processing.core.PApplet +
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +
join(String[], String) - +Static method in class processing.core.PApplet +
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +
JPEG - +Static variable in interface processing.core.PConstants +
  +
+
+

+K

+
+
kern(char, char) - +Method in class processing.core.PFont +
Currently un-implemented for .vlw fonts, + but honored for layout in case subclasses use it. +
key - +Variable in class processing.core.PApplet +
Last key pressed. +
keyCode - +Variable in class processing.core.PApplet +
When "key" is set to CODED, this will contain a Java key code. +
keyEvent - +Variable in class processing.core.PApplet +
the last KeyEvent object passed into a mouse function. +
keyPressed - +Variable in class processing.core.PApplet +
true if the mouse is currently pressed. +
keyPressed(KeyEvent) - +Method in class processing.core.PApplet +
Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + 'keyCode', and 'keyEvent' variables to no longer work; + key events will no longer be queued until the end of draw(); + and the keyPressed(), keyReleased() and keyTyped() methods + will no longer be called. +
keyPressed() - +Method in class processing.core.PApplet +
Called each time a single key on the keyboard is pressed. +
keyReleased(KeyEvent) - +Method in class processing.core.PApplet +
  +
keyReleased() - +Method in class processing.core.PApplet +
See keyPressed(). +
keyTyped(KeyEvent) - +Method in class processing.core.PApplet +
  +
keyTyped() - +Method in class processing.core.PApplet +
Only called for "regular" keys like letters, + see keyPressed() for full documentation. +
+
+

+L

+
+
LEFT - +Static variable in interface processing.core.PConstants +
  +
leftExtent - +Variable in class processing.core.PFont +
  +
lerp(float, float, float) - +Static method in class processing.core.PApplet +
  +
lerpColor(int, int, float) - +Method in class processing.core.PApplet +
  +
lerpColor(int, int, float, int) - +Static method in class processing.core.PApplet +
  +
lerpColor(int, int, float) - +Method in class processing.core.PGraphics +
Interpolate between two colors, using the current color mode. +
lerpColor(int, int, float, int) - +Static method in class processing.core.PGraphics +
Interpolate between two colors. +
lightCount - +Variable in class processing.core.PGraphics3D +
  +
lightDiffuse - +Variable in class processing.core.PGraphics3D +
Diffuse colors for lights. +
LIGHTEST - +Static variable in interface processing.core.PConstants +
  +
lightFalloff(float, float, float) - +Method in class processing.core.PApplet +
  +
lightFalloff(float, float, float) - +Method in class processing.core.PGraphics +
  +
lightFalloff(float, float, float) - +Method in class processing.core.PGraphics3D +
Set the light falloff rates for the last light that was created. +
lightFalloffConstant - +Variable in class processing.core.PGraphics3D +
Light falloff +
lightFalloffLinear - +Variable in class processing.core.PGraphics3D +
  +
lightFalloffQuadratic - +Variable in class processing.core.PGraphics3D +
  +
lightNormal - +Variable in class processing.core.PGraphics3D +
Light direction (normalized vector) +
lightPosition - +Variable in class processing.core.PGraphics3D +
Light positions +
lights() - +Method in class processing.core.PApplet +
  +
lights() - +Method in class processing.core.PGraphics +
  +
lights() - +Method in class processing.core.PGraphics3D +
Sets up an ambient and directional light. +
lightSpecular(float, float, float) - +Method in class processing.core.PApplet +
  +
lightSpecular(float, float, float) - +Method in class processing.core.PGraphics +
  +
lightSpecular - +Variable in class processing.core.PGraphics3D +
Specular colors for lights. +
lightSpecular(float, float, float) - +Method in class processing.core.PGraphics3D +
Set the specular color of the last light created. +
lightSpotAngle - +Variable in class processing.core.PGraphics3D +
Light spot angle +
lightSpotAngleCos - +Variable in class processing.core.PGraphics3D +
Cosine of light spot angle +
lightSpotConcentration - +Variable in class processing.core.PGraphics3D +
Light spot concentration +
lightType - +Variable in class processing.core.PGraphics3D +
Light types +
limit(float) - +Method in class processing.core.PVector +
Limit the magnitude of this vector +
line(float, float, float, float) - +Method in class processing.core.PApplet +
  +
line(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
LINE - +Static variable in interface processing.core.PConstants +
  +
line(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
line(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
line - +Variable in class processing.core.PGraphics3D +
  +
line(float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
lineClipping() - +Method in class processing.core.PLine +
  +
LINES - +Static variable in interface processing.core.PConstants +
  +
link(String) - +Method in class processing.core.PApplet +
  +
link(String, String) - +Method in class processing.core.PApplet +
Link to an external page without all the muss. +
LINUX - +Static variable in interface processing.core.PConstants +
  +
list() - +Static method in class processing.core.PFont +
Get a list of the fonts installed on the system that can be used + by Java. +
listChildren() - +Method in class processing.xml.XMLElement +
Put the names of all children into an array. +
loadBytes(String) - +Method in class processing.core.PApplet +
  +
loadBytes(InputStream) - +Static method in class processing.core.PApplet +
  +
loadBytes(File) - +Static method in class processing.core.PApplet +
  +
loadFont(String) - +Method in class processing.core.PApplet +
  +
loadFonts() - +Static method in class processing.core.PFont +
  +
loadImage(String) - +Method in class processing.core.PApplet +
Load an image from the data folder or a local directory. +
loadImage(String, String) - +Method in class processing.core.PApplet +
Identical to loadImage, but allows you to specify the type of + image by its extension. +
loadPixels() - +Method in class processing.core.PApplet +
Override the g.pixels[] function to set the pixels[] array + that's part of the PApplet object. +
loadPixels() - +Method in class processing.core.PGraphicsJava2D +
  +
loadPixels() - +Method in class processing.core.PImage +
Call this when you want to mess with the pixels[] array. +
loadShape(String) - +Method in class processing.core.PApplet +
Load a geometry from a file as a PShape. +
loadStrings(File) - +Static method in class processing.core.PApplet +
  +
loadStrings(String) - +Method in class processing.core.PApplet +
Load data from a file and shove it into a String array. +
loadStrings(InputStream) - +Static method in class processing.core.PApplet +
  +
log(float) - +Static method in class processing.core.PApplet +
  +
loop() - +Method in class processing.core.PApplet +
  +
+
+

+M

+
+
m00 - +Variable in class processing.core.PMatrix2D +
  +
m00 - +Variable in class processing.core.PMatrix3D +
  +
m01 - +Variable in class processing.core.PMatrix2D +
  +
m01 - +Variable in class processing.core.PMatrix3D +
  +
m02 - +Variable in class processing.core.PMatrix2D +
  +
m02 - +Variable in class processing.core.PMatrix3D +
  +
m03 - +Variable in class processing.core.PMatrix3D +
  +
m10 - +Variable in class processing.core.PMatrix2D +
  +
m10 - +Variable in class processing.core.PMatrix3D +
  +
m11 - +Variable in class processing.core.PMatrix2D +
  +
m11 - +Variable in class processing.core.PMatrix3D +
  +
m12 - +Variable in class processing.core.PMatrix2D +
  +
m12 - +Variable in class processing.core.PMatrix3D +
  +
m13 - +Variable in class processing.core.PMatrix3D +
  +
m20 - +Variable in class processing.core.PMatrix3D +
  +
m21 - +Variable in class processing.core.PMatrix3D +
  +
m22 - +Variable in class processing.core.PMatrix3D +
  +
m23 - +Variable in class processing.core.PMatrix3D +
  +
m30 - +Variable in class processing.core.PMatrix3D +
  +
m31 - +Variable in class processing.core.PMatrix3D +
  +
m32 - +Variable in class processing.core.PMatrix3D +
  +
m33 - +Variable in class processing.core.PMatrix3D +
  +
m_drawFlags - +Variable in class processing.core.PLine +
  +
m_drawFlags - +Variable in class processing.core.PTriangle +
  +
MACOSX - +Static variable in interface processing.core.PConstants +
  +
mag(float, float) - +Static method in class processing.core.PApplet +
  +
mag(float, float, float) - +Static method in class processing.core.PApplet +
  +
mag() - +Method in class processing.core.PVector +
Calculate the magnitude (length) of the vector +
main(String[]) - +Static method in class processing.core.PApplet +
main() method for running this class from the command line. +
map(float, float, float, float, float) - +Static method in class processing.core.PApplet +
Convenience function to map a variable from one coordinate space + to another. +
mask(int[]) - +Method in class processing.core.PApplet +
  +
mask(PImage) - +Method in class processing.core.PApplet +
  +
mask(int[]) - +Method in class processing.core.PGraphicsJava2D +
  +
mask(PImage) - +Method in class processing.core.PGraphicsJava2D +
  +
mask(int[]) - +Method in class processing.core.PImage +
Set alpha channel for an image. +
mask(PImage) - +Method in class processing.core.PImage +
Set alpha channel for an image using another image as the source. +
match(String, String) - +Static method in class processing.core.PApplet +
Match a string with a regular expression, and returns the match as an + array. +
matchAll(String, String) - +Static method in class processing.core.PApplet +
Identical to match(), except that it returns an array of all matches in + the specified String, rather than just the first. +
max(int, int) - +Static method in class processing.core.PApplet +
  +
max(float, float) - +Static method in class processing.core.PApplet +
  +
max(int, int, int) - +Static method in class processing.core.PApplet +
  +
max(float, float, float) - +Static method in class processing.core.PApplet +
  +
max(int[]) - +Static method in class processing.core.PApplet +
Find the maximum value in an array. +
max(float[]) - +Static method in class processing.core.PApplet +
Find the maximum value in an array. +
MAX_FLOAT - +Static variable in interface processing.core.PConstants +
Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + and to avoid teaching static methods on the first day. +
MAX_INT - +Static variable in interface processing.core.PConstants +
Largest possible (positive) integer value +
MAX_LIGHTS - +Static variable in class processing.core.PGraphics3D +
Maximum lights by default is 8, which is arbitrary for this renderer, + but is the minimum defined by OpenGL +
mbox2 - +Variable in class processing.core.PFont +
next power of 2 over the max image size (usually 64) +
MENU_SHORTCUT - +Static variable in class processing.core.PApplet +
Modifier flags for the shortcut key used to trigger menus. +
millis() - +Method in class processing.core.PApplet +
Get the number of milliseconds since the applet started. +
min(int, int) - +Static method in class processing.core.PApplet +
  +
min(float, float) - +Static method in class processing.core.PApplet +
  +
min(int, int, int) - +Static method in class processing.core.PApplet +
  +
min(float, float, float) - +Static method in class processing.core.PApplet +
  +
min(int[]) - +Static method in class processing.core.PApplet +
Find the minimum value in an array. +
min(float[]) - +Static method in class processing.core.PApplet +
Find the minimum value in an array. +
MIN_FLOAT - +Static variable in interface processing.core.PConstants +
Note that Float.MIN_VALUE is the smallest positive value + for a floating point number, not actually the minimum (negative) value + for a float. +
MIN_INT - +Static variable in interface processing.core.PConstants +
Smallest possible (negative) integer value +
MIN_WINDOW_HEIGHT - +Static variable in class processing.core.PApplet +
  +
MIN_WINDOW_WIDTH - +Static variable in class processing.core.PApplet +
Minimum dimensions for the window holding an applet. +
minute() - +Static method in class processing.core.PApplet +
Minutes position of the current time. +
MISC_ERROR - +Static variable in exception processing.xml.XMLValidationException +
Another error than those specified in this class was encountered. +
MISSING_ATTRIBUTE - +Static variable in exception processing.xml.XMLValidationException +
An attribute was missing. +
MISSING_ELEMENT - +Static variable in exception processing.xml.XMLValidationException +
An element was missing. +
MISSING_PCDATA - +Static variable in exception processing.xml.XMLValidationException +
A PCDATA element was missing. +
MITER - +Static variable in interface processing.core.PConstants +
  +
MODEL - +Static variable in interface processing.core.PConstants +
textMode(MODEL) is the default, meaning that characters + will be affected by transformations like any other shapes. +
modelview - +Variable in class processing.core.PGraphics3D +
The modelview matrix. +
modelviewInv - +Variable in class processing.core.PGraphics3D +
Inverse modelview matrix, used for lighting. +
modelX(float, float, float) - +Method in class processing.core.PApplet +
  +
modelX(float, float, float) - +Method in class processing.core.PGraphics +
Returns the model space x value for an x, y, z coordinate. +
modelX(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
modelY(float, float, float) - +Method in class processing.core.PApplet +
  +
modelY(float, float, float) - +Method in class processing.core.PGraphics +
Returns the model space y value for an x, y, z coordinate. +
modelY(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
modelZ(float, float, float) - +Method in class processing.core.PApplet +
  +
modelZ(float, float, float) - +Method in class processing.core.PGraphics +
Returns the model space z value for an x, y, z coordinate. +
modelZ(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
month() - +Static method in class processing.core.PApplet +
Get the current month in range 1 through 12. +
mouseButton - +Variable in class processing.core.PApplet +
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. +
mouseClicked(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseClicked() - +Method in class processing.core.PApplet +
When the mouse is clicked, mousePressed() will be called, + then mouseReleased(), then mouseClicked(). +
mouseDragged(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseDragged() - +Method in class processing.core.PApplet +
Mouse button is pressed and the mouse has been dragged. +
mouseEntered(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseEvent - +Variable in class processing.core.PApplet +
  +
mouseExited(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseMoved(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseMoved() - +Method in class processing.core.PApplet +
Mouse button is not pressed but the mouse has changed locations. +
mousePressed - +Variable in class processing.core.PApplet +
  +
mousePressed(MouseEvent) - +Method in class processing.core.PApplet +
If you override this or any function that takes a "MouseEvent e" + without calling its super.mouseXxxx() then mouseX, mouseY, + mousePressed, and mouseEvent will no longer be set. +
mousePressed() - +Method in class processing.core.PApplet +
Mouse has been pressed, and should be considered "down" + until mouseReleased() is called. +
mouseReleased(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseReleased() - +Method in class processing.core.PApplet +
Mouse button has been released. +
mouseX - +Variable in class processing.core.PApplet +
current x position of the mouse +
mouseY - +Variable in class processing.core.PApplet +
current y position of the mouse +
MOVE - +Static variable in interface processing.core.PConstants +
  +
mult(PVector, PVector) - +Method in interface processing.core.PMatrix +
Multiply a PVector by this matrix. +
mult(float[], float[]) - +Method in interface processing.core.PMatrix +
Multiply a multi-element vector against this matrix. +
mult(PVector, PVector) - +Method in class processing.core.PMatrix2D +
Multiply the x and y coordinates of a PVector against this matrix. +
mult(float[], float[]) - +Method in class processing.core.PMatrix2D +
Multiply a two element vector against this matrix. +
mult(PVector, PVector) - +Method in class processing.core.PMatrix3D +
  +
mult(float[], float[]) - +Method in class processing.core.PMatrix3D +
Multiply a three or four element vector against this matrix. +
mult(float) - +Method in class processing.core.PVector +
Multiply this vector by a scalar +
mult(PVector, float) - +Static method in class processing.core.PVector +
Multiply a vector by a scalar +
mult(PVector, float, PVector) - +Static method in class processing.core.PVector +
Multiply a vector by a scalar, and write the result into a target PVector. +
mult(PVector) - +Method in class processing.core.PVector +
Multiply each element of one vector by the elements of another vector. +
mult(PVector, PVector) - +Static method in class processing.core.PVector +
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +
mult(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
Multiply each element of one vector by the individual elements of another + vector, and write the result into a target vector. +
MULTIPLY - +Static variable in interface processing.core.PConstants +
  +
multW(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multW(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multX(float, float) - +Method in class processing.core.PMatrix2D +
  +
multX(float, float) - +Method in class processing.core.PMatrix3D +
  +
multX(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multX(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multY(float, float) - +Method in class processing.core.PMatrix2D +
  +
multY(float, float) - +Method in class processing.core.PMatrix3D +
  +
multY(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multY(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multZ(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multZ(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
+
+

+N

+
+
name - +Variable in class processing.core.PFont +
Name of the font as seen by Java when it was created. +
newProcessingInstruction(String, Reader) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a processing instruction is encountered. +
nextVertex() - +Method in class processing.core.PSmoothTriangle +
  +
nf(int[], int) - +Static method in class processing.core.PApplet +
  +
nf(int, int) - +Static method in class processing.core.PApplet +
  +
nf(float[], int, int) - +Static method in class processing.core.PApplet +
  +
nf(float, int, int) - +Static method in class processing.core.PApplet +
  +
nfc(int[]) - +Static method in class processing.core.PApplet +
  +
nfc(int) - +Static method in class processing.core.PApplet +
  +
nfc(float[], int) - +Static method in class processing.core.PApplet +
  +
nfc(float, int) - +Static method in class processing.core.PApplet +
  +
nfp(int, int) - +Static method in class processing.core.PApplet +
number format positive (or plus) + Formats a number, always placing a - or + sign + in the front when it's negative or positive. +
nfp(int[], int) - +Static method in class processing.core.PApplet +
  +
nfp(float[], int, int) - +Static method in class processing.core.PApplet +
  +
nfp(float, int, int) - +Static method in class processing.core.PApplet +
  +
nfs(int, int) - +Static method in class processing.core.PApplet +
number format signed (or space) + Formats a number but leaves a blank space in the front + when it's positive so that it can be properly aligned with + numbers that have a negative sign in front of them. +
nfs(int[], int) - +Static method in class processing.core.PApplet +
  +
nfs(float[], int, int) - +Static method in class processing.core.PApplet +
Number formatter that takes into account whether the number + has a sign (positive, negative, etc) in front of it. +
nfs(float, int, int) - +Static method in class processing.core.PApplet +
  +
NO_LINE - +Static variable in class processing.xml.XMLElement +
No line number defined. +
noCursor() - +Method in class processing.core.PApplet +
Hide the cursor by creating a transparent image + and using it as a custom cursor. +
noFill() - +Method in class processing.core.PApplet +
  +
noFill() - +Method in class processing.core.PGraphics +
  +
noise(float) - +Method in class processing.core.PApplet +
Computes the Perlin noise function value at point x. +
noise(float, float) - +Method in class processing.core.PApplet +
Computes the Perlin noise function value at the point x, y. +
noise(float, float, float) - +Method in class processing.core.PApplet +
Computes the Perlin noise function value at x, y, z. +
noiseDetail(int) - +Method in class processing.core.PApplet +
  +
noiseDetail(int, float) - +Method in class processing.core.PApplet +
  +
noiseSeed(long) - +Method in class processing.core.PApplet +
  +
noLights() - +Method in class processing.core.PApplet +
  +
noLights() - +Method in class processing.core.PGraphics +
  +
noLights() - +Method in class processing.core.PGraphics3D +
Turn off all lights. +
noLoop() - +Method in class processing.core.PApplet +
  +
norm(float, float, float) - +Static method in class processing.core.PApplet +
Normalize a value to exist between 0 and 1 (inclusive). +
normal(float, float, float) - +Method in class processing.core.PApplet +
  +
NORMAL - +Static variable in interface processing.core.PConstants +
texture coordinates in 0..1 range +
normal(float, float, float) - +Method in class processing.core.PGraphics +
Sets the current normal vector. +
normalize() - +Method in class processing.core.PVector +
Normalize the vector to length 1 (make it a unit vector) +
normalize(PVector) - +Method in class processing.core.PVector +
Normalize this vector, storing the result in another vector. +
NORMALIZED - +Static variable in interface processing.core.PConstants +
Deprecated. use NORMAL instead +
normalX - +Variable in class processing.core.PGraphics +
Current normal vector. +
normalY - +Variable in class processing.core.PGraphics +
Current normal vector. +
normalZ - +Variable in class processing.core.PGraphics +
Current normal vector. +
noSmooth() - +Method in class processing.core.PApplet +
  +
noSmooth() - +Method in class processing.core.PGraphics +
Disable smoothing. +
noSmooth() - +Method in class processing.core.PGraphics3D +
  +
noSmooth() - +Method in class processing.core.PGraphicsJava2D +
  +
noStroke() - +Method in class processing.core.PApplet +
  +
noStroke() - +Method in class processing.core.PGraphics +
  +
noTint() - +Method in class processing.core.PApplet +
  +
noTint() - +Method in class processing.core.PGraphics +
  +
NX - +Static variable in interface processing.core.PConstants +
  +
NY - +Static variable in interface processing.core.PConstants +
  +
NZ - +Static variable in interface processing.core.PConstants +
  +
+
+

+O

+
+
online - +Variable in class processing.core.PApplet +
true if the applet is online. +
OPAQUE - +Static variable in interface processing.core.PConstants +
  +
open(String) - +Static method in class processing.core.PApplet +
Attempt to open a file using the platform's shell. +
open(String[]) - +Static method in class processing.core.PApplet +
Launch a process using a platforms shell. +
OPEN - +Static variable in interface processing.core.PConstants +
  +
OPENGL - +Static variable in interface processing.core.PConstants +
  +
openStream(String) - +Method in class processing.core.PApplet +
Deprecated. As of release 0136, use createInput() instead. +
openStream(String, String) - +Method in class processing.xml.StdXMLReader +
Opens a stream from a public and system ID. +
ortho() - +Method in class processing.core.PApplet +
  +
ortho(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
ortho() - +Method in class processing.core.PGraphics +
  +
ortho(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
ortho() - +Method in class processing.core.PGraphics3D +
Calls ortho() with the proper parameters for Processing's + standard orthographic projection. +
ortho(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Similar to gluOrtho(), but wipes out the current projection matrix. +
ORTHOGRAPHIC - +Static variable in interface processing.core.PConstants +
  +
OTHER - +Static variable in interface processing.core.PConstants +
  +
OVERLAY - +Static variable in interface processing.core.PConstants +
  +
+
+

+P

+
+
P2D - +Static variable in interface processing.core.PConstants +
  +
P3D - +Static variable in interface processing.core.PConstants +
  +
paint(Graphics) - +Method in class processing.core.PApplet +
  +
PApplet - Class in processing.core
Base class for all sketches that use processing.core.
PApplet() - +Constructor for class processing.core.PApplet +
  +
PApplet.RegisteredMethods - Class in processing.core
This returns the last width and height specified by the user + via the size() command.
PApplet.RegisteredMethods() - +Constructor for class processing.core.PApplet.RegisteredMethods +
  +
PApplet.RendererChangeException - Exception in processing.core
Exception thrown when size() is called the first time.
PApplet.RendererChangeException() - +Constructor for exception processing.core.PApplet.RendererChangeException +
  +
param(String) - +Method in class processing.core.PApplet +
Get a param from the web page, or (eventually) + from a properties file. +
parent - +Variable in class processing.core.PImage +
Path to parent object that will be used with save(). +
parse() - +Method in class processing.xml.StdXMLParser +
Parses the data and lets the builder create the logical data structure. +
parseBoolean(int) - +Static method in class processing.core.PApplet +
Convert an integer to a boolean. +
parseBoolean(String) - +Static method in class processing.core.PApplet +
Convert the string "true" or "false" to a boolean. +
parseBoolean(byte[]) - +Static method in class processing.core.PApplet +
Convert a byte array to a boolean array. +
parseBoolean(int[]) - +Static method in class processing.core.PApplet +
Convert an int array to a boolean array. +
parseBoolean(String[]) - +Static method in class processing.core.PApplet +
  +
parseByte(boolean) - +Static method in class processing.core.PApplet +
  +
parseByte(char) - +Static method in class processing.core.PApplet +
  +
parseByte(int) - +Static method in class processing.core.PApplet +
  +
parseByte(float) - +Static method in class processing.core.PApplet +
  +
parseByte(boolean[]) - +Static method in class processing.core.PApplet +
  +
parseByte(char[]) - +Static method in class processing.core.PApplet +
  +
parseByte(int[]) - +Static method in class processing.core.PApplet +
  +
parseByte(float[]) - +Static method in class processing.core.PApplet +
  +
parseByte(byte[]) - +Static method in class processing.core.PApplet +
  +
parseChar(byte) - +Static method in class processing.core.PApplet +
  +
parseChar(int) - +Static method in class processing.core.PApplet +
  +
parseChar(byte[]) - +Static method in class processing.core.PApplet +
  +
parseChar(int[]) - +Static method in class processing.core.PApplet +
  +
parseDTD(String, StdXMLReader, XMLEntityResolver, boolean) - +Method in class processing.xml.XMLValidator +
Parses the DTD. +
parseFloat(int) - +Static method in class processing.core.PApplet +
Convert an int to a float value. +
parseFloat(String) - +Static method in class processing.core.PApplet +
  +
parseFloat(String, float) - +Static method in class processing.core.PApplet +
  +
parseFloat(int[]) - +Static method in class processing.core.PApplet +
  +
parseFloat(String[]) - +Static method in class processing.core.PApplet +
  +
parseFloat(String[], float) - +Static method in class processing.core.PApplet +
  +
parseInt(boolean) - +Static method in class processing.core.PApplet +
  +
parseInt(byte) - +Static method in class processing.core.PApplet +
Note that parseInt() will un-sign a signed byte value. +
parseInt(char) - +Static method in class processing.core.PApplet +
Note that parseInt('5') is unlike String in the sense that it + won't return 5, but the ascii value. +
parseInt(float) - +Static method in class processing.core.PApplet +
Same as floor(), or an (int) cast. +
parseInt(String) - +Static method in class processing.core.PApplet +
Parse a String into an int value. +
parseInt(String, int) - +Static method in class processing.core.PApplet +
Parse a String to an int, and provide an alternate value that + should be used when the number is invalid. +
parseInt(boolean[]) - +Static method in class processing.core.PApplet +
  +
parseInt(byte[]) - +Static method in class processing.core.PApplet +
  +
parseInt(char[]) - +Static method in class processing.core.PApplet +
  +
parseInt(float[]) - +Static method in class processing.core.PApplet +
  +
parseInt(String[]) - +Static method in class processing.core.PApplet +
Make an array of int elements from an array of String objects. +
parseInt(String[], int) - +Static method in class processing.core.PApplet +
Make an array of int elements from an array of String objects. +
PATH - +Static variable in interface processing.core.PConstants +
  +
PATH - +Static variable in class processing.core.PShape +
A series of vertex, curveVertex, and bezierVertex calls. +
PCDataAdded(String, int) - +Method in class processing.xml.XMLValidator +
Indicates that a new #PCDATA element has been encountered. +
PConstants - Interface in processing.core
Numbers shared throughout processing.core.
PDF - +Static variable in interface processing.core.PConstants +
  +
perspective() - +Method in class processing.core.PApplet +
  +
perspective(float, float, float, float) - +Method in class processing.core.PApplet +
  +
PERSPECTIVE - +Static variable in interface processing.core.PConstants +
  +
perspective() - +Method in class processing.core.PGraphics +
  +
perspective(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
perspective() - +Method in class processing.core.PGraphics3D +
Calls perspective() with Processing's standard coordinate projection. +
perspective(float, float, float, float) - +Method in class processing.core.PGraphics3D +
Similar to gluPerspective(). +
PFont - Class in processing.core
Grayscale bitmap font class used by Processing.
PFont() - +Constructor for class processing.core.PFont +
  +
PFont(InputStream) - +Constructor for class processing.core.PFont +
  +
PFont(Font, boolean, char[]) - +Constructor for class processing.core.PFont +
Create a new image-based font on the fly. +
PGraphics - Class in processing.core
Main graphics and rendering context, as well as the base API implementation.
PGraphics() - +Constructor for class processing.core.PGraphics +
Constructor for the PGraphics object. +
PGraphics2D - Class in processing.core
Subclass of PGraphics that handles fast 2D rendering using a + MemoryImageSource.
PGraphics2D() - +Constructor for class processing.core.PGraphics2D +
  +
PGraphics3D - Class in processing.core
Subclass of PGraphics that handles 3D rendering.
PGraphics3D() - +Constructor for class processing.core.PGraphics3D +
  +
PGraphicsJava2D - Class in processing.core
Subclass for PGraphics that implements the graphics API using Java2D.
PGraphicsJava2D() - +Constructor for class processing.core.PGraphicsJava2D +
  +
PI - +Static variable in interface processing.core.PConstants +
  +
PImage - Class in processing.core
Storage class for pixel data.
PImage() - +Constructor for class processing.core.PImage +
Create an empty image object, set its format to RGB. +
PImage(int, int) - +Constructor for class processing.core.PImage +
Create a new RGB (alpha ignored) image of a specific size. +
PImage(int, int, int) - +Constructor for class processing.core.PImage +
  +
PImage(Image) - +Constructor for class processing.core.PImage +
Construct a new PImage from a java.awt.Image. +
pixelCount - +Variable in class processing.core.PGraphics +
  +
pixels - +Variable in class processing.core.PApplet +
Pixel buffer from this applet's PGraphics. +
pixels - +Variable in class processing.core.PImage +
  +
platform - +Static variable in class processing.core.PApplet +
Current platform in use, one of the + PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER. +
platformNames - +Static variable in interface processing.core.PConstants +
  +
PLine - Class in processing.core
Code for rendering lines with P2D and P3D.
PLine(PGraphics) - +Constructor for class processing.core.PLine +
  +
PMatrix - Interface in processing.core
 
PMatrix2D - Class in processing.core
3x2 affine matrix implementation.
PMatrix2D() - +Constructor for class processing.core.PMatrix2D +
  +
PMatrix2D(float, float, float, float, float, float) - +Constructor for class processing.core.PMatrix2D +
  +
PMatrix2D(PMatrix) - +Constructor for class processing.core.PMatrix2D +
  +
PMatrix3D - Class in processing.core
4x4 matrix implementation.
PMatrix3D() - +Constructor for class processing.core.PMatrix3D +
  +
PMatrix3D(float, float, float, float, float, float) - +Constructor for class processing.core.PMatrix3D +
  +
PMatrix3D(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Constructor for class processing.core.PMatrix3D +
  +
PMatrix3D(PMatrix) - +Constructor for class processing.core.PMatrix3D +
  +
pmouseX - +Variable in class processing.core.PApplet +
Previous x/y position of the mouse. +
pmouseY - +Variable in class processing.core.PApplet +
Previous x/y position of the mouse. +
point(float, float) - +Method in class processing.core.PApplet +
  +
point(float, float, float) - +Method in class processing.core.PApplet +
  +
POINT - +Static variable in interface processing.core.PConstants +
  +
point(float, float) - +Method in class processing.core.PGraphics +
  +
point(float, float, float) - +Method in class processing.core.PGraphics +
  +
point(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
point(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
POINTS - +Static variable in interface processing.core.PConstants +
  +
POLYGON - +Static variable in interface processing.core.PConstants +
  +
popMatrix() - +Method in class processing.core.PApplet +
  +
popMatrix() - +Method in class processing.core.PGraphics +
Replace the current transformation matrix with the top of the stack. +
popMatrix() - +Method in class processing.core.PGraphics2D +
  +
popMatrix() - +Method in class processing.core.PGraphics3D +
  +
popMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
popStyle() - +Method in class processing.core.PApplet +
  +
popStyle() - +Method in class processing.core.PGraphics +
  +
post(PGraphics) - +Method in class processing.core.PShape +
  +
POSTERIZE - +Static variable in interface processing.core.PConstants +
  +
pow(float, float) - +Static method in class processing.core.PApplet +
  +
PPolygon - Class in processing.core
Z-buffer polygon rendering object used by PGraphics2D.
PPolygon(PGraphics) - +Constructor for class processing.core.PPolygon +
  +
preApply(PMatrix2D) - +Method in interface processing.core.PMatrix +
Apply another matrix to the left of this one. +
preApply(PMatrix3D) - +Method in interface processing.core.PMatrix +
  +
preApply(float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
preApply(PMatrix2D) - +Method in class processing.core.PMatrix2D +
Apply another matrix to the left of this one. +
preApply(PMatrix3D) - +Method in class processing.core.PMatrix2D +
  +
preApply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
preApply(PMatrix2D) - +Method in class processing.core.PMatrix3D +
  +
preApply(PMatrix3D) - +Method in class processing.core.PMatrix3D +
Apply another matrix to the left of this one. +
preApply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
PRIMITIVE - +Static variable in class processing.core.PShape +
A line, ellipse, arc, image, etc. +
print(byte) - +Static method in class processing.core.PApplet +
  +
print(boolean) - +Static method in class processing.core.PApplet +
  +
print(char) - +Static method in class processing.core.PApplet +
  +
print(int) - +Static method in class processing.core.PApplet +
  +
print(float) - +Static method in class processing.core.PApplet +
  +
print(String) - +Static method in class processing.core.PApplet +
  +
print(Object) - +Static method in class processing.core.PApplet +
  +
print() - +Method in class processing.core.PMatrix2D +
  +
print() - +Method in class processing.core.PMatrix3D +
  +
print() - +Method in class processing.core.PShapeSVG +
Prints out the SVG document. +
printCamera() - +Method in class processing.core.PApplet +
  +
printCamera() - +Method in class processing.core.PGraphics +
  +
printCamera() - +Method in class processing.core.PGraphics3D +
Print the current camera matrix. +
println() - +Static method in class processing.core.PApplet +
  +
println(byte) - +Static method in class processing.core.PApplet +
  +
println(boolean) - +Static method in class processing.core.PApplet +
  +
println(char) - +Static method in class processing.core.PApplet +
  +
println(int) - +Static method in class processing.core.PApplet +
  +
println(float) - +Static method in class processing.core.PApplet +
  +
println(String) - +Static method in class processing.core.PApplet +
  +
println(Object) - +Static method in class processing.core.PApplet +
  +
printMatrix() - +Method in class processing.core.PApplet +
  +
printMatrix() - +Method in class processing.core.PGraphics +
Print the current model (or "transformation") matrix. +
printMatrix() - +Method in class processing.core.PGraphics2D +
Print the current model (or "transformation") matrix. +
printMatrix() - +Method in class processing.core.PGraphics3D +
Print the current model (or "transformation") matrix. +
printMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
printProjection() - +Method in class processing.core.PApplet +
  +
printProjection() - +Method in class processing.core.PGraphics +
  +
printProjection() - +Method in class processing.core.PGraphics3D +
Print the current projection matrix. +
printStackTrace(PrintWriter) - +Method in exception processing.xml.XMLException +
Dumps the exception stack to a print writer. +
printStackTrace(PrintStream) - +Method in exception processing.xml.XMLException +
Dumps the exception stack to an output stream. +
printStackTrace() - +Method in exception processing.xml.XMLException +
Dumps the exception stack to System.err. +
PROBLEM - +Static variable in interface processing.core.PConstants +
  +
processing.core - package processing.core
 
processing.xml - package processing.xml
 
PROJECT - +Static variable in interface processing.core.PConstants +
  +
projection - +Variable in class processing.core.PGraphics3D +
Current projection matrix. +
PShape - Class in processing.core
In-progress class to handle shape data, currently to be considered of + alpha or beta quality.
PShape() - +Constructor for class processing.core.PShape +
  +
PShape(int) - +Constructor for class processing.core.PShape +
  +
PShapeSVG - Class in processing.core
SVG stands for Scalable Vector Graphics, a portable graphics format.
PShapeSVG(PApplet, String) - +Constructor for class processing.core.PShapeSVG +
Initializes a new SVG Object with the given filename. +
PShapeSVG(XMLElement) - +Constructor for class processing.core.PShapeSVG +
Initializes a new SVG Object from the given XMLElement. +
PShapeSVG(PShapeSVG, XMLElement) - +Constructor for class processing.core.PShapeSVG +
  +
PSmoothTriangle - Class in processing.core
Smoothed triangle renderer for P3D.
PSmoothTriangle(PGraphics3D) - +Constructor for class processing.core.PSmoothTriangle +
  +
psname - +Variable in class processing.core.PFont +
Postscript name of the font that this bitmap was created from. +
PStyle - Class in processing.core
 
PStyle() - +Constructor for class processing.core.PStyle +
  +
PTriangle - Class in processing.core
Handles rendering of single (tesselated) triangles in 3D.
PTriangle(PGraphics3D) - +Constructor for class processing.core.PTriangle +
  +
pushMatrix() - +Method in class processing.core.PApplet +
  +
pushMatrix() - +Method in class processing.core.PGraphics +
Push a copy of the current transformation matrix onto the stack. +
pushMatrix() - +Method in class processing.core.PGraphics2D +
  +
pushMatrix() - +Method in class processing.core.PGraphics3D +
  +
pushMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
pushStyle() - +Method in class processing.core.PApplet +
  +
pushStyle() - +Method in class processing.core.PGraphics +
  +
PVector - Class in processing.core
A class to describe a two or three dimensional vector.
PVector() - +Constructor for class processing.core.PVector +
Constructor for an empty vector: x, y, and z are set to 0. +
PVector(float, float, float) - +Constructor for class processing.core.PVector +
Constructor for a 3D vector. +
PVector(float, float) - +Constructor for class processing.core.PVector +
Constructor for a 2D vector: z coordinate is set to 0. +
+
+

+Q

+
+
quad(float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
QUAD - +Static variable in interface processing.core.PConstants +
  +
quad(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
quad(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
QUAD_STRIP - +Static variable in interface processing.core.PConstants +
  +
QUADS - +Static variable in interface processing.core.PConstants +
  +
QUARTER_PI - +Static variable in interface processing.core.PConstants +
  +
+
+

+R

+
+
R - +Static variable in interface processing.core.PConstants +
  +
RAD_TO_DEG - +Static variable in interface processing.core.PConstants +
  +
radians(float) - +Static method in class processing.core.PApplet +
  +
RADIUS - +Static variable in interface processing.core.PConstants +
Draw mode from the center, and using the radius +
random(float) - +Method in class processing.core.PApplet +
Return a random number in the range [0, howbig). +
random(float, float) - +Method in class processing.core.PApplet +
Return a random number in the range [howsmall, howbig). +
randomSeed(long) - +Method in class processing.core.PApplet +
  +
read() - +Method in class processing.xml.StdXMLReader +
Reads a character. +
recorder - +Variable in class processing.core.PApplet +
A leech graphics object that is echoing all events. +
rect(float, float, float, float) - +Method in class processing.core.PApplet +
  +
RECT - +Static variable in interface processing.core.PConstants +
  +
rect(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
rectMode(int) - +Method in class processing.core.PApplet +
  +
rectMode - +Variable in class processing.core.PGraphics +
The current rect mode (read-only) +
rectMode(int) - +Method in class processing.core.PGraphics +
  +
rectMode - +Variable in class processing.core.PStyle +
  +
red(int) - +Method in class processing.core.PApplet +
  +
red(int) - +Method in class processing.core.PGraphics +
  +
RED_MASK - +Static variable in interface processing.core.PConstants +
  +
redraw() - +Method in class processing.core.PApplet +
  +
registerDispose(Object) - +Method in class processing.core.PApplet +
  +
registerDraw(Object) - +Method in class processing.core.PApplet +
  +
registerKeyEvent(Object) - +Method in class processing.core.PApplet +
  +
registerMouseEvent(Object) - +Method in class processing.core.PApplet +
  +
registerPost(Object) - +Method in class processing.core.PApplet +
  +
registerPre(Object) - +Method in class processing.core.PApplet +
  +
registerSize(Object) - +Method in class processing.core.PApplet +
  +
remove(Object, Method) - +Method in class processing.core.PApplet.RegisteredMethods +
Removes first object/method pair matched (and only the first, + must be called multiple times if object is registered multiple times). +
removeAttribute(String) - +Method in class processing.xml.XMLElement +
Removes an attribute. +
removeAttribute(String, String) - +Method in class processing.xml.XMLElement +
Removes an attribute. +
removeCache(Object) - +Method in class processing.core.PApplet +
  +
removeCache(Object) - +Method in class processing.core.PImage +
Remove information associated with this renderer from the cache, if any. +
removeChild(XMLElement) - +Method in class processing.xml.XMLElement +
Removes a child element. +
removeChildAtIndex(int) - +Method in class processing.xml.XMLElement +
Removes the child located at a certain index. +
render() - +Method in class processing.core.PSmoothTriangle +
  +
render() - +Method in class processing.core.PTriangle +
Renders the polygon +
REPLACE - +Static variable in interface processing.core.PConstants +
  +
requestImage(String) - +Method in class processing.core.PApplet +
  +
requestImage(String, String) - +Method in class processing.core.PApplet +
  +
requestImageMax - +Variable in class processing.core.PApplet +
By trial and error, four image loading threads seem to work best when + loading images from online. +
reset() - +Method in class processing.core.PLine +
  +
reset() - +Method in interface processing.core.PMatrix +
  +
reset() - +Method in class processing.core.PMatrix2D +
  +
reset() - +Method in class processing.core.PMatrix3D +
  +
reset(int) - +Method in class processing.core.PSmoothTriangle +
  +
reset() - +Method in class processing.core.PTriangle +
Resets polygon attributes +
resetMatrix() - +Method in class processing.core.PApplet +
  +
resetMatrix() - +Method in class processing.core.PGraphics +
Set the current transformation matrix to identity. +
resetMatrix() - +Method in class processing.core.PGraphics2D +
Load identity as the transform/model matrix. +
resetMatrix() - +Method in class processing.core.PGraphics3D +
  +
resetMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
resetMatrix() - +Method in class processing.core.PShape +
  +
resize(int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
resize(int, int) - +Method in class processing.core.PImage +
Resize this image to a new width and height. +
RETURN - +Static variable in interface processing.core.PConstants +
  +
reverse(boolean[]) - +Static method in class processing.core.PApplet +
  +
reverse(byte[]) - +Static method in class processing.core.PApplet +
  +
reverse(char[]) - +Static method in class processing.core.PApplet +
  +
reverse(int[]) - +Static method in class processing.core.PApplet +
  +
reverse(float[]) - +Static method in class processing.core.PApplet +
  +
reverse(String[]) - +Static method in class processing.core.PApplet +
  +
reverse(Object) - +Static method in class processing.core.PApplet +
  +
RGB - +Static variable in interface processing.core.PConstants +
  +
RIGHT - +Static variable in interface processing.core.PConstants +
  +
rotate(float) - +Method in class processing.core.PApplet +
  +
rotate(float, float, float, float) - +Method in class processing.core.PApplet +
  +
rotate(float) - +Method in class processing.core.PGraphics +
Two dimensional rotation. +
rotate(float, float, float, float) - +Method in class processing.core.PGraphics +
Rotate about a vector in space. +
rotate(float) - +Method in class processing.core.PGraphics2D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
rotate(float) - +Method in class processing.core.PGraphics3D +
Two dimensional rotation. +
rotate(float, float, float, float) - +Method in class processing.core.PGraphics3D +
Rotate around an arbitrary vector, similar to glRotate(), + except that it takes radians (instead of degrees). +
rotate(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotate(float) - +Method in interface processing.core.PMatrix +
  +
rotate(float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
rotate(float) - +Method in class processing.core.PMatrix2D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
rotate(float) - +Method in class processing.core.PMatrix3D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
rotate(float) - +Method in class processing.core.PShape +
  +
rotate(float, float, float, float) - +Method in class processing.core.PShape +
  +
rotateX(float) - +Method in class processing.core.PApplet +
  +
rotateX(float) - +Method in class processing.core.PGraphics +
Rotate around the X axis. +
rotateX(float) - +Method in class processing.core.PGraphics2D +
  +
rotateX(float) - +Method in class processing.core.PGraphics3D +
  +
rotateX(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotateX(float) - +Method in interface processing.core.PMatrix +
  +
rotateX(float) - +Method in class processing.core.PMatrix2D +
  +
rotateX(float) - +Method in class processing.core.PMatrix3D +
  +
rotateX(float) - +Method in class processing.core.PShape +
  +
rotateY(float) - +Method in class processing.core.PApplet +
  +
rotateY(float) - +Method in class processing.core.PGraphics +
Rotate around the Y axis. +
rotateY(float) - +Method in class processing.core.PGraphics2D +
  +
rotateY(float) - +Method in class processing.core.PGraphics3D +
  +
rotateY(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotateY(float) - +Method in interface processing.core.PMatrix +
  +
rotateY(float) - +Method in class processing.core.PMatrix2D +
  +
rotateY(float) - +Method in class processing.core.PMatrix3D +
  +
rotateY(float) - +Method in class processing.core.PShape +
  +
rotateZ(float) - +Method in class processing.core.PApplet +
  +
rotateZ(float) - +Method in class processing.core.PGraphics +
Rotate around the Z axis. +
rotateZ(float) - +Method in class processing.core.PGraphics2D +
  +
rotateZ(float) - +Method in class processing.core.PGraphics3D +
  +
rotateZ(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotateZ(float) - +Method in interface processing.core.PMatrix +
  +
rotateZ(float) - +Method in class processing.core.PMatrix2D +
  +
rotateZ(float) - +Method in class processing.core.PMatrix3D +
  +
rotateZ(float) - +Method in class processing.core.PShape +
  +
round(float) - +Static method in class processing.core.PApplet +
  +
ROUND - +Static variable in interface processing.core.PConstants +
  +
run() - +Method in class processing.core.PApplet +
Main method for the primary animation thread. +
+
+

+S

+
+
SA - +Static variable in interface processing.core.PConstants +
  +
saturation(int) - +Method in class processing.core.PApplet +
  +
saturation(int) - +Method in class processing.core.PGraphics +
  +
save(String) - +Method in class processing.core.PApplet +
Intercepts any relative paths to make them absolute (relative + to the sketch folder) before passing to save() in PImage. +
save(OutputStream) - +Method in class processing.core.PFont +
Write this PFont to an OutputStream. +
save(String) - +Method in class processing.core.PImage +
Save this image to disk. +
saveBytes(String, byte[]) - +Method in class processing.core.PApplet +
Saves bytes to a file to inside the sketch folder. +
saveBytes(File, byte[]) - +Static method in class processing.core.PApplet +
Saves bytes to a specific File location specified by the user. +
saveBytes(OutputStream, byte[]) - +Static method in class processing.core.PApplet +
Spews a buffer of bytes to an OutputStream. +
saveFile(String) - +Method in class processing.core.PApplet +
Identical to savePath(), but returns a File object. +
saveFrame() - +Method in class processing.core.PApplet +
Grab an image of what's currently in the drawing area and save it + as a .tif or .tga file. +
saveFrame(String) - +Method in class processing.core.PApplet +
Save the current frame as a .tif or .tga image. +
savePath(String) - +Method in class processing.core.PApplet +
Returns a path inside the applet folder to save to. +
saveStream(String, String) - +Method in class processing.core.PApplet +
Save the contents of a stream to a file in the sketch folder. +
saveStream(File, String) - +Method in class processing.core.PApplet +
Identical to the other saveStream(), but writes to a File + object, for greater control over the file location. +
saveStream(File, InputStream) - +Static method in class processing.core.PApplet +
  +
saveStrings(String, String[]) - +Method in class processing.core.PApplet +
  +
saveStrings(File, String[]) - +Static method in class processing.core.PApplet +
  +
saveStrings(OutputStream, String[]) - +Static method in class processing.core.PApplet +
  +
SB - +Static variable in interface processing.core.PConstants +
  +
scale(float) - +Method in class processing.core.PApplet +
  +
scale(float, float) - +Method in class processing.core.PApplet +
  +
scale(float, float, float) - +Method in class processing.core.PApplet +
  +
scale(float) - +Method in class processing.core.PGraphics +
Scale in all dimensions. +
scale(float, float) - +Method in class processing.core.PGraphics +
Scale in X and Y. +
scale(float, float, float) - +Method in class processing.core.PGraphics +
Scale in X, Y, and Z. +
scale(float) - +Method in class processing.core.PGraphics2D +
  +
scale(float, float) - +Method in class processing.core.PGraphics2D +
  +
scale(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
scale(float) - +Method in class processing.core.PGraphics3D +
Same as scale(s, s, s). +
scale(float, float) - +Method in class processing.core.PGraphics3D +
Same as scale(sx, sy, 1). +
scale(float, float, float) - +Method in class processing.core.PGraphics3D +
Scale in three dimensions. +
scale(float) - +Method in class processing.core.PGraphicsJava2D +
  +
scale(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
scale(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
scale(float) - +Method in interface processing.core.PMatrix +
  +
scale(float, float) - +Method in interface processing.core.PMatrix +
  +
scale(float, float, float) - +Method in interface processing.core.PMatrix +
  +
scale(float) - +Method in class processing.core.PMatrix2D +
  +
scale(float, float) - +Method in class processing.core.PMatrix2D +
  +
scale(float, float, float) - +Method in class processing.core.PMatrix2D +
  +
scale(float) - +Method in class processing.core.PMatrix3D +
  +
scale(float, float) - +Method in class processing.core.PMatrix3D +
  +
scale(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
scale(float) - +Method in class processing.core.PShape +
  +
scale(float, float) - +Method in class processing.core.PShape +
  +
scale(float, float, float) - +Method in class processing.core.PShape +
  +
screen - +Variable in class processing.core.PApplet +
The screen size when the applet was started. +
SCREEN - +Static variable in interface processing.core.PConstants +
  +
screenX(float, float) - +Method in class processing.core.PApplet +
  +
screenX(float, float, float) - +Method in class processing.core.PApplet +
  +
screenX(float, float) - +Method in class processing.core.PGraphics +
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +
screenX(float, float, float) - +Method in class processing.core.PGraphics +
Maps a three dimensional point to its placement on-screen. +
screenX(float, float) - +Method in class processing.core.PGraphics2D +
  +
screenX(float, float) - +Method in class processing.core.PGraphics3D +
  +
screenX(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
screenX(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenX(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenY(float, float) - +Method in class processing.core.PApplet +
  +
screenY(float, float, float) - +Method in class processing.core.PApplet +
  +
screenY(float, float) - +Method in class processing.core.PGraphics +
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +
screenY(float, float, float) - +Method in class processing.core.PGraphics +
Maps a three dimensional point to its placement on-screen. +
screenY(float, float) - +Method in class processing.core.PGraphics2D +
  +
screenY(float, float) - +Method in class processing.core.PGraphics3D +
  +
screenY(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
screenY(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenY(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenZ(float, float, float) - +Method in class processing.core.PApplet +
  +
screenZ(float, float, float) - +Method in class processing.core.PGraphics +
Maps a three dimensional point to its placement on-screen. +
screenZ(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
screenZ(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
second() - +Static method in class processing.core.PApplet +
Seconds position of the current time. +
selectedFile - +Variable in class processing.core.PApplet +
  +
selectFolder() - +Method in class processing.core.PApplet +
Open a platform-specific folder chooser dialog. +
selectFolder(String) - +Method in class processing.core.PApplet +
Open a platform-specific folder chooser dialog. +
selectInput() - +Method in class processing.core.PApplet +
Open a platform-specific file chooser dialog to select a file for input. +
selectInput(String) - +Method in class processing.core.PApplet +
Open a platform-specific file chooser dialog to select a file for input. +
selectOutput() - +Method in class processing.core.PApplet +
Open a platform-specific file save dialog to select a file for output. +
selectOutput(String) - +Method in class processing.core.PApplet +
Open a platform-specific file save dialog to select a file for output. +
set(int, int, int) - +Method in class processing.core.PApplet +
  +
set(int, int, PImage) - +Method in class processing.core.PApplet +
  +
set(int, int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
set(int, int, int) - +Method in class processing.core.PImage +
Set a single pixel to the specified color. +
set(int, int, PImage) - +Method in class processing.core.PImage +
Efficient method of drawing an image's pixels directly to this surface. +
set(PMatrix) - +Method in interface processing.core.PMatrix +
  +
set(float[]) - +Method in interface processing.core.PMatrix +
  +
set(float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
set(PMatrix) - +Method in class processing.core.PMatrix2D +
  +
set(PMatrix3D) - +Method in class processing.core.PMatrix2D +
  +
set(float[]) - +Method in class processing.core.PMatrix2D +
  +
set(float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
set(PMatrix) - +Method in class processing.core.PMatrix3D +
  +
set(float[]) - +Method in class processing.core.PMatrix3D +
  +
set(float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
set(float, float, float) - +Method in class processing.core.PVector +
Set x, y, and z coordinates. +
set(PVector) - +Method in class processing.core.PVector +
Set x, y, and z coordinates from a Vector3D object. +
set(float[]) - +Method in class processing.core.PVector +
Set the x, y (and maybe z) coordinates using a float[] array as the source. +
setAttribute(String, String) - +Method in class processing.xml.XMLElement +
Sets an attribute. +
setAttribute(String, String, String) - +Method in class processing.xml.XMLElement +
Sets an attribute. +
setBuilder(StdXMLBuilder) - +Method in class processing.xml.StdXMLParser +
Sets the builder which creates the logical structure of the XML data. +
setCache(Object, Object) - +Method in class processing.core.PApplet +
  +
setCache(Object, Object) - +Method in class processing.core.PImage +
Store data of some kind for a renderer that requires extra metadata of + some kind. +
setCamVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PSmoothTriangle +
Pass camera-space coordinates for the triangle. +
setCamVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Pass camera-space coordinates for the triangle. +
setContent(String) - +Method in class processing.xml.XMLElement +
Sets the #PCDATA content. +
setCulling(boolean) - +Method in class processing.core.PTriangle +
Sets backface culling on/off +
setFont(Font) - +Method in class processing.core.PFont +
Set the native complement of this font. +
setIndex(int) - +Method in class processing.core.PLine +
  +
setIntensities(float, float, float, float, float, float, float, float) - +Method in class processing.core.PLine +
  +
setIntensities(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PSmoothTriangle +
  +
setIntensities(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Sets vertex intensities in 0xRRGGBBAA format +
setInterpPower(int) - +Static method in class processing.core.PTriangle +
Set the power of two used for linear interpolation of texture coordinates. +
setMatrix(PMatrix) - +Method in class processing.core.PApplet +
  +
setMatrix(PMatrix2D) - +Method in class processing.core.PApplet +
  +
setMatrix(PMatrix3D) - +Method in class processing.core.PApplet +
  +
setMatrix(PMatrix) - +Method in class processing.core.PGraphics +
Set the current transformation matrix to the contents of another. +
setMatrix(PMatrix2D) - +Method in class processing.core.PGraphics +
Set the current transformation to the contents of the specified source. +
setMatrix(PMatrix3D) - +Method in class processing.core.PGraphics +
Set the current transformation to the contents of the specified source. +
setMatrix(PMatrix2D) - +Method in class processing.core.PGraphics3D +
  +
setMatrix(PMatrix3D) - +Method in class processing.core.PGraphics3D +
Set the current transformation to the contents of the specified source. +
setMatrix(PMatrix2D) - +Method in class processing.core.PGraphicsJava2D +
  +
setMatrix(PMatrix3D) - +Method in class processing.core.PGraphicsJava2D +
  +
setModified() - +Method in class processing.core.PImage +
  +
setModified(boolean) - +Method in class processing.core.PImage +
  +
setName(String) - +Method in class processing.core.PShape +
  +
setName(String) - +Method in class processing.xml.XMLElement +
Sets the full name. +
setName(String, String) - +Method in class processing.xml.XMLElement +
Sets the name. +
setParameterEntityResolver(XMLEntityResolver) - +Method in class processing.xml.XMLValidator +
Sets the parameter entity resolver. +
setParent(PApplet) - +Method in class processing.core.PGraphics +
  +
setPath(String) - +Method in class processing.core.PGraphics +
  +
setPrimary(boolean) - +Method in class processing.core.PGraphics +
Set (or unset) this as the main drawing surface. +
setPublicID(String) - +Method in class processing.xml.StdXMLReader +
Sets the public ID of the current stream. +
setReader(StdXMLReader) - +Method in class processing.xml.StdXMLParser +
Sets the reader from which the parser retrieves its data. +
setResolver(XMLEntityResolver) - +Method in class processing.xml.StdXMLParser +
Sets the entity resolver. +
setSize(int, int) - +Method in class processing.core.PGraphics +
The final step in setting up a renderer, set its size of this renderer. +
setSize(int, int) - +Method in class processing.core.PGraphics3D +
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. +
setSize(int, int) - +Method in class processing.core.PGraphicsJava2D +
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. +
setSystemID(String) - +Method in class processing.xml.StdXMLReader +
Sets the system ID of the current stream. +
setTexture(PImage) - +Method in class processing.core.PTriangle +
Sets texture image used for the polygon +
setup() - +Method in class processing.core.PApplet +
  +
setupExternalMessages() - +Method in class processing.core.PApplet +
Set this sketch to communicate its state back to the PDE. +
setupFrameResizeListener() - +Method in class processing.core.PApplet +
Set up a listener that will fire proper component resize events + in cases where frame.setResizable(true) is called. +
setUV(float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Sets the UV coordinates of the texture +
setUV(float[], float[]) - +Method in class processing.core.PTriangle +
  +
setValidator(XMLValidator) - +Method in class processing.xml.StdXMLParser +
Sets the validator that validates the XML data. +
setVertices(float, float, float, float, float, float) - +Method in class processing.core.PLine +
  +
setVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PSmoothTriangle +
  +
setVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Sets vertex coordinates for the triangle +
setVisible(boolean) - +Method in class processing.core.PShape +
  +
setWidth - +Variable in class processing.core.PFont +
  +
SG - +Static variable in interface processing.core.PConstants +
  +
shape(PShape) - +Method in class processing.core.PApplet +
  +
shape(PShape, float, float) - +Method in class processing.core.PApplet +
  +
shape(PShape, float, float, float, float) - +Method in class processing.core.PApplet +
  +
SHAPE - +Static variable in interface processing.core.PConstants +
textMode(SHAPE) draws text using the the glyph outlines of + individual characters rather than as textures. +
shape(PShape) - +Method in class processing.core.PGraphics +
  +
shape(PShape, float, float) - +Method in class processing.core.PGraphics +
Convenience method to draw at a particular location. +
shape(PShape, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
shapeMode(int) - +Method in class processing.core.PApplet +
  +
shapeMode - +Variable in class processing.core.PGraphics +
The current shape alignment mode (read-only) +
shapeMode(int) - +Method in class processing.core.PGraphics +
Set the orientation for the shape() command (like imageMode() or rectMode()). +
shapeMode - +Variable in class processing.core.PStyle +
  +
SHIFT - +Static variable in interface processing.core.PConstants +
  +
SHINE - +Static variable in interface processing.core.PConstants +
  +
shininess(float) - +Method in class processing.core.PApplet +
  +
shininess - +Variable in class processing.core.PGraphics +
  +
shininess(float) - +Method in class processing.core.PGraphics +
  +
shininess - +Variable in class processing.core.PStyle +
  +
shorten(boolean[]) - +Static method in class processing.core.PApplet +
  +
shorten(byte[]) - +Static method in class processing.core.PApplet +
  +
shorten(char[]) - +Static method in class processing.core.PApplet +
  +
shorten(int[]) - +Static method in class processing.core.PApplet +
  +
shorten(float[]) - +Static method in class processing.core.PApplet +
  +
shorten(String[]) - +Static method in class processing.core.PApplet +
  +
shorten(Object) - +Static method in class processing.core.PApplet +
  +
showException(String) - +Static method in class processing.core.PGraphics +
Show an renderer-related exception that halts the program. +
showWarning(String) - +Static method in class processing.core.PGraphics +
Show a renderer error, and keep track of it so that it's only shown once. +
sin(float) - +Static method in class processing.core.PApplet +
  +
size(int, int) - +Method in class processing.core.PApplet +
Starts up and creates a two-dimensional drawing surface, + or resizes the current drawing surface. +
size(int, int, String) - +Method in class processing.core.PApplet +
  +
size(int, int, String, String) - +Method in class processing.core.PApplet +
Creates a new PGraphics object and sets it to the specified size. +
size - +Variable in class processing.core.PFont +
"natural" size of the font (most often 48) +
sketchFile(String) - +Method in class processing.core.PApplet +
  +
sketchPath - +Variable in class processing.core.PApplet +
Path to sketch folder +
sketchPath(String) - +Method in class processing.core.PApplet +
Prepend the sketch folder path to the filename (or path) that is + passed in. +
skewX(float) - +Method in interface processing.core.PMatrix +
  +
skewX(float) - +Method in class processing.core.PMatrix2D +
  +
skewX(float) - +Method in class processing.core.PMatrix3D +
  +
skewY(float) - +Method in interface processing.core.PMatrix +
  +
skewY(float) - +Method in class processing.core.PMatrix2D +
  +
skewY(float) - +Method in class processing.core.PMatrix3D +
  +
smooth() - +Method in class processing.core.PApplet +
  +
smooth - +Variable in class processing.core.PFont +
true if smoothing was enabled for this font, used for native impl +
smooth - +Variable in class processing.core.PGraphics +
  +
smooth() - +Method in class processing.core.PGraphics +
If true in PImage, use bilinear interpolation for copy() + operations. +
smooth() - +Method in class processing.core.PGraphics3D +
  +
smooth() - +Method in class processing.core.PGraphicsJava2D +
  +
smoothTriangle - +Variable in class processing.core.PGraphics3D +
Used for anti-aliased and perspective corrected rendering. +
SOFT_LIGHT - +Static variable in interface processing.core.PConstants +
  +
sort(byte[]) - +Static method in class processing.core.PApplet +
  +
sort(byte[], int) - +Static method in class processing.core.PApplet +
  +
sort(char[]) - +Static method in class processing.core.PApplet +
  +
sort(char[], int) - +Static method in class processing.core.PApplet +
  +
sort(int[]) - +Static method in class processing.core.PApplet +
  +
sort(int[], int) - +Static method in class processing.core.PApplet +
  +
sort(float[]) - +Static method in class processing.core.PApplet +
  +
sort(float[], int) - +Static method in class processing.core.PApplet +
  +
sort(String[]) - +Static method in class processing.core.PApplet +
  +
sort(String[], int) - +Static method in class processing.core.PApplet +
  +
SPB - +Static variable in interface processing.core.PConstants +
  +
specular(int) - +Method in class processing.core.PApplet +
  +
specular(float) - +Method in class processing.core.PApplet +
  +
specular(float, float, float) - +Method in class processing.core.PApplet +
  +
specular(int) - +Method in class processing.core.PGraphics +
  +
specular(float) - +Method in class processing.core.PGraphics +
  +
specular(float, float, float) - +Method in class processing.core.PGraphics +
  +
specularB - +Variable in class processing.core.PGraphics +
  +
specularB - +Variable in class processing.core.PStyle +
  +
specularG - +Variable in class processing.core.PGraphics +
  +
specularG - +Variable in class processing.core.PStyle +
  +
specularR - +Variable in class processing.core.PGraphics +
  +
specularR - +Variable in class processing.core.PStyle +
  +
SPG - +Static variable in interface processing.core.PConstants +
  +
sphere(float) - +Method in class processing.core.PApplet +
  +
SPHERE - +Static variable in interface processing.core.PConstants +
  +
sphere(float) - +Method in class processing.core.PGraphics +
Draw a sphere with radius r centered at coordinate 0, 0, 0. +
sphere(float) - +Method in class processing.core.PGraphics2D +
  +
sphere(float) - +Method in class processing.core.PGraphics3D +
  +
sphere(float) - +Method in class processing.core.PGraphicsJava2D +
  +
sphereDetail(int) - +Method in class processing.core.PApplet +
  +
sphereDetail(int, int) - +Method in class processing.core.PApplet +
  +
sphereDetail(int) - +Method in class processing.core.PGraphics +
  +
sphereDetail(int, int) - +Method in class processing.core.PGraphics +
Set the detail level for approximating a sphere. +
sphereDetail(int) - +Method in class processing.core.PGraphics2D +
  +
sphereDetail(int, int) - +Method in class processing.core.PGraphics2D +
  +
sphereDetailU - +Variable in class processing.core.PGraphics +
  +
sphereDetailV - +Variable in class processing.core.PGraphics +
  +
splice(boolean[], boolean, int) - +Static method in class processing.core.PApplet +
  +
splice(boolean[], boolean[], int) - +Static method in class processing.core.PApplet +
  +
splice(byte[], byte, int) - +Static method in class processing.core.PApplet +
  +
splice(byte[], byte[], int) - +Static method in class processing.core.PApplet +
  +
splice(char[], char, int) - +Static method in class processing.core.PApplet +
  +
splice(char[], char[], int) - +Static method in class processing.core.PApplet +
  +
splice(int[], int, int) - +Static method in class processing.core.PApplet +
  +
splice(int[], int[], int) - +Static method in class processing.core.PApplet +
  +
splice(float[], float, int) - +Static method in class processing.core.PApplet +
  +
splice(float[], float[], int) - +Static method in class processing.core.PApplet +
  +
splice(String[], String, int) - +Static method in class processing.core.PApplet +
  +
splice(String[], String[], int) - +Static method in class processing.core.PApplet +
  +
splice(Object, Object, int) - +Static method in class processing.core.PApplet +
  +
split(String, char) - +Static method in class processing.core.PApplet +
Split a string into pieces along a specific character. +
split(String, String) - +Static method in class processing.core.PApplet +
Split a String on a specific delimiter. +
splitTokens(String) - +Static method in class processing.core.PApplet +
Split the provided String at wherever whitespace occurs. +
splitTokens(String, String) - +Static method in class processing.core.PApplet +
Splits a string into pieces, using any of the chars in the + String 'delim' as separator characters. +
SPOT - +Static variable in interface processing.core.PConstants +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
SPR - +Static variable in interface processing.core.PConstants +
  +
sq(float) - +Static method in class processing.core.PApplet +
  +
sqrt(float) - +Static method in class processing.core.PApplet +
  +
SQUARE - +Static variable in interface processing.core.PConstants +
  +
SR - +Static variable in interface processing.core.PConstants +
stroke argb values +
start() - +Method in class processing.core.PApplet +
Called by the browser or applet viewer to inform this applet that it + should start its execution. +
startBuilding(String, int) - +Method in class processing.xml.StdXMLBuilder +
This method is called before the parser starts processing its input. +
startElement(String, String, String, String, int) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a new XML element is encountered. +
startNewStream(Reader) - +Method in class processing.xml.StdXMLReader +
Starts a new stream from a Java reader. +
startNewStream(Reader, boolean) - +Method in class processing.xml.StdXMLReader +
Starts a new stream from a Java reader. +
status(String) - +Method in class processing.core.PApplet +
Show status in the status bar of a web browser, or in the + System.out console. +
StdXMLBuilder - Class in processing.xml
StdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + tree of IXMLElement from an XML data source.
StdXMLBuilder() - +Constructor for class processing.xml.StdXMLBuilder +
Creates the builder. +
StdXMLBuilder(XMLElement) - +Constructor for class processing.xml.StdXMLBuilder +
  +
StdXMLParser - Class in processing.xml
StdXMLParser is the core parser of NanoXML.
StdXMLParser() - +Constructor for class processing.xml.StdXMLParser +
Creates a new parser. +
StdXMLReader - Class in processing.xml
StdXMLReader reads the data to be parsed.
StdXMLReader(String, String) - +Constructor for class processing.xml.StdXMLReader +
Initializes the reader from a system and public ID. +
StdXMLReader(Reader) - +Constructor for class processing.xml.StdXMLReader +
Initializes the XML reader. +
StdXMLReader(InputStream) - +Constructor for class processing.xml.StdXMLReader +
Initializes the XML reader. +
stop() - +Method in class processing.core.PApplet +
Called by the browser or applet viewer to inform + this applet that it should stop its execution. +
str(boolean) - +Static method in class processing.core.PApplet +
  +
str(byte) - +Static method in class processing.core.PApplet +
  +
str(char) - +Static method in class processing.core.PApplet +
  +
str(int) - +Static method in class processing.core.PApplet +
  +
str(float) - +Static method in class processing.core.PApplet +
  +
str(boolean[]) - +Static method in class processing.core.PApplet +
  +
str(byte[]) - +Static method in class processing.core.PApplet +
  +
str(char[]) - +Static method in class processing.core.PApplet +
  +
str(int[]) - +Static method in class processing.core.PApplet +
  +
str(float[]) - +Static method in class processing.core.PApplet +
  +
stringReader(String) - +Static method in class processing.xml.StdXMLReader +
Creates a new reader using a string as input. +
stroke(int) - +Method in class processing.core.PApplet +
  +
stroke(int, float) - +Method in class processing.core.PApplet +
  +
stroke(float) - +Method in class processing.core.PApplet +
  +
stroke(float, float) - +Method in class processing.core.PApplet +
  +
stroke(float, float, float) - +Method in class processing.core.PApplet +
  +
stroke(float, float, float, float) - +Method in class processing.core.PApplet +
  +
stroke - +Variable in class processing.core.PGraphics +
true if stroke() is enabled, (read-only) +
stroke(int) - +Method in class processing.core.PGraphics +
Set the tint to either a grayscale or ARGB value. +
stroke(int, float) - +Method in class processing.core.PGraphics +
  +
stroke(float) - +Method in class processing.core.PGraphics +
  +
stroke(float, float) - +Method in class processing.core.PGraphics +
  +
stroke(float, float, float) - +Method in class processing.core.PGraphics +
  +
stroke(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
stroke - +Variable in class processing.core.PStyle +
  +
strokeCap(int) - +Method in class processing.core.PApplet +
  +
strokeCap - +Variable in class processing.core.PGraphics +
Set by strokeCap() (read-only). +
strokeCap(int) - +Method in class processing.core.PGraphics +
  +
strokeCap(int) - +Method in class processing.core.PGraphics3D +
  +
strokeCap(int) - +Method in class processing.core.PGraphicsJava2D +
  +
strokeCap - +Variable in class processing.core.PStyle +
  +
strokeColor - +Variable in class processing.core.PGraphics +
stroke that was last set (read-only) +
strokeColor - +Variable in class processing.core.PStyle +
  +
strokeGradient - +Variable in class processing.core.PGraphicsJava2D +
  +
strokeGradientObject - +Variable in class processing.core.PGraphicsJava2D +
  +
strokeJoin(int) - +Method in class processing.core.PApplet +
  +
strokeJoin - +Variable in class processing.core.PGraphics +
Set by strokeJoin() (read-only). +
strokeJoin(int) - +Method in class processing.core.PGraphics +
  +
strokeJoin(int) - +Method in class processing.core.PGraphics3D +
  +
strokeJoin(int) - +Method in class processing.core.PGraphicsJava2D +
  +
strokeJoin - +Variable in class processing.core.PStyle +
  +
strokeWeight(float) - +Method in class processing.core.PApplet +
  +
strokeWeight - +Variable in class processing.core.PGraphics +
Last value set by strokeWeight() (read-only). +
strokeWeight(float) - +Method in class processing.core.PGraphics +
  +
strokeWeight(float) - +Method in class processing.core.PGraphicsJava2D +
  +
strokeWeight - +Variable in class processing.core.PStyle +
  +
style(PStyle) - +Method in class processing.core.PApplet +
  +
style(PStyle) - +Method in class processing.core.PGraphics +
  +
sub(PVector) - +Method in class processing.core.PVector +
Subtract a vector from this vector +
sub(float, float, float) - +Method in class processing.core.PVector +
  +
sub(PVector, PVector) - +Static method in class processing.core.PVector +
Subtract one vector from another +
sub(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
  +
subset(boolean[], int) - +Static method in class processing.core.PApplet +
  +
subset(boolean[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(byte[], int) - +Static method in class processing.core.PApplet +
  +
subset(byte[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(char[], int) - +Static method in class processing.core.PApplet +
  +
subset(char[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(int[], int) - +Static method in class processing.core.PApplet +
  +
subset(int[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(float[], int) - +Static method in class processing.core.PApplet +
  +
subset(float[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(String[], int) - +Static method in class processing.core.PApplet +
  +
subset(String[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(Object, int) - +Static method in class processing.core.PApplet +
  +
subset(Object, int, int) - +Static method in class processing.core.PApplet +
  +
SUBTRACT - +Static variable in interface processing.core.PConstants +
  +
SW - +Static variable in interface processing.core.PConstants +
stroke weight +
+
+

+T

+
+
TAB - +Static variable in interface processing.core.PConstants +
  +
tan(float) - +Static method in class processing.core.PApplet +
  +
TARGA - +Static variable in interface processing.core.PConstants +
  +
text(char) - +Method in class processing.core.PApplet +
  +
text(char, float, float) - +Method in class processing.core.PApplet +
  +
text(char, float, float, float) - +Method in class processing.core.PApplet +
  +
text(String) - +Method in class processing.core.PApplet +
  +
text(String, float, float) - +Method in class processing.core.PApplet +
  +
text(char[], int, int, float, float) - +Method in class processing.core.PApplet +
  +
text(String, float, float, float) - +Method in class processing.core.PApplet +
  +
text(char[], int, int, float, float, float) - +Method in class processing.core.PApplet +
  +
text(String, float, float, float, float) - +Method in class processing.core.PApplet +
  +
text(String, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
text(int, float, float) - +Method in class processing.core.PApplet +
  +
text(int, float, float, float) - +Method in class processing.core.PApplet +
  +
text(float, float, float) - +Method in class processing.core.PApplet +
  +
text(float, float, float, float) - +Method in class processing.core.PApplet +
  +
TEXT - +Static variable in interface processing.core.PConstants +
  +
text(char) - +Method in class processing.core.PGraphics +
Write text where we just left off. +
text(char, float, float) - +Method in class processing.core.PGraphics +
Draw a single character on screen. +
text(char, float, float, float) - +Method in class processing.core.PGraphics +
Draw a single character on screen (with a z coordinate) +
text(String) - +Method in class processing.core.PGraphics +
Write text where we just left off. +
text(String, float, float) - +Method in class processing.core.PGraphics +
Draw a chunk of text. +
text(char[], int, int, float, float) - +Method in class processing.core.PGraphics +
Method to draw text from an array of chars. +
text(String, float, float, float) - +Method in class processing.core.PGraphics +
Same as above but with a z coordinate. +
text(char[], int, int, float, float, float) - +Method in class processing.core.PGraphics +
  +
text(String, float, float, float, float) - +Method in class processing.core.PGraphics +
Draw text in a box that is constrained to a particular size. +
text(String, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
text(int, float, float) - +Method in class processing.core.PGraphics +
  +
text(int, float, float, float) - +Method in class processing.core.PGraphics +
  +
text(float, float, float) - +Method in class processing.core.PGraphics +
This does a basic number formatting, to avoid the + generally ugly appearance of printing floats. +
text(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
textAlign(int) - +Method in class processing.core.PApplet +
  +
textAlign(int, int) - +Method in class processing.core.PApplet +
  +
textAlign - +Variable in class processing.core.PGraphics +
The current text align (read-only) +
textAlign(int) - +Method in class processing.core.PGraphics +
Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. +
textAlign(int, int) - +Method in class processing.core.PGraphics +
Sets the horizontal and vertical alignment of the text. +
textAlign - +Variable in class processing.core.PStyle +
  +
textAlignY - +Variable in class processing.core.PGraphics +
The current vertical text alignment (read-only) +
textAlignY - +Variable in class processing.core.PStyle +
  +
textAscent() - +Method in class processing.core.PApplet +
  +
textAscent() - +Method in class processing.core.PGraphics +
Returns the ascent of the current font at the current size. +
textAscent() - +Method in class processing.core.PGraphicsJava2D +
  +
textDescent() - +Method in class processing.core.PApplet +
  +
textDescent() - +Method in class processing.core.PGraphics +
Returns the descent of the current font at the current size. +
textDescent() - +Method in class processing.core.PGraphicsJava2D +
  +
textFont(PFont) - +Method in class processing.core.PApplet +
  +
textFont(PFont, float) - +Method in class processing.core.PApplet +
  +
textFont - +Variable in class processing.core.PGraphics +
The current text font (read-only) +
textFont(PFont) - +Method in class processing.core.PGraphics +
Sets the current font. +
textFont(PFont, float) - +Method in class processing.core.PGraphics +
Useful function to set the font and size at the same time. +
textFont - +Variable in class processing.core.PStyle +
  +
textLeading(float) - +Method in class processing.core.PApplet +
  +
textLeading - +Variable in class processing.core.PGraphics +
The current text leading (read-only) +
textLeading(float) - +Method in class processing.core.PGraphics +
Set the text leading to a specific value. +
textLeading - +Variable in class processing.core.PStyle +
  +
textMode(int) - +Method in class processing.core.PApplet +
  +
textMode - +Variable in class processing.core.PGraphics +
The current text mode (read-only) +
textMode(int) - +Method in class processing.core.PGraphics +
Sets the text rendering/placement to be either SCREEN (direct + to the screen, exact coordinates, only use the font's original size) + or MODEL (the default, where text is manipulated by translate() and + can have a textSize). +
textMode - +Variable in class processing.core.PStyle +
  +
textSize(float) - +Method in class processing.core.PApplet +
  +
textSize - +Variable in class processing.core.PGraphics +
The current text size (read-only) +
textSize(float) - +Method in class processing.core.PGraphics +
Sets the text size, also resets the value for the leading. +
textSize(float) - +Method in class processing.core.PGraphicsJava2D +
Same as parent, but override for native version of the font. +
textSize - +Variable in class processing.core.PStyle +
  +
texture(PImage) - +Method in class processing.core.PApplet +
  +
texture(PImage) - +Method in class processing.core.PGraphics +
Set texture image for current shape. +
texture(PImage) - +Method in class processing.core.PGraphics3D +
  +
texture(PImage) - +Method in class processing.core.PGraphicsJava2D +
  +
texture(PImage) - +Method in class processing.core.PSmoothTriangle +
  +
textureImage - +Variable in class processing.core.PGraphics +
Current image being used as a texture +
textureMode(int) - +Method in class processing.core.PApplet +
  +
textureMode - +Variable in class processing.core.PGraphics +
Sets whether texture coordinates passed to + vertex() calls will be based on coordinates that are + based on the IMAGE or NORMALIZED. +
textureMode(int) - +Method in class processing.core.PGraphics +
Set texture mode to either to use coordinates based on the IMAGE + (more intuitive for new users) or NORMALIZED (better for advanced chaps) +
textureU - +Variable in class processing.core.PGraphics +
Current horizontal coordinate for texture, will always + be between 0 and 1, even if using textureMode(IMAGE). +
textureV - +Variable in class processing.core.PGraphics +
Current vertical coordinate for texture, see above. +
textWidth(char) - +Method in class processing.core.PApplet +
  +
textWidth(String) - +Method in class processing.core.PApplet +
  +
textWidth(char) - +Method in class processing.core.PGraphics +
  +
textWidth(String) - +Method in class processing.core.PGraphics +
Return the width of a line of text. +
theight - +Variable in class processing.core.PFont +
texture height, same as mbox2, but reserved for future use +
THIRD_PI - +Static variable in interface processing.core.PConstants +
  +
THRESHOLD - +Static variable in interface processing.core.PConstants +
  +
TIFF - +Static variable in interface processing.core.PConstants +
  +
tint(int) - +Method in class processing.core.PApplet +
  +
tint(int, float) - +Method in class processing.core.PApplet +
  +
tint(float) - +Method in class processing.core.PApplet +
  +
tint(float, float) - +Method in class processing.core.PApplet +
  +
tint(float, float, float) - +Method in class processing.core.PApplet +
  +
tint(float, float, float, float) - +Method in class processing.core.PApplet +
  +
tint - +Variable in class processing.core.PGraphics +
True if tint() is enabled (read-only). +
tint(int) - +Method in class processing.core.PGraphics +
Set the tint to either a grayscale or ARGB value. +
tint(int, float) - +Method in class processing.core.PGraphics +
  +
tint(float) - +Method in class processing.core.PGraphics +
  +
tint(float, float) - +Method in class processing.core.PGraphics +
  +
tint(float, float, float) - +Method in class processing.core.PGraphics +
  +
tint(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
tint - +Variable in class processing.core.PStyle +
  +
tintColor - +Variable in class processing.core.PGraphics +
tint that was last set (read-only) +
tintColor - +Variable in class processing.core.PStyle +
  +
TOP - +Static variable in interface processing.core.PConstants +
Align text to the top +
topExtent - +Variable in class processing.core.PFont +
  +
toString() - +Method in class processing.core.PVector +
  +
toString(boolean) - +Method in class processing.xml.XMLElement +
  +
toString() - +Method in exception processing.xml.XMLException +
Returns a string representation of the exception. +
translate(float, float) - +Method in class processing.core.PApplet +
  +
translate(float, float, float) - +Method in class processing.core.PApplet +
  +
translate(float, float) - +Method in class processing.core.PGraphics +
Translate in X and Y. +
translate(float, float, float) - +Method in class processing.core.PGraphics +
Translate in X, Y, and Z. +
translate(float, float) - +Method in class processing.core.PGraphics2D +
  +
translate(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
translate(float, float) - +Method in class processing.core.PGraphics3D +
  +
translate(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
translate(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
translate(float, float) - +Method in interface processing.core.PMatrix +
  +
translate(float, float, float) - +Method in interface processing.core.PMatrix +
  +
translate(float, float) - +Method in class processing.core.PMatrix2D +
  +
translate(float, float, float) - +Method in class processing.core.PMatrix2D +
  +
translate(float, float) - +Method in class processing.core.PMatrix3D +
  +
translate(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
translate(float, float) - +Method in class processing.core.PShape +
  +
translate(float, float, float) - +Method in class processing.core.PShape +
  +
transpose() - +Method in interface processing.core.PMatrix +
Transpose this matrix. +
transpose() - +Method in class processing.core.PMatrix2D +
Transpose this matrix. +
transpose() - +Method in class processing.core.PMatrix3D +
Transpose this matrix. +
TRI_COLOR_COUNT - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_A - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_B - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_G - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_R - +Static variable in class processing.core.PGraphics3D +
  +
TRI_SPECULAR_B - +Static variable in class processing.core.PGraphics3D +
  +
TRI_SPECULAR_G - +Static variable in class processing.core.PGraphics3D +
  +
TRI_SPECULAR_R - +Static variable in class processing.core.PGraphics3D +
  +
triangle(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
TRIANGLE - +Static variable in interface processing.core.PConstants +
  +
triangle(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
triangle - +Variable in class processing.core.PGraphics3D +
  +
triangle(float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
TRIANGLE_FAN - +Static variable in interface processing.core.PConstants +
  +
TRIANGLE_STRIP - +Static variable in interface processing.core.PConstants +
  +
TRIANGLES - +Static variable in interface processing.core.PConstants +
  +
trim(String) - +Static method in class processing.core.PApplet +
Remove whitespace characters from the beginning and ending + of a String. +
trim(String[]) - +Static method in class processing.core.PApplet +
Trim the whitespace from a String array. +
twidth - +Variable in class processing.core.PFont +
texture width, same as mbox2, but reserved for future use +
TWO_PI - +Static variable in interface processing.core.PConstants +
  +
TX - +Static variable in interface processing.core.PConstants +
  +
TY - +Static variable in interface processing.core.PConstants +
  +
TZ - +Static variable in interface processing.core.PConstants +
  +
+
+

+U

+
+
U - +Static variable in interface processing.core.PConstants +
  +
unbinary(String) - +Static method in class processing.core.PApplet +
Unpack a binary String into an int. +
unexpand() - +Method in class processing.core.PSmoothTriangle +
  +
UNEXPECTED_ATTRIBUTE - +Static variable in exception processing.xml.XMLValidationException +
An unexpected attribute was encountered. +
UNEXPECTED_ELEMENT - +Static variable in exception processing.xml.XMLValidationException +
An unexpected element was encountered. +
UNEXPECTED_PCDATA - +Static variable in exception processing.xml.XMLValidationException +
An unexpected PCDATA element was encountered. +
unhex(String) - +Static method in class processing.core.PApplet +
  +
unread(char) - +Method in class processing.xml.StdXMLReader +
Pushes the last character read back to the stream. +
unregisterDispose(Object) - +Method in class processing.core.PApplet +
  +
unregisterDraw(Object) - +Method in class processing.core.PApplet +
  +
unregisterKeyEvent(Object) - +Method in class processing.core.PApplet +
  +
unregisterMouseEvent(Object) - +Method in class processing.core.PApplet +
  +
unregisterPost(Object) - +Method in class processing.core.PApplet +
  +
unregisterPre(Object) - +Method in class processing.core.PApplet +
  +
unregisterSize(Object) - +Method in class processing.core.PApplet +
  +
UP - +Static variable in interface processing.core.PConstants +
  +
update(Graphics) - +Method in class processing.core.PApplet +
  +
updatePixels() - +Method in class processing.core.PApplet +
  +
updatePixels(int, int, int, int) - +Method in class processing.core.PApplet +
  +
updatePixels() - +Method in class processing.core.PGraphicsJava2D +
Update the pixels[] buffer to the PGraphics image. +
updatePixels(int, int, int, int) - +Method in class processing.core.PGraphicsJava2D +
Update the pixels[] buffer to the PGraphics image. +
updatePixels() - +Method in class processing.core.PImage +
Call this when finished messing with the pixels[] array. +
updatePixels(int, int, int, int) - +Method in class processing.core.PImage +
Mark the pixels in this region as needing an update. +
+
+

+V

+
+
V - +Static variable in interface processing.core.PConstants +
  +
value - +Variable in class processing.core.PFont +
  +
vertex(float, float) - +Method in class processing.core.PApplet +
  +
vertex(float, float, float) - +Method in class processing.core.PApplet +
  +
vertex(float[]) - +Method in class processing.core.PApplet +
  +
vertex(float, float, float, float) - +Method in class processing.core.PApplet +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
vertex(float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float, float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float[]) - +Method in class processing.core.PGraphics +
Used by renderer subclasses or PShape to efficiently pass in already + formatted vertex information. +
vertex(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
vertex(float, float) - +Method in class processing.core.PGraphics3D +
  +
vertex(float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
vertex(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
vertex(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
vertex(float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
VERTEX - +Static variable in class processing.core.PShape +
  +
VERTEX_FIELD_COUNT - +Static variable in interface processing.core.PConstants +
  +
VW - +Static variable in interface processing.core.PConstants +
  +
VX - +Static variable in interface processing.core.PConstants +
  +
VY - +Static variable in interface processing.core.PConstants +
  +
VZ - +Static variable in interface processing.core.PConstants +
  +
+
+

+W

+
+
WAIT - +Static variable in interface processing.core.PConstants +
  +
WHITESPACE - +Static variable in interface processing.core.PConstants +
  +
width - +Variable in class processing.core.PApplet +
width of this applet's associated PGraphics +
width - +Variable in class processing.core.PFont +
  +
width(char) - +Method in class processing.core.PFont +
Width of this character for a font of size 1. +
width - +Variable in class processing.core.PImage +
  +
width - +Variable in class processing.core.PShape +
  +
WINDOWS - +Static variable in interface processing.core.PConstants +
  +
write(XMLElement) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
write(XMLElement, boolean) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
write(XMLElement, boolean, int) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
write(XMLElement, boolean, int, boolean) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
+
+

+X

+
+
X - +Static variable in interface processing.core.PConstants +
  +
x - +Variable in class processing.core.PVector +
The x component of the vector. +
XMLElement - Class in processing.xml
XMLElement is an XML element.
XMLElement() - +Constructor for class processing.xml.XMLElement +
Creates an empty element to be used for #PCDATA content. +
XMLElement(String, String, String, int) - +Constructor for class processing.xml.XMLElement +
Creates an empty element. +
XMLElement(PApplet, String) - +Constructor for class processing.xml.XMLElement +
Begin parsing XML data passed in from a PApplet. +
XMLElement(Reader) - +Constructor for class processing.xml.XMLElement +
  +
XMLElement(String) - +Constructor for class processing.xml.XMLElement +
  +
XMLEntityResolver - Class in processing.xml
An XMLEntityResolver resolves entities.
XMLEntityResolver() - +Constructor for class processing.xml.XMLEntityResolver +
Initializes the resolver. +
XMLException - Exception in processing.xml
An XMLException is thrown when an exception occurred while processing the + XML data.
XMLException(String) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(Exception) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(String, int, Exception) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(String, int, String) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(String, int, Exception, String, boolean) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLParseException - Exception in processing.xml
An XMLParseException is thrown when the XML passed to the XML parser is not + well-formed.
XMLParseException(String) - +Constructor for exception processing.xml.XMLParseException +
Creates a new exception. +
XMLParseException(String, int, String) - +Constructor for exception processing.xml.XMLParseException +
Creates a new exception. +
XMLValidationException - Exception in processing.xml
An XMLValidationException is thrown when the XML passed to the XML parser is + well-formed but not valid.
XMLValidationException(int, String, int, String, String, String, String) - +Constructor for exception processing.xml.XMLValidationException +
Creates a new exception. +
XMLValidator - Class in processing.xml
XMLValidator implementation based on NonValidator (which implemented + IXMLValidator in the original NanoXML).
XMLValidator() - +Constructor for class processing.xml.XMLValidator +
Creates the "validator". +
XMLWriter - Class in processing.xml
An XMLWriter writes XML data to a stream.
XMLWriter(Writer) - +Constructor for class processing.xml.XMLWriter +
Creates a new XML writer. +
XMLWriter(OutputStream) - +Constructor for class processing.xml.XMLWriter +
Creates a new XML writer. +
+
+

+Y

+
+
Y - +Static variable in interface processing.core.PConstants +
  +
y - +Variable in class processing.core.PVector +
The y component of the vector. +
year() - +Static method in class processing.core.PApplet +
Get the current year. +
+
+

+Z

+
+
Z - +Static variable in interface processing.core.PConstants +
  +
z - +Variable in class processing.core.PVector +
The z component of the vector. +
zbuffer - +Variable in class processing.core.PGraphics3D +
The depth buffer. +
+
+A B C D E F G H I J K L M N O P Q R S T U V W X Y Z + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/index.html b/build/javadoc/core/index.html new file mode 100644 index 000000000..556db6944 --- /dev/null +++ b/build/javadoc/core/index.html @@ -0,0 +1,38 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="overview-summary.html">Non-frame version.</A> + + + diff --git a/build/javadoc/core/overview-frame.html b/build/javadoc/core/overview-frame.html new file mode 100644 index 000000000..e8f7ed0e2 --- /dev/null +++ b/build/javadoc/core/overview-frame.html @@ -0,0 +1,43 @@ + + + + + +Overview + + + + + + + + + + + + + + + +
+
+ + + + + +
All Classes +

+ +Packages +
+processing.core +
+processing.xml +
+

+ +

+  + + diff --git a/build/javadoc/core/overview-summary.html b/build/javadoc/core/overview-summary.html new file mode 100644 index 000000000..19653e59b --- /dev/null +++ b/build/javadoc/core/overview-summary.html @@ -0,0 +1,149 @@ + + + + + +Overview + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +


+ + + + + + + + + + + + + +
+Packages
processing.core 
processing.xml 
+ +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/overview-tree.html b/build/javadoc/core/overview-tree.html new file mode 100644 index 000000000..f9adb0523 --- /dev/null +++ b/build/javadoc/core/overview-tree.html @@ -0,0 +1,188 @@ + + + + + +Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
processing.core, processing.xml
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/package-list b/build/javadoc/core/package-list new file mode 100644 index 000000000..a760d39f7 --- /dev/null +++ b/build/javadoc/core/package-list @@ -0,0 +1,2 @@ +processing.core +processing.xml diff --git a/build/javadoc/core/processing/core/PApplet.RegisteredMethods.html b/build/javadoc/core/processing/core/PApplet.RegisteredMethods.html new file mode 100644 index 000000000..85b41c167 --- /dev/null +++ b/build/javadoc/core/processing/core/PApplet.RegisteredMethods.html @@ -0,0 +1,320 @@ + + + + + +PApplet.RegisteredMethods + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PApplet.RegisteredMethods

+
+java.lang.Object
+  extended by processing.core.PApplet.RegisteredMethods
+
+
+
Enclosing class:
PApplet
+
+
+
+
public class PApplet.RegisteredMethods
extends java.lang.Object
+ + +

+This returns the last width and height specified by the user + via the size() command. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
PApplet.RegisteredMethods() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(java.lang.Object object, + java.lang.reflect.Method method) + +
+           
+ voidhandle() + +
+           
+ voidhandle(java.lang.Object[] oargs) + +
+           
+ voidremove(java.lang.Object object, + java.lang.reflect.Method method) + +
+          Removes first object/method pair matched (and only the first, + must be called multiple times if object is registered multiple times).
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PApplet.RegisteredMethods

+
+public PApplet.RegisteredMethods()
+
+
+ + + + + + + + +
+Method Detail
+ +

+handle

+
+public void handle()
+
+
+
+
+
+
+ +

+handle

+
+public void handle(java.lang.Object[] oargs)
+
+
+
+
+
+
+ +

+add

+
+public void add(java.lang.Object object,
+                java.lang.reflect.Method method)
+
+
+
+
+
+
+ +

+remove

+
+public void remove(java.lang.Object object,
+                   java.lang.reflect.Method method)
+
+
Removes first object/method pair matched (and only the first, + must be called multiple times if object is registered multiple times). + Does not shrink array afterwards, silently returns if method not found. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PApplet.RendererChangeException.html b/build/javadoc/core/processing/core/PApplet.RendererChangeException.html new file mode 100644 index 000000000..a0826c998 --- /dev/null +++ b/build/javadoc/core/processing/core/PApplet.RendererChangeException.html @@ -0,0 +1,246 @@ + + + + + +PApplet.RendererChangeException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PApplet.RendererChangeException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.lang.RuntimeException
+              extended by processing.core.PApplet.RendererChangeException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
Enclosing class:
PApplet
+
+
+
+
public static class PApplet.RendererChangeException
extends java.lang.RuntimeException
+ + +

+Exception thrown when size() is called the first time. +

+ This is used internally so that setup() is forced to run twice + when the renderer is changed. This is the only way for us to handle + invoking the new renderer while also in the midst of rendering. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
PApplet.RendererChangeException() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PApplet.RendererChangeException

+
+public PApplet.RendererChangeException()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PApplet.html b/build/javadoc/core/processing/core/PApplet.html new file mode 100644 index 000000000..107daf932 --- /dev/null +++ b/build/javadoc/core/processing/core/PApplet.html @@ -0,0 +1,16706 @@ + + + + + +PApplet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PApplet

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Panel
+              extended by java.applet.Applet
+                  extended by processing.core.PApplet
+
+
+
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, PConstants
+
+
+
+
public class PApplet
extends java.applet.Applet
implements PConstants, java.lang.Runnable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, java.awt.event.FocusListener
+ + +

+Base class for all sketches that use processing.core. +

+ Note that you should not use AWT or Swing components inside a Processing + applet. The surface is made to automatically update itself, and will cause + problems with redraw of components drawn above it. If you'd like to + integrate other Java components, see below. +

+ As of release 0145, Processing uses active mode rendering in all cases. + All animation tasks happen on the "Processing Animation Thread". The + setup() and draw() methods are handled by that thread, and events (like + mouse movement and key presses, which are fired by the event dispatch + thread or EDT) are queued to be (safely) handled at the end of draw(). + For code that needs to run on the EDT, use SwingUtilities.invokeLater(). + When doing so, be careful to synchronize between that code (since + invokeLater() will make your code run from the EDT) and the Processing + animation thread. Use of a callback function or the registerXxx() methods + in PApplet can help ensure that your code doesn't do something naughty. +

+ As of release 0136 of Processing, we have discontinued support for versions + of Java prior to 1.5. We don't have enough people to support it, and for a + project of our size, we should be focusing on the future, rather than + working around legacy Java code. In addition, Java 1.5 gives us access to + better timing facilities which will improve the steadiness of animation. +

+ This class extends Applet instead of JApplet because 1) historically, + we supported Java 1.1, which does not include Swing (without an + additional, sizable, download), and 2) Swing is a bloated piece of crap. + A Processing applet is a heavyweight AWT component, and can be used the + same as any other AWT component, with or without Swing. +

+ Similarly, Processing runs in a Frame and not a JFrame. However, there's + nothing to prevent you from embedding a PApplet into a JFrame, it's just + that the base version uses a regular AWT frame because there's simply + no need for swing in that context. If people want to use Swing, they can + embed themselves as they wish. +

+ It is possible to use PApplet, along with core.jar in other projects. + In addition to enabling you to use Java 1.5+ features with your sketch, + this also allows you to embed a Processing drawing area into another Java + application. This means you can use standard GUI controls with a Processing + sketch. Because AWT and Swing GUI components cannot be used on top of a + PApplet, you can instead embed the PApplet inside another GUI the way you + would any other Component. +

+ It is also possible to resize the Processing window by including + frame.setResizable(true) inside your setup() method. + Note that the Java method frame.setSize() will not work unless + you first set the frame to be resizable. +

+ Because the default animation thread will run at 60 frames per second, + an embedded PApplet can make the parent sluggish. You can use frameRate() + to make it update less often, or you can use noLoop() and loop() to disable + and then re-enable looping. If you want to only update the sketch + intermittently, use noLoop() inside setup(), and redraw() whenever + the screen needs to be updated once (or loop() to re-enable the animation + thread). The following example embeds a sketch and also uses the noLoop() + and redraw() methods. You need not use noLoop() and redraw() when embedding + if you want your application to animate continuously. +

+ public class ExampleFrame extends Frame {
+
+     public ExampleFrame() {
+         super("Embedded PApplet");
+
+         setLayout(new BorderLayout());
+         PApplet embed = new Embedded();
+         add(embed, BorderLayout.CENTER);
+
+         // important to call this whenever embedding a PApplet.
+         // It ensures that the animation thread is started and
+         // that other internal variables are properly set.
+         embed.init();
+     }
+ }
+
+ public class Embedded extends PApplet {
+
+     public void setup() {
+         // original setup code here ...
+         size(400, 400);
+
+         // prevent thread from starving everything else
+         noLoop();
+     }
+
+     public void draw() {
+         // drawing code goes here
+     }
+
+     public void mousePressed() {
+         // do something based on mouse movement
+
+         // update the screen (run draw once)
+         redraw();
+     }
+ }
+ 
+ +

Processing on multiple displays

+

I was asked about Processing with multiple displays, and for lack of a + better place to document it, things will go here.

+

You can address both screens by making a window the width of both, + and the height of the maximum of both screens. In this case, do not use + present mode, because that's exclusive to one screen. Basically it'll + give you a PApplet that spans both screens. If using one half to control + and the other half for graphics, you'd just have to put the 'live' stuff + on one half of the canvas, the control stuff on the other. This works + better in windows because on the mac we can't get rid of the menu bar + unless it's running in present mode.

+

For more control, you need to write straight java code that uses p5. + You can create two windows, that are shown on two separate screens, + that have their own PApplet. this is just one of the tradeoffs of one of + the things that we don't support in p5 from within the environment + itself (we must draw the line somewhere), because of how messy it would + get to start talking about multiple screens. It's also not that tough to + do by hand w/ some Java code.

+

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+ classPApplet.RegisteredMethods + +
+          This returns the last width and height specified by the user + via the size() command.
+static classPApplet.RendererChangeException + +
+          Exception thrown when size() is called the first time.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ java.lang.String[]args + +
+          Command line options passed in from main().
+static java.lang.StringARGS_BGCOLOR + +
+           
+static java.lang.StringARGS_DISPLAY + +
+           
+static java.lang.StringARGS_EDITOR_LOCATION + +
+          Position of the upper-lefthand corner of the editor window + that launched this applet.
+static java.lang.StringARGS_EXCLUSIVE + +
+           
+static java.lang.StringARGS_EXTERNAL + +
+          Location for where to position the applet window on screen.
+static java.lang.StringARGS_HIDE_STOP + +
+           
+static java.lang.StringARGS_LOCATION + +
+           
+static java.lang.StringARGS_PRESENT + +
+           
+static java.lang.StringARGS_SKETCH_FOLDER + +
+          Allows the user or PdeEditor to set a specific sketch folder path.
+static java.lang.StringARGS_STOP_COLOR + +
+           
+static intDEFAULT_HEIGHT + +
+           
+static intDEFAULT_WIDTH + +
+          Default width and height for applet when not specified
+ booleandefaultSize + +
+          true if no size() command has been executed.
+static java.lang.StringEXTERNAL_MOVE + +
+          When run externally to a PDE Editor, this is sent by the applet + whenever the window is moved.
+static java.lang.StringEXTERNAL_STOP + +
+          When run externally to a PdeEditor, + this is sent by the applet when it quits.
+ booleanfinished + +
+          true if this applet has had it.
+ booleanfirstMouse + +
+          Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump.
+ booleanfocused + +
+          Gets set to true/false as the applet gains/loses focus.
+ java.awt.Frameframe + +
+          The frame containing this applet (if any)
+ intframeCount + +
+          How many frames have been displayed since the applet started.
+ floatframeRate + +
+          The current value of frames per second.
+ PGraphicsg + +
+          The PGraphics renderer associated with this PApplet
+ intheight + +
+          height of this applet's associated PGraphics
+static byte[]ICON_IMAGE + +
+          GIF image of the Processing logo.
+static floatjavaVersion + +
+          Version of Java that's in use, whether 1.1 or 1.3 or whatever, + stored as a float.
+static java.lang.StringjavaVersionName + +
+          Full name of the Java version (i.e.
+ charkey + +
+          Last key pressed.
+ intkeyCode + +
+          When "key" is set to CODED, this will contain a Java key code.
+ java.awt.event.KeyEventkeyEvent + +
+          the last KeyEvent object passed into a mouse function.
+ booleankeyPressed + +
+          true if the mouse is currently pressed.
+static intMENU_SHORTCUT + +
+          Modifier flags for the shortcut key used to trigger menus.
+static intMIN_WINDOW_HEIGHT + +
+           
+static intMIN_WINDOW_WIDTH + +
+          Minimum dimensions for the window holding an applet.
+ intmouseButton + +
+          Last mouse button pressed, one of LEFT, CENTER, or RIGHT.
+ java.awt.event.MouseEventmouseEvent + +
+           
+ booleanmousePressed + +
+           
+ intmouseX + +
+          current x position of the mouse
+ intmouseY + +
+          current y position of the mouse
+ booleanonline + +
+          true if the applet is online.
+ int[]pixels + +
+          Pixel buffer from this applet's PGraphics.
+static intplatform + +
+          Current platform in use, one of the + PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER.
+ intpmouseX + +
+          Previous x/y position of the mouse.
+ intpmouseY + +
+          Previous x/y position of the mouse.
+ PGraphicsrecorder + +
+          A leech graphics object that is echoing all events.
+ intrequestImageMax + +
+          By trial and error, four image loading threads seem to work best when + loading images from online.
+ java.awt.Dimensionscreen + +
+          The screen size when the applet was started.
+ java.io.FileselectedFile + +
+           
+ java.lang.StringsketchPath + +
+          Path to sketch folder
+ intwidth + +
+          width of this applet's associated PGraphics
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
PApplet() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static floatabs(float n) + +
+           
+static intabs(int n) + +
+           
+static floatacos(float value) + +
+           
+ voidaddListeners() + +
+           
+ floatalpha(int what) + +
+           
+ voidambient(float gray) + +
+           
+ voidambient(float x, + float y, + float z) + +
+           
+ voidambient(int rgb) + +
+           
+ voidambientLight(float red, + float green, + float blue) + +
+           
+ voidambientLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+static byte[]append(byte[] b, + byte value) + +
+           
+static char[]append(char[] b, + char value) + +
+           
+static float[]append(float[] b, + float value) + +
+           
+static int[]append(int[] b, + int value) + +
+           
+static java.lang.Objectappend(java.lang.Object b, + java.lang.Object value) + +
+           
+static java.lang.String[]append(java.lang.String[] b, + java.lang.String value) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapplyMatrix(PMatrix source) + +
+           
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voidapplyMatrix(PMatrix3D source) + +
+           
+ voidarc(float a, + float b, + float c, + float d, + float start, + float stop) + +
+           
+static voidarraycopy(java.lang.Object src, + int srcPosition, + java.lang.Object dst, + int dstPosition, + int length) + +
+          Deprecated. Use arrayCopy() instead.
+static voidarrayCopy(java.lang.Object src, + int srcPosition, + java.lang.Object dst, + int dstPosition, + int length) + +
+          Calls System.arraycopy(), included here so that we can + avoid people needing to learn about the System object + before they can just copy an array.
+static voidarraycopy(java.lang.Object src, + java.lang.Object dst) + +
+          Deprecated. Use arrayCopy() instead.
+static voidarrayCopy(java.lang.Object src, + java.lang.Object dst) + +
+          Shortcut to copy the entire contents of + the source into the destination array.
+static voidarraycopy(java.lang.Object src, + java.lang.Object dst, + int length) + +
+          Deprecated. Use arrayCopy() instead.
+static voidarrayCopy(java.lang.Object src, + java.lang.Object dst, + int length) + +
+          Convenience method for arraycopy().
+static floatasin(float value) + +
+           
+static floatatan(float value) + +
+           
+static floatatan2(float a, + float b) + +
+           
+ voidbackground(float gray) + +
+           
+ voidbackground(float gray, + float alpha) + +
+           
+ voidbackground(float x, + float y, + float z) + +
+           
+ voidbackground(float x, + float y, + float z, + float a) + +
+           
+ voidbackground(int rgb) + +
+           
+ voidbackground(int rgb, + float alpha) + +
+           
+ voidbackground(PImage image) + +
+           
+ voidbeginCamera() + +
+           
+ voidbeginRaw(PGraphics rawGraphics) + +
+          Begin recording raw shape data to the specified renderer.
+ PGraphicsbeginRaw(java.lang.String renderer, + java.lang.String filename) + +
+          Begin recording raw shape data to a renderer of the specified type, + using the width and height of the main drawing surface.
+ voidbeginRecord(PGraphics recorder) + +
+          Begin recording (echoing) commands to the specified PGraphics object.
+ PGraphicsbeginRecord(java.lang.String renderer, + java.lang.String filename) + +
+          Begin recording to a new renderer of the specified type, using the width + and height of the main drawing surface.
+ voidbeginShape() + +
+           
+ voidbeginShape(int kind) + +
+           
+ voidbezier(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidbezier(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbezierDetail(int detail) + +
+           
+ floatbezierPoint(float a, + float b, + float c, + float d, + float t) + +
+           
+ floatbezierTangent(float a, + float b, + float c, + float d, + float t) + +
+           
+ voidbezierVertex(float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidbezierVertex(float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+static java.lang.Stringbinary(byte what) + +
+          Returns a String that contains the binary value of a byte.
+static java.lang.Stringbinary(char what) + +
+          Returns a String that contains the binary value of a char.
+static java.lang.Stringbinary(int what) + +
+          Returns a String that contains the binary value of an int.
+static java.lang.Stringbinary(int what, + int digits) + +
+          Returns a String that contains the binary value of an int.
+ voidblend(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+           
+ voidblend(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+           
+static intblendColor(int c1, + int c2, + int mode) + +
+           
+ floatblue(int what) + +
+           
+ voidbox(float size) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+           
+ floatbrightness(int what) + +
+           
+ voidcamera() + +
+           
+ voidcamera(float eyeX, + float eyeY, + float eyeZ, + float centerX, + float centerY, + float centerZ, + float upX, + float upY, + float upZ) + +
+           
+static intceil(float what) + +
+           
+ intcolor(float fgray) + +
+           
+ intcolor(float fgray, + float falpha) + +
+           
+ intcolor(float x, + float y, + float z) + +
+           
+ intcolor(float x, + float y, + float z, + float a) + +
+           
+ intcolor(int gray) + +
+           
+ intcolor(int gray, + int alpha) + +
+          As of 0116 this also takes color(#FF8800, alpha)
+ intcolor(int x, + int y, + int z) + +
+           
+ intcolor(int x, + int y, + int z, + int a) + +
+           
+ voidcolorMode(int mode) + +
+           
+ voidcolorMode(int mode, + float max) + +
+           
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ) + +
+           
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ, + float maxA) + +
+           
+static boolean[]concat(boolean[] a, + boolean[] b) + +
+           
+static byte[]concat(byte[] a, + byte[] b) + +
+           
+static char[]concat(char[] a, + char[] b) + +
+           
+static float[]concat(float[] a, + float[] b) + +
+           
+static int[]concat(int[] a, + int[] b) + +
+           
+static java.lang.Objectconcat(java.lang.Object a, + java.lang.Object b) + +
+           
+static java.lang.String[]concat(java.lang.String[] a, + java.lang.String[] b) + +
+           
+static floatconstrain(float amt, + float low, + float high) + +
+           
+static intconstrain(int amt, + int low, + int high) + +
+           
+ voidcopy(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+           
+ voidcopy(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+           
+static floatcos(float angle) + +
+           
+ PFontcreateFont(java.lang.String name, + float size) + +
+           
+ PFontcreateFont(java.lang.String name, + float size, + boolean smooth) + +
+           
+ PFontcreateFont(java.lang.String name, + float size, + boolean smooth, + char[] charset) + +
+          Create a .vlw font on the fly from either a font name that's + installed on the system, or from a .ttf or .otf that's inside + the data folder of this sketch.
+ PGraphicscreateGraphics(int iwidth, + int iheight, + java.lang.String irenderer) + +
+          Create an offscreen PGraphics object for drawing.
+ PGraphicscreateGraphics(int iwidth, + int iheight, + java.lang.String irenderer, + java.lang.String ipath) + +
+          Create an offscreen graphics surface for drawing, in this case + for a renderer that writes to a file (such as PDF or DXF).
+ PImagecreateImage(int wide, + int high, + int format) + +
+          Preferred method of creating new PImage objects, ensures that a + reference to the parent PApplet is included, which makes save() work + without needing an absolute path.
+static java.io.InputStreamcreateInput(java.io.File file) + +
+           
+ java.io.InputStreamcreateInput(java.lang.String filename) + +
+          Simplified method to open a Java InputStream.
+ java.io.InputStreamcreateInputRaw(java.lang.String filename) + +
+          Call openStream() without automatic gzip decompression.
+static java.io.OutputStreamcreateOutput(java.io.File file) + +
+           
+ java.io.OutputStreamcreateOutput(java.lang.String filename) + +
+          Similar to createInput() (formerly openStream), this creates a Java + OutputStream for a given filename or path.
+static voidcreatePath(java.io.File file) + +
+           
+static voidcreatePath(java.lang.String path) + +
+          Takes a path and creates any in-between folders if they don't + already exist.
+static java.io.BufferedReadercreateReader(java.io.File file) + +
+          I want to read lines from a file.
+static java.io.BufferedReadercreateReader(java.io.InputStream input) + +
+          I want to read lines from a stream.
+ java.io.BufferedReadercreateReader(java.lang.String filename) + +
+          I want to read lines from a file.
+static java.io.PrintWritercreateWriter(java.io.File file) + +
+          I want to print lines to a file.
+static java.io.PrintWritercreateWriter(java.io.OutputStream output) + +
+          I want to print lines to a file.
+ java.io.PrintWritercreateWriter(java.lang.String filename) + +
+          I want to print lines to a file.
+ voidcursor() + +
+          Show the cursor after noCursor() was called.
+ voidcursor(int cursorType) + +
+          Set the cursor type
+ voidcursor(PImage image) + +
+          Replace the cursor with the specified PImage.
+ voidcursor(PImage image, + int hotspotX, + int hotspotY) + +
+          Set a custom cursor to an image with a specific hotspot.
+ voidcurve(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidcurve(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidcurveDetail(int detail) + +
+           
+ floatcurvePoint(float a, + float b, + float c, + float d, + float t) + +
+           
+ floatcurveTangent(float a, + float b, + float c, + float d, + float t) + +
+           
+ voidcurveTightness(float tightness) + +
+           
+ voidcurveVertex(float x, + float y) + +
+           
+ voidcurveVertex(float x, + float y, + float z) + +
+           
+ java.io.FiledataFile(java.lang.String where) + +
+          Return a full path to an item in the data folder as a File object.
+ java.lang.StringdataPath(java.lang.String where) + +
+          Return a full path to an item in the data folder.
+static intday() + +
+          Get the current day of the month (1 through 31).
+static floatdegrees(float radians) + +
+           
+ voiddelay(int napTime) + +
+          The delay() function causes the program to halt for a specified time.
+ voiddestroy() + +
+          Called by the browser or applet viewer to inform this applet + that it is being reclaimed and that it should destroy + any resources that it has allocated.
+ voiddie(java.lang.String what) + +
+          Function for an applet/application to kill itself and + display an error.
+ voiddie(java.lang.String what, + java.lang.Exception e) + +
+          Same as above but with an exception.
+ voiddirectionalLight(float red, + float green, + float blue, + float nx, + float ny, + float nz) + +
+           
+ booleandisplayable() + +
+           
+static floatdist(float x1, + float y1, + float x2, + float y2) + +
+           
+static floatdist(float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ voiddraw() + +
+           
+ voidedge(boolean edge) + +
+           
+ voidellipse(float a, + float b, + float c, + float d) + +
+           
+ voidellipseMode(int mode) + +
+           
+ voidemissive(float gray) + +
+           
+ voidemissive(float x, + float y, + float z) + +
+           
+ voidemissive(int rgb) + +
+           
+ voidendCamera() + +
+           
+ voidendRaw() + +
+          Stop recording raw shape data to the specified renderer.
+ voidendRecord() + +
+           
+ voidendShape() + +
+           
+ voidendShape(int mode) + +
+           
+static java.lang.Processexec(java.lang.String[] argv) + +
+           
+ voidexit() + +
+          Call to safely exit the sketch when finished.
+static floatexp(float a) + +
+           
+static boolean[]expand(boolean[] list) + +
+           
+static boolean[]expand(boolean[] list, + int newSize) + +
+           
+static byte[]expand(byte[] list) + +
+           
+static byte[]expand(byte[] list, + int newSize) + +
+           
+static char[]expand(char[] list) + +
+           
+static char[]expand(char[] list, + int newSize) + +
+           
+static float[]expand(float[] list) + +
+           
+static float[]expand(float[] list, + int newSize) + +
+           
+static int[]expand(int[] list) + +
+           
+static int[]expand(int[] list, + int newSize) + +
+           
+static java.lang.Objectexpand(java.lang.Object array) + +
+           
+static java.lang.Objectexpand(java.lang.Object list, + int newSize) + +
+           
+static java.lang.String[]expand(java.lang.String[] list) + +
+           
+static java.lang.String[]expand(java.lang.String[] list, + int newSize) + +
+           
+ voidfill(float gray) + +
+           
+ voidfill(float gray, + float alpha) + +
+           
+ voidfill(float x, + float y, + float z) + +
+           
+ voidfill(float x, + float y, + float z, + float a) + +
+           
+ voidfill(int rgb) + +
+           
+ voidfill(int rgb, + float alpha) + +
+           
+ voidfilter(int kind) + +
+           
+ voidfilter(int kind, + float param) + +
+           
+static intfloor(float what) + +
+           
+ voidflush() + +
+           
+ voidfocusGained() + +
+           
+ voidfocusGained(java.awt.event.FocusEvent e) + +
+           
+ voidfocusLost() + +
+           
+ voidfocusLost(java.awt.event.FocusEvent e) + +
+           
+ voidframeRate(float newRateTarget) + +
+          Set a target frameRate.
+ voidfrustum(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ PImageget() + +
+           
+ intget(int x, + int y) + +
+           
+ PImageget(int x, + int y, + int w, + int h) + +
+           
+ java.lang.ObjectgetCache(java.lang.Object parent) + +
+           
+ PMatrixgetMatrix() + +
+           
+ PMatrix2DgetMatrix(PMatrix2D target) + +
+           
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+           
+ intgetSketchHeight() + +
+           
+ java.lang.StringgetSketchRenderer() + +
+           
+ intgetSketchWidth() + +
+           
+ floatgreen(int what) + +
+           
+ voidhandleDraw() + +
+           
+static java.lang.Stringhex(byte what) + +
+           
+static java.lang.Stringhex(char what) + +
+           
+static java.lang.Stringhex(int what) + +
+           
+static java.lang.Stringhex(int what, + int digits) + +
+           
+ voidhint(int which) + +
+           
+static inthour() + +
+          Hour position of the current time in international format (0-23).
+ floathue(int what) + +
+           
+ voidimage(PImage image, + float x, + float y) + +
+           
+ voidimage(PImage image, + float x, + float y, + float c, + float d) + +
+           
+ voidimage(PImage image, + float a, + float b, + float c, + float d, + int u1, + int v1, + int u2, + int v2) + +
+           
+ voidimageMode(int mode) + +
+           
+ voidinit() + +
+           
+static java.lang.Stringjoin(java.lang.String[] str, + char separator) + +
+          Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator.
+static java.lang.Stringjoin(java.lang.String[] str, + java.lang.String separator) + +
+          Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator.
+ voidkeyPressed() + +
+          Called each time a single key on the keyboard is pressed.
+ voidkeyPressed(java.awt.event.KeyEvent e) + +
+          Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + 'keyCode', and 'keyEvent' variables to no longer work; + key events will no longer be queued until the end of draw(); + and the keyPressed(), keyReleased() and keyTyped() methods + will no longer be called.
+ voidkeyReleased() + +
+          See keyPressed().
+ voidkeyReleased(java.awt.event.KeyEvent e) + +
+           
+ voidkeyTyped() + +
+          Only called for "regular" keys like letters, + see keyPressed() for full documentation.
+ voidkeyTyped(java.awt.event.KeyEvent e) + +
+           
+static floatlerp(float start, + float stop, + float amt) + +
+           
+ intlerpColor(int c1, + int c2, + float amt) + +
+           
+static intlerpColor(int c1, + int c2, + float amt, + int mode) + +
+           
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+           
+ voidlights() + +
+           
+ voidlightSpecular(float x, + float y, + float z) + +
+           
+ voidline(float x1, + float y1, + float x2, + float y2) + +
+           
+ voidline(float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ voidlink(java.lang.String here) + +
+           
+ voidlink(java.lang.String url, + java.lang.String frameTitle) + +
+          Link to an external page without all the muss.
+static byte[]loadBytes(java.io.File file) + +
+           
+static byte[]loadBytes(java.io.InputStream input) + +
+           
+ byte[]loadBytes(java.lang.String filename) + +
+           
+ PFontloadFont(java.lang.String filename) + +
+           
+ PImageloadImage(java.lang.String filename) + +
+          Load an image from the data folder or a local directory.
+ PImageloadImage(java.lang.String filename, + java.lang.String extension) + +
+          Identical to loadImage, but allows you to specify the type of + image by its extension.
+ voidloadPixels() + +
+          Override the g.pixels[] function to set the pixels[] array + that's part of the PApplet object.
+ PShapeloadShape(java.lang.String filename) + +
+          Load a geometry from a file as a PShape.
+static java.lang.String[]loadStrings(java.io.File file) + +
+           
+static java.lang.String[]loadStrings(java.io.InputStream input) + +
+           
+ java.lang.String[]loadStrings(java.lang.String filename) + +
+          Load data from a file and shove it into a String array.
+static floatlog(float a) + +
+           
+ voidloop() + +
+           
+static floatmag(float a, + float b) + +
+           
+static floatmag(float a, + float b, + float c) + +
+           
+static voidmain(java.lang.String[] args) + +
+          main() method for running this class from the command line.
+static floatmap(float value, + float istart, + float istop, + float ostart, + float ostop) + +
+          Convenience function to map a variable from one coordinate space + to another.
+ voidmask(int[] alpha) + +
+           
+ voidmask(PImage alpha) + +
+           
+static java.lang.String[]match(java.lang.String what, + java.lang.String regexp) + +
+          Match a string with a regular expression, and returns the match as an + array.
+static java.lang.String[][]matchAll(java.lang.String what, + java.lang.String regexp) + +
+          Identical to match(), except that it returns an array of all matches in + the specified String, rather than just the first.
+static floatmax(float[] list) + +
+          Find the maximum value in an array.
+static floatmax(float a, + float b) + +
+           
+static floatmax(float a, + float b, + float c) + +
+           
+static intmax(int[] list) + +
+          Find the maximum value in an array.
+static intmax(int a, + int b) + +
+           
+static intmax(int a, + int b, + int c) + +
+           
+ intmillis() + +
+          Get the number of milliseconds since the applet started.
+static floatmin(float[] list) + +
+          Find the minimum value in an array.
+static floatmin(float a, + float b) + +
+           
+static floatmin(float a, + float b, + float c) + +
+           
+static intmin(int[] list) + +
+          Find the minimum value in an array.
+static intmin(int a, + int b) + +
+           
+static intmin(int a, + int b, + int c) + +
+           
+static intminute() + +
+          Minutes position of the current time.
+ floatmodelX(float x, + float y, + float z) + +
+           
+ floatmodelY(float x, + float y, + float z) + +
+           
+ floatmodelZ(float x, + float y, + float z) + +
+           
+static intmonth() + +
+          Get the current month in range 1 through 12.
+ voidmouseClicked() + +
+          When the mouse is clicked, mousePressed() will be called, + then mouseReleased(), then mouseClicked().
+ voidmouseClicked(java.awt.event.MouseEvent e) + +
+           
+ voidmouseDragged() + +
+          Mouse button is pressed and the mouse has been dragged.
+ voidmouseDragged(java.awt.event.MouseEvent e) + +
+           
+ voidmouseEntered(java.awt.event.MouseEvent e) + +
+           
+ voidmouseExited(java.awt.event.MouseEvent e) + +
+           
+ voidmouseMoved() + +
+          Mouse button is not pressed but the mouse has changed locations.
+ voidmouseMoved(java.awt.event.MouseEvent e) + +
+           
+ voidmousePressed() + +
+          Mouse has been pressed, and should be considered "down" + until mouseReleased() is called.
+ voidmousePressed(java.awt.event.MouseEvent e) + +
+          If you override this or any function that takes a "MouseEvent e" + without calling its super.mouseXxxx() then mouseX, mouseY, + mousePressed, and mouseEvent will no longer be set.
+ voidmouseReleased() + +
+          Mouse button has been released.
+ voidmouseReleased(java.awt.event.MouseEvent e) + +
+           
+static java.lang.String[]nf(float[] num, + int left, + int right) + +
+           
+static java.lang.Stringnf(float num, + int left, + int right) + +
+           
+static java.lang.String[]nf(int[] num, + int digits) + +
+           
+static java.lang.Stringnf(int num, + int digits) + +
+           
+static java.lang.String[]nfc(float[] num, + int right) + +
+           
+static java.lang.Stringnfc(float num, + int right) + +
+           
+static java.lang.Stringnfc(int num) + +
+           
+static java.lang.String[]nfc(int[] num) + +
+           
+static java.lang.String[]nfp(float[] num, + int left, + int right) + +
+           
+static java.lang.Stringnfp(float num, + int left, + int right) + +
+           
+static java.lang.String[]nfp(int[] num, + int digits) + +
+           
+static java.lang.Stringnfp(int num, + int digits) + +
+          number format positive (or plus) + Formats a number, always placing a - or + sign + in the front when it's negative or positive.
+static java.lang.String[]nfs(float[] num, + int left, + int right) + +
+          Number formatter that takes into account whether the number + has a sign (positive, negative, etc) in front of it.
+static java.lang.Stringnfs(float num, + int left, + int right) + +
+           
+static java.lang.String[]nfs(int[] num, + int digits) + +
+           
+static java.lang.Stringnfs(int num, + int digits) + +
+          number format signed (or space) + Formats a number but leaves a blank space in the front + when it's positive so that it can be properly aligned with + numbers that have a negative sign in front of them.
+ voidnoCursor() + +
+          Hide the cursor by creating a transparent image + and using it as a custom cursor.
+ voidnoFill() + +
+           
+ floatnoise(float x) + +
+          Computes the Perlin noise function value at point x.
+ floatnoise(float x, + float y) + +
+          Computes the Perlin noise function value at the point x, y.
+ floatnoise(float x, + float y, + float z) + +
+          Computes the Perlin noise function value at x, y, z.
+ voidnoiseDetail(int lod) + +
+           
+ voidnoiseDetail(int lod, + float falloff) + +
+           
+ voidnoiseSeed(long what) + +
+           
+ voidnoLights() + +
+           
+ voidnoLoop() + +
+           
+static floatnorm(float value, + float start, + float stop) + +
+          Normalize a value to exist between 0 and 1 (inclusive).
+ voidnormal(float nx, + float ny, + float nz) + +
+           
+ voidnoSmooth() + +
+           
+ voidnoStroke() + +
+           
+ voidnoTint() + +
+           
+static voidopen(java.lang.String filename) + +
+          Attempt to open a file using the platform's shell.
+static java.lang.Processopen(java.lang.String[] argv) + +
+          Launch a process using a platforms shell.
+ java.io.InputStreamopenStream(java.lang.String filename) + +
+          Deprecated. As of release 0136, use createInput() instead.
+ voidortho() + +
+           
+ voidortho(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ voidpaint(java.awt.Graphics screen) + +
+           
+ java.lang.Stringparam(java.lang.String what) + +
+          Get a param from the web page, or (eventually) + from a properties file.
+static boolean[]parseBoolean(byte[] what) + +
+          Convert a byte array to a boolean array.
+static booleanparseBoolean(int what) + +
+          Convert an integer to a boolean.
+static boolean[]parseBoolean(int[] what) + +
+          Convert an int array to a boolean array.
+static booleanparseBoolean(java.lang.String what) + +
+          Convert the string "true" or "false" to a boolean.
+static boolean[]parseBoolean(java.lang.String[] what) + +
+           
+static byteparseByte(boolean what) + +
+           
+static byte[]parseByte(boolean[] what) + +
+           
+static float[]parseByte(byte[] what) + +
+           
+static byteparseByte(char what) + +
+           
+static byte[]parseByte(char[] what) + +
+           
+static byteparseByte(float what) + +
+           
+static byte[]parseByte(float[] what) + +
+           
+static byteparseByte(int what) + +
+           
+static byte[]parseByte(int[] what) + +
+           
+static charparseChar(byte what) + +
+           
+static char[]parseChar(byte[] what) + +
+           
+static charparseChar(int what) + +
+           
+static char[]parseChar(int[] what) + +
+           
+static floatparseFloat(int what) + +
+          Convert an int to a float value.
+static float[]parseFloat(int[] what) + +
+           
+static floatparseFloat(java.lang.String what) + +
+           
+static float[]parseFloat(java.lang.String[] what) + +
+           
+static float[]parseFloat(java.lang.String[] what, + float missing) + +
+           
+static floatparseFloat(java.lang.String what, + float otherwise) + +
+           
+static intparseInt(boolean what) + +
+           
+static int[]parseInt(boolean[] what) + +
+           
+static intparseInt(byte what) + +
+          Note that parseInt() will un-sign a signed byte value.
+static int[]parseInt(byte[] what) + +
+           
+static intparseInt(char what) + +
+          Note that parseInt('5') is unlike String in the sense that it + won't return 5, but the ascii value.
+static int[]parseInt(char[] what) + +
+           
+static intparseInt(float what) + +
+          Same as floor(), or an (int) cast.
+static int[]parseInt(float[] what) + +
+           
+static intparseInt(java.lang.String what) + +
+          Parse a String into an int value.
+static int[]parseInt(java.lang.String[] what) + +
+          Make an array of int elements from an array of String objects.
+static int[]parseInt(java.lang.String[] what, + int missing) + +
+          Make an array of int elements from an array of String objects.
+static intparseInt(java.lang.String what, + int otherwise) + +
+          Parse a String to an int, and provide an alternate value that + should be used when the number is invalid.
+ voidperspective() + +
+           
+ voidperspective(float fovy, + float aspect, + float zNear, + float zFar) + +
+           
+ voidpoint(float x, + float y) + +
+           
+ voidpoint(float x, + float y, + float z) + +
+           
+ voidpointLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+           
+ voidpopStyle() + +
+           
+static floatpow(float a, + float b) + +
+           
+static voidprint(boolean what) + +
+           
+static voidprint(byte what) + +
+           
+static voidprint(char what) + +
+           
+static voidprint(float what) + +
+           
+static voidprint(int what) + +
+           
+static voidprint(java.lang.Object what) + +
+           
+static voidprint(java.lang.String what) + +
+           
+ voidprintCamera() + +
+           
+static voidprintln() + +
+           
+static voidprintln(boolean what) + +
+           
+static voidprintln(byte what) + +
+           
+static voidprintln(char what) + +
+           
+static voidprintln(float what) + +
+           
+static voidprintln(int what) + +
+           
+static voidprintln(java.lang.Object what) + +
+           
+static voidprintln(java.lang.String what) + +
+           
+ voidprintMatrix() + +
+           
+ voidprintProjection() + +
+           
+ voidpushMatrix() + +
+           
+ voidpushStyle() + +
+           
+ voidquad(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+static floatradians(float degrees) + +
+           
+ floatrandom(float howbig) + +
+          Return a random number in the range [0, howbig).
+ floatrandom(float howsmall, + float howbig) + +
+          Return a random number in the range [howsmall, howbig).
+ voidrandomSeed(long what) + +
+           
+ voidrect(float a, + float b, + float c, + float d) + +
+           
+ voidrectMode(int mode) + +
+           
+ floatred(int what) + +
+           
+ voidredraw() + +
+           
+ voidregisterDispose(java.lang.Object o) + +
+           
+ voidregisterDraw(java.lang.Object o) + +
+           
+ voidregisterKeyEvent(java.lang.Object o) + +
+           
+ voidregisterMouseEvent(java.lang.Object o) + +
+           
+ voidregisterPost(java.lang.Object o) + +
+           
+ voidregisterPre(java.lang.Object o) + +
+           
+ voidregisterSize(java.lang.Object o) + +
+           
+ voidremoveCache(java.lang.Object parent) + +
+           
+ PImagerequestImage(java.lang.String filename) + +
+           
+ PImagerequestImage(java.lang.String filename, + java.lang.String extension) + +
+           
+ voidresetMatrix() + +
+           
+static boolean[]reverse(boolean[] list) + +
+           
+static byte[]reverse(byte[] list) + +
+           
+static char[]reverse(char[] list) + +
+           
+static float[]reverse(float[] list) + +
+           
+static int[]reverse(int[] list) + +
+           
+static java.lang.Objectreverse(java.lang.Object list) + +
+           
+static java.lang.String[]reverse(java.lang.String[] list) + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+static intround(float what) + +
+           
+ voidrun() + +
+          Main method for the primary animation thread.
+ floatsaturation(int what) + +
+           
+ voidsave(java.lang.String filename) + +
+          Intercepts any relative paths to make them absolute (relative + to the sketch folder) before passing to save() in PImage.
+static voidsaveBytes(java.io.File file, + byte[] buffer) + +
+          Saves bytes to a specific File location specified by the user.
+static voidsaveBytes(java.io.OutputStream output, + byte[] buffer) + +
+          Spews a buffer of bytes to an OutputStream.
+ voidsaveBytes(java.lang.String filename, + byte[] buffer) + +
+          Saves bytes to a file to inside the sketch folder.
+ java.io.FilesaveFile(java.lang.String where) + +
+          Identical to savePath(), but returns a File object.
+ voidsaveFrame() + +
+          Grab an image of what's currently in the drawing area and save it + as a .tif or .tga file.
+ voidsaveFrame(java.lang.String what) + +
+          Save the current frame as a .tif or .tga image.
+ java.lang.StringsavePath(java.lang.String where) + +
+          Returns a path inside the applet folder to save to.
+static voidsaveStream(java.io.File targetFile, + java.io.InputStream sourceStream) + +
+           
+ voidsaveStream(java.io.File targetFile, + java.lang.String sourceLocation) + +
+          Identical to the other saveStream(), but writes to a File + object, for greater control over the file location.
+ voidsaveStream(java.lang.String targetFilename, + java.lang.String sourceLocation) + +
+          Save the contents of a stream to a file in the sketch folder.
+static voidsaveStrings(java.io.File file, + java.lang.String[] strings) + +
+           
+static voidsaveStrings(java.io.OutputStream output, + java.lang.String[] strings) + +
+           
+ voidsaveStrings(java.lang.String filename, + java.lang.String[] strings) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ floatscreenX(float x, + float y) + +
+           
+ floatscreenX(float x, + float y, + float z) + +
+           
+ floatscreenY(float x, + float y) + +
+           
+ floatscreenY(float x, + float y, + float z) + +
+           
+ floatscreenZ(float x, + float y, + float z) + +
+           
+static intsecond() + +
+          Seconds position of the current time.
+ java.lang.StringselectFolder() + +
+          Open a platform-specific folder chooser dialog.
+ java.lang.StringselectFolder(java.lang.String prompt) + +
+          Open a platform-specific folder chooser dialog.
+ java.lang.StringselectInput() + +
+          Open a platform-specific file chooser dialog to select a file for input.
+ java.lang.StringselectInput(java.lang.String prompt) + +
+          Open a platform-specific file chooser dialog to select a file for input.
+ java.lang.StringselectOutput() + +
+          Open a platform-specific file save dialog to select a file for output.
+ java.lang.StringselectOutput(java.lang.String prompt) + +
+          Open a platform-specific file save dialog to select a file for output.
+ voidset(int x, + int y, + int c) + +
+           
+ voidset(int x, + int y, + PImage src) + +
+           
+ voidsetCache(java.lang.Object parent, + java.lang.Object storage) + +
+           
+ voidsetMatrix(PMatrix source) + +
+           
+ voidsetMatrix(PMatrix2D source) + +
+           
+ voidsetMatrix(PMatrix3D source) + +
+           
+ voidsetup() + +
+           
+ voidsetupExternalMessages() + +
+          Set this sketch to communicate its state back to the PDE.
+ voidsetupFrameResizeListener() + +
+          Set up a listener that will fire proper component resize events + in cases where frame.setResizable(true) is called.
+ voidshape(PShape shape) + +
+           
+ voidshape(PShape shape, + float x, + float y) + +
+           
+ voidshape(PShape shape, + float x, + float y, + float c, + float d) + +
+           
+ voidshapeMode(int mode) + +
+           
+ voidshininess(float shine) + +
+           
+static boolean[]shorten(boolean[] list) + +
+           
+static byte[]shorten(byte[] list) + +
+           
+static char[]shorten(char[] list) + +
+           
+static float[]shorten(float[] list) + +
+           
+static int[]shorten(int[] list) + +
+           
+static java.lang.Objectshorten(java.lang.Object list) + +
+           
+static java.lang.String[]shorten(java.lang.String[] list) + +
+           
+static floatsin(float angle) + +
+           
+ voidsize(int iwidth, + int iheight) + +
+          Starts up and creates a two-dimensional drawing surface, + or resizes the current drawing surface.
+ voidsize(int iwidth, + int iheight, + java.lang.String irenderer) + +
+           
+ voidsize(int iwidth, + int iheight, + java.lang.String irenderer, + java.lang.String ipath) + +
+          Creates a new PGraphics object and sets it to the specified size.
+ java.io.FilesketchFile(java.lang.String where) + +
+           
+ java.lang.StringsketchPath(java.lang.String where) + +
+          Prepend the sketch folder path to the filename (or path) that is + passed in.
+ voidsmooth() + +
+           
+static byte[]sort(byte[] what) + +
+           
+static byte[]sort(byte[] what, + int count) + +
+           
+static char[]sort(char[] what) + +
+           
+static char[]sort(char[] what, + int count) + +
+           
+static float[]sort(float[] what) + +
+           
+static float[]sort(float[] what, + int count) + +
+           
+static int[]sort(int[] what) + +
+           
+static int[]sort(int[] what, + int count) + +
+           
+static java.lang.String[]sort(java.lang.String[] what) + +
+           
+static java.lang.String[]sort(java.lang.String[] what, + int count) + +
+           
+ voidspecular(float gray) + +
+           
+ voidspecular(float x, + float y, + float z) + +
+           
+ voidspecular(int rgb) + +
+           
+ voidsphere(float r) + +
+           
+ voidsphereDetail(int res) + +
+           
+ voidsphereDetail(int ures, + int vres) + +
+           
+static boolean[]splice(boolean[] list, + boolean[] v, + int index) + +
+           
+static boolean[]splice(boolean[] list, + boolean v, + int index) + +
+           
+static byte[]splice(byte[] list, + byte[] v, + int index) + +
+           
+static byte[]splice(byte[] list, + byte v, + int index) + +
+           
+static char[]splice(char[] list, + char[] v, + int index) + +
+           
+static char[]splice(char[] list, + char v, + int index) + +
+           
+static float[]splice(float[] list, + float[] v, + int index) + +
+           
+static float[]splice(float[] list, + float v, + int index) + +
+           
+static int[]splice(int[] list, + int[] v, + int index) + +
+           
+static int[]splice(int[] list, + int v, + int index) + +
+           
+static java.lang.Objectsplice(java.lang.Object list, + java.lang.Object v, + int index) + +
+           
+static java.lang.String[]splice(java.lang.String[] list, + java.lang.String[] v, + int index) + +
+           
+static java.lang.String[]splice(java.lang.String[] list, + java.lang.String v, + int index) + +
+           
+static java.lang.String[]split(java.lang.String what, + char delim) + +
+          Split a string into pieces along a specific character.
+static java.lang.String[]split(java.lang.String what, + java.lang.String delim) + +
+          Split a String on a specific delimiter.
+static java.lang.String[]splitTokens(java.lang.String what) + +
+          Split the provided String at wherever whitespace occurs.
+static java.lang.String[]splitTokens(java.lang.String what, + java.lang.String delim) + +
+          Splits a string into pieces, using any of the chars in the + String 'delim' as separator characters.
+ voidspotLight(float red, + float green, + float blue, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+static floatsq(float a) + +
+           
+static floatsqrt(float a) + +
+           
+ voidstart() + +
+          Called by the browser or applet viewer to inform this applet that it + should start its execution.
+ voidstatus(java.lang.String what) + +
+          Show status in the status bar of a web browser, or in the + System.out console.
+ voidstop() + +
+          Called by the browser or applet viewer to inform + this applet that it should stop its execution.
+static java.lang.Stringstr(boolean x) + +
+           
+static java.lang.String[]str(boolean[] x) + +
+           
+static java.lang.Stringstr(byte x) + +
+           
+static java.lang.String[]str(byte[] x) + +
+           
+static java.lang.Stringstr(char x) + +
+           
+static java.lang.String[]str(char[] x) + +
+           
+static java.lang.Stringstr(float x) + +
+           
+static java.lang.String[]str(float[] x) + +
+           
+static java.lang.Stringstr(int x) + +
+           
+static java.lang.String[]str(int[] x) + +
+           
+ voidstroke(float gray) + +
+           
+ voidstroke(float gray, + float alpha) + +
+           
+ voidstroke(float x, + float y, + float z) + +
+           
+ voidstroke(float x, + float y, + float z, + float a) + +
+           
+ voidstroke(int rgb) + +
+           
+ voidstroke(int rgb, + float alpha) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ voidstyle(PStyle s) + +
+           
+static boolean[]subset(boolean[] list, + int start) + +
+           
+static boolean[]subset(boolean[] list, + int start, + int count) + +
+           
+static byte[]subset(byte[] list, + int start) + +
+           
+static byte[]subset(byte[] list, + int start, + int count) + +
+           
+static char[]subset(char[] list, + int start) + +
+           
+static char[]subset(char[] list, + int start, + int count) + +
+           
+static float[]subset(float[] list, + int start) + +
+           
+static float[]subset(float[] list, + int start, + int count) + +
+           
+static int[]subset(int[] list, + int start) + +
+           
+static int[]subset(int[] list, + int start, + int count) + +
+           
+static java.lang.Objectsubset(java.lang.Object list, + int start) + +
+           
+static java.lang.Objectsubset(java.lang.Object list, + int start, + int count) + +
+           
+static java.lang.String[]subset(java.lang.String[] list, + int start) + +
+           
+static java.lang.String[]subset(java.lang.String[] list, + int start, + int count) + +
+           
+static floattan(float angle) + +
+           
+ voidtext(char c) + +
+           
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y) + +
+           
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y, + float z) + +
+           
+ voidtext(char c, + float x, + float y) + +
+           
+ voidtext(char c, + float x, + float y, + float z) + +
+           
+ voidtext(float num, + float x, + float y) + +
+           
+ voidtext(float num, + float x, + float y, + float z) + +
+           
+ voidtext(int num, + float x, + float y) + +
+           
+ voidtext(int num, + float x, + float y, + float z) + +
+           
+ voidtext(java.lang.String str) + +
+           
+ voidtext(java.lang.String str, + float x, + float y) + +
+           
+ voidtext(java.lang.String str, + float x, + float y, + float z) + +
+           
+ voidtext(java.lang.String str, + float x1, + float y1, + float x2, + float y2) + +
+           
+ voidtext(java.lang.String s, + float x1, + float y1, + float x2, + float y2, + float z) + +
+           
+ voidtextAlign(int align) + +
+           
+ voidtextAlign(int alignX, + int alignY) + +
+           
+ floattextAscent() + +
+           
+ floattextDescent() + +
+           
+ voidtextFont(PFont which) + +
+           
+ voidtextFont(PFont which, + float size) + +
+           
+ voidtextLeading(float leading) + +
+           
+ voidtextMode(int mode) + +
+           
+ voidtextSize(float size) + +
+           
+ voidtexture(PImage image) + +
+           
+ voidtextureMode(int mode) + +
+           
+ floattextWidth(char c) + +
+           
+ floattextWidth(java.lang.String str) + +
+           
+ voidtint(float gray) + +
+           
+ voidtint(float gray, + float alpha) + +
+           
+ voidtint(float x, + float y, + float z) + +
+           
+ voidtint(float x, + float y, + float z, + float a) + +
+           
+ voidtint(int rgb) + +
+           
+ voidtint(int rgb, + float alpha) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ voidtriangle(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+static java.lang.Stringtrim(java.lang.String str) + +
+          Remove whitespace characters from the beginning and ending + of a String.
+static java.lang.String[]trim(java.lang.String[] array) + +
+          Trim the whitespace from a String array.
+static intunbinary(java.lang.String what) + +
+          Unpack a binary String into an int.
+static intunhex(java.lang.String what) + +
+           
+ voidunregisterDispose(java.lang.Object o) + +
+           
+ voidunregisterDraw(java.lang.Object o) + +
+           
+ voidunregisterKeyEvent(java.lang.Object o) + +
+           
+ voidunregisterMouseEvent(java.lang.Object o) + +
+           
+ voidunregisterPost(java.lang.Object o) + +
+           
+ voidunregisterPre(java.lang.Object o) + +
+           
+ voidunregisterSize(java.lang.Object o) + +
+           
+ voidupdate(java.awt.Graphics screen) + +
+           
+ voidupdatePixels() + +
+           
+ voidupdatePixels(int x1, + int y1, + int x2, + int y2) + +
+           
+ voidvertex(float[] v) + +
+           
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+static intyear() + +
+          Get the current year.
+ + + + + + + +
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
+ + + + + + + +
Methods inherited from class java.awt.Panel
addNotify
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+javaVersionName

+
+public static final java.lang.String javaVersionName
+
+
Full name of the Java version (i.e. 1.5.0_11). + Prior to 0125, this was only the first three digits. +

+

+
+
+
+ +

+javaVersion

+
+public static final float javaVersion
+
+
Version of Java that's in use, whether 1.1 or 1.3 or whatever, + stored as a float. +

+ Note that because this is stored as a float, the values may + not be exactly 1.3 or 1.4. Instead, make sure you're + comparing against 1.3f or 1.4f, which will have the same amount + of error (i.e. 1.40000001). This could just be a double, but + since Processing only uses floats, it's safer for this to be a float + because there's no good way to specify a double with the preproc. +

+

+
+
+
+ +

+platform

+
+public static int platform
+
+
Current platform in use, one of the + PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER. +

+

+
+
+
+ +

+MENU_SHORTCUT

+
+public static final int MENU_SHORTCUT
+
+
Modifier flags for the shortcut key used to trigger menus. + (Cmd on Mac OS X, Ctrl on Linux and Windows) +

+

+
+
+
+ +

+g

+
+public PGraphics g
+
+
The PGraphics renderer associated with this PApplet +

+

+
+
+
+ +

+frame

+
+public java.awt.Frame frame
+
+
The frame containing this applet (if any) +

+

+
+
+
+ +

+screen

+
+public java.awt.Dimension screen
+
+
The screen size when the applet was started. +

+ Access this via screen.width and screen.height. To make an applet + run at full screen, use size(screen.width, screen.height). +

+ If you have multiple displays, this will be the size of the main + display. Running full screen across multiple displays isn't + particularly supported, and requires more monkeying with the values. + This probably can't/won't be fixed until/unless I get a dual head + system. +

+ Note that this won't update if you change the resolution + of your screen once the the applet is running. +

+ This variable is not static, because future releases need to be better + at handling multiple displays. +

+

+
+
+
+ +

+recorder

+
+public PGraphics recorder
+
+
A leech graphics object that is echoing all events. +

+

+
+
+
+ +

+args

+
+public java.lang.String[] args
+
+
Command line options passed in from main(). +

+ This does not include the arguments passed in to PApplet itself. +

+

+
+
+
+ +

+sketchPath

+
+public java.lang.String sketchPath
+
+
Path to sketch folder +

+

+
+
+
+ +

+DEFAULT_WIDTH

+
+public static final int DEFAULT_WIDTH
+
+
Default width and height for applet when not specified +

+

+
See Also:
Constant Field Values
+
+
+ +

+DEFAULT_HEIGHT

+
+public static final int DEFAULT_HEIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MIN_WINDOW_WIDTH

+
+public static final int MIN_WINDOW_WIDTH
+
+
Minimum dimensions for the window holding an applet. + This varies between platforms, Mac OS X 10.3 can do any height + but requires at least 128 pixels width. Windows XP has another + set of limitations. And for all I know, Linux probably lets you + make windows with negative sizes. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MIN_WINDOW_HEIGHT

+
+public static final int MIN_WINDOW_HEIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+defaultSize

+
+public boolean defaultSize
+
+
true if no size() command has been executed. This is used to wait until + a size has been set before placing in the window and showing it. +

+

+
+
+
+ +

+pixels

+
+public int[] pixels
+
+
Pixel buffer from this applet's PGraphics. +

+ When used with OpenGL or Java2D, this value will + be null until loadPixels() has been called. +

+

+
+
+
+ +

+width

+
+public int width
+
+
width of this applet's associated PGraphics +

+

+
+
+
+ +

+height

+
+public int height
+
+
height of this applet's associated PGraphics +

+

+
+
+
+ +

+mouseX

+
+public int mouseX
+
+
current x position of the mouse +

+

+
+
+
+ +

+mouseY

+
+public int mouseY
+
+
current y position of the mouse +

+

+
+
+
+ +

+pmouseX

+
+public int pmouseX
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+ +

+pmouseY

+
+public int pmouseY
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+ +

+firstMouse

+
+public boolean firstMouse
+
+
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump. +

+ Just using (frameCount == 0) won't work since mouseXxxxx() + may not be called until a couple frames into things. +

+

+
+
+
+ +

+mouseButton

+
+public int mouseButton
+
+
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. +

+ If running on Mac OS, a ctrl-click will be interpreted as + the righthand mouse button (unlike Java, which reports it as + the left mouse). +

+

+
+
+
+ +

+mousePressed

+
+public boolean mousePressed
+
+
+
+
+
+ +

+mouseEvent

+
+public java.awt.event.MouseEvent mouseEvent
+
+
+
+
+
+ +

+key

+
+public char key
+
+
Last key pressed. +

+ If it's a coded key, i.e. UP/DOWN/CTRL/SHIFT/ALT, + this will be set to CODED (0xffff or 65535). +

+

+
+
+
+ +

+keyCode

+
+public int keyCode
+
+
When "key" is set to CODED, this will contain a Java key code. +

+ For the arrow keys, keyCode will be one of UP, DOWN, LEFT and RIGHT. + Also available are ALT, CONTROL and SHIFT. A full set of constants + can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables. +

+

+
+
+
+ +

+keyPressed

+
+public boolean keyPressed
+
+
true if the mouse is currently pressed. +

+

+
+
+
+ +

+keyEvent

+
+public java.awt.event.KeyEvent keyEvent
+
+
the last KeyEvent object passed into a mouse function. +

+

+
+
+
+ +

+focused

+
+public boolean focused
+
+
Gets set to true/false as the applet gains/loses focus. +

+

+
+
+
+ +

+online

+
+public boolean online
+
+
true if the applet is online. +

+ This can be used to test how the applet should behave + since online situations are different (no file writing, etc). +

+

+
+
+
+ +

+frameRate

+
+public float frameRate
+
+
The current value of frames per second. +

+ The initial value will be 10 fps, and will be updated with each + frame thereafter. The value is not instantaneous (since that + wouldn't be very useful since it would jump around so much), + but is instead averaged (integrated) over several frames. + As such, this value won't be valid until after 5-10 frames. +

+

+
+
+
+ +

+frameCount

+
+public int frameCount
+
+
How many frames have been displayed since the applet started. +

+ This value is read-only do not attempt to set it, + otherwise bad things will happen. +

+ Inside setup(), frameCount is 0. + For the first iteration of draw(), frameCount will equal 1. +

+

+
+
+
+ +

+finished

+
+public boolean finished
+
+
true if this applet has had it. +

+

+
+
+
+ +

+ARGS_EDITOR_LOCATION

+
+public static final java.lang.String ARGS_EDITOR_LOCATION
+
+
Position of the upper-lefthand corner of the editor window + that launched this applet. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ARGS_EXTERNAL

+
+public static final java.lang.String ARGS_EXTERNAL
+
+
Location for where to position the applet window on screen. +

+ This is used by the editor to when saving the previous applet + location, or could be used by other classes to launch at a + specific position on-screen. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ARGS_LOCATION

+
+public static final java.lang.String ARGS_LOCATION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_DISPLAY

+
+public static final java.lang.String ARGS_DISPLAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_BGCOLOR

+
+public static final java.lang.String ARGS_BGCOLOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_PRESENT

+
+public static final java.lang.String ARGS_PRESENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_EXCLUSIVE

+
+public static final java.lang.String ARGS_EXCLUSIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_STOP_COLOR

+
+public static final java.lang.String ARGS_STOP_COLOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_HIDE_STOP

+
+public static final java.lang.String ARGS_HIDE_STOP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_SKETCH_FOLDER

+
+public static final java.lang.String ARGS_SKETCH_FOLDER
+
+
Allows the user or PdeEditor to set a specific sketch folder path. +

+ Used by PdeEditor to pass in the location where saveFrame() + and all that stuff should write things. +

+

+
See Also:
Constant Field Values
+
+
+ +

+EXTERNAL_STOP

+
+public static final java.lang.String EXTERNAL_STOP
+
+
When run externally to a PdeEditor, + this is sent by the applet when it quits. +

+

+
See Also:
Constant Field Values
+
+
+ +

+EXTERNAL_MOVE

+
+public static final java.lang.String EXTERNAL_MOVE
+
+
When run externally to a PDE Editor, this is sent by the applet + whenever the window is moved. +

+ This is used so that the editor can re-open the sketch window + in the same position as the user last left it. +

+

+
See Also:
Constant Field Values
+
+
+ +

+requestImageMax

+
+public int requestImageMax
+
+
By trial and error, four image loading threads seem to work best when + loading images from online. This is consistent with the number of open + connections that web browsers will maintain. The variable is made public + (however no accessor has been added since it's esoteric) if you really + want to have control over the value used. For instance, when loading local + files, it might be better to only have a single thread (or two) loading + images so that you're disk isn't simply jumping around. +

+

+
+
+
+ +

+selectedFile

+
+public java.io.File selectedFile
+
+
+
+
+
+ +

+ICON_IMAGE

+
+public static final byte[] ICON_IMAGE
+
+
GIF image of the Processing logo. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PApplet

+
+public PApplet()
+
+
+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init()
+
+
+
Overrides:
init in class java.applet.Applet
+
+
+
+
+
+
+ +

+getSketchWidth

+
+public int getSketchWidth()
+
+
+
+
+
+
+
+
+
+ +

+getSketchHeight

+
+public int getSketchHeight()
+
+
+
+
+
+
+
+
+
+ +

+getSketchRenderer

+
+public java.lang.String getSketchRenderer()
+
+
+
+
+
+
+
+
+
+ +

+start

+
+public void start()
+
+
Called by the browser or applet viewer to inform this applet that it + should start its execution. It is called after the init method and + each time the applet is revisited in a Web page. +

+ Called explicitly via the first call to PApplet.paint(), because + PAppletGL needs to have a usable screen before getting things rolling. +

+

+
Overrides:
start in class java.applet.Applet
+
+
+
+
+
+
+ +

+stop

+
+public void stop()
+
+
Called by the browser or applet viewer to inform + this applet that it should stop its execution. +

+ Unfortunately, there are no guarantees from the Java spec + when or if stop() will be called (i.e. on browser quit, + or when moving between web pages), and it's not always called. +

+

+
Overrides:
stop in class java.applet.Applet
+
+
+
+
+
+
+ +

+destroy

+
+public void destroy()
+
+
Called by the browser or applet viewer to inform this applet + that it is being reclaimed and that it should destroy + any resources that it has allocated. +

+ This also attempts to call PApplet.stop(), in case there + was an inadvertent override of the stop() function by a user. +

+ destroy() supposedly gets called as the applet viewer + is shutting down the applet. stop() is called + first, and then destroy() to really get rid of things. + no guarantees on when they're run (on browser quit, or + when moving between pages), though. +

+

+
Overrides:
destroy in class java.applet.Applet
+
+
+
+
+
+
+ +

+registerSize

+
+public void registerSize(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerPre

+
+public void registerPre(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerDraw

+
+public void registerDraw(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerPost

+
+public void registerPost(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerMouseEvent

+
+public void registerMouseEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerKeyEvent

+
+public void registerKeyEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerDispose

+
+public void registerDispose(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterSize

+
+public void unregisterSize(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterPre

+
+public void unregisterPre(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterDraw

+
+public void unregisterDraw(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterPost

+
+public void unregisterPost(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterMouseEvent

+
+public void unregisterMouseEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterKeyEvent

+
+public void unregisterKeyEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterDispose

+
+public void unregisterDispose(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+setup

+
+public void setup()
+
+
+
+
+
+
+
+
+
+ +

+draw

+
+public void draw()
+
+
+
+
+
+
+
+
+
+ +

+size

+
+public void size(int iwidth,
+                 int iheight)
+
+
Starts up and creates a two-dimensional drawing surface, + or resizes the current drawing surface. +

+ This should be the first thing called inside of setup(). +

+ If using Java 1.3 or later, this will default to using + PGraphics2, the Java2D-based renderer. If using Java 1.1, + or if PGraphics2 is not available, then PGraphics will be used. + To set your own renderer, use the other version of the size() + method that takes a renderer as its last parameter. +

+ If called once a renderer has already been set, this will + use the previous renderer and simply resize it. +

+

+
+
+
+
+
+
+
+ +

+size

+
+public void size(int iwidth,
+                 int iheight,
+                 java.lang.String irenderer)
+
+
+
+
+
+
+
+
+
+ +

+size

+
+public void size(int iwidth,
+                 int iheight,
+                 java.lang.String irenderer,
+                 java.lang.String ipath)
+
+
Creates a new PGraphics object and sets it to the specified size. + + Note that you cannot change the renderer once outside of setup(). + In most cases, you can call size() to give it a new size, + but you need to always ask for the same renderer, otherwise + you're gonna run into trouble. + + The size() method should *only* be called from inside the setup() or + draw() methods, so that it is properly run on the main animation thread. + To change the size of a PApplet externally, use setSize(), which will + update the component size, and queue a resize of the renderer as well. +

+

+
+
+
+
+
+
+
+ +

+createGraphics

+
+public PGraphics createGraphics(int iwidth,
+                                int iheight,
+                                java.lang.String irenderer)
+
+
Create an offscreen PGraphics object for drawing. This can be used + for bitmap or vector images drawing or rendering. +
    +
  • Do not use "new PGraphicsXxxx()", use this method. This method + ensures that internal variables are set up properly that tie the + new graphics context back to its parent PApplet. +
  • The basic way to create bitmap images is to use the saveFrame() + function. +
  • If you want to create a really large scene and write that, + first make sure that you've allocated a lot of memory in the Preferences. +
  • If you want to create images that are larger than the screen, + you should create your own PGraphics object, draw to that, and use + save(). + For now, it's best to use P3D in this scenario. + P2D is currently disabled, and the JAVA2D default will give mixed + results. An example of using P3D: +
    +
    + PGraphics big;
    +
    + void setup() {
    +   big = createGraphics(3000, 3000, P3D);
    +
    +   big.beginDraw();
    +   big.background(128);
    +   big.line(20, 1800, 1800, 900);
    +   // etc..
    +   big.endDraw();
    +
    +   // make sure the file is written to the sketch folder
    +   big.save("big.tif");
    + }
    +
    + 
    +
  • It's important to always wrap drawing to createGraphics() with + beginDraw() and endDraw() (beginFrame() and endFrame() prior to + revision 0115). The reason is that the renderer needs to know when + drawing has stopped, so that it can update itself internally. + This also handles calling the defaults() method, for people familiar + with that. +
  • It's not possible to use createGraphics() with the OPENGL renderer, + because it doesn't allow offscreen use. +
  • With Processing 0115 and later, it's possible to write images in + formats other than the default .tga and .tiff. The exact formats and + background information can be found in the developer's reference for + PImage.save(). +
+

+

+
+
+
+
+
+
+
+ +

+createGraphics

+
+public PGraphics createGraphics(int iwidth,
+                                int iheight,
+                                java.lang.String irenderer,
+                                java.lang.String ipath)
+
+
Create an offscreen graphics surface for drawing, in this case + for a renderer that writes to a file (such as PDF or DXF). +

+

+
+
+
+
Parameters:
ipath - can be an absolute or relative path
+
+
+
+ +

+createImage

+
+public PImage createImage(int wide,
+                          int high,
+                          int format)
+
+
Preferred method of creating new PImage objects, ensures that a + reference to the parent PApplet is included, which makes save() work + without needing an absolute path. +

+

+
+
+
+
+
+
+
+ +

+update

+
+public void update(java.awt.Graphics screen)
+
+
+
Overrides:
update in class java.awt.Container
+
+
+
+
+
+
+ +

+paint

+
+public void paint(java.awt.Graphics screen)
+
+
+
Overrides:
paint in class java.awt.Container
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
Main method for the primary animation thread. + + Painting in AWT and Swing +

+

+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+handleDraw

+
+public void handleDraw()
+
+
+
+
+
+
+
+
+
+ +

+redraw

+
+public void redraw()
+
+
+
+
+
+
+
+
+
+ +

+loop

+
+public void loop()
+
+
+
+
+
+
+
+
+
+ +

+noLoop

+
+public void noLoop()
+
+
+
+
+
+
+
+
+
+ +

+addListeners

+
+public void addListeners()
+
+
+
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed(java.awt.event.MouseEvent e)
+
+
If you override this or any function that takes a "MouseEvent e" + without calling its super.mouseXxxx() then mouseX, mouseY, + mousePressed, and mouseEvent will no longer be set. +

+

+
Specified by:
mousePressed in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseReleased

+
+public void mouseReleased(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseReleased in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseClicked

+
+public void mouseClicked(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseClicked in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseEntered

+
+public void mouseEntered(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseEntered in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseExited

+
+public void mouseExited(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseExited in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
+
+
+
+
+
+
+ +

+mouseMoved

+
+public void mouseMoved(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed()
+
+
Mouse has been pressed, and should be considered "down" + until mouseReleased() is called. If you must, use + int button = mouseEvent.getButton(); + to figure out which button was clicked. It will be one of: + MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3 + Note, however, that this is completely inconsistent across + platforms. +

+

+
+
+
+
+
+
+
+ +

+mouseReleased

+
+public void mouseReleased()
+
+
Mouse button has been released. +

+

+
+
+
+
+
+
+
+ +

+mouseClicked

+
+public void mouseClicked()
+
+
When the mouse is clicked, mousePressed() will be called, + then mouseReleased(), then mouseClicked(). Note that + mousePressed is already false inside of mouseClicked(). +

+

+
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged()
+
+
Mouse button is pressed and the mouse has been dragged. +

+

+
+
+
+
+
+
+
+ +

+mouseMoved

+
+public void mouseMoved()
+
+
Mouse button is not pressed but the mouse has changed locations. +

+

+
+
+
+
+
+
+
+ +

+keyPressed

+
+public void keyPressed(java.awt.event.KeyEvent e)
+
+
Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + 'keyCode', and 'keyEvent' variables to no longer work; + key events will no longer be queued until the end of draw(); + and the keyPressed(), keyReleased() and keyTyped() methods + will no longer be called. +

+

+
Specified by:
keyPressed in interface java.awt.event.KeyListener
+
+
+
+
+
+
+ +

+keyReleased

+
+public void keyReleased(java.awt.event.KeyEvent e)
+
+
+
Specified by:
keyReleased in interface java.awt.event.KeyListener
+
+
+
+
+
+
+ +

+keyTyped

+
+public void keyTyped(java.awt.event.KeyEvent e)
+
+
+
Specified by:
keyTyped in interface java.awt.event.KeyListener
+
+
+
+
+
+
+ +

+keyPressed

+
+public void keyPressed()
+
+
Called each time a single key on the keyboard is pressed. + Because of how operating systems handle key repeats, holding + down a key will cause multiple calls to keyPressed(), because + the OS repeat takes over. +

+ Examples for key handling: + (Tested on Windows XP, please notify if different on other + platforms, I have a feeling Mac OS and Linux may do otherwise) +

+ 1. Pressing 'a' on the keyboard:
+    keyPressed  with key == 'a' and keyCode == 'A'
+    keyTyped    with key == 'a' and keyCode ==  0
+    keyReleased with key == 'a' and keyCode == 'A'
+
+ 2. Pressing 'A' on the keyboard:
+    keyPressed  with key == 'A' and keyCode == 'A'
+    keyTyped    with key == 'A' and keyCode ==  0
+    keyReleased with key == 'A' and keyCode == 'A'
+
+ 3. Pressing 'shift', then 'a' on the keyboard (caps lock is off):
+    keyPressed  with key == CODED and keyCode == SHIFT
+    keyPressed  with key == 'A'   and keyCode == 'A'
+    keyTyped    with key == 'A'   and keyCode == 0
+    keyReleased with key == 'A'   and keyCode == 'A'
+    keyReleased with key == CODED and keyCode == SHIFT
+
+ 4. Holding down the 'a' key.
+    The following will happen several times,
+    depending on your machine's "key repeat rate" settings:
+    keyPressed  with key == 'a' and keyCode == 'A'
+    keyTyped    with key == 'a' and keyCode ==  0
+    When you finally let go, you'll get:
+    keyReleased with key == 'a' and keyCode == 'A'
+
+ 5. Pressing and releasing the 'shift' key
+    keyPressed  with key == CODED and keyCode == SHIFT
+    keyReleased with key == CODED and keyCode == SHIFT
+    (note there is no keyTyped)
+
+ 6. Pressing the tab key in an applet with Java 1.4 will
+    normally do nothing, but PApplet dynamically shuts
+    this behavior off if Java 1.4 is in use (tested 1.4.2_05 Windows).
+    Java 1.1 (Microsoft VM) passes the TAB key through normally.
+    Not tested on other platforms or for 1.3.
+ 
+

+

+
+
+
+
+
+
+
+ +

+keyReleased

+
+public void keyReleased()
+
+
See keyPressed(). +

+

+
+
+
+
+
+
+
+ +

+keyTyped

+
+public void keyTyped()
+
+
Only called for "regular" keys like letters, + see keyPressed() for full documentation. +

+

+
+
+
+
+
+
+
+ +

+focusGained

+
+public void focusGained()
+
+
+
+
+
+
+
+
+
+ +

+focusGained

+
+public void focusGained(java.awt.event.FocusEvent e)
+
+
+
Specified by:
focusGained in interface java.awt.event.FocusListener
+
+
+
+
+
+
+ +

+focusLost

+
+public void focusLost()
+
+
+
+
+
+
+
+
+
+ +

+focusLost

+
+public void focusLost(java.awt.event.FocusEvent e)
+
+
+
Specified by:
focusLost in interface java.awt.event.FocusListener
+
+
+
+
+
+
+ +

+millis

+
+public int millis()
+
+
Get the number of milliseconds since the applet started. +

+ This is a function, rather than a variable, because it may + change multiple times per frame. +

+

+
+
+
+
+
+
+
+ +

+second

+
+public static int second()
+
+
Seconds position of the current time. +

+

+
+
+
+
+
+
+
+ +

+minute

+
+public static int minute()
+
+
Minutes position of the current time. +

+

+
+
+
+
+
+
+
+ +

+hour

+
+public static int hour()
+
+
Hour position of the current time in international format (0-23). +

+ To convert this value to American time:
+

int yankeeHour = (hour() % 12);
+ if (yankeeHour == 0) yankeeHour = 12;
+

+

+
+
+
+
+
+
+
+ +

+day

+
+public static int day()
+
+
Get the current day of the month (1 through 31). +

+ If you're looking for the day of the week (M-F or whatever) + or day of the year (1..365) then use java's Calendar.get() +

+

+
+
+
+
+
+
+
+ +

+month

+
+public static int month()
+
+
Get the current month in range 1 through 12. +

+

+
+
+
+
+
+
+
+ +

+year

+
+public static int year()
+
+
Get the current year. +

+

+
+
+
+
+
+
+
+ +

+delay

+
+public void delay(int napTime)
+
+
The delay() function causes the program to halt for a specified time. + Delay times are specified in thousandths of a second. For example, + running delay(3000) will stop the program for three seconds and + delay(500) will stop the program for a half-second. Remember: the + display window is updated only at the end of draw(), so putting more + than one delay() inside draw() will simply add them together and the new + frame will be drawn when the total delay is over. +

+ I'm not sure if this is even helpful anymore, as the screen isn't + updated before or after the delay, meaning which means it just + makes the app lock up temporarily. +

+

+
+
+
+
+
+
+
+ +

+frameRate

+
+public void frameRate(float newRateTarget)
+
+
Set a target frameRate. This will cause delay() to be called + after each frame so that the sketch synchronizes to a particular speed. + Note that this only sets the maximum frame rate, it cannot be used to + make a slow sketch go faster. Sketches have no default frame rate + setting, and will attempt to use maximum processor power to achieve + maximum speed. +

+

+
+
+
+
+
+
+
+ +

+param

+
+public java.lang.String param(java.lang.String what)
+
+
Get a param from the web page, or (eventually) + from a properties file. +

+

+
+
+
+
+
+
+
+ +

+status

+
+public void status(java.lang.String what)
+
+
Show status in the status bar of a web browser, or in the + System.out console. Eventually this might show status in the + p5 environment itself, rather than relying on the console. +

+

+
+
+
+
+
+
+
+ +

+link

+
+public void link(java.lang.String here)
+
+
+
+
+
+
+
+
+
+ +

+link

+
+public void link(java.lang.String url,
+                 java.lang.String frameTitle)
+
+
Link to an external page without all the muss. +

+ When run with an applet, uses the browser to open the url, + for applications, attempts to launch a browser with the url. +

+ Works on Mac OS X and Windows. For Linux, use: +

open(new String[] { "firefox", url });
+ or whatever you want as your browser, since Linux doesn't + yet have a standard method for launching URLs. +

+

+
+
+
+
+
+
+
+ +

+open

+
+public static void open(java.lang.String filename)
+
+
Attempt to open a file using the platform's shell. +

+

+
+
+
+
+
+
+
+ +

+open

+
+public static java.lang.Process open(java.lang.String[] argv)
+
+
Launch a process using a platforms shell. This version uses an array + to make it easier to deal with spaces in the individual elements. + (This avoids the situation of trying to put single or double quotes + around different bits). +

+

+
+
+
+
+
+
+
+ +

+exec

+
+public static java.lang.Process exec(java.lang.String[] argv)
+
+
+
+
+
+
+
+
+
+ +

+die

+
+public void die(java.lang.String what)
+
+
Function for an applet/application to kill itself and + display an error. Mostly this is here to be improved later. +

+

+
+
+
+
+
+
+
+ +

+die

+
+public void die(java.lang.String what,
+                java.lang.Exception e)
+
+
Same as above but with an exception. Also needs work. +

+

+
+
+
+
+
+
+
+ +

+exit

+
+public void exit()
+
+
Call to safely exit the sketch when finished. For instance, + to render a single frame, save it, and quit. +

+

+
+
+
+
+
+
+
+ +

+save

+
+public void save(java.lang.String filename)
+
+
Intercepts any relative paths to make them absolute (relative + to the sketch folder) before passing to save() in PImage. + (Changed in 0100) +

+

+
+
+
+
+
+
+
+ +

+saveFrame

+
+public void saveFrame()
+
+
Grab an image of what's currently in the drawing area and save it + as a .tif or .tga file. +

+ Best used just before endDraw() at the end of your draw(). + This can only create .tif or .tga images, so if neither extension + is specified it defaults to writing a tiff and adds a .tif suffix. +

+

+
+
+
+
+
+
+
+ +

+saveFrame

+
+public void saveFrame(java.lang.String what)
+
+
Save the current frame as a .tif or .tga image. +

+ The String passed in can contain a series of # signs + that will be replaced with the screengrab number. +

+ i.e. saveFrame("blah-####.tif");
+      // saves a numbered tiff image, replacing the
+      // #### signs with zeros and the frame number 
+

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor(int cursorType)
+
+
Set the cursor type +

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor(PImage image)
+
+
Replace the cursor with the specified PImage. The x- and y- + coordinate of the center will be the center of the image. +

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor(PImage image,
+                   int hotspotX,
+                   int hotspotY)
+
+
Set a custom cursor to an image with a specific hotspot. + Only works with JDK 1.2 and later. + Currently seems to be broken on Java 1.4 for Mac OS X +

+ Based on code contributed by Amit Pitaru, plus additional + code to handle Java versions via reflection by Jonathan Feinberg. + Reflection removed for release 0128 and later. +

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor()
+
+
Show the cursor after noCursor() was called. + Notice that the program remembers the last set cursor type +

+

+
+
+
+
+
+
+
+ +

+noCursor

+
+public void noCursor()
+
+
Hide the cursor by creating a transparent image + and using it as a custom cursor. +

+

+
+
+
+
+
+
+
+ +

+print

+
+public static void print(byte what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(char what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(int what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(float what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(java.lang.Object what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println()
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(byte what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(char what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(int what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(float what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(java.lang.Object what)
+
+
+
+
+
+
+
+
+
+ +

+abs

+
+public static final float abs(float n)
+
+
+
+
+
+
+
+
+
+ +

+abs

+
+public static final int abs(int n)
+
+
+
+
+
+
+
+
+
+ +

+sq

+
+public static final float sq(float a)
+
+
+
+
+
+
+
+
+
+ +

+sqrt

+
+public static final float sqrt(float a)
+
+
+
+
+
+
+
+
+
+ +

+log

+
+public static final float log(float a)
+
+
+
+
+
+
+
+
+
+ +

+exp

+
+public static final float exp(float a)
+
+
+
+
+
+
+
+
+
+ +

+pow

+
+public static final float pow(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final int max(int a,
+                            int b)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final float max(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final int max(int a,
+                            int b,
+                            int c)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final float max(float a,
+                              float b,
+                              float c)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final int max(int[] list)
+
+
Find the maximum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The maximum value
+
+
+
+ +

+max

+
+public static final float max(float[] list)
+
+
Find the maximum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The maximum value
+
+
+
+ +

+min

+
+public static final int min(int a,
+                            int b)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final float min(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final int min(int a,
+                            int b,
+                            int c)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final float min(float a,
+                              float b,
+                              float c)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final int min(int[] list)
+
+
Find the minimum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The minimum value
+
+
+
+ +

+min

+
+public static final float min(float[] list)
+
+
Find the minimum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The minimum value
+
+
+
+ +

+constrain

+
+public static final int constrain(int amt,
+                                  int low,
+                                  int high)
+
+
+
+
+
+
+
+
+
+ +

+constrain

+
+public static final float constrain(float amt,
+                                    float low,
+                                    float high)
+
+
+
+
+
+
+
+
+
+ +

+sin

+
+public static final float sin(float angle)
+
+
+
+
+
+
+
+
+
+ +

+cos

+
+public static final float cos(float angle)
+
+
+
+
+
+
+
+
+
+ +

+tan

+
+public static final float tan(float angle)
+
+
+
+
+
+
+
+
+
+ +

+asin

+
+public static final float asin(float value)
+
+
+
+
+
+
+
+
+
+ +

+acos

+
+public static final float acos(float value)
+
+
+
+
+
+
+
+
+
+ +

+atan

+
+public static final float atan(float value)
+
+
+
+
+
+
+
+
+
+ +

+atan2

+
+public static final float atan2(float a,
+                                float b)
+
+
+
+
+
+
+
+
+
+ +

+degrees

+
+public static final float degrees(float radians)
+
+
+
+
+
+
+
+
+
+ +

+radians

+
+public static final float radians(float degrees)
+
+
+
+
+
+
+
+
+
+ +

+ceil

+
+public static final int ceil(float what)
+
+
+
+
+
+
+
+
+
+ +

+floor

+
+public static final int floor(float what)
+
+
+
+
+
+
+
+
+
+ +

+round

+
+public static final int round(float what)
+
+
+
+
+
+
+
+
+
+ +

+mag

+
+public static final float mag(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+mag

+
+public static final float mag(float a,
+                              float b,
+                              float c)
+
+
+
+
+
+
+
+
+
+ +

+dist

+
+public static final float dist(float x1,
+                               float y1,
+                               float x2,
+                               float y2)
+
+
+
+
+
+
+
+
+
+ +

+dist

+
+public static final float dist(float x1,
+                               float y1,
+                               float z1,
+                               float x2,
+                               float y2,
+                               float z2)
+
+
+
+
+
+
+
+
+
+ +

+lerp

+
+public static final float lerp(float start,
+                               float stop,
+                               float amt)
+
+
+
+
+
+
+
+
+
+ +

+norm

+
+public static final float norm(float value,
+                               float start,
+                               float stop)
+
+
Normalize a value to exist between 0 and 1 (inclusive). + Mathematically the opposite of lerp(), figures out what proportion + a particular value is relative to start and stop coordinates. +

+

+
+
+
+
+
+
+
+ +

+map

+
+public static final float map(float value,
+                              float istart,
+                              float istop,
+                              float ostart,
+                              float ostop)
+
+
Convenience function to map a variable from one coordinate space + to another. Equivalent to unlerp() followed by lerp(). +

+

+
+
+
+
+
+
+
+ +

+random

+
+public final float random(float howbig)
+
+
Return a random number in the range [0, howbig). +

+ The number returned will range from zero up to + (but not including) 'howbig'. +

+

+
+
+
+
+
+
+
+ +

+random

+
+public final float random(float howsmall,
+                          float howbig)
+
+
Return a random number in the range [howsmall, howbig). +

+ The number returned will range from 'howsmall' up to + (but not including 'howbig'. +

+ If howsmall is >= howbig, howsmall will be returned, + meaning that random(5, 5) will return 5 (useful) + and random(7, 4) will return 7 (not useful.. better idea?) +

+

+
+
+
+
+
+
+
+ +

+randomSeed

+
+public final void randomSeed(long what)
+
+
+
+
+
+
+
+
+
+ +

+noise

+
+public float noise(float x)
+
+
Computes the Perlin noise function value at point x. +

+

+
+
+
+
+
+
+
+ +

+noise

+
+public float noise(float x,
+                   float y)
+
+
Computes the Perlin noise function value at the point x, y. +

+

+
+
+
+
+
+
+
+ +

+noise

+
+public float noise(float x,
+                   float y,
+                   float z)
+
+
Computes the Perlin noise function value at x, y, z. +

+

+
+
+
+
+
+
+
+ +

+noiseDetail

+
+public void noiseDetail(int lod)
+
+
+
+
+
+
+
+
+
+ +

+noiseDetail

+
+public void noiseDetail(int lod,
+                        float falloff)
+
+
+
+
+
+
+
+
+
+ +

+noiseSeed

+
+public void noiseSeed(long what)
+
+
+
+
+
+
+
+
+
+ +

+loadImage

+
+public PImage loadImage(java.lang.String filename)
+
+
Load an image from the data folder or a local directory. + Supports .gif (including transparency), .tga, and .jpg images. + In Java 1.3 or later, .png images are + + also supported. +

+ Generally, loadImage() should only be used during setup, because + re-loading images inside draw() is likely to cause a significant + delay while memory is allocated and the thread blocks while waiting + for the image to load because loading is not asynchronous. +

+ To load several images asynchronously, see more information in the + FAQ about writing your own threaded image loading method. +

+ As of 0096, returns null if no image of that name is found, + rather than an error. +

+ Release 0115 also provides support for reading TIFF and RLE-encoded + Targa (.tga) files written by Processing via save() and saveFrame(). + Other TIFF and Targa files will probably not load, use a different + format (gif, jpg and png are safest bets) when creating images with + another application to use with Processing. +

+ Also in release 0115, more image formats (BMP and others) can + be read when using Java 1.4 and later. Because many people still + use Java 1.1 and 1.3, these formats are not recommended for + work that will be posted on the web. To get a list of possible + image formats for use with Java 1.4 and later, use the following: + println(javax.imageio.ImageIO.getReaderFormatNames()) +

+ Images are loaded via a byte array that is passed to + Toolkit.createImage(). Unfortunately, we cannot use Applet.getImage() + because it takes a URL argument, which would be a pain in the a-- + to make work consistently for online and local sketches. + Sometimes this causes problems, resulting in issues like + Bug 279 + and + Bug 305. + In release 0115, everything was instead run through javax.imageio, + but that turned out to be very slow, see + Bug 392. + As a result, starting with 0116, the following happens: +

    +
  • TGA and TIFF images are loaded using the internal load methods. +
  • JPG, GIF, and PNG images are loaded via loadBytes(). +
  • If the image still isn't loaded, it's passed to javax.imageio. +
+ For releases 0116 and later, if you have problems such as those seen + in Bugs 279 and 305, use Applet.getImage() instead. You'll be stuck + with the limitations of getImage() (the headache of dealing with + online/offline use). Set up your own MediaTracker, and pass the resulting + java.awt.Image to the PImage constructor that takes an AWT image. +

+

+
+
+
+
+
+
+
+ +

+loadImage

+
+public PImage loadImage(java.lang.String filename,
+                        java.lang.String extension)
+
+
Identical to loadImage, but allows you to specify the type of + image by its extension. Especially useful when downloading from + CGI scripts. +

+ Use 'unknown' as the extension to pass off to the default + image loader that handles gif, jpg, and png. +

+

+
+
+
+
+
+
+
+ +

+requestImage

+
+public PImage requestImage(java.lang.String filename)
+
+
+
+
+
+
+
+
+
+ +

+requestImage

+
+public PImage requestImage(java.lang.String filename,
+                           java.lang.String extension)
+
+
+
+
+
+
+
+
+
+ +

+loadShape

+
+public PShape loadShape(java.lang.String filename)
+
+
Load a geometry from a file as a PShape. Currently only supports SVG data. +

+

+
+
+
+
+
+
+
+ +

+loadFont

+
+public PFont loadFont(java.lang.String filename)
+
+
+
+
+
+
+
+
+
+ +

+createFont

+
+public PFont createFont(java.lang.String name,
+                        float size)
+
+
+
+
+
+
+
+
+
+ +

+createFont

+
+public PFont createFont(java.lang.String name,
+                        float size,
+                        boolean smooth)
+
+
+
+
+
+
+
+
+
+ +

+createFont

+
+public PFont createFont(java.lang.String name,
+                        float size,
+                        boolean smooth,
+                        char[] charset)
+
+
Create a .vlw font on the fly from either a font name that's + installed on the system, or from a .ttf or .otf that's inside + the data folder of this sketch. +

+ Only works with Java 1.3 or later. Many .otf fonts don't seem + to be supported by Java, perhaps because they're CFF based? +

+ Font names are inconsistent across platforms and Java versions. + On Mac OS X, Java 1.3 uses the font menu name of the font, + whereas Java 1.4 uses the PostScript name of the font. Java 1.4 + on OS X will also accept the font menu name as well. On Windows, + it appears that only the menu names are used, no matter what + Java version is in use. Naming system unknown/untested for 1.5. +

+ Use 'null' for the charset if you want to use any of the 65,536 + unicode characters that exist in the font. Note that this can + produce an enormous file or may cause an OutOfMemoryError. +

+

+
+
+
+
+
+
+
+ +

+selectInput

+
+public java.lang.String selectInput()
+
+
Open a platform-specific file chooser dialog to select a file for input. +

+

+
+
+
+ +
Returns:
full path to the selected file, or null if no selection.
+
+
+
+ +

+selectInput

+
+public java.lang.String selectInput(java.lang.String prompt)
+
+
Open a platform-specific file chooser dialog to select a file for input. +

+

+
+
+
+
Parameters:
prompt - Mesage to show the user when prompting for a file. +
Returns:
full path to the selected file, or null if canceled.
+
+
+
+ +

+selectOutput

+
+public java.lang.String selectOutput()
+
+
Open a platform-specific file save dialog to select a file for output. +

+

+
+
+
+ +
Returns:
full path to the file entered, or null if canceled.
+
+
+
+ +

+selectOutput

+
+public java.lang.String selectOutput(java.lang.String prompt)
+
+
Open a platform-specific file save dialog to select a file for output. +

+

+
+
+
+
Parameters:
prompt - Mesage to show the user when prompting for a file. +
Returns:
full path to the file entered, or null if canceled.
+
+
+
+ +

+selectFolder

+
+public java.lang.String selectFolder()
+
+
Open a platform-specific folder chooser dialog. +

+

+
+
+
+ +
Returns:
full path to the selected folder, or null if no selection.
+
+
+
+ +

+selectFolder

+
+public java.lang.String selectFolder(java.lang.String prompt)
+
+
Open a platform-specific folder chooser dialog. +

+

+
+
+
+
Parameters:
prompt - Mesage to show the user when prompting for a file. +
Returns:
full path to the selected folder, or null if no selection.
+
+
+
+ +

+createReader

+
+public java.io.BufferedReader createReader(java.lang.String filename)
+
+
I want to read lines from a file. I have RSI from typing these + eight lines of code so many times. +

+

+
+
+
+
+
+
+
+ +

+createReader

+
+public static java.io.BufferedReader createReader(java.io.File file)
+
+
I want to read lines from a file. And I'm still annoyed. +

+

+
+
+
+
+
+
+
+ +

+createReader

+
+public static java.io.BufferedReader createReader(java.io.InputStream input)
+
+
I want to read lines from a stream. If I have to type the + following lines any more I'm gonna send Sun my medical bills. +

+

+
+
+
+
+
+
+
+ +

+createWriter

+
+public java.io.PrintWriter createWriter(java.lang.String filename)
+
+
I want to print lines to a file. Why can't I? +

+

+
+
+
+
+
+
+
+ +

+createWriter

+
+public static java.io.PrintWriter createWriter(java.io.File file)
+
+
I want to print lines to a file. I have RSI from typing these + eight lines of code so many times. +

+

+
+
+
+
+
+
+
+ +

+createWriter

+
+public static java.io.PrintWriter createWriter(java.io.OutputStream output)
+
+
I want to print lines to a file. Why am I always explaining myself? + It's the JavaSoft API engineers who need to explain themselves. +

+

+
+
+
+
+
+
+
+ +

+openStream

+
+public java.io.InputStream openStream(java.lang.String filename)
+
+
Deprecated. As of release 0136, use createInput() instead. +

+

+
+
+
+
+
+
+
+ +

+createInput

+
+public java.io.InputStream createInput(java.lang.String filename)
+
+
Simplified method to open a Java InputStream. +

+ This method is useful if you want to use the facilities provided + by PApplet to easily open things from the data folder or from a URL, + but want an InputStream object so that you can use other Java + methods to take more control of how the stream is read. +

+ If the requested item doesn't exist, null is returned. + (Prior to 0096, die() would be called, killing the applet) +

+ For 0096+, the "data" folder is exported intact with subfolders, + and openStream() properly handles subdirectories from the data folder +

+ If not online, this will also check to see if the user is asking + for a file whose name isn't properly capitalized. This helps prevent + issues when a sketch is exported to the web, where case sensitivity + matters, as opposed to Windows and the Mac OS default where + case sensitivity is preserved but ignored. +

+ It is strongly recommended that libraries use this method to open + data files, so that the loading sequence is handled in the same way + as functions like loadBytes(), loadImage(), etc. +

+ The filename passed in can be: +

    +
  • A URL, for instance openStream("http://processing.org/"); +
  • A file in the sketch's data folder +
  • Another file to be opened locally (when running as an application) +
+

+

+
+
+
+
+
+
+
+ +

+createInputRaw

+
+public java.io.InputStream createInputRaw(java.lang.String filename)
+
+
Call openStream() without automatic gzip decompression. +

+

+
+
+
+
+
+
+
+ +

+createInput

+
+public static java.io.InputStream createInput(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+loadBytes

+
+public byte[] loadBytes(java.lang.String filename)
+
+
+
+
+
+
+
+
+
+ +

+loadBytes

+
+public static byte[] loadBytes(java.io.InputStream input)
+
+
+
+
+
+
+
+
+
+ +

+loadBytes

+
+public static byte[] loadBytes(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+loadStrings

+
+public static java.lang.String[] loadStrings(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+loadStrings

+
+public java.lang.String[] loadStrings(java.lang.String filename)
+
+
Load data from a file and shove it into a String array. +

+ Exceptions are handled internally, when an error, occurs, an + exception is printed to the console and 'null' is returned, + but the program continues running. This is a tradeoff between + 1) showing the user that there was a problem but 2) not requiring + that all i/o code is contained in try/catch blocks, for the sake + of new users (or people who are just trying to get things done + in a "scripting" fashion. If you want to handle exceptions, + use Java methods for I/O. +

+

+
+
+
+
+
+
+
+ +

+loadStrings

+
+public static java.lang.String[] loadStrings(java.io.InputStream input)
+
+
+
+
+
+
+
+
+
+ +

+createOutput

+
+public java.io.OutputStream createOutput(java.lang.String filename)
+
+
Similar to createInput() (formerly openStream), this creates a Java + OutputStream for a given filename or path. The file will be created in + the sketch folder, or in the same folder as an exported application. +

+ If the path does not exist, intermediate folders will be created. If an + exception occurs, it will be printed to the console, and null will be + returned. +

+ Future releases may also add support for handling HTTP POST via this + method (for better symmetry with createInput), however that's maybe a + little too clever (and then we'd have to add the same features to the + other file functions like createWriter). Who you callin' bloated? +

+

+
+
+
+
+
+
+
+ +

+createOutput

+
+public static java.io.OutputStream createOutput(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+saveStream

+
+public void saveStream(java.lang.String targetFilename,
+                       java.lang.String sourceLocation)
+
+
Save the contents of a stream to a file in the sketch folder. + This is basically saveBytes(blah, loadBytes()), but done + more efficiently (and with less confusing syntax). +

+

+
+
+
+
+
+
+
+ +

+saveStream

+
+public void saveStream(java.io.File targetFile,
+                       java.lang.String sourceLocation)
+
+
Identical to the other saveStream(), but writes to a File + object, for greater control over the file location. + Note that unlike other api methods, this will not automatically + compress or uncompress gzip files. +

+

+
+
+
+
+
+
+
+ +

+saveStream

+
+public static void saveStream(java.io.File targetFile,
+                              java.io.InputStream sourceStream)
+
+
+
+
+
+
+
+
+
+ +

+saveBytes

+
+public void saveBytes(java.lang.String filename,
+                      byte[] buffer)
+
+
Saves bytes to a file to inside the sketch folder. + The filename can be a relative path, i.e. "poo/bytefun.txt" + would save to a file named "bytefun.txt" to a subfolder + called 'poo' inside the sketch folder. If the in-between + subfolders don't exist, they'll be created. +

+

+
+
+
+
+
+
+
+ +

+saveBytes

+
+public static void saveBytes(java.io.File file,
+                             byte[] buffer)
+
+
Saves bytes to a specific File location specified by the user. +

+

+
+
+
+
+
+
+
+ +

+saveBytes

+
+public static void saveBytes(java.io.OutputStream output,
+                             byte[] buffer)
+
+
Spews a buffer of bytes to an OutputStream. +

+

+
+
+
+
+
+
+
+ +

+saveStrings

+
+public void saveStrings(java.lang.String filename,
+                        java.lang.String[] strings)
+
+
+
+
+
+
+
+
+
+ +

+saveStrings

+
+public static void saveStrings(java.io.File file,
+                               java.lang.String[] strings)
+
+
+
+
+
+
+
+
+
+ +

+saveStrings

+
+public static void saveStrings(java.io.OutputStream output,
+                               java.lang.String[] strings)
+
+
+
+
+
+
+
+
+
+ +

+sketchPath

+
+public java.lang.String sketchPath(java.lang.String where)
+
+
Prepend the sketch folder path to the filename (or path) that is + passed in. External libraries should use this function to save to + the sketch folder. +

+ Note that when running as an applet inside a web browser, + the sketchPath will be set to null, because security restrictions + prevent applets from accessing that information. +

+ This will also cause an error if the sketch is not inited properly, + meaning that init() was never called on the PApplet when hosted + my some other main() or by other code. For proper use of init(), + see the examples in the main description text for PApplet. +

+

+
+
+
+
+
+
+
+ +

+sketchFile

+
+public java.io.File sketchFile(java.lang.String where)
+
+
+
+
+
+
+
+
+
+ +

+savePath

+
+public java.lang.String savePath(java.lang.String where)
+
+
Returns a path inside the applet folder to save to. Like sketchPath(), + but creates any in-between folders so that things save properly. +

+ All saveXxxx() functions use the path to the sketch folder, rather than + its data folder. Once exported, the data folder will be found inside the + jar file of the exported application or applet. In this case, it's not + possible to save data into the jar file, because it will often be running + from a server, or marked in-use if running from a local file system. + With this in mind, saving to the data path doesn't make sense anyway. + If you know you're running locally, and want to save to the data folder, + use saveXxxx("data/blah.dat"). +

+

+
+
+
+
+
+
+
+ +

+saveFile

+
+public java.io.File saveFile(java.lang.String where)
+
+
Identical to savePath(), but returns a File object. +

+

+
+
+
+
+
+
+
+ +

+dataPath

+
+public java.lang.String dataPath(java.lang.String where)
+
+
Return a full path to an item in the data folder. +

+ In this method, the data path is defined not as the applet's actual + data path, but a folder titled "data" in the sketch's working + directory. When running inside the PDE, this will be the sketch's + "data" folder. However, when exported (as application or applet), + sketch's data folder is exported as part of the applications jar file, + and it's not possible to read/write from the jar file in a generic way. + If you need to read data from the jar file, you should use createInput(). +

+

+
+
+
+
+
+
+
+ +

+dataFile

+
+public java.io.File dataFile(java.lang.String where)
+
+
Return a full path to an item in the data folder as a File object. + See the dataPath() method for more information. +

+

+
+
+
+
+
+
+
+ +

+createPath

+
+public static void createPath(java.lang.String path)
+
+
Takes a path and creates any in-between folders if they don't + already exist. Useful when trying to save to a subfolder that + may not actually exist. +

+

+
+
+
+
+
+
+
+ +

+createPath

+
+public static void createPath(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static byte[] sort(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static byte[] sort(byte[] what,
+                          int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static char[] sort(char[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static char[] sort(char[] what,
+                          int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static int[] sort(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static int[] sort(int[] what,
+                         int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static float[] sort(float[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static float[] sort(float[] what,
+                           int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static java.lang.String[] sort(java.lang.String[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static java.lang.String[] sort(java.lang.String[] what,
+                                      int count)
+
+
+
+
+
+
+
+
+
+ +

+arrayCopy

+
+public static void arrayCopy(java.lang.Object src,
+                             int srcPosition,
+                             java.lang.Object dst,
+                             int dstPosition,
+                             int length)
+
+
Calls System.arraycopy(), included here so that we can + avoid people needing to learn about the System object + before they can just copy an array. +

+

+
+
+
+
+
+
+
+ +

+arrayCopy

+
+public static void arrayCopy(java.lang.Object src,
+                             java.lang.Object dst,
+                             int length)
+
+
Convenience method for arraycopy(). + Identical to arraycopy(src, 0, dst, 0, length); +

+

+
+
+
+
+
+
+
+ +

+arrayCopy

+
+public static void arrayCopy(java.lang.Object src,
+                             java.lang.Object dst)
+
+
Shortcut to copy the entire contents of + the source into the destination array. + Identical to arraycopy(src, 0, dst, 0, src.length); +

+

+
+
+
+
+
+
+
+ +

+arraycopy

+
+public static void arraycopy(java.lang.Object src,
+                             int srcPosition,
+                             java.lang.Object dst,
+                             int dstPosition,
+                             int length)
+
+
Deprecated. Use arrayCopy() instead. +

+

+
+
+
+
+
+
+
+ +

+arraycopy

+
+public static void arraycopy(java.lang.Object src,
+                             java.lang.Object dst,
+                             int length)
+
+
Deprecated. Use arrayCopy() instead. +

+

+
+
+
+
+
+
+
+ +

+arraycopy

+
+public static void arraycopy(java.lang.Object src,
+                             java.lang.Object dst)
+
+
Deprecated. Use arrayCopy() instead. +

+

+
+
+
+
+
+
+
+ +

+expand

+
+public static boolean[] expand(boolean[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static boolean[] expand(boolean[] list,
+                               int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static byte[] expand(byte[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static byte[] expand(byte[] list,
+                            int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static char[] expand(char[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static char[] expand(char[] list,
+                            int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static int[] expand(int[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static int[] expand(int[] list,
+                           int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static float[] expand(float[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static float[] expand(float[] list,
+                             int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.String[] expand(java.lang.String[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.String[] expand(java.lang.String[] list,
+                                        int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.Object expand(java.lang.Object array)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.Object expand(java.lang.Object list,
+                                      int newSize)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static byte[] append(byte[] b,
+                            byte value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static char[] append(char[] b,
+                            char value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static int[] append(int[] b,
+                           int value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static float[] append(float[] b,
+                             float value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static java.lang.String[] append(java.lang.String[] b,
+                                        java.lang.String value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static java.lang.Object append(java.lang.Object b,
+                                      java.lang.Object value)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static boolean[] shorten(boolean[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static byte[] shorten(byte[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static char[] shorten(char[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static int[] shorten(int[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static float[] shorten(float[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static java.lang.String[] shorten(java.lang.String[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static java.lang.Object shorten(java.lang.Object list)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final boolean[] splice(boolean[] list,
+                                     boolean v,
+                                     int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final boolean[] splice(boolean[] list,
+                                     boolean[] v,
+                                     int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final byte[] splice(byte[] list,
+                                  byte v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final byte[] splice(byte[] list,
+                                  byte[] v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final char[] splice(char[] list,
+                                  char v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final char[] splice(char[] list,
+                                  char[] v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final int[] splice(int[] list,
+                                 int v,
+                                 int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final int[] splice(int[] list,
+                                 int[] v,
+                                 int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final float[] splice(float[] list,
+                                   float v,
+                                   int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final float[] splice(float[] list,
+                                   float[] v,
+                                   int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final java.lang.String[] splice(java.lang.String[] list,
+                                              java.lang.String v,
+                                              int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final java.lang.String[] splice(java.lang.String[] list,
+                                              java.lang.String[] v,
+                                              int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final java.lang.Object splice(java.lang.Object list,
+                                            java.lang.Object v,
+                                            int index)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static boolean[] subset(boolean[] list,
+                               int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static boolean[] subset(boolean[] list,
+                               int start,
+                               int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static byte[] subset(byte[] list,
+                            int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static byte[] subset(byte[] list,
+                            int start,
+                            int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static char[] subset(char[] list,
+                            int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static char[] subset(char[] list,
+                            int start,
+                            int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static int[] subset(int[] list,
+                           int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static int[] subset(int[] list,
+                           int start,
+                           int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static float[] subset(float[] list,
+                             int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static float[] subset(float[] list,
+                             int start,
+                             int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.String[] subset(java.lang.String[] list,
+                                        int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.String[] subset(java.lang.String[] list,
+                                        int start,
+                                        int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.Object subset(java.lang.Object list,
+                                      int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.Object subset(java.lang.Object list,
+                                      int start,
+                                      int count)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static boolean[] concat(boolean[] a,
+                               boolean[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static byte[] concat(byte[] a,
+                            byte[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static char[] concat(char[] a,
+                            char[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static int[] concat(int[] a,
+                           int[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static float[] concat(float[] a,
+                             float[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static java.lang.String[] concat(java.lang.String[] a,
+                                        java.lang.String[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static java.lang.Object concat(java.lang.Object a,
+                                      java.lang.Object b)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static boolean[] reverse(boolean[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static byte[] reverse(byte[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static char[] reverse(char[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static int[] reverse(int[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static float[] reverse(float[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static java.lang.String[] reverse(java.lang.String[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static java.lang.Object reverse(java.lang.Object list)
+
+
+
+
+
+
+
+
+
+ +

+trim

+
+public static java.lang.String trim(java.lang.String str)
+
+
Remove whitespace characters from the beginning and ending + of a String. Works like String.trim() but includes the + unicode nbsp character as well. +

+

+
+
+
+
+
+
+
+ +

+trim

+
+public static java.lang.String[] trim(java.lang.String[] array)
+
+
Trim the whitespace from a String array. This returns a new + array and does not affect the passed-in array. +

+

+
+
+
+
+
+
+
+ +

+join

+
+public static java.lang.String join(java.lang.String[] str,
+                                    char separator)
+
+
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +

+

+
+
+
+
+
+
+
+ +

+join

+
+public static java.lang.String join(java.lang.String[] str,
+                                    java.lang.String separator)
+
+
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +

+ To use this on numbers, first pass the array to nf() or nfs() + to get a list of String objects, then use join on that. +

+ e.g. String stuff[] = { "apple", "bear", "cat" };
+      String list = join(stuff, ", ");
+      // list is now "apple, bear, cat"
+

+

+
+
+
+
+
+
+
+ +

+splitTokens

+
+public static java.lang.String[] splitTokens(java.lang.String what)
+
+
Split the provided String at wherever whitespace occurs. + Multiple whitespace (extra spaces or tabs or whatever) + between items will count as a single break. +

+ The whitespace characters are "\t\n\r\f", which are the defaults + for java.util.StringTokenizer, plus the unicode non-breaking space + character, which is found commonly on files created by or used + in conjunction with Mac OS X (character 160, or 0x00A0 in hex). +

+ i.e. splitTokens("a b") -> { "a", "b" }
+      splitTokens("a    b") -> { "a", "b" }
+      splitTokens("a\tb") -> { "a", "b" }
+      splitTokens("a \t  b  ") -> { "a", "b" }
+

+

+
+
+
+
+
+
+
+ +

+splitTokens

+
+public static java.lang.String[] splitTokens(java.lang.String what,
+                                             java.lang.String delim)
+
+
Splits a string into pieces, using any of the chars in the + String 'delim' as separator characters. For instance, + in addition to white space, you might want to treat commas + as a separator. The delimeter characters won't appear in + the returned String array. +
+ i.e. splitTokens("a, b", " ,") -> { "a", "b" }
+ 
+ To include all the whitespace possibilities, use the variable + WHITESPACE, found in PConstants: +
+ i.e. splitTokens("a   | b", WHITESPACE + "|");  ->  { "a", "b" }
+

+

+
+
+
+
+
+
+
+ +

+split

+
+public static java.lang.String[] split(java.lang.String what,
+                                       char delim)
+
+
Split a string into pieces along a specific character. + Most commonly used to break up a String along a space or a tab + character. +

+ This operates differently than the others, where the + single delimeter is the only breaking point, and consecutive + delimeters will produce an empty string (""). This way, + one can split on tab characters, but maintain the column + alignments (of say an excel file) where there are empty columns. +

+

+
+
+
+
+
+
+
+ +

+split

+
+public static java.lang.String[] split(java.lang.String what,
+                                       java.lang.String delim)
+
+
Split a String on a specific delimiter. Unlike Java's String.split() + method, this does not parse the delimiter as a regexp because it's more + confusing than necessary, and String.split() is always available for + those who want regexp. +

+

+
+
+
+
+
+
+
+ +

+match

+
+public static java.lang.String[] match(java.lang.String what,
+                                       java.lang.String regexp)
+
+
Match a string with a regular expression, and returns the match as an + array. The first index is the matching expression, and array elements + [1] and higher represent each of the groups (sequences found in parens). + + This uses multiline matching (Pattern.MULTILINE) and dotall mode + (Pattern.DOTALL) by default, so that ^ and $ match the beginning and + end of any lines found in the source, and the . operator will also + pick up newline characters. +

+

+
+
+
+
+
+
+
+ +

+matchAll

+
+public static java.lang.String[][] matchAll(java.lang.String what,
+                                            java.lang.String regexp)
+
+
Identical to match(), except that it returns an array of all matches in + the specified String, rather than just the first. +

+

+
+
+
+
+
+
+
+ +

+parseBoolean

+
+public static final boolean parseBoolean(int what)
+
+

Convert an integer to a boolean. Because of how Java handles upgrading + numbers, this will also cover byte and char (as they will upgrade to + an int without any sort of explicit cast).

+

The preprocessor will convert boolean(what) to parseBoolean(what).

+

+

+
+
+
+ +
Returns:
false if 0, true if any other number
+
+
+
+ +

+parseBoolean

+
+public static final boolean parseBoolean(java.lang.String what)
+
+
Convert the string "true" or "false" to a boolean. +

+

+
+
+
+ +
Returns:
true if 'what' is "true" or "TRUE", false otherwise
+
+
+
+ +

+parseBoolean

+
+public static final boolean[] parseBoolean(byte[] what)
+
+
Convert a byte array to a boolean array. Each element will be + evaluated identical to the integer case, where a byte equal + to zero will return false, and any other value will return true. +

+

+
+
+
+ +
Returns:
array of boolean elements
+
+
+
+ +

+parseBoolean

+
+public static final boolean[] parseBoolean(int[] what)
+
+
Convert an int array to a boolean array. An int equal + to zero will return false, and any other value will return true. +

+

+
+
+
+ +
Returns:
array of boolean elements
+
+
+
+ +

+parseBoolean

+
+public static final boolean[] parseBoolean(java.lang.String[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(char what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(int what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(float what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(boolean[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(char[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(float[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char parseChar(byte what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char parseChar(int what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char[] parseChar(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char[] parseChar(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(byte what)
+
+
Note that parseInt() will un-sign a signed byte value. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(char what)
+
+
Note that parseInt('5') is unlike String in the sense that it + won't return 5, but the ascii value. This is because ((int) someChar) + returns the ascii value, and parseInt() is just longhand for the cast. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(float what)
+
+
Same as floor(), or an (int) cast. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(java.lang.String what)
+
+
Parse a String into an int value. Returns 0 if the value is bad. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(java.lang.String what,
+                                 int otherwise)
+
+
Parse a String to an int, and provide an alternate value that + should be used when the number is invalid. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int[] parseInt(boolean[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int[] parseInt(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int[] parseInt(char[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static int[] parseInt(float[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static int[] parseInt(java.lang.String[] what)
+
+
Make an array of int elements from an array of String objects. + If the String can't be parsed as a number, it will be set to zero. + + String s[] = { "1", "300", "44" }; + int numbers[] = parseInt(s); + + numbers will contain { 1, 300, 44 } +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static int[] parseInt(java.lang.String[] what,
+                             int missing)
+
+
Make an array of int elements from an array of String objects. + If the String can't be parsed as a number, its entry in the + array will be set to the value of the "missing" parameter. + + String s[] = { "1", "300", "apple", "44" }; + int numbers[] = parseInt(s, 9999); + + numbers will contain { 1, 300, 9999, 44 } +

+

+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float parseFloat(int what)
+
+
Convert an int to a float value. Also handles bytes because of + Java's rules for upgrading values. +

+

+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float parseFloat(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float parseFloat(java.lang.String what,
+                                     float otherwise)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final float[] parseByte(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float[] parseFloat(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float[] parseFloat(java.lang.String[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float[] parseFloat(java.lang.String[] what,
+                                       float missing)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(boolean x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(byte x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(char x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(int x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(float x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(boolean[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(byte[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(char[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(int[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(float[] x)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String[] nf(int[] num,
+                                    int digits)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String nf(int num,
+                                  int digits)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String[] nfc(int[] num)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String nfc(int num)
+
+
+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String nfs(int num,
+                                   int digits)
+
+
number format signed (or space) + Formats a number but leaves a blank space in the front + when it's positive so that it can be properly aligned with + numbers that have a negative sign in front of them. +

+

+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String[] nfs(int[] num,
+                                     int digits)
+
+
+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String nfp(int num,
+                                   int digits)
+
+
number format positive (or plus) + Formats a number, always placing a - or + sign + in the front when it's negative or positive. +

+

+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String[] nfp(int[] num,
+                                     int digits)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String[] nf(float[] num,
+                                    int left,
+                                    int right)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String nf(float num,
+                                  int left,
+                                  int right)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String[] nfc(float[] num,
+                                     int right)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String nfc(float num,
+                                   int right)
+
+
+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String[] nfs(float[] num,
+                                     int left,
+                                     int right)
+
+
Number formatter that takes into account whether the number + has a sign (positive, negative, etc) in front of it. +

+

+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String nfs(float num,
+                                   int left,
+                                   int right)
+
+
+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String[] nfp(float[] num,
+                                     int left,
+                                     int right)
+
+
+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String nfp(float num,
+                                   int left,
+                                   int right)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(byte what)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(char what)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(int what)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(int what,
+                                         int digits)
+
+
+
+
+
+
+
+
+
+ +

+unhex

+
+public static final int unhex(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(byte what)
+
+
Returns a String that contains the binary value of a byte. + The returned value will always have 8 digits. +

+

+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(char what)
+
+
Returns a String that contains the binary value of a char. + The returned value will always have 16 digits because chars + are two bytes long. +

+

+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(int what)
+
+
Returns a String that contains the binary value of an int. + The length depends on the size of the number itself. + An int can be up to 32 binary digits, but that seems like + overkill for almost any situation, so this function just + auto-size. If you want a specific number of digits (like all 32) + use binary(int what, int digits) to specify how many digits. +

+

+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(int what,
+                                            int digits)
+
+
Returns a String that contains the binary value of an int. + The digits parameter determines how many digits will be used. +

+

+
+
+
+
+
+
+
+ +

+unbinary

+
+public static final int unbinary(java.lang.String what)
+
+
Unpack a binary String into an int. + i.e. unbinary("00001000") would return 8. +

+

+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float fgray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray,
+                       int alpha)
+
+
As of 0116 this also takes color(#FF8800, alpha) +

+

+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float fgray,
+                       float falpha)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z,
+                       int a)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
+
+
+
+
+
+
+
+ +

+setupExternalMessages

+
+public void setupExternalMessages()
+
+
Set this sketch to communicate its state back to the PDE. +

+ This uses the stderr stream to write positions of the window + (so that it will be saved by the PDE for the next run) and + notify on quit. See more notes in the Worker class. +

+

+
+
+
+
+
+
+
+ +

+setupFrameResizeListener

+
+public void setupFrameResizeListener()
+
+
Set up a listener that will fire proper component resize events + in cases where frame.setResizable(true) is called. +

+

+
+
+
+
+
+
+
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
main() method for running this class from the command line. +

+ The options shown here are not yet finalized and will be + changing over the next several releases. +

+ The simplest way to turn and applet into an application is to + add the following code to your program: +

static public void main(String args[]) {
+   PApplet.main(new String[] { "YourSketchName" });
+ }
+ This will properly launch your applet from a double-clickable + .jar or from the command line. +
+ Parameters useful for launching or also used by the PDE:
+
+ --location=x,y        upper-lefthand corner of where the applet
+                       should appear on screen. if not used,
+                       the default is to center on the main screen.
+
+ --present             put the applet into full screen presentation
+                       mode. requires java 1.4 or later.
+                       
+ --exclusive           use full screen exclusive mode when presenting.
+                       disables new windows or interaction with other 
+                       monitors, this is like a "game" mode.
+
+ --hide-stop           use to hide the stop button in situations where
+                       you don't want to allow users to exit. also
+                       see the FAQ on information for capturing the ESC
+                       key when running in presentation mode.
+
+ --stop-color=#xxxxxx  color of the 'stop' text used to quit an
+                       sketch when it's in present mode.
+
+ --bgcolor=#xxxxxx     background color of the window.
+
+ --sketch-path         location of where to save files from functions
+                       like saveStrings() or saveFrame(). defaults to
+                       the folder that the java application was
+                       launched from, which means if this isn't set by
+                       the pde, everything goes into the same folder
+                       as processing.exe.
+
+ --display=n           set what display should be used by this applet.
+                       displays are numbered starting from 1.
+
+ Parameters used by Processing when running via the PDE
+
+ --external            set when the applet is being used by the PDE
+
+ --editor-location=x,y position of the upper-lefthand corner of the
+                       editor window, for placement of applet window
+ 
+

+

+
+
+
+
+
+
+
+ +

+beginRecord

+
+public PGraphics beginRecord(java.lang.String renderer,
+                             java.lang.String filename)
+
+
Begin recording to a new renderer of the specified type, using the width + and height of the main drawing surface. +

+

+
+
+
+
+
+
+
+ +

+beginRecord

+
+public void beginRecord(PGraphics recorder)
+
+
Begin recording (echoing) commands to the specified PGraphics object. +

+

+
+
+
+
+
+
+
+ +

+endRecord

+
+public void endRecord()
+
+
+
+
+
+
+
+
+
+ +

+beginRaw

+
+public PGraphics beginRaw(java.lang.String renderer,
+                          java.lang.String filename)
+
+
Begin recording raw shape data to a renderer of the specified type, + using the width and height of the main drawing surface. + + If hashmarks (###) are found in the filename, they'll be replaced + by the current frame number (frameCount). +

+

+
+
+
+
+
+
+
+ +

+beginRaw

+
+public void beginRaw(PGraphics rawGraphics)
+
+
Begin recording raw shape data to the specified renderer. + + This simply echoes to g.beginRaw(), but since is placed here (rather than + generated by preproc.pl) for clarity and so that it doesn't echo the + command should beginRecord() be in use. +

+

+
+
+
+
+
+
+
+ +

+endRaw

+
+public void endRaw()
+
+
Stop recording raw shape data to the specified renderer. + + This simply echoes to g.beginRaw(), but since is placed here (rather than + generated by preproc.pl) for clarity and so that it doesn't echo the + command should beginRecord() be in use. +

+

+
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Override the g.pixels[] function to set the pixels[] array + that's part of the PApplet object. Allows the use of + pixels[] in the code, rather than g.pixels[]. +

+

+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x1,
+                         int y1,
+                         int x2,
+                         int y2)
+
+
+
+
+
+
+
+
+
+ +

+flush

+
+public void flush()
+
+
+
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape()
+
+
+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
+
+
+
+
+
+
+
+ +

+edge

+
+public void edge(boolean edge)
+
+
+
+
+
+
+
+
+
+ +

+normal

+
+public void normal(float nx,
+                   float ny,
+                   float nz)
+
+
+
+
+
+
+
+
+
+ +

+textureMode

+
+public void textureMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float[] v)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape()
+
+
+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float x3,
+                         float y3,
+                         float x4,
+                         float y4)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float z2,
+                         float x3,
+                         float y3,
+                         float z3,
+                         float x4,
+                         float y4,
+                         float z4)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y,
+                        float z)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float z1,
+                 float x2,
+                 float y2,
+                 float z2)
+
+
+
+
+
+
+
+
+
+ +

+triangle

+
+public void triangle(float x1,
+                     float y1,
+                     float x2,
+                     float y2,
+                     float x3,
+                     float y3)
+
+
+
+
+
+
+
+
+
+ +

+quad

+
+public void quad(float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float x3,
+                 float y3,
+                 float x4,
+                 float y4)
+
+
+
+
+
+
+
+
+
+ +

+rectMode

+
+public void rectMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+rect

+
+public void rect(float a,
+                 float b,
+                 float c,
+                 float d)
+
+
+
+
+
+
+
+
+
+ +

+ellipseMode

+
+public void ellipseMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+ellipse

+
+public void ellipse(float a,
+                    float b,
+                    float c,
+                    float d)
+
+
+
+
+
+
+
+
+
+ +

+arc

+
+public void arc(float a,
+                float b,
+                float c,
+                float d,
+                float start,
+                float stop)
+
+
+
+
+
+
+
+
+
+ +

+box

+
+public void box(float size)
+
+
+
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int res)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int ures,
+                         int vres)
+
+
+
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
+
+
+
+
+
+
+
+ +

+bezierPoint

+
+public float bezierPoint(float a,
+                         float b,
+                         float c,
+                         float d,
+                         float t)
+
+
+
+
+
+
+
+
+
+ +

+bezierTangent

+
+public float bezierTangent(float a,
+                           float b,
+                           float c,
+                           float d,
+                           float t)
+
+
+
+
+
+
+
+
+
+ +

+bezierDetail

+
+public void bezierDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float x2,
+                   float y2,
+                   float x3,
+                   float y3,
+                   float x4,
+                   float y4)
+
+
+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float z1,
+                   float x2,
+                   float y2,
+                   float z2,
+                   float x3,
+                   float y3,
+                   float z3,
+                   float x4,
+                   float y4,
+                   float z4)
+
+
+
+
+
+
+
+
+
+ +

+curvePoint

+
+public float curvePoint(float a,
+                        float b,
+                        float c,
+                        float d,
+                        float t)
+
+
+
+
+
+
+
+
+
+ +

+curveTangent

+
+public float curveTangent(float a,
+                          float b,
+                          float c,
+                          float d,
+                          float t)
+
+
+
+
+
+
+
+
+
+ +

+curveDetail

+
+public void curveDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+curveTightness

+
+public void curveTightness(float tightness)
+
+
+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float x2,
+                  float y2,
+                  float x3,
+                  float y3,
+                  float x4,
+                  float y4)
+
+
+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float z1,
+                  float x2,
+                  float y2,
+                  float z2,
+                  float x3,
+                  float y3,
+                  float z3,
+                  float x4,
+                  float y4,
+                  float z4)
+
+
+
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
+
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
+
+
+
+
+
+
+
+ +

+imageMode

+
+public void imageMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float a,
+                  float b,
+                  float c,
+                  float d,
+                  int u1,
+                  int v1,
+                  int u2,
+                  int v2)
+
+
+
+
+
+
+
+
+
+ +

+shapeMode

+
+public void shapeMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int align)
+
+
+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int alignX,
+                      int alignY)
+
+
+
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
+
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which)
+
+
+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which,
+                     float size)
+
+
+
+
+
+
+
+
+
+ +

+textLeading

+
+public void textLeading(float leading)
+
+
+
+
+
+
+
+
+
+ +

+textMode

+
+public void textMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+textSize

+
+public void textSize(float size)
+
+
+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(char c)
+
+
+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(java.lang.String str)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String s,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
+
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix2D getMatrix(PMatrix2D target)
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
+
+
+
+
+
+
+
+ +

+beginCamera

+
+public void beginCamera()
+
+
+
+
+
+
+
+
+
+ +

+endCamera

+
+public void endCamera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera(float eyeX,
+                   float eyeY,
+                   float eyeZ,
+                   float centerX,
+                   float centerY,
+                   float centerZ,
+                   float upX,
+                   float upY,
+                   float upZ)
+
+
+
+
+
+
+
+
+
+ +

+printCamera

+
+public void printCamera()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho(float left,
+                  float right,
+                  float bottom,
+                  float top,
+                  float near,
+                  float far)
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective()
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective(float fovy,
+                        float aspect,
+                        float zNear,
+                        float zFar)
+
+
+
+
+
+
+
+
+
+ +

+frustum

+
+public void frustum(float left,
+                    float right,
+                    float bottom,
+                    float top,
+                    float near,
+                    float far)
+
+
+
+
+
+
+
+
+
+ +

+printProjection

+
+public void printProjection()
+
+
+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+modelX

+
+public float modelX(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+modelY

+
+public float modelY(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+modelZ

+
+public float modelZ(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+pushStyle

+
+public void pushStyle()
+
+
+
+
+
+
+
+
+
+ +

+popStyle

+
+public void popStyle()
+
+
+
+
+
+
+
+
+
+ +

+style

+
+public void style(PStyle s)
+
+
+
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
+
+
+
+
+
+
+ +

+noStroke

+
+public void noStroke()
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z,
+                   float a)
+
+
+
+
+
+
+
+
+
+ +

+noTint

+
+public void noTint()
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+noFill

+
+public void noFill()
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float gray)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float gray)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float shine)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float gray)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+lights

+
+public void lights()
+
+
+
+
+
+
+
+
+
+ +

+noLights

+
+public void noLights()
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue)
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue,
+                         float x,
+                         float y,
+                         float z)
+
+
+
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float red,
+                             float green,
+                             float blue,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float red,
+                       float green,
+                       float blue,
+                       float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float red,
+                      float green,
+                      float blue,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
+
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb,
+                       float alpha)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray,
+                       float alpha)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(PImage image)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float max)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ,
+                      float maxA)
+
+
+
+
+
+
+
+
+
+ +

+alpha

+
+public final float alpha(int what)
+
+
+
+
+
+
+
+
+
+ +

+red

+
+public final float red(int what)
+
+
+
+
+
+
+
+
+
+ +

+green

+
+public final float green(int what)
+
+
+
+
+
+
+
+
+
+ +

+blue

+
+public final float blue(int what)
+
+
+
+
+
+
+
+
+
+ +

+hue

+
+public final float hue(int what)
+
+
+
+
+
+
+
+
+
+ +

+saturation

+
+public final float saturation(int what)
+
+
+
+
+
+
+
+
+
+ +

+brightness

+
+public final float brightness(int what)
+
+
+
+
+
+
+
+
+
+ +

+lerpColor

+
+public int lerpColor(int c1,
+                     int c2,
+                     float amt)
+
+
+
+
+
+
+
+
+
+ +

+lerpColor

+
+public static int lerpColor(int c1,
+                            int c2,
+                            float amt,
+                            int mode)
+
+
+
+
+
+
+
+
+
+ +

+displayable

+
+public boolean displayable()
+
+
+
+
+
+
+
+
+
+ +

+setCache

+
+public void setCache(java.lang.Object parent,
+                     java.lang.Object storage)
+
+
+
+
+
+
+
+
+
+ +

+getCache

+
+public java.lang.Object getCache(java.lang.Object parent)
+
+
+
+
+
+
+
+
+
+ +

+removeCache

+
+public void removeCache(java.lang.Object parent)
+
+
+
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
+
+
+
+
+
+
+
+ +

+get

+
+public PImage get(int x,
+                  int y,
+                  int w,
+                  int h)
+
+
+
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int c)
+
+
+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                PImage src)
+
+
+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind)
+
+
+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind,
+                   float param)
+
+
+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(PImage src,
+                 int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
+
+
+
+
+
+
+
+ +

+blendColor

+
+public static int blendColor(int c1,
+                             int c2,
+                             int mode)
+
+
+
+
+
+
+
+
+
+ +

+blend

+
+public void blend(int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
+
+
+
+
+
+
+
+ +

+blend

+
+public void blend(PImage src,
+                  int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PConstants.html b/build/javadoc/core/processing/core/PConstants.html new file mode 100644 index 000000000..899e56385 --- /dev/null +++ b/build/javadoc/core/processing/core/PConstants.html @@ -0,0 +1,3632 @@ + + + + + +PConstants + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Interface PConstants

+
+
All Known Implementing Classes:
PApplet, PFont, PGraphics, PGraphics2D, PGraphics3D, PGraphicsJava2D, PImage, PLine, PPolygon, PShape, PShapeSVG, PSmoothTriangle, PStyle, PTriangle
+
+
+
+
public interface PConstants
+ + +

+Numbers shared throughout processing.core. +

+ An attempt is made to keep the constants as short/non-verbose + as possible. For instance, the constant is TIFF instead of + FILE_TYPE_TIFF. We'll do this as long as we can get away with it. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intA + +
+           
+static intAB + +
+           
+static intADD + +
+           
+static intAG + +
+           
+static intALPHA + +
+           
+static intALPHA_MASK + +
+           
+static intALT + +
+           
+static intAMBIENT + +
+           
+static intAR + +
+           
+static intARC + +
+           
+static intARGB + +
+           
+static intARROW + +
+           
+static intB + +
+           
+static charBACKSPACE + +
+           
+static intBASELINE + +
+          Default vertical alignment for text placement
+static intBEEN_LIT + +
+           
+static intBEVEL + +
+           
+static intBLEND + +
+           
+static intBLUE_MASK + +
+           
+static intBLUR + +
+           
+static intBOTTOM + +
+          Align text from the bottom, using the baseline.
+static intBOX + +
+           
+static intBURN + +
+           
+static intCENTER + +
+          Draw from the center, using second pair of values as the diameter.
+static intCENTER_DIAMETER + +
+          Deprecated. Use DIAMETER instead.
+static intCENTER_RADIUS + +
+          Deprecated. Use RADIUS instead.
+static intCHATTER + +
+           
+static intCLOSE + +
+           
+static intCMYK + +
+           
+static intCODED + +
+           
+static intCOMPLAINT + +
+           
+static intCONTROL + +
+           
+static intCORNER + +
+          Draw mode convention to use (x, y) to (width, height)
+static intCORNERS + +
+          Draw mode convention to use (x1, y1) to (x2, y2) coordinates
+static intCROSS + +
+           
+static intCUSTOM + +
+           
+static intDA + +
+           
+static intDARKEST + +
+           
+static intDB + +
+           
+static floatDEG_TO_RAD + +
+           
+static charDELETE + +
+           
+static intDG + +
+           
+static intDIAMETER + +
+          Synonym for the CENTER constant.
+static intDIFFERENCE + +
+           
+static intDILATE + +
+           
+static intDIRECTIONAL + +
+           
+static intDISABLE_ACCURATE_TEXTURES + +
+           
+static intDISABLE_DEPTH_SORT + +
+           
+static intDISABLE_DEPTH_TEST + +
+           
+static intDISABLE_OPENGL_2X_SMOOTH + +
+           
+static intDISABLE_OPENGL_ERROR_REPORT + +
+           
+static intDODGE + +
+           
+static intDOWN + +
+           
+static intDR + +
+           
+static java.lang.StringDXF + +
+           
+static intEB + +
+           
+static intEDGE + +
+           
+static intEG + +
+           
+static intELLIPSE + +
+           
+static intENABLE_ACCURATE_TEXTURES + +
+           
+static intENABLE_DEPTH_SORT + +
+           
+static intENABLE_DEPTH_TEST + +
+           
+static intENABLE_NATIVE_FONTS + +
+           
+static intENABLE_OPENGL_2X_SMOOTH + +
+           
+static intENABLE_OPENGL_4X_SMOOTH + +
+           
+static intENABLE_OPENGL_ERROR_REPORT + +
+           
+static charENTER + +
+           
+static floatEPSILON + +
+           
+static intER + +
+           
+static intERODE + +
+           
+static java.lang.StringERROR_BACKGROUND_IMAGE_FORMAT + +
+           
+static java.lang.StringERROR_BACKGROUND_IMAGE_SIZE + +
+           
+static java.lang.StringERROR_PUSHMATRIX_OVERFLOW + +
+           
+static java.lang.StringERROR_PUSHMATRIX_UNDERFLOW + +
+           
+static java.lang.StringERROR_TEXTFONT_NULL_PFONT + +
+           
+static charESC + +
+           
+static intEXCLUSION + +
+           
+static intG + +
+           
+static intGIF + +
+           
+static intGRAY + +
+           
+static intGREEN_MASK + +
+           
+static floatHALF_PI + +
+           
+static intHAND + +
+           
+static intHARD_LIGHT + +
+           
+static intHINT_COUNT + +
+           
+static intHSB + +
+           
+static intIMAGE + +
+          texture coordinates based on image width/height
+static intINVERT + +
+           
+static java.lang.StringJAVA2D + +
+           
+static intJPEG + +
+           
+static intLEFT + +
+           
+static intLIGHTEST + +
+           
+static intLINE + +
+           
+static intLINES + +
+           
+static intLINUX + +
+           
+static intMACOSX + +
+           
+static floatMAX_FLOAT + +
+          Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + and to avoid teaching static methods on the first day.
+static intMAX_INT + +
+          Largest possible (positive) integer value
+static floatMIN_FLOAT + +
+          Note that Float.MIN_VALUE is the smallest positive value + for a floating point number, not actually the minimum (negative) value + for a float.
+static intMIN_INT + +
+          Smallest possible (negative) integer value
+static intMITER + +
+           
+static intMODEL + +
+          textMode(MODEL) is the default, meaning that characters + will be affected by transformations like any other shapes.
+static intMOVE + +
+           
+static intMULTIPLY + +
+           
+static intNORMAL + +
+          texture coordinates in 0..1 range
+static intNORMALIZED + +
+          Deprecated. use NORMAL instead
+static intNX + +
+           
+static intNY + +
+           
+static intNZ + +
+           
+static intOPAQUE + +
+           
+static intOPEN + +
+           
+static java.lang.StringOPENGL + +
+           
+static intORTHOGRAPHIC + +
+           
+static intOTHER + +
+           
+static intOVERLAY + +
+           
+static java.lang.StringP2D + +
+           
+static java.lang.StringP3D + +
+           
+static intPATH + +
+           
+static java.lang.StringPDF + +
+           
+static intPERSPECTIVE + +
+           
+static floatPI + +
+           
+static java.lang.String[]platformNames + +
+           
+static intPOINT + +
+           
+static intPOINTS + +
+           
+static intPOLYGON + +
+           
+static intPOSTERIZE + +
+           
+static intPROBLEM + +
+           
+static intPROJECT + +
+           
+static intQUAD + +
+           
+static intQUAD_STRIP + +
+           
+static intQUADS + +
+           
+static floatQUARTER_PI + +
+           
+static intR + +
+           
+static floatRAD_TO_DEG + +
+           
+static intRADIUS + +
+          Draw mode from the center, and using the radius
+static intRECT + +
+           
+static intRED_MASK + +
+           
+static intREPLACE + +
+           
+static charRETURN + +
+           
+static intRGB + +
+           
+static intRIGHT + +
+           
+static intROUND + +
+           
+static intSA + +
+           
+static intSB + +
+           
+static intSCREEN + +
+           
+static intSG + +
+           
+static intSHAPE + +
+          textMode(SHAPE) draws text using the the glyph outlines of + individual characters rather than as textures.
+static intSHIFT + +
+           
+static intSHINE + +
+           
+static intSOFT_LIGHT + +
+           
+static intSPB + +
+           
+static intSPG + +
+           
+static intSPHERE + +
+           
+static intSPOT + +
+           
+static intSPR + +
+           
+static intSQUARE + +
+           
+static intSR + +
+          stroke argb values
+static intSUBTRACT + +
+           
+static intSW + +
+          stroke weight
+static charTAB + +
+           
+static intTARGA + +
+           
+static intTEXT + +
+           
+static floatTHIRD_PI + +
+           
+static intTHRESHOLD + +
+           
+static intTIFF + +
+           
+static intTOP + +
+          Align text to the top
+static intTRIANGLE + +
+           
+static intTRIANGLE_FAN + +
+           
+static intTRIANGLE_STRIP + +
+           
+static intTRIANGLES + +
+           
+static floatTWO_PI + +
+           
+static intTX + +
+           
+static intTY + +
+           
+static intTZ + +
+           
+static intU + +
+           
+static intUP + +
+           
+static intV + +
+           
+static intVERTEX_FIELD_COUNT + +
+           
+static intVW + +
+           
+static intVX + +
+           
+static intVY + +
+           
+static intVZ + +
+           
+static intWAIT + +
+           
+static java.lang.StringWHITESPACE + +
+           
+static intWINDOWS + +
+           
+static intX + +
+           
+static intY + +
+           
+static intZ + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+X

+
+static final int X
+
+
+
See Also:
Constant Field Values
+
+
+ +

+Y

+
+static final int Y
+
+
+
See Also:
Constant Field Values
+
+
+ +

+Z

+
+static final int Z
+
+
+
See Also:
Constant Field Values
+
+
+ +

+R

+
+static final int R
+
+
+
See Also:
Constant Field Values
+
+
+ +

+G

+
+static final int G
+
+
+
See Also:
Constant Field Values
+
+
+ +

+B

+
+static final int B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+A

+
+static final int A
+
+
+
See Also:
Constant Field Values
+
+
+ +

+U

+
+static final int U
+
+
+
See Also:
Constant Field Values
+
+
+ +

+V

+
+static final int V
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NX

+
+static final int NX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NY

+
+static final int NY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NZ

+
+static final int NZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EDGE

+
+static final int EDGE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR

+
+static final int SR
+
+
stroke argb values +

+

+
See Also:
Constant Field Values
+
+
+ +

+SG

+
+static final int SG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SB

+
+static final int SB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SA

+
+static final int SA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SW

+
+static final int SW
+
+
stroke weight +

+

+
See Also:
Constant Field Values
+
+
+ +

+TX

+
+static final int TX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TY

+
+static final int TY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TZ

+
+static final int TZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VX

+
+static final int VX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VY

+
+static final int VY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VZ

+
+static final int VZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VW

+
+static final int VW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AR

+
+static final int AR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AG

+
+static final int AG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AB

+
+static final int AB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DR

+
+static final int DR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DG

+
+static final int DG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DB

+
+static final int DB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DA

+
+static final int DA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPR

+
+static final int SPR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPG

+
+static final int SPG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPB

+
+static final int SPB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SHINE

+
+static final int SHINE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ER

+
+static final int ER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EG

+
+static final int EG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EB

+
+static final int EB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEEN_LIT

+
+static final int BEEN_LIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VERTEX_FIELD_COUNT

+
+static final int VERTEX_FIELD_COUNT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+P2D

+
+static final java.lang.String P2D
+
+
+
See Also:
Constant Field Values
+
+
+ +

+P3D

+
+static final java.lang.String P3D
+
+
+
See Also:
Constant Field Values
+
+
+ +

+JAVA2D

+
+static final java.lang.String JAVA2D
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OPENGL

+
+static final java.lang.String OPENGL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PDF

+
+static final java.lang.String PDF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DXF

+
+static final java.lang.String DXF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OTHER

+
+static final int OTHER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WINDOWS

+
+static final int WINDOWS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MACOSX

+
+static final int MACOSX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINUX

+
+static final int LINUX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+platformNames

+
+static final java.lang.String[] platformNames
+
+
+
+
+
+ +

+EPSILON

+
+static final float EPSILON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MAX_FLOAT

+
+static final float MAX_FLOAT
+
+
Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + and to avoid teaching static methods on the first day. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MIN_FLOAT

+
+static final float MIN_FLOAT
+
+
Note that Float.MIN_VALUE is the smallest positive value + for a floating point number, not actually the minimum (negative) value + for a float. This constant equals 0xFF7FFFFF, the smallest (farthest + negative) value a float can have before it hits NaN. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MAX_INT

+
+static final int MAX_INT
+
+
Largest possible (positive) integer value +

+

+
See Also:
Constant Field Values
+
+
+ +

+MIN_INT

+
+static final int MIN_INT
+
+
Smallest possible (negative) integer value +

+

+
See Also:
Constant Field Values
+
+
+ +

+PI

+
+static final float PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HALF_PI

+
+static final float HALF_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+THIRD_PI

+
+static final float THIRD_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUARTER_PI

+
+static final float QUARTER_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TWO_PI

+
+static final float TWO_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DEG_TO_RAD

+
+static final float DEG_TO_RAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RAD_TO_DEG

+
+static final float RAD_TO_DEG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WHITESPACE

+
+static final java.lang.String WHITESPACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RGB

+
+static final int RGB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGB

+
+static final int ARGB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HSB

+
+static final int HSB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ALPHA

+
+static final int ALPHA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CMYK

+
+static final int CMYK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TIFF

+
+static final int TIFF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGA

+
+static final int TARGA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+JPEG

+
+static final int JPEG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GIF

+
+static final int GIF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLUR

+
+static final int BLUR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GRAY

+
+static final int GRAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INVERT

+
+static final int INVERT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OPAQUE

+
+static final int OPAQUE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POSTERIZE

+
+static final int POSTERIZE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+THRESHOLD

+
+static final int THRESHOLD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERODE

+
+static final int ERODE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DILATE

+
+static final int DILATE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REPLACE

+
+static final int REPLACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLEND

+
+static final int BLEND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ADD

+
+static final int ADD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SUBTRACT

+
+static final int SUBTRACT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LIGHTEST

+
+static final int LIGHTEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DARKEST

+
+static final int DARKEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIFFERENCE

+
+static final int DIFFERENCE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXCLUSION

+
+static final int EXCLUSION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MULTIPLY

+
+static final int MULTIPLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SCREEN

+
+static final int SCREEN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OVERLAY

+
+static final int OVERLAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HARD_LIGHT

+
+static final int HARD_LIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SOFT_LIGHT

+
+static final int SOFT_LIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DODGE

+
+static final int DODGE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BURN

+
+static final int BURN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ALPHA_MASK

+
+static final int ALPHA_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RED_MASK

+
+static final int RED_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GREEN_MASK

+
+static final int GREEN_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLUE_MASK

+
+static final int BLUE_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CHATTER

+
+static final int CHATTER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMPLAINT

+
+static final int COMPLAINT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PROBLEM

+
+static final int PROBLEM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CUSTOM

+
+static final int CUSTOM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ORTHOGRAPHIC

+
+static final int ORTHOGRAPHIC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PERSPECTIVE

+
+static final int PERSPECTIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POINT

+
+static final int POINT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POINTS

+
+static final int POINTS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINE

+
+static final int LINE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINES

+
+static final int LINES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLE

+
+static final int TRIANGLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLES

+
+static final int TRIANGLES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLE_STRIP

+
+static final int TRIANGLE_STRIP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLE_FAN

+
+static final int TRIANGLE_FAN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUAD

+
+static final int QUAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUADS

+
+static final int QUADS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUAD_STRIP

+
+static final int QUAD_STRIP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POLYGON

+
+static final int POLYGON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PATH

+
+static final int PATH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RECT

+
+static final int RECT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ELLIPSE

+
+static final int ELLIPSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARC

+
+static final int ARC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPHERE

+
+static final int SPHERE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOX

+
+static final int BOX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OPEN

+
+static final int OPEN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CLOSE

+
+static final int CLOSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CORNER

+
+static final int CORNER
+
+
Draw mode convention to use (x, y) to (width, height) +

+

+
See Also:
Constant Field Values
+
+
+ +

+CORNERS

+
+static final int CORNERS
+
+
Draw mode convention to use (x1, y1) to (x2, y2) coordinates +

+

+
See Also:
Constant Field Values
+
+
+ +

+RADIUS

+
+static final int RADIUS
+
+
Draw mode from the center, and using the radius +

+

+
See Also:
Constant Field Values
+
+
+ +

+CENTER_RADIUS

+
+static final int CENTER_RADIUS
+
+
Deprecated. Use RADIUS instead.
+
See Also:
Constant Field Values
+
+
+ +

+CENTER

+
+static final int CENTER
+
+
Draw from the center, using second pair of values as the diameter. + Formerly called CENTER_DIAMETER in alpha releases. +

+

+
See Also:
Constant Field Values
+
+
+ +

+DIAMETER

+
+static final int DIAMETER
+
+
Synonym for the CENTER constant. Draw from the center, + using second pair of values as the diameter. +

+

+
See Also:
Constant Field Values
+
+
+ +

+CENTER_DIAMETER

+
+static final int CENTER_DIAMETER
+
+
Deprecated. Use DIAMETER instead.
+
See Also:
Constant Field Values
+
+
+ +

+BASELINE

+
+static final int BASELINE
+
+
Default vertical alignment for text placement +

+

+
See Also:
Constant Field Values
+
+
+ +

+TOP

+
+static final int TOP
+
+
Align text to the top +

+

+
See Also:
Constant Field Values
+
+
+ +

+BOTTOM

+
+static final int BOTTOM
+
+
Align text from the bottom, using the baseline. +

+

+
See Also:
Constant Field Values
+
+
+ +

+NORMAL

+
+static final int NORMAL
+
+
texture coordinates in 0..1 range +

+

+
See Also:
Constant Field Values
+
+
+ +

+NORMALIZED

+
+static final int NORMALIZED
+
+
Deprecated. use NORMAL instead
+
See Also:
Constant Field Values
+
+
+ +

+IMAGE

+
+static final int IMAGE
+
+
texture coordinates based on image width/height +

+

+
See Also:
Constant Field Values
+
+
+ +

+MODEL

+
+static final int MODEL
+
+
textMode(MODEL) is the default, meaning that characters + will be affected by transformations like any other shapes. +

+ Changed value in 0093 to not interfere with LEFT, CENTER, and RIGHT. +

+

+
See Also:
Constant Field Values
+
+
+ +

+SHAPE

+
+static final int SHAPE
+
+
textMode(SHAPE) draws text using the the glyph outlines of + individual characters rather than as textures. If the outlines are + not available, then textMode(SHAPE) will be ignored and textMode(MODEL) + will be used instead. For this reason, be sure to call textMode() + after calling textFont(). +

+ Currently, textMode(SHAPE) is only supported by OPENGL mode. + It also requires Java 1.2 or higher (OPENGL requires 1.4 anyway) +

+

+
See Also:
Constant Field Values
+
+
+ +

+SQUARE

+
+static final int SQUARE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ROUND

+
+static final int ROUND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PROJECT

+
+static final int PROJECT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MITER

+
+static final int MITER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEVEL

+
+static final int BEVEL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AMBIENT

+
+static final int AMBIENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIRECTIONAL

+
+static final int DIRECTIONAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPOT

+
+static final int SPOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BACKSPACE

+
+static final char BACKSPACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TAB

+
+static final char TAB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENTER

+
+static final char ENTER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RETURN

+
+static final char RETURN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ESC

+
+static final char ESC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DELETE

+
+static final char DELETE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CODED

+
+static final int CODED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UP

+
+static final int UP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DOWN

+
+static final int DOWN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LEFT

+
+static final int LEFT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RIGHT

+
+static final int RIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ALT

+
+static final int ALT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CONTROL

+
+static final int CONTROL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SHIFT

+
+static final int SHIFT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARROW

+
+static final int ARROW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CROSS

+
+static final int CROSS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HAND

+
+static final int HAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOVE

+
+static final int MOVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TEXT

+
+static final int TEXT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WAIT

+
+static final int WAIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_OPENGL_2X_SMOOTH

+
+static final int DISABLE_OPENGL_2X_SMOOTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_OPENGL_2X_SMOOTH

+
+static final int ENABLE_OPENGL_2X_SMOOTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_OPENGL_4X_SMOOTH

+
+static final int ENABLE_OPENGL_4X_SMOOTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_NATIVE_FONTS

+
+static final int ENABLE_NATIVE_FONTS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_DEPTH_TEST

+
+static final int DISABLE_DEPTH_TEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_DEPTH_TEST

+
+static final int ENABLE_DEPTH_TEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_DEPTH_SORT

+
+static final int ENABLE_DEPTH_SORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_DEPTH_SORT

+
+static final int DISABLE_DEPTH_SORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_OPENGL_ERROR_REPORT

+
+static final int DISABLE_OPENGL_ERROR_REPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_OPENGL_ERROR_REPORT

+
+static final int ENABLE_OPENGL_ERROR_REPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_ACCURATE_TEXTURES

+
+static final int ENABLE_ACCURATE_TEXTURES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_ACCURATE_TEXTURES

+
+static final int DISABLE_ACCURATE_TEXTURES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HINT_COUNT

+
+static final int HINT_COUNT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_BACKGROUND_IMAGE_SIZE

+
+static final java.lang.String ERROR_BACKGROUND_IMAGE_SIZE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_BACKGROUND_IMAGE_FORMAT

+
+static final java.lang.String ERROR_BACKGROUND_IMAGE_FORMAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_TEXTFONT_NULL_PFONT

+
+static final java.lang.String ERROR_TEXTFONT_NULL_PFONT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_PUSHMATRIX_OVERFLOW

+
+static final java.lang.String ERROR_PUSHMATRIX_OVERFLOW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_PUSHMATRIX_UNDERFLOW

+
+static final java.lang.String ERROR_PUSHMATRIX_UNDERFLOW
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PFont.html b/build/javadoc/core/processing/core/PFont.html new file mode 100644 index 000000000..2be5bdaa3 --- /dev/null +++ b/build/javadoc/core/processing/core/PFont.html @@ -0,0 +1,990 @@ + + + + + +PFont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PFont

+
+java.lang.Object
+  extended by processing.core.PFont
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PFont
extends java.lang.Object
implements PConstants
+ + +

+Grayscale bitmap font class used by Processing. +

+ Awful (and by that, I mean awesome) ascii (non)art for how this works: +

+   |
+   |                   height is the full used height of the image
+   |
+   |   ..XX..       }
+   |   ..XX..       }
+   |   ......       }
+   |   XXXX..       }  topExtent (top y is baseline - topExtent)
+   |   ..XX..       }
+   |   ..XX..       }  dotted areas are where the image data
+   |   ..XX..       }  is actually located for the character
+   +---XXXXXX----   }  (it extends to the right and down
+   |                   for power of two texture sizes)
+   ^^^^ leftExtent (amount to move over before drawing the image
+
+   ^^^^^^^^^^^^^^ setWidth (width displaced by char)
+ 
+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ intascent + +
+           
+ intcharCount + +
+           
+static char[]DEFAULT_CHARSET + +
+          The default Processing character set.
+ intdescent + +
+           
+ int[]height + +
+           
+ PImage[]images + +
+           
+ int[]leftExtent + +
+           
+ intmbox2 + +
+          next power of 2 over the max image size (usually 64)
+ java.lang.Stringname + +
+          Name of the font as seen by Java when it was created.
+ java.lang.Stringpsname + +
+          Postscript name of the font that this bitmap was created from.
+ int[]setWidth + +
+           
+ intsize + +
+          "natural" size of the font (most often 48)
+ booleansmooth + +
+          true if smoothing was enabled for this font, used for native impl
+ inttheight + +
+          texture height, same as mbox2, but reserved for future use
+ int[]topExtent + +
+           
+ inttwidth + +
+          texture width, same as mbox2, but reserved for future use
+ int[]value + +
+           
+ int[]width + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PFont() + +
+           
PFont(java.awt.Font font, + boolean smooth, + char[] charset) + +
+          Create a new image-based font on the fly.
PFont(java.io.InputStream input) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ floatascent() + +
+          Returns the ascent of this font from the baseline.
+ floatdescent() + +
+          Returns how far this font descends from the baseline.
+ java.awt.FontfindFont() + +
+          Attempt to find the native version of this font.
+static java.awt.FontfindFont(java.lang.String name) + +
+          Starting with Java 1.5, Apple broke the ability to specify most fonts.
+ java.awt.FontgetFont() + +
+          Return the native java.awt.Font associated with this PFont (if any).
+ intindex(char c) + +
+          Get index for the char (convert from unicode to bagel charset).
+ floatkern(char a, + char b) + +
+          Currently un-implemented for .vlw fonts, + but honored for layout in case subclasses use it.
+static java.lang.String[]list() + +
+          Get a list of the fonts installed on the system that can be used + by Java.
+static voidloadFonts() + +
+           
+ voidsave(java.io.OutputStream output) + +
+          Write this PFont to an OutputStream.
+ voidsetFont(java.awt.Font font) + +
+          Set the native complement of this font.
+ floatwidth(char c) + +
+          Width of this character for a font of size 1.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+charCount

+
+public int charCount
+
+
+
+
+
+ +

+images

+
+public PImage[] images
+
+
+
+
+
+ +

+name

+
+public java.lang.String name
+
+
Name of the font as seen by Java when it was created. + If the font is available, the native version will be used. +

+

+
+
+
+ +

+psname

+
+public java.lang.String psname
+
+
Postscript name of the font that this bitmap was created from. +

+

+
+
+
+ +

+size

+
+public int size
+
+
"natural" size of the font (most often 48) +

+

+
+
+
+ +

+smooth

+
+public boolean smooth
+
+
true if smoothing was enabled for this font, used for native impl +

+

+
+
+
+ +

+mbox2

+
+public int mbox2
+
+
next power of 2 over the max image size (usually 64) +

+

+
+
+
+ +

+twidth

+
+public int twidth
+
+
texture width, same as mbox2, but reserved for future use +

+

+
+
+
+ +

+theight

+
+public int theight
+
+
texture height, same as mbox2, but reserved for future use +

+

+
+
+
+ +

+value

+
+public int[] value
+
+
+
+
+
+ +

+height

+
+public int[] height
+
+
+
+
+
+ +

+width

+
+public int[] width
+
+
+
+
+
+ +

+setWidth

+
+public int[] setWidth
+
+
+
+
+
+ +

+topExtent

+
+public int[] topExtent
+
+
+
+
+
+ +

+leftExtent

+
+public int[] leftExtent
+
+
+
+
+
+ +

+ascent

+
+public int ascent
+
+
+
+
+
+ +

+descent

+
+public int descent
+
+
+
+
+
+ +

+DEFAULT_CHARSET

+
+public static char[] DEFAULT_CHARSET
+
+
The default Processing character set. +

+ This is the union of the Mac Roman and Windows ANSI (CP1250) + character sets. ISO 8859-1 Latin 1 is Unicode characters 0x80 -> 0xFF, + and would seem a good standard, but in practice, most P5 users would + rather have characters that they expect from their platform's fonts. +

+ This is more of an interim solution until a much better + font solution can be determined. (i.e. create fonts on + the fly from some sort of vector format). +

+ Not that I expect that to happen. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PFont

+
+public PFont()
+
+
+
+ +

+PFont

+
+public PFont(java.io.InputStream input)
+      throws java.io.IOException
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +

+PFont

+
+public PFont(java.awt.Font font,
+             boolean smooth,
+             char[] charset)
+
+
Create a new image-based font on the fly. +

+

+
Parameters:
font - the font object to create from
charset - array of all unicode chars that should be included
smooth - true to enable smoothing/anti-aliasing
+
+ + + + + + + + +
+Method Detail
+ +

+setFont

+
+public void setFont(java.awt.Font font)
+
+
Set the native complement of this font. +

+

+
+
+
+
+
+
+
+ +

+getFont

+
+public java.awt.Font getFont()
+
+
Return the native java.awt.Font associated with this PFont (if any). +

+

+
+
+
+
+
+
+
+ +

+findFont

+
+public java.awt.Font findFont()
+
+
Attempt to find the native version of this font. + (Public so that it can be used by OpenGL or other renderers.) +

+

+
+
+
+
+
+
+
+ +

+save

+
+public void save(java.io.OutputStream output)
+          throws java.io.IOException
+
+
Write this PFont to an OutputStream. +

+ This is used by the Create Font tool, or whatever anyone else dreams + up for messing with fonts themselves. +

+ It is assumed that the calling class will handle closing + the stream when finished. +

+

+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+index

+
+public int index(char c)
+
+
Get index for the char (convert from unicode to bagel charset). +

+

+
+
+
+ +
Returns:
index into arrays or -1 if not found
+
+
+
+ +

+kern

+
+public float kern(char a,
+                  char b)
+
+
Currently un-implemented for .vlw fonts, + but honored for layout in case subclasses use it. +

+

+
+
+
+
+
+
+
+ +

+ascent

+
+public float ascent()
+
+
Returns the ascent of this font from the baseline. + The value is based on a font of size 1. +

+

+
+
+
+
+
+
+
+ +

+descent

+
+public float descent()
+
+
Returns how far this font descends from the baseline. + The value is based on a font size of 1. +

+

+
+
+
+
+
+
+
+ +

+width

+
+public float width(char c)
+
+
Width of this character for a font of size 1. +

+

+
+
+
+
+
+
+
+ +

+list

+
+public static java.lang.String[] list()
+
+
Get a list of the fonts installed on the system that can be used + by Java. Not all fonts can be used in Java, in fact it's mostly + only TrueType fonts. OpenType fonts with CFF data such as Adobe's + OpenType fonts seem to have trouble (even though they're sort of + TrueType fonts as well, or may have a .ttf extension). Regular + PostScript fonts seem to work OK, however. +

+ Not recommended for use in applets, but this is implemented + in PFont because the Java methods to access this information + have changed between 1.1 and 1.4, and the 1.4 method is + typical of the sort of undergraduate-level over-abstraction + that the seems to have made its way into the Java API after 1.1. +

+

+
+
+
+
+
+
+
+ +

+loadFonts

+
+public static void loadFonts()
+
+
+
+
+
+
+
+
+
+ +

+findFont

+
+public static java.awt.Font findFont(java.lang.String name)
+
+
Starting with Java 1.5, Apple broke the ability to specify most fonts. + This has been filed as bug #4769141 at bugreporter.apple.com. More info at + Bug 407. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PGraphics.html b/build/javadoc/core/processing/core/PGraphics.html new file mode 100644 index 000000000..388f82bff --- /dev/null +++ b/build/javadoc/core/processing/core/PGraphics.html @@ -0,0 +1,7309 @@ + + + + + +PGraphics + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphics

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
Direct Known Subclasses:
PGraphics2D, PGraphics3D, PGraphicsJava2D
+
+
+
+
public class PGraphics
extends PImage
implements PConstants
+ + +

+Main graphics and rendering context, as well as the base API implementation. + +

Subclassing and initializing PGraphics objects

+ Starting in release 0149, subclasses of PGraphics are handled differently. + The constructor for subclasses takes no parameters, instead a series of + functions are called by the hosting PApplet to specify its attributes. +
    +
  • setParent(PApplet) - is called to specify the parent PApplet. +
  • setPrimary(boolean) - called with true if this PGraphics will be the + primary drawing surface used by the sketch, or false if not. +
  • setPath(String) - called when the renderer needs a filename or output + path, such as with the PDF or DXF renderers. +
  • setSize(int, int) - this is called last, at which point it's safe for + the renderer to complete its initialization routine. +
+ The functions were broken out because of the growing number of parameters + such as these that might be used by a renderer, yet with the exception of + setSize(), it's not clear which will be necessary. So while the size could + be passed in to the constructor instead of a setSize() function, a function + would still be needed that would notify the renderer that it was time to + finish its initialization. Thus, setSize() simply does both. + +

Know your rights: public vs. private methods

+ Methods that are protected are often subclassed by other renderers, however + they are not set 'public' because they shouldn't be part of the user-facing + public API accessible from PApplet. That is, we don't want sketches calling + textModeCheck() or vertexTexture() directly. + +

Handling warnings and exceptions

+ Methods that are unavailable generally show a warning, unless their lack of + availability will soon cause another exception. For instance, if a method + like getMatrix() returns null because it is unavailable, an exception will + be thrown stating that the method is unavailable, rather than waiting for + the NullPointerException that will occur when the sketch tries to use that + method. As of release 0149, warnings will only be shown once, and exceptions + have been changed to warnings where possible. + +

Using xxxxImpl() for subclassing smoothness

+ The xxxImpl() methods are generally renderer-specific handling for some + subset if tasks for a particular function (vague enough for you?) For + instance, imageImpl() handles drawing an image whose x/y/w/h and u/v coords + have been specified, and screen placement (independent of imageMode) has + been determined. There's no point in all renderers implementing the + if (imageMode == BLAH) placement/sizing logic, so that's handled + by PGraphics, which then calls imageImpl() once all that is figured out. + +

His brother PImage

+ PGraphics subclasses PImage so that it can be drawn and manipulated in a + similar fashion. As such, many methods are inherited from PGraphics, + though many are unavailable: for instance, resize() is not likely to be + implemented; the same goes for mask(), depending on the situation. + +

What's in PGraphics, what ain't

+ For the benefit of subclasses, as much as possible has been placed inside + PGraphics. For instance, bezier interpolation code and implementations of + the strokeCap() method (that simply sets the strokeCap variable) are + handled here. Features that will vary widely between renderers are located + inside the subclasses themselves. For instance, all matrix handling code + is per-renderer: Java 2D uses its own AffineTransform, P2D uses a PMatrix2D, + and PGraphics3D needs to keep continually update forward and reverse + transformations. A proper (future) OpenGL implementation will have all its + matrix madness handled by the card. Lighting also falls under this + category, however the base material property settings (emissive, specular, + et al.) are handled in PGraphics because they use the standard colorMode() + logic. Subclasses should override methods like emissiveFromCalc(), which + is a point where a valid color has been defined internally, and can be + applied in some manner based on the calcXxxx values. + +

What's in the PGraphics documentation, what ain't

+ Some things are noted here, some things are not. For public API, always + refer to the reference + on Processing.org for proper explanations. No attempt has been made to + keep the javadoc up to date or complete. It's an enormous task for + which we simply do not have the time. That is, it's not something that + to be done once—it's a matter of keeping the multiple references + synchronized (to say nothing of the translation issues), while targeting + them for their separate audiences. Ouch. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatambientB + +
+           
+ floatambientG + +
+           
+ floatambientR + +
+           
+ intbackgroundColor + +
+          Last background color that was set, zero if an image
+ intbezierDetail + +
+           
+ intcolorMode + +
+          The current colorMode
+ floatcolorModeA + +
+          Max value for alpha set by colorMode
+ floatcolorModeX + +
+          Max value for red (or hue) set by colorMode
+ floatcolorModeY + +
+          Max value for green (or saturation) set by colorMode
+ floatcolorModeZ + +
+          Max value for blue (or value) set by colorMode
+ floatcurveTightness + +
+           
+ booleanedge + +
+           
+ intellipseMode + +
+          The current ellipse mode (read-only)
+ floatemissiveB + +
+           
+ floatemissiveG + +
+           
+ floatemissiveR + +
+           
+ booleanfill + +
+          true if fill() is enabled, (read-only)
+ intfillColor + +
+          fill that was last set (read-only)
+ java.awt.Imageimage + +
+          Java AWT Image object associated with this renderer.
+ intimageMode + +
+          The current image alignment (read-only)
+ floatnormalX + +
+          Current normal vector.
+ floatnormalY + +
+          Current normal vector.
+ floatnormalZ + +
+          Current normal vector.
+ intpixelCount + +
+           
+ intrectMode + +
+          The current rect mode (read-only)
+ intshapeMode + +
+          The current shape alignment mode (read-only)
+ floatshininess + +
+           
+ booleansmooth + +
+           
+ floatspecularB + +
+           
+ floatspecularG + +
+           
+ floatspecularR + +
+           
+ intsphereDetailU + +
+           
+ intsphereDetailV + +
+           
+ booleanstroke + +
+          true if stroke() is enabled, (read-only)
+ intstrokeCap + +
+          Set by strokeCap() (read-only).
+ intstrokeColor + +
+          stroke that was last set (read-only)
+ intstrokeJoin + +
+          Set by strokeJoin() (read-only).
+ floatstrokeWeight + +
+          Last value set by strokeWeight() (read-only).
+ inttextAlign + +
+          The current text align (read-only)
+ inttextAlignY + +
+          The current vertical text alignment (read-only)
+ PFonttextFont + +
+          The current text font (read-only)
+ floattextLeading + +
+          The current text leading (read-only)
+ inttextMode + +
+          The current text mode (read-only)
+ floattextSize + +
+          The current text size (read-only)
+ PImagetextureImage + +
+          Current image being used as a texture
+ inttextureMode + +
+          Sets whether texture coordinates passed to + vertex() calls will be based on coordinates that are + based on the IMAGE or NORMALIZED.
+ floattextureU + +
+          Current horizontal coordinate for texture, will always + be between 0 and 1, even if using textureMode(IMAGE).
+ floattextureV + +
+          Current vertical coordinate for texture, see above.
+ booleantint + +
+          True if tint() is enabled (read-only).
+ inttintColor + +
+          tint that was last set (read-only)
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphics() + +
+          Constructor for the PGraphics object.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ floatalpha(int what) + +
+           
+ voidambient(float gray) + +
+           
+ voidambient(float x, + float y, + float z) + +
+           
+ voidambient(int rgb) + +
+           
+ voidambientLight(float red, + float green, + float blue) + +
+           
+ voidambientLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidapplyMatrix(PMatrix source) + +
+           
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voidapplyMatrix(PMatrix3D source) + +
+           
+ voidarc(float a, + float b, + float c, + float d, + float start, + float stop) + +
+          Identical parameters and placement to ellipse, + but draws only an arc of that ellipse.
+ voidbackground(float gray) + +
+          Set the background to a grayscale value, based on the + current colorMode.
+ voidbackground(float gray, + float alpha) + +
+          See notes about alpha in background(x, y, z, a).
+ voidbackground(float x, + float y, + float z) + +
+          Set the background to an r, g, b or h, s, b value, + based on the current colorMode.
+ voidbackground(float x, + float y, + float z, + float a) + +
+          Clear the background with a color that includes an alpha value.
+ voidbackground(int rgb) + +
+          Set the background to a gray or ARGB color.
+ voidbackground(int rgb, + float alpha) + +
+          See notes about alpha in background(x, y, z, a).
+ voidbackground(PImage image) + +
+          Takes an RGB or ARGB image and sets it as the background.
+ voidbeginCamera() + +
+           
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginRaw(PGraphics rawGraphics) + +
+          Record individual lines and triangles by echoing them to another renderer.
+ voidbeginShape() + +
+          Start a new shape of type POLYGON
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbezier(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+          Draw a cubic bezier curve.
+ voidbezier(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbezierDetail(int detail) + +
+           
+ floatbezierPoint(float a, + float b, + float c, + float d, + float t) + +
+          Evalutes quadratic bezier at point t for points a, b, c, d.
+ floatbezierTangent(float a, + float b, + float c, + float d, + float t) + +
+          Provide the tangent at the given point on the bezier curve.
+ voidbezierVertex(float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidbezierVertex(float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ floatblue(int what) + +
+           
+ voidbox(float size) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+          This feature is in testing, do not use or rely upon its implementation
+ floatbrightness(int what) + +
+           
+ voidcamera() + +
+           
+ voidcamera(float eyeX, + float eyeY, + float eyeZ, + float centerX, + float centerY, + float centerZ, + float upX, + float upY, + float upZ) + +
+           
+ booleancanDraw() + +
+          Some renderers have requirements re: when they are ready to draw.
+ intcolor(float gray) + +
+           
+ intcolor(float gray, + float alpha) + +
+           
+ intcolor(float x, + float y, + float z) + +
+           
+ intcolor(float x, + float y, + float z, + float a) + +
+           
+ intcolor(int gray) + +
+           
+ intcolor(int rgb, + float alpha) + +
+           
+ intcolor(int gray, + int alpha) + +
+           
+ intcolor(int x, + int y, + int z) + +
+           
+ intcolor(int x, + int y, + int z, + int a) + +
+           
+ voidcolorMode(int mode) + +
+          Callback to handle clearing the background when begin/endRaw is in use.
+ voidcolorMode(int mode, + float max) + +
+           
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ) + +
+          Set the colorMode and the maximum values for (r, g, b) + or (h, s, b).
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ, + float maxA) + +
+           
+ voidcurve(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+          Draws a segment of Catmull-Rom curve.
+ voidcurve(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidcurveDetail(int detail) + +
+           
+ floatcurvePoint(float a, + float b, + float c, + float d, + float t) + +
+          Get a location along a catmull-rom curve segment.
+ floatcurveTangent(float a, + float b, + float c, + float d, + float t) + +
+          Calculate the tangent at a t value (0..1) on a Catmull-Rom curve.
+ voidcurveTightness(float tightness) + +
+           
+ voidcurveVertex(float x, + float y) + +
+           
+ voidcurveVertex(float x, + float y, + float z) + +
+           
+ voiddirectionalLight(float red, + float green, + float blue, + float nx, + float ny, + float nz) + +
+           
+ booleandisplayable() + +
+          Return true if this renderer should be drawn to the screen.
+ voiddispose() + +
+          Handle any takedown for this graphics context.
+ voidedge(boolean edge) + +
+          Sets whether the upcoming vertex is part of an edge.
+ voidellipse(float a, + float b, + float c, + float d) + +
+           
+ voidellipseMode(int mode) + +
+           
+ voidemissive(float gray) + +
+           
+ voidemissive(float x, + float y, + float z) + +
+           
+ voidemissive(int rgb) + +
+           
+ voidendCamera() + +
+           
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidendRaw() + +
+           
+ voidendShape() + +
+           
+ voidendShape(int mode) + +
+           
+ voidfill(float gray) + +
+           
+ voidfill(float gray, + float alpha) + +
+           
+ voidfill(float x, + float y, + float z) + +
+           
+ voidfill(float x, + float y, + float z, + float a) + +
+           
+ voidfill(int rgb) + +
+          Set the fill to either a grayscale value or an ARGB int.
+ voidfill(int rgb, + float alpha) + +
+           
+ voidflush() + +
+           
+ voidfrustum(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ PMatrixgetMatrix() + +
+           
+ PMatrix2DgetMatrix(PMatrix2D target) + +
+          Copy the current transformation matrix into the specified target.
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+          Copy the current transformation matrix into the specified target.
+ PStylegetStyle() + +
+           
+ PStylegetStyle(PStyle s) + +
+           
+ floatgreen(int what) + +
+           
+ voidhint(int which) + +
+          Enable a hint option.
+ floathue(int what) + +
+           
+ voidimage(PImage image, + float x, + float y) + +
+           
+ voidimage(PImage image, + float x, + float y, + float c, + float d) + +
+           
+ voidimage(PImage image, + float a, + float b, + float c, + float d, + int u1, + int v1, + int u2, + int v2) + +
+          Draw an image(), also specifying u/v coordinates.
+ voidimageMode(int mode) + +
+          The mode can only be set to CORNERS, CORNER, and CENTER.
+ booleanis2D() + +
+          Return true if this renderer supports 2D drawing.
+ booleanis3D() + +
+          Return true if this renderer supports 2D drawing.
+ intlerpColor(int c1, + int c2, + float amt) + +
+          Interpolate between two colors, using the current color mode.
+static intlerpColor(int c1, + int c2, + float amt, + int mode) + +
+          Interpolate between two colors.
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+           
+ voidlights() + +
+           
+ voidlightSpecular(float x, + float y, + float z) + +
+           
+ voidline(float x1, + float y1, + float x2, + float y2) + +
+           
+ voidline(float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ floatmodelX(float x, + float y, + float z) + +
+          Returns the model space x value for an x, y, z coordinate.
+ floatmodelY(float x, + float y, + float z) + +
+          Returns the model space y value for an x, y, z coordinate.
+ floatmodelZ(float x, + float y, + float z) + +
+          Returns the model space z value for an x, y, z coordinate.
+ voidnoFill() + +
+           
+ voidnoLights() + +
+           
+ voidnormal(float nx, + float ny, + float nz) + +
+          Sets the current normal vector.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidnoStroke() + +
+           
+ voidnoTint() + +
+           
+ voidortho() + +
+           
+ voidortho(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ voidperspective() + +
+           
+ voidperspective(float fovy, + float aspect, + float zNear, + float zFar) + +
+           
+ voidpoint(float x, + float y) + +
+           
+ voidpoint(float x, + float y, + float z) + +
+           
+ voidpointLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidpopStyle() + +
+           
+ voidprintCamera() + +
+           
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidprintProjection() + +
+           
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidpushStyle() + +
+           
+ voidquad(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidrect(float a, + float b, + float c, + float d) + +
+           
+ voidrectMode(int mode) + +
+           
+ floatred(int what) + +
+           
+ voidresetMatrix() + +
+          Set the current transformation matrix to identity.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+          Rotate about a vector in space.
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ floatsaturation(int what) + +
+           
+ voidscale(float s) + +
+          Scale in all dimensions.
+ voidscale(float sx, + float sy) + +
+          Scale in X and Y.
+ voidscale(float x, + float y, + float z) + +
+          Scale in X, Y, and Z.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenX(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenZ(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ voidsetMatrix(PMatrix source) + +
+          Set the current transformation matrix to the contents of another.
+ voidsetMatrix(PMatrix2D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetMatrix(PMatrix3D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetParent(PApplet parent) + +
+           
+ voidsetPath(java.lang.String path) + +
+           
+ voidsetPrimary(boolean primary) + +
+          Set (or unset) this as the main drawing surface.
+ voidsetSize(int w, + int h) + +
+          The final step in setting up a renderer, set its size of this renderer.
+ voidshape(PShape shape) + +
+           
+ voidshape(PShape shape, + float x, + float y) + +
+          Convenience method to draw at a particular location.
+ voidshape(PShape shape, + float x, + float y, + float c, + float d) + +
+           
+ voidshapeMode(int mode) + +
+          Set the orientation for the shape() command (like imageMode() or rectMode()).
+ voidshininess(float shine) + +
+           
+static voidshowException(java.lang.String msg) + +
+          Show an renderer-related exception that halts the program.
+static voidshowWarning(java.lang.String msg) + +
+          Show a renderer error, and keep track of it so that it's only shown once.
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidspecular(float gray) + +
+           
+ voidspecular(float x, + float y, + float z) + +
+           
+ voidspecular(int rgb) + +
+           
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidsphereDetail(int res) + +
+           
+ voidsphereDetail(int ures, + int vres) + +
+          Set the detail level for approximating a sphere.
+ voidspotLight(float red, + float green, + float blue, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+ voidstroke(float gray) + +
+           
+ voidstroke(float gray, + float alpha) + +
+           
+ voidstroke(float x, + float y, + float z) + +
+           
+ voidstroke(float x, + float y, + float z, + float a) + +
+           
+ voidstroke(int rgb) + +
+          Set the tint to either a grayscale or ARGB value.
+ voidstroke(int rgb, + float alpha) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ voidstyle(PStyle s) + +
+           
+ voidtext(char c) + +
+          Write text where we just left off.
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y) + +
+          Method to draw text from an array of chars.
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y, + float z) + +
+           
+ voidtext(char c, + float x, + float y) + +
+          Draw a single character on screen.
+ voidtext(char c, + float x, + float y, + float z) + +
+          Draw a single character on screen (with a z coordinate)
+ voidtext(float num, + float x, + float y) + +
+          This does a basic number formatting, to avoid the + generally ugly appearance of printing floats.
+ voidtext(float num, + float x, + float y, + float z) + +
+           
+ voidtext(int num, + float x, + float y) + +
+           
+ voidtext(int num, + float x, + float y, + float z) + +
+           
+ voidtext(java.lang.String str) + +
+          Write text where we just left off.
+ voidtext(java.lang.String str, + float x, + float y) + +
+          Draw a chunk of text.
+ voidtext(java.lang.String str, + float x, + float y, + float z) + +
+          Same as above but with a z coordinate.
+ voidtext(java.lang.String str, + float x1, + float y1, + float x2, + float y2) + +
+          Draw text in a box that is constrained to a particular size.
+ voidtext(java.lang.String s, + float x1, + float y1, + float x2, + float y2, + float z) + +
+           
+ voidtextAlign(int align) + +
+          Sets the alignment of the text to one of LEFT, CENTER, or RIGHT.
+ voidtextAlign(int alignX, + int alignY) + +
+          Sets the horizontal and vertical alignment of the text.
+ floattextAscent() + +
+          Returns the ascent of the current font at the current size.
+ floattextDescent() + +
+          Returns the descent of the current font at the current size.
+ voidtextFont(PFont which) + +
+          Sets the current font.
+ voidtextFont(PFont which, + float size) + +
+          Useful function to set the font and size at the same time.
+ voidtextLeading(float leading) + +
+          Set the text leading to a specific value.
+ voidtextMode(int mode) + +
+          Sets the text rendering/placement to be either SCREEN (direct + to the screen, exact coordinates, only use the font's original size) + or MODEL (the default, where text is manipulated by translate() and + can have a textSize).
+ voidtextSize(float size) + +
+          Sets the text size, also resets the value for the leading.
+ voidtexture(PImage image) + +
+          Set texture image for current shape.
+ voidtextureMode(int mode) + +
+          Set texture mode to either to use coordinates based on the IMAGE + (more intuitive for new users) or NORMALIZED (better for advanced chaps)
+ floattextWidth(char c) + +
+           
+ floattextWidth(java.lang.String str) + +
+          Return the width of a line of text.
+ voidtint(float gray) + +
+           
+ voidtint(float gray, + float alpha) + +
+           
+ voidtint(float x, + float y, + float z) + +
+           
+ voidtint(float x, + float y, + float z, + float a) + +
+           
+ voidtint(int rgb) + +
+          Set the tint to either a grayscale or ARGB value.
+ voidtint(int rgb, + float alpha) + +
+           
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtranslate(float tx, + float ty, + float tz) + +
+          Translate in X, Y, and Z.
+ voidtriangle(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+ voidvertex(float[] v) + +
+          Used by renderer subclasses or PShape to efficiently pass in already + formatted vertex information.
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+pixelCount

+
+public int pixelCount
+
+
+
+
+
+ +

+smooth

+
+public boolean smooth
+
+
+
+
+
+ +

+colorMode

+
+public int colorMode
+
+
The current colorMode +

+

+
+
+
+ +

+colorModeX

+
+public float colorModeX
+
+
Max value for red (or hue) set by colorMode +

+

+
+
+
+ +

+colorModeY

+
+public float colorModeY
+
+
Max value for green (or saturation) set by colorMode +

+

+
+
+
+ +

+colorModeZ

+
+public float colorModeZ
+
+
Max value for blue (or value) set by colorMode +

+

+
+
+
+ +

+colorModeA

+
+public float colorModeA
+
+
Max value for alpha set by colorMode +

+

+
+
+
+ +

+tint

+
+public boolean tint
+
+
True if tint() is enabled (read-only). + + Using tint/tintColor seems a better option for naming than + tintEnabled/tint because the latter seems ugly, even though + g.tint as the actual color seems a little more intuitive, + it's just that g.tintEnabled is even more unintuitive. + Same goes for fill and stroke, et al. +

+

+
+
+
+ +

+tintColor

+
+public int tintColor
+
+
tint that was last set (read-only) +

+

+
+
+
+ +

+fill

+
+public boolean fill
+
+
true if fill() is enabled, (read-only) +

+

+
+
+
+ +

+fillColor

+
+public int fillColor
+
+
fill that was last set (read-only) +

+

+
+
+
+ +

+stroke

+
+public boolean stroke
+
+
true if stroke() is enabled, (read-only) +

+

+
+
+
+ +

+strokeColor

+
+public int strokeColor
+
+
stroke that was last set (read-only) +

+

+
+
+
+ +

+strokeWeight

+
+public float strokeWeight
+
+
Last value set by strokeWeight() (read-only). This has a default + setting, rather than fighting with renderers about whether that + renderer supports thick lines. +

+

+
+
+
+ +

+strokeJoin

+
+public int strokeJoin
+
+
Set by strokeJoin() (read-only). This has a default setting + so that strokeJoin() need not be called by defaults, + because subclasses may not implement it (i.e. PGraphicsGL) +

+

+
+
+
+ +

+strokeCap

+
+public int strokeCap
+
+
Set by strokeCap() (read-only). This has a default setting + so that strokeCap() need not be called by defaults, + because subclasses may not implement it (i.e. PGraphicsGL) +

+

+
+
+
+ +

+rectMode

+
+public int rectMode
+
+
The current rect mode (read-only) +

+

+
+
+
+ +

+ellipseMode

+
+public int ellipseMode
+
+
The current ellipse mode (read-only) +

+

+
+
+
+ +

+shapeMode

+
+public int shapeMode
+
+
The current shape alignment mode (read-only) +

+

+
+
+
+ +

+imageMode

+
+public int imageMode
+
+
The current image alignment (read-only) +

+

+
+
+
+ +

+textFont

+
+public PFont textFont
+
+
The current text font (read-only) +

+

+
+
+
+ +

+textAlign

+
+public int textAlign
+
+
The current text align (read-only) +

+

+
+
+
+ +

+textAlignY

+
+public int textAlignY
+
+
The current vertical text alignment (read-only) +

+

+
+
+
+ +

+textMode

+
+public int textMode
+
+
The current text mode (read-only) +

+

+
+
+
+ +

+textSize

+
+public float textSize
+
+
The current text size (read-only) +

+

+
+
+
+ +

+textLeading

+
+public float textLeading
+
+
The current text leading (read-only) +

+

+
+
+
+ +

+ambientR

+
+public float ambientR
+
+
+
+
+
+ +

+ambientG

+
+public float ambientG
+
+
+
+
+
+ +

+ambientB

+
+public float ambientB
+
+
+
+
+
+ +

+specularR

+
+public float specularR
+
+
+
+
+
+ +

+specularG

+
+public float specularG
+
+
+
+
+
+ +

+specularB

+
+public float specularB
+
+
+
+
+
+ +

+emissiveR

+
+public float emissiveR
+
+
+
+
+
+ +

+emissiveG

+
+public float emissiveG
+
+
+
+
+
+ +

+emissiveB

+
+public float emissiveB
+
+
+
+
+
+ +

+shininess

+
+public float shininess
+
+
+
+
+
+ +

+backgroundColor

+
+public int backgroundColor
+
+
Last background color that was set, zero if an image +

+

+
+
+
+ +

+image

+
+public java.awt.Image image
+
+
Java AWT Image object associated with this renderer. For P2D and P3D, + this will be associated with their MemoryImageSource. For PGraphicsJava2D, + it will be the offscreen drawing buffer. +

+

+
+
+
+ +

+bezierDetail

+
+public int bezierDetail
+
+
+
+
+
+ +

+curveTightness

+
+public float curveTightness
+
+
+
+
+
+ +

+edge

+
+public boolean edge
+
+
+
+
+
+ +

+normalX

+
+public float normalX
+
+
Current normal vector. +

+

+
+
+
+ +

+normalY

+
+public float normalY
+
+
Current normal vector. +

+

+
+
+
+ +

+normalZ

+
+public float normalZ
+
+
Current normal vector. +

+

+
+
+
+ +

+textureMode

+
+public int textureMode
+
+
Sets whether texture coordinates passed to + vertex() calls will be based on coordinates that are + based on the IMAGE or NORMALIZED. +

+

+
+
+
+ +

+textureU

+
+public float textureU
+
+
Current horizontal coordinate for texture, will always + be between 0 and 1, even if using textureMode(IMAGE). +

+

+
+
+
+ +

+textureV

+
+public float textureV
+
+
Current vertical coordinate for texture, see above. +

+

+
+
+
+ +

+textureImage

+
+public PImage textureImage
+
+
Current image being used as a texture +

+

+
+
+
+ +

+sphereDetailU

+
+public int sphereDetailU
+
+
+
+
+
+ +

+sphereDetailV

+
+public int sphereDetailV
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphics

+
+public PGraphics()
+
+
Constructor for the PGraphics object. Use this to ensure that + the defaults get set properly. In a subclass, use this(w, h) + as the first line of a subclass' constructor to properly set + the internal fields and defaults. +

+

+ + + + + + + + +
+Method Detail
+ +

+setParent

+
+public void setParent(PApplet parent)
+
+
+
+
+
+
+
+
+
+ +

+setPrimary

+
+public void setPrimary(boolean primary)
+
+
Set (or unset) this as the main drawing surface. Meaning that it can + safely be set to opaque (and given a default gray background), or anything + else that goes along with that. +

+

+
+
+
+
+
+
+
+ +

+setPath

+
+public void setPath(java.lang.String path)
+
+
+
+
+
+
+
+
+
+ +

+setSize

+
+public void setSize(int w,
+                    int h)
+
+
The final step in setting up a renderer, set its size of this renderer. + This was formerly handled by the constructor, but instead it's been broken + out so that setParent/setPrimary/setPath can be handled differently. + + Important that this is ignored by preproc.pl because otherwise it will + override setSize() in PApplet/Applet/Component, which will 1) not call + super.setSize(), and 2) will cause the renderer to be resized from the + event thread (EDT), causing a nasty crash as it collides with the + animation thread. +

+

+
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Handle any takedown for this graphics context. +

+ This is called when a sketch is shut down and this renderer was + specified using the size() command, or inside endRecord() and + endRaw(), in order to shut things off. +

+

+
+
+
+
+
+
+
+ +

+canDraw

+
+public boolean canDraw()
+
+
Some renderers have requirements re: when they are ready to draw. +

+

+
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
+
+
+
+
+
+
+ +

+flush

+
+public void flush()
+
+
+
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
Enable a hint option. +

+ For the most part, hints are temporary api quirks, + for which a proper api hasn't been properly worked out. + for instance SMOOTH_IMAGES existed because smooth() + wasn't yet implemented, but it will soon go away. +

+ They also exist for obscure features in the graphics + engine, like enabling/disabling single pixel lines + that ignore the zbuffer, the way they do in alphabot. +

+ Current hint options: +

    +
  • DISABLE_DEPTH_TEST - + turns off the z-buffer in the P3D or OPENGL renderers. +
+

+

+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape()
+
+
Start a new shape of type POLYGON +

+

+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
+
+
+
+
+
+
+ +

+edge

+
+public void edge(boolean edge)
+
+
Sets whether the upcoming vertex is part of an edge. + Equivalent to glEdgeFlag(), for people familiar with OpenGL. +

+

+
+
+
+
+
+
+
+ +

+normal

+
+public void normal(float nx,
+                   float ny,
+                   float nz)
+
+
Sets the current normal vector. Only applies with 3D rendering + and inside a beginShape/endShape block. +

+ This is for drawing three dimensional shapes and surfaces, + allowing you to specify a vector perpendicular to the surface + of the shape, which determines how lighting affects it. +

+ For the most part, PGraphics3D will attempt to automatically + assign normals to shapes, but since that's imperfect, + this is a better option when you want more control. +

+ For people familiar with OpenGL, this function is basically + identical to glNormal3f(). +

+

+
+
+
+
+
+
+
+ +

+textureMode

+
+public void textureMode(int mode)
+
+
Set texture mode to either to use coordinates based on the IMAGE + (more intuitive for new users) or NORMALIZED (better for advanced chaps) +

+

+
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
Set texture image for current shape. + Needs to be called between @see beginShape and @see endShape +

+

+
+
+
+
Parameters:
image - reference to a PImage object
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float[] v)
+
+
Used by renderer subclasses or PShape to efficiently pass in already + formatted vertex information. +

+

+
+
+
+
Parameters:
v - vertex parameters, as a float array of length VERTEX_FIELD_COUNT
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
This feature is in testing, do not use or rely upon its implementation +

+

+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape()
+
+
+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float x3,
+                         float y3,
+                         float x4,
+                         float y4)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float z2,
+                         float x3,
+                         float y3,
+                         float z3,
+                         float x4,
+                         float y4,
+                         float z4)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y,
+                        float z)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float z1,
+                 float x2,
+                 float y2,
+                 float z2)
+
+
+
+
+
+
+
+
+
+ +

+triangle

+
+public void triangle(float x1,
+                     float y1,
+                     float x2,
+                     float y2,
+                     float x3,
+                     float y3)
+
+
+
+
+
+
+
+
+
+ +

+quad

+
+public void quad(float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float x3,
+                 float y3,
+                 float x4,
+                 float y4)
+
+
+
+
+
+
+
+
+
+ +

+rectMode

+
+public void rectMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+rect

+
+public void rect(float a,
+                 float b,
+                 float c,
+                 float d)
+
+
+
+
+
+
+
+
+
+ +

+ellipseMode

+
+public void ellipseMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+ellipse

+
+public void ellipse(float a,
+                    float b,
+                    float c,
+                    float d)
+
+
+
+
+
+
+
+
+
+ +

+arc

+
+public void arc(float a,
+                float b,
+                float c,
+                float d,
+                float start,
+                float stop)
+
+
Identical parameters and placement to ellipse, + but draws only an arc of that ellipse. +

+ start and stop are always radians because angleMode() was goofy. + ellipseMode() sets the placement. +

+ also tries to be smart about start < stop. +

+

+
+
+
+
+
+
+
+ +

+box

+
+public void box(float size)
+
+
+
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int res)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int ures,
+                         int vres)
+
+
Set the detail level for approximating a sphere. The ures and vres params + control the horizontal and vertical resolution. + + Code for sphereDetail() submitted by toxi [031031]. + Code for enhanced u/v version from davbol [080801]. +

+

+
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
+
+
+
+
+
+
+ +

+bezierPoint

+
+public float bezierPoint(float a,
+                         float b,
+                         float c,
+                         float d,
+                         float t)
+
+
Evalutes quadratic bezier at point t for points a, b, c, d. + t varies between 0 and 1, and a and d are the on curve points, + b and c are the control points. this can be done once with the + x coordinates and a second time with the y coordinates to get + the location of a bezier curve at t. +

+ For instance, to convert the following example:

+ stroke(255, 102, 0);
+ line(85, 20, 10, 10);
+ line(90, 90, 15, 80);
+ stroke(0, 0, 0);
+ bezier(85, 20, 10, 10, 90, 90, 15, 80);
+
+ // draw it in gray, using 10 steps instead of the default 20
+ // this is a slower way to do it, but useful if you need
+ // to do things with the coordinates at each step
+ stroke(128);
+ beginShape(LINE_STRIP);
+ for (int i = 0; i <= 10; i++) {
+   float t = i / 10.0f;
+   float x = bezierPoint(85, 10, 90, 15, t);
+   float y = bezierPoint(20, 10, 90, 80, t);
+   vertex(x, y);
+ }
+ endShape();
+

+

+
+
+
+
+
+
+
+ +

+bezierTangent

+
+public float bezierTangent(float a,
+                           float b,
+                           float c,
+                           float d,
+                           float t)
+
+
Provide the tangent at the given point on the bezier curve. + Fix from davbol for 0136. +

+

+
+
+
+
+
+
+
+ +

+bezierDetail

+
+public void bezierDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float x2,
+                   float y2,
+                   float x3,
+                   float y3,
+                   float x4,
+                   float y4)
+
+
Draw a cubic bezier curve. The first and last points are + the on-curve points. The middle two are the 'control' points, + or 'handles' in an application like Illustrator. +

+ Identical to typing: +

beginShape();
+ vertex(x1, y1);
+ bezierVertex(x2, y2, x3, y3, x4, y4);
+ endShape();
+ 
+ In Postscript-speak, this would be: +
moveto(x1, y1);
+ curveto(x2, y2, x3, y3, x4, y4);
+ If you were to try and continue that curve like so: +
curveto(x5, y5, x6, y6, x7, y7);
+ This would be done in processing by adding these statements: +
bezierVertex(x5, y5, x6, y6, x7, y7)
+ 
+ To draw a quadratic (instead of cubic) curve, + use the control point twice by doubling it: +
bezier(x1, y1, cx, cy, cx, cy, x2, y2);
+

+

+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float z1,
+                   float x2,
+                   float y2,
+                   float z2,
+                   float x3,
+                   float y3,
+                   float z3,
+                   float x4,
+                   float y4,
+                   float z4)
+
+
+
+
+
+
+
+
+
+ +

+curvePoint

+
+public float curvePoint(float a,
+                        float b,
+                        float c,
+                        float d,
+                        float t)
+
+
Get a location along a catmull-rom curve segment. +

+

+
+
+
+
Parameters:
t - Value between zero and one for how far along the segment
+
+
+
+ +

+curveTangent

+
+public float curveTangent(float a,
+                          float b,
+                          float c,
+                          float d,
+                          float t)
+
+
Calculate the tangent at a t value (0..1) on a Catmull-Rom curve. + Code thanks to Dave Bollinger (Bug #715) +

+

+
+
+
+
+
+
+
+ +

+curveDetail

+
+public void curveDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+curveTightness

+
+public void curveTightness(float tightness)
+
+
+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float x2,
+                  float y2,
+                  float x3,
+                  float y3,
+                  float x4,
+                  float y4)
+
+
Draws a segment of Catmull-Rom curve. +

+ As of 0070, this function no longer doubles the first and + last points. The curves are a bit more boring, but it's more + mathematically correct, and properly mirrored in curvePoint(). +

+ Identical to typing out:

+ beginShape();
+ curveVertex(x1, y1);
+ curveVertex(x2, y2);
+ curveVertex(x3, y3);
+ curveVertex(x4, y4);
+ endShape();
+ 
+

+

+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float z1,
+                  float x2,
+                  float y2,
+                  float z2,
+                  float x3,
+                  float y3,
+                  float z3,
+                  float x4,
+                  float y4,
+                  float z4)
+
+
+
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Disable smoothing. See smooth(). +

+

+
+
+
+
+
+
+
+ +

+imageMode

+
+public void imageMode(int mode)
+
+
The mode can only be set to CORNERS, CORNER, and CENTER. +

+ Support for CENTER was added in release 0146. +

+

+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float a,
+                  float b,
+                  float c,
+                  float d,
+                  int u1,
+                  int v1,
+                  int u2,
+                  int v2)
+
+
Draw an image(), also specifying u/v coordinates. + In this method, the u, v coordinates are always based on image space + location, regardless of the current textureMode(). +

+

+
+
+
+
+
+
+
+ +

+shapeMode

+
+public void shapeMode(int mode)
+
+
Set the orientation for the shape() command (like imageMode() or rectMode()). +

+

+
+
+
+
Parameters:
mode - Either CORNER, CORNERS, or CENTER.
+
+
+
+ +

+shape

+
+public void shape(PShape shape)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y)
+
+
Convenience method to draw at a particular location. +

+

+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int align)
+
+
Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. + This will also reset the vertical text alignment to BASELINE. +

+

+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int alignX,
+                      int alignY)
+
+
Sets the horizontal and vertical alignment of the text. The horizontal + alignment can be one of LEFT, CENTER, or RIGHT. The vertical alignment + can be TOP, BOTTOM, CENTER, or the BASELINE (the default). +

+

+
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
Returns the ascent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
Returns the descent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which)
+
+
Sets the current font. The font's size will be the "natural" + size of this font (the size that was set when using "Create Font"). + The leading will also be reset. +

+

+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which,
+                     float size)
+
+
Useful function to set the font and size at the same time. +

+

+
+
+
+
+
+
+
+ +

+textLeading

+
+public void textLeading(float leading)
+
+
Set the text leading to a specific value. If using a custom + value for the text leading, you'll have to call textLeading() + again after any calls to textSize(). +

+

+
+
+
+
+
+
+
+ +

+textMode

+
+public void textMode(int mode)
+
+
Sets the text rendering/placement to be either SCREEN (direct + to the screen, exact coordinates, only use the font's original size) + or MODEL (the default, where text is manipulated by translate() and + can have a textSize). The text size cannot be set when using + textMode(SCREEN), because it uses the pixels directly from the font. +

+

+
+
+
+
+
+
+
+ +

+textSize

+
+public void textSize(float size)
+
+
Sets the text size, also resets the value for the leading. +

+

+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(char c)
+
+
+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(java.lang.String str)
+
+
Return the width of a line of text. If the text has multiple + lines, this returns the length of the longest line. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c)
+
+
Write text where we just left off. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y)
+
+
Draw a single character on screen. + Extremely slow when used with textMode(SCREEN) and Java 2D, + because loadPixels has to be called first and updatePixels last. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y,
+                 float z)
+
+
Draw a single character on screen (with a z coordinate) +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str)
+
+
Write text where we just left off. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y)
+
+
Draw a chunk of text. + Newlines that are \n (Unix newline or linefeed char, ascii 10) + are honored, but \r (carriage return, Windows and Mac OS) are + ignored. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y)
+
+
Method to draw text from an array of chars. This method will usually be + more efficient than drawing from a String object, because the String will + not be converted to a char array before drawing. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y,
+                 float z)
+
+
Same as above but with a z coordinate. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
Draw text in a box that is constrained to a particular size. + The current rectMode() determines what the coordinates mean + (whether x1/y1/x2/y2 or x/y/w/h). +

+ Note that the x,y coords of the start of the box + will align with the *ascent* of the text, not the baseline, + as is the case for the other text() functions. +

+ Newlines that are \n (Unix newline or linefeed char, ascii 10) + are honored, and \r (carriage return, Windows and Mac OS) are + ignored. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String s,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y)
+
+
This does a basic number formatting, to avoid the + generally ugly appearance of printing floats. + Users who want more control should use their own nf() cmmand, + or if they want the long, ugly version of float, + use String.valueOf() to convert the float to a String first. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Push a copy of the current transformation matrix onto the stack. +

+

+
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Replace the current transformation matrix with the top of the stack. +

+

+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Translate in X and Y. +

+

+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
Translate in X, Y, and Z. +

+

+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Two dimensional rotation. + + Same as rotateZ (this is identical to a 3D rotation along the z-axis) + but included for clarity. It'd be weird for people drawing 2D graphics + to be using rotateZ. And they might kick our a-- for the confusion. + + Additional background. +

+

+
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Rotate around the X axis. +

+

+
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Rotate around the Y axis. +

+

+
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
Rotate about a vector in space. Same as the glRotatef() function. +

+

+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Scale in all dimensions. +

+

+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Scale in X and Y. Equivalent to scale(sx, sy, 1). + + Not recommended for use in 3D, because the z-dimension is just + scaled by 1, since there's no way to know what else to scale it by. +

+

+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
Scale in X, Y, and Z. +

+

+
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Set the current transformation matrix to identity. +

+

+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Apply a 3x2 affine transformation matrix. +

+

+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Apply a 4x4 transformation matrix. +

+

+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix2D getMatrix(PMatrix2D target)
+
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix source)
+
+
Set the current transformation matrix to the contents of another. +

+

+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
Set the current transformation to the contents of the specified source. +

+

+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
Set the current transformation to the contents of the specified source. +

+

+
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Print the current model (or "transformation") matrix. +

+

+
+
+
+
+
+
+
+ +

+beginCamera

+
+public void beginCamera()
+
+
+
+
+
+
+
+
+
+ +

+endCamera

+
+public void endCamera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera(float eyeX,
+                   float eyeY,
+                   float eyeZ,
+                   float centerX,
+                   float centerY,
+                   float centerZ,
+                   float upX,
+                   float upY,
+                   float upZ)
+
+
+
+
+
+
+
+
+
+ +

+printCamera

+
+public void printCamera()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho(float left,
+                  float right,
+                  float bottom,
+                  float top,
+                  float near,
+                  float far)
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective()
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective(float fovy,
+                        float aspect,
+                        float zNear,
+                        float zFar)
+
+
+
+
+
+
+
+
+
+ +

+frustum

+
+public void frustum(float left,
+                    float right,
+                    float bottom,
+                    float top,
+                    float near,
+                    float far)
+
+
+
+
+
+
+
+
+
+ +

+printProjection

+
+public void printProjection()
+
+
+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns its z value. + This value can be used to determine if an (x, y, z) coordinate + is in front or in back of another (x, y, z) coordinate. + The units are based on how the zbuffer is set up, and don't + relate to anything "real". They're only useful for in + comparison to another value obtained from screenZ(), + or directly out of the zbuffer[]. +

+

+
+
+
+
+
+
+
+ +

+modelX

+
+public float modelX(float x,
+                    float y,
+                    float z)
+
+
Returns the model space x value for an x, y, z coordinate. +

+ This will give you a coordinate after it has been transformed + by translate(), rotate(), and camera(), but not yet transformed + by the projection matrix. For instance, his can be useful for + figuring out how points in 3D space relate to the edge + coordinates of a shape. +

+

+
+
+
+
+
+
+
+ +

+modelY

+
+public float modelY(float x,
+                    float y,
+                    float z)
+
+
Returns the model space y value for an x, y, z coordinate. +

+

+
+
+
+
+
+
+
+ +

+modelZ

+
+public float modelZ(float x,
+                    float y,
+                    float z)
+
+
Returns the model space z value for an x, y, z coordinate. +

+

+
+
+
+
+
+
+
+ +

+pushStyle

+
+public void pushStyle()
+
+
+
+
+
+
+
+
+
+ +

+popStyle

+
+public void popStyle()
+
+
+
+
+
+
+
+
+
+ +

+style

+
+public void style(PStyle s)
+
+
+
+
+
+
+
+
+
+ +

+getStyle

+
+public PStyle getStyle()
+
+
+
+
+
+
+
+
+
+ +

+getStyle

+
+public PStyle getStyle(PStyle s)
+
+
+
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
+
+
+
+
+
+
+ +

+noStroke

+
+public void noStroke()
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb)
+
+
Set the tint to either a grayscale or ARGB value. + See notes attached to the fill() function. +

+

+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z,
+                   float a)
+
+
+
+
+
+
+
+
+
+ +

+noTint

+
+public void noTint()
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb)
+
+
Set the tint to either a grayscale or ARGB value. +

+

+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+noFill

+
+public void noFill()
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb)
+
+
Set the fill to either a grayscale value or an ARGB int. +

+

+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float gray)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float gray)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float shine)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float gray)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+lights

+
+public void lights()
+
+
+
+
+
+
+
+
+
+ +

+noLights

+
+public void noLights()
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue)
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue,
+                         float x,
+                         float y,
+                         float z)
+
+
+
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float red,
+                             float green,
+                             float blue,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float red,
+                       float green,
+                       float blue,
+                       float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float red,
+                      float green,
+                      float blue,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
+
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb)
+
+
Set the background to a gray or ARGB color. +

+ For the main drawing surface, the alpha value will be ignored. However, + alpha can be used on PGraphics objects from createGraphics(). This is + the only way to set all the pixels partially transparent, for instance. +

+ Note that background() should be called before any transformations occur, + because some implementations may require the current transformation matrix + to be identity before drawing. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb,
+                       float alpha)
+
+
See notes about alpha in background(x, y, z, a). +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray)
+
+
Set the background to a grayscale value, based on the + current colorMode. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray,
+                       float alpha)
+
+
See notes about alpha in background(x, y, z, a). +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z)
+
+
Set the background to an r, g, b or h, s, b value, + based on the current colorMode. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
Clear the background with a color that includes an alpha value. This can + only be used with objects created by createGraphics(), because the main + drawing surface cannot be set transparent. +

+ It might be tempting to use this function to partially clear the screen + on each frame, however that's not how this function works. When calling + background(), the pixels will be replaced with pixels that have that level + of transparency. To do a semi-transparent overlay, use fill() with alpha + and draw a rectangle. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(PImage image)
+
+
Takes an RGB or ARGB image and sets it as the background. + The width and height of the image must be the same size as the sketch. + Use image.resize(width, height) to make short work of such a task. +

+ Note that even if the image is set as RGB, the high 8 bits of each pixel + should be set opaque (0xFF000000), because the image data will be copied + directly to the screen, and non-opaque background images may have strange + behavior. Using image.filter(OPAQUE) will handle this easily. +

+ When using 3D, this will also clear the zbuffer (if it exists). +

+

+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode)
+
+
Callback to handle clearing the background when begin/endRaw is in use. + Handled as separate function for OpenGL (or other) subclasses that + override backgroundImpl() but still needs this to work properly. +

+

+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float max)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ)
+
+
Set the colorMode and the maximum values for (r, g, b) + or (h, s, b). +

+ Note that this doesn't set the maximum for the alpha value, + which might be confusing if for instance you switched to +

colorMode(HSB, 360, 100, 100);
+ because the alpha values were still between 0 and 255. +

+

+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ,
+                      float maxA)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float gray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray,
+                       int alpha)
+
+
+
+
+
+
Parameters:
gray - can be packed ARGB or a gray in this case
+
+
+
+ +

+color

+
+public final int color(int rgb,
+                       float alpha)
+
+
+
+
+
+
Parameters:
rgb - can be packed ARGB or a gray in this case
+
+
+
+ +

+color

+
+public final int color(float gray,
+                       float alpha)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z,
+                       int a)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
+
+
+
+
+
+
+
+ +

+alpha

+
+public final float alpha(int what)
+
+
+
+
+
+
+
+
+
+ +

+red

+
+public final float red(int what)
+
+
+
+
+
+
+
+
+
+ +

+green

+
+public final float green(int what)
+
+
+
+
+
+
+
+
+
+ +

+blue

+
+public final float blue(int what)
+
+
+
+
+
+
+
+
+
+ +

+hue

+
+public final float hue(int what)
+
+
+
+
+
+
+
+
+
+ +

+saturation

+
+public final float saturation(int what)
+
+
+
+
+
+
+
+
+
+ +

+brightness

+
+public final float brightness(int what)
+
+
+
+
+
+
+
+
+
+ +

+lerpColor

+
+public int lerpColor(int c1,
+                     int c2,
+                     float amt)
+
+
Interpolate between two colors, using the current color mode. +

+

+
+
+
+
+
+
+
+ +

+lerpColor

+
+public static int lerpColor(int c1,
+                            int c2,
+                            float amt,
+                            int mode)
+
+
Interpolate between two colors. Like lerp(), but for the + individual color components of a color supplied as an int value. +

+

+
+
+
+
+
+
+
+ +

+beginRaw

+
+public void beginRaw(PGraphics rawGraphics)
+
+
Record individual lines and triangles by echoing them to another renderer. +

+

+
+
+
+
+
+
+
+ +

+endRaw

+
+public void endRaw()
+
+
+
+
+
+
+
+
+
+ +

+showWarning

+
+public static void showWarning(java.lang.String msg)
+
+
Show a renderer error, and keep track of it so that it's only shown once. +

+

+
+
+
+
Parameters:
msg - the error message (which will be stored for later comparison)
+
+
+
+ +

+showException

+
+public static void showException(java.lang.String msg)
+
+
Show an renderer-related exception that halts the program. Currently just + wraps the message as a RuntimeException and throws it, but might do + something more specific might be used in the future. +

+

+
+
+
+
+
+
+
+ +

+displayable

+
+public boolean displayable()
+
+
Return true if this renderer should be drawn to the screen. Defaults to + returning true, since nearly all renderers are on-screen beasts. But can + be overridden for subclasses like PDF so that a window doesn't open up. +

+ A better name? showFrame, displayable, isVisible, visible, shouldDisplay, + what to call this? +

+

+
+
+
+
+
+
+
+ +

+is2D

+
+public boolean is2D()
+
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
+
+
+
+
+
+
+ +

+is3D

+
+public boolean is3D()
+
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PGraphics2D.html b/build/javadoc/core/processing/core/PGraphics2D.html new file mode 100644 index 000000000..53f1c90ce --- /dev/null +++ b/build/javadoc/core/processing/core/PGraphics2D.html @@ -0,0 +1,1312 @@ + + + + + +PGraphics2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphics2D

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphics2D
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class PGraphics2D
extends PGraphics
+ + +

+Subclass of PGraphics that handles fast 2D rendering using a + MemoryImageSource. The renderer found in this class is not as accurate as + PGraphicsJava2D, but offers certain speed tradeoffs, particular when + messing with the pixels array, or displaying image or video data. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphics2D() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbezier(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbox(float size) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+          This feature is in testing, do not use or rely upon its implementation
+ booleancanDraw() + +
+          Some renderers have requirements re: when they are ready to draw.
+ voidcurve(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidendShape(int mode) + +
+           
+ voidpoint(float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidresetMatrix() + +
+          Load identity as the transform/model matrix.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+          Rotate about a vector in space.
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ voidscale(float s) + +
+          Scale in all dimensions.
+ voidscale(float sx, + float sy) + +
+          Scale in X and Y.
+ voidscale(float x, + float y, + float z) + +
+          Scale in X, Y, and Z.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidsphereDetail(int res) + +
+           
+ voidsphereDetail(int ures, + int vres) + +
+          Set the detail level for approximating a sphere.
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtranslate(float tx, + float ty, + float tz) + +
+          Translate in X, Y, and Z.
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, background, background, background, background, background, background, background, beginCamera, beginRaw, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, brightness, camera, camera, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endRaw, endShape, fill, fill, fill, fill, fill, fill, flush, frustum, getMatrix, getMatrix, getMatrix, getStyle, getStyle, green, hint, hue, image, image, image, imageMode, is2D, is3D, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, modelX, modelY, modelZ, noFill, noLights, normal, noSmooth, noStroke, noTint, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, quad, rect, rectMode, red, saturation, screenX, screenY, screenZ, setMatrix, setMatrix, setMatrix, setParent, setPath, setPrimary, setSize, shape, shape, shape, shapeMode, shininess, showException, showWarning, smooth, specular, specular, specular, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PGraphics2D

+
+public PGraphics2D()
+
+
+ + + + + + + + +
+Method Detail
+ +

+canDraw

+
+public boolean canDraw()
+
+
Description copied from class: PGraphics
+
Some renderers have requirements re: when they are ready to draw. +

+

+
Overrides:
canDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
Overrides:
endDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
Description copied from class: PGraphics
+
This feature is in testing, do not use or rely upon its implementation +

+

+
Overrides:
breakShape in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y,
+                  float z)
+
+
+
Overrides:
point in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float size)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int res)
+
+
+
Overrides:
sphereDetail in class PGraphics
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int ures,
+                         int vres)
+
+
Description copied from class: PGraphics
+
Set the detail level for approximating a sphere. The ures and vres params + control the horizontal and vertical resolution. + + Code for sphereDetail() submitted by toxi [031031]. + Code for enhanced u/v version from davbol [080801]. +

+

+
Overrides:
sphereDetail in class PGraphics
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Description copied from class: PGraphics
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
Overrides:
sphere in class PGraphics
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float z1,
+                   float x2,
+                   float y2,
+                   float z2,
+                   float x3,
+                   float y3,
+                   float z3,
+                   float x4,
+                   float y4,
+                   float z4)
+
+
+
Overrides:
bezier in class PGraphics
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float z1,
+                  float x2,
+                  float y2,
+                  float z2,
+                  float x3,
+                  float y3,
+                  float z3,
+                  float x4,
+                  float y4,
+                  float z4)
+
+
+
Overrides:
curve in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Description copied from class: PGraphics
+
Translate in X and Y. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
Description copied from class: PGraphics
+
Translate in X, Y, and Z. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Description copied from class: PGraphics
+
Two dimensional rotation. + + Same as rotateZ (this is identical to a 3D rotation along the z-axis) + but included for clarity. It'd be weird for people drawing 2D graphics + to be using rotateZ. And they might kick our a-- for the confusion. + + Additional background. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the X axis. +

+

+
Overrides:
rotateX in class PGraphics
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Y axis. +

+

+
Overrides:
rotateY in class PGraphics
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
Overrides:
rotateZ in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
Description copied from class: PGraphics
+
Rotate about a vector in space. Same as the glRotatef() function. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Description copied from class: PGraphics
+
Scale in all dimensions. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Description copied from class: PGraphics
+
Scale in X and Y. Equivalent to scale(sx, sy, 1). + + Not recommended for use in 3D, because the z-dimension is just + scaled by 1, since there's no way to know what else to scale it by. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
Description copied from class: PGraphics
+
Scale in X, Y, and Z. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Description copied from class: PGraphics
+
Push a copy of the current transformation matrix onto the stack. +

+

+
Overrides:
pushMatrix in class PGraphics
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Description copied from class: PGraphics
+
Replace the current transformation matrix with the top of the stack. +

+

+
Overrides:
popMatrix in class PGraphics
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Load identity as the transform/model matrix. + Same as glLoadIdentity(). +

+

+
Overrides:
resetMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Apply a 3x2 affine transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Description copied from class: PGraphics
+
Apply a 4x4 transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Print the current model (or "transformation") matrix. +

+

+
Overrides:
printMatrix in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PGraphics3D.html b/build/javadoc/core/processing/core/PGraphics3D.html new file mode 100644 index 000000000..99136aac1 --- /dev/null +++ b/build/javadoc/core/processing/core/PGraphics3D.html @@ -0,0 +1,3322 @@ + + + + + +PGraphics3D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphics3D

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphics3D
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class PGraphics3D
extends PGraphics
+ + +

+Subclass of PGraphics that handles 3D rendering. + It can render 3D inside a browser window and requires no plug-ins. +

+ The renderer is mostly set up based on the structure of the OpenGL API, + if you have questions about specifics that aren't covered here, + look for reference on the OpenGL implementation of a similar feature. +

+ Lighting and camera implementation by Simon Greenwold. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ PMatrix3Dcamera + +
+          The camera matrix, the modelview will be set to this on beginDraw.
+ floatcameraAspect + +
+          Aspect ratio of camera's view.
+ floatcameraFar + +
+           
+ floatcameraFOV + +
+          Camera field of view.
+ floatcameraNear + +
+           
+ floatcameraX + +
+          Position of the camera.
+ floatcameraY + +
+          Position of the camera.
+ floatcameraZ + +
+          Position of the camera.
+ floatcurrentLightFalloffConstant + +
+          Current light falloff
+ floatcurrentLightFalloffLinear + +
+           
+ floatcurrentLightFalloffQuadratic + +
+           
+ float[]currentLightSpecular + +
+          Current specular color for lighting
+ intlightCount + +
+           
+ float[][]lightDiffuse + +
+          Diffuse colors for lights.
+ float[]lightFalloffConstant + +
+          Light falloff
+ float[]lightFalloffLinear + +
+           
+ float[]lightFalloffQuadratic + +
+           
+ PVector[]lightNormal + +
+          Light direction (normalized vector)
+ PVector[]lightPosition + +
+          Light positions
+ float[][]lightSpecular + +
+          Specular colors for lights.
+ float[]lightSpotAngle + +
+          Light spot angle
+ float[]lightSpotAngleCos + +
+          Cosine of light spot angle
+ float[]lightSpotConcentration + +
+          Light spot concentration
+ int[]lightType + +
+          Light types
+ PLineline + +
+           
+static intMAX_LIGHTS + +
+          Maximum lights by default is 8, which is arbitrary for this renderer, + but is the minimum defined by OpenGL
+ PMatrix3Dmodelview + +
+          The modelview matrix.
+ PMatrix3DmodelviewInv + +
+          Inverse modelview matrix, used for lighting.
+ PMatrix3Dprojection + +
+          Current projection matrix.
+ PSmoothTrianglesmoothTriangle + +
+          Used for anti-aliased and perspective corrected rendering.
+static intTRI_COLOR_COUNT + +
+           
+static intTRI_DIFFUSE_A + +
+           
+static intTRI_DIFFUSE_B + +
+           
+static intTRI_DIFFUSE_G + +
+           
+static intTRI_DIFFUSE_R + +
+           
+static intTRI_SPECULAR_B + +
+           
+static intTRI_SPECULAR_G + +
+           
+static intTRI_SPECULAR_R + +
+           
+ PTriangletriangle + +
+           
+ float[]zbuffer + +
+          The depth buffer.
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphics3D() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidambientLight(float r, + float g, + float b) + +
+          Add an ambient light based on the current color mode.
+ voidambientLight(float r, + float g, + float b, + float x, + float y, + float z) + +
+          Add an ambient light based on the current color mode.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voidapplyMatrix(PMatrix3D source) + +
+           
+ voidbeginCamera() + +
+          Set matrix mode to the camera matrix (instead of the current + transformation matrix).
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbox(float w, + float h, + float d) + +
+           
+ voidcamera() + +
+          Set camera to the default settings.
+ voidcamera(float eyeX, + float eyeY, + float eyeZ, + float centerX, + float centerY, + float centerZ, + float upX, + float upY, + float upZ) + +
+          More flexible method for dealing with camera().
+ voiddirectionalLight(float r, + float g, + float b, + float nx, + float ny, + float nz) + +
+           
+ voidendCamera() + +
+          Record the current settings into the camera matrix, and set + the matrix mode back to the current transformation matrix.
+ voidendDraw() + +
+          See notes in PGraphics.
+ voidendShape(int mode) + +
+           
+ voidflush() + +
+          Emit any sorted geometry that's been collected on this frame.
+ voidfrustum(float left, + float right, + float bottom, + float top, + float znear, + float zfar) + +
+          Same as glFrustum(), except that it wipes out (rather than + multiplies against) the current perspective matrix.
+ PMatrixgetMatrix() + +
+           
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+          Copy the current transformation matrix into the specified target.
+ voidhint(int which) + +
+          Enable a hint option.
+ booleanis2D() + +
+          Return true if this renderer supports 2D drawing.
+ booleanis3D() + +
+          Return true if this renderer supports 2D drawing.
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+          Set the light falloff rates for the last light that was created.
+ voidlights() + +
+          Sets up an ambient and directional light.
+ voidlightSpecular(float x, + float y, + float z) + +
+          Set the specular color of the last light created.
+ floatmodelX(float x, + float y, + float z) + +
+          Returns the model space x value for an x, y, z coordinate.
+ floatmodelY(float x, + float y, + float z) + +
+          Returns the model space y value for an x, y, z coordinate.
+ floatmodelZ(float x, + float y, + float z) + +
+          Returns the model space z value for an x, y, z coordinate.
+ voidnoLights() + +
+          Turn off all lights.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidortho() + +
+          Calls ortho() with the proper parameters for Processing's + standard orthographic projection.
+ voidortho(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+          Similar to gluOrtho(), but wipes out the current projection matrix.
+ voidperspective() + +
+          Calls perspective() with Processing's standard coordinate projection.
+ voidperspective(float fov, + float aspect, + float zNear, + float zFar) + +
+          Similar to gluPerspective().
+ voidpointLight(float r, + float g, + float b, + float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidprintCamera() + +
+          Print the current camera matrix.
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidprintProjection() + +
+          Print the current projection matrix.
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidresetMatrix() + +
+          Set the current transformation matrix to identity.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+          Rotate around an arbitrary vector, similar to glRotate(), + except that it takes radians (instead of degrees).
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ voidscale(float s) + +
+          Same as scale(s, s, s).
+ voidscale(float sx, + float sy) + +
+          Same as scale(sx, sy, 1).
+ voidscale(float x, + float y, + float z) + +
+          Scale in three dimensions.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenX(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenZ(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ voidsetMatrix(PMatrix2D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetMatrix(PMatrix3D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetSize(int iwidth, + int iheight) + +
+          Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size.
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidspotLight(float r, + float g, + float b, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidtexture(PImage image) + +
+          Set texture image for current shape.
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtranslate(float tx, + float ty, + float tz) + +
+          Translate in X, Y, and Z.
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, applyMatrix, arc, background, background, background, background, background, background, background, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, box, breakShape, brightness, canDraw, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getStyle, getStyle, green, hue, image, image, image, imageMode, lerpColor, lerpColor, line, line, noFill, normal, noStroke, noTint, point, point, popStyle, pushStyle, quad, rect, rectMode, red, saturation, setMatrix, setParent, setPath, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, stroke, stroke, stroke, stroke, stroke, stroke, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+zbuffer

+
+public float[] zbuffer
+
+
The depth buffer. +

+

+
+
+
+ +

+modelview

+
+public PMatrix3D modelview
+
+
The modelview matrix. +

+

+
+
+
+ +

+modelviewInv

+
+public PMatrix3D modelviewInv
+
+
Inverse modelview matrix, used for lighting. +

+

+
+
+
+ +

+camera

+
+public PMatrix3D camera
+
+
The camera matrix, the modelview will be set to this on beginDraw. +

+

+
+
+
+ +

+cameraFOV

+
+public float cameraFOV
+
+
Camera field of view. +

+

+
+
+
+ +

+cameraX

+
+public float cameraX
+
+
Position of the camera. +

+

+
+
+
+ +

+cameraY

+
+public float cameraY
+
+
Position of the camera. +

+

+
+
+
+ +

+cameraZ

+
+public float cameraZ
+
+
Position of the camera. +

+

+
+
+
+ +

+cameraNear

+
+public float cameraNear
+
+
+
+
+
+ +

+cameraFar

+
+public float cameraFar
+
+
+
+
+
+ +

+cameraAspect

+
+public float cameraAspect
+
+
Aspect ratio of camera's view. +

+

+
+
+
+ +

+projection

+
+public PMatrix3D projection
+
+
Current projection matrix. +

+

+
+
+
+ +

+MAX_LIGHTS

+
+public static final int MAX_LIGHTS
+
+
Maximum lights by default is 8, which is arbitrary for this renderer, + but is the minimum defined by OpenGL +

+

+
See Also:
Constant Field Values
+
+
+ +

+lightCount

+
+public int lightCount
+
+
+
+
+
+ +

+lightType

+
+public int[] lightType
+
+
Light types +

+

+
+
+
+ +

+lightPosition

+
+public PVector[] lightPosition
+
+
Light positions +

+

+
+
+
+ +

+lightNormal

+
+public PVector[] lightNormal
+
+
Light direction (normalized vector) +

+

+
+
+
+ +

+lightFalloffConstant

+
+public float[] lightFalloffConstant
+
+
Light falloff +

+

+
+
+
+ +

+lightFalloffLinear

+
+public float[] lightFalloffLinear
+
+
+
+
+
+ +

+lightFalloffQuadratic

+
+public float[] lightFalloffQuadratic
+
+
+
+
+
+ +

+lightSpotAngle

+
+public float[] lightSpotAngle
+
+
Light spot angle +

+

+
+
+
+ +

+lightSpotAngleCos

+
+public float[] lightSpotAngleCos
+
+
Cosine of light spot angle +

+

+
+
+
+ +

+lightSpotConcentration

+
+public float[] lightSpotConcentration
+
+
Light spot concentration +

+

+
+
+
+ +

+lightDiffuse

+
+public float[][] lightDiffuse
+
+
Diffuse colors for lights. + For an ambient light, this will hold the ambient color. + Internally these are stored as numbers between 0 and 1. +

+

+
+
+
+ +

+lightSpecular

+
+public float[][] lightSpecular
+
+
Specular colors for lights. + Internally these are stored as numbers between 0 and 1. +

+

+
+
+
+ +

+currentLightSpecular

+
+public float[] currentLightSpecular
+
+
Current specular color for lighting +

+

+
+
+
+ +

+currentLightFalloffConstant

+
+public float currentLightFalloffConstant
+
+
Current light falloff +

+

+
+
+
+ +

+currentLightFalloffLinear

+
+public float currentLightFalloffLinear
+
+
+
+
+
+ +

+currentLightFalloffQuadratic

+
+public float currentLightFalloffQuadratic
+
+
+
+
+
+ +

+TRI_DIFFUSE_R

+
+public static final int TRI_DIFFUSE_R
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_DIFFUSE_G

+
+public static final int TRI_DIFFUSE_G
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_DIFFUSE_B

+
+public static final int TRI_DIFFUSE_B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_DIFFUSE_A

+
+public static final int TRI_DIFFUSE_A
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_SPECULAR_R

+
+public static final int TRI_SPECULAR_R
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_SPECULAR_G

+
+public static final int TRI_SPECULAR_G
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_SPECULAR_B

+
+public static final int TRI_SPECULAR_B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_COLOR_COUNT

+
+public static final int TRI_COLOR_COUNT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+smoothTriangle

+
+public PSmoothTriangle smoothTriangle
+
+
Used for anti-aliased and perspective corrected rendering. +

+

+
+
+
+ +

+line

+
+public PLine line
+
+
+
+
+
+ +

+triangle

+
+public PTriangle triangle
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphics3D

+
+public PGraphics3D()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setSize

+
+public void setSize(int iwidth,
+                    int iheight)
+
+
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. + + Note that this will nuke any cameraMode() settings. +

+

+
Overrides:
setSize in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
See notes in PGraphics. + If z-sorting has been turned on, then the triangles will + all be quicksorted here (to make alpha work more properly) + and then blit to the screen. +

+

+
Overrides:
endDraw in class PGraphics
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
Description copied from class: PGraphics
+
Enable a hint option. +

+ For the most part, hints are temporary api quirks, + for which a proper api hasn't been properly worked out. + for instance SMOOTH_IMAGES existed because smooth() + wasn't yet implemented, but it will soon go away. +

+ They also exist for obscure features in the graphics + engine, like enabling/disabling single pixel lines + that ignore the zbuffer, the way they do in alphabot. +

+ Current hint options: +

    +
  • DISABLE_DEPTH_TEST - + turns off the z-buffer in the P3D or OPENGL renderers. +
+

+

+
Overrides:
hint in class PGraphics
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
Description copied from class: PGraphics
+
Set texture image for current shape. + Needs to be called between @see beginShape and @see endShape +

+

+
Overrides:
texture in class PGraphics
+
+
+
Parameters:
image - reference to a PImage object
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics
+
+
+
+
+
+
+ +

+flush

+
+public void flush()
+
+
Emit any sorted geometry that's been collected on this frame. +

+

+
Overrides:
flush in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Description copied from class: PGraphics
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
Overrides:
sphere in class PGraphics
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
Description copied from class: PGraphics
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
Overrides:
smooth in class PGraphics
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Description copied from class: PGraphics
+
Disable smoothing. See smooth(). +

+

+
Overrides:
noSmooth in class PGraphics
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Description copied from class: PGraphics
+
Push a copy of the current transformation matrix onto the stack. +

+

+
Overrides:
pushMatrix in class PGraphics
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Description copied from class: PGraphics
+
Replace the current transformation matrix with the top of the stack. +

+

+
Overrides:
popMatrix in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Description copied from class: PGraphics
+
Translate in X and Y. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
Description copied from class: PGraphics
+
Translate in X, Y, and Z. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Two dimensional rotation. Same as rotateZ (this is identical + to a 3D rotation along the z-axis) but included for clarity -- + it'd be weird for people drawing 2D graphics to be using rotateZ. + And they might kick our a-- for the confusion. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the X axis. +

+

+
Overrides:
rotateX in class PGraphics
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Y axis. +

+

+
Overrides:
rotateY in class PGraphics
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
Overrides:
rotateZ in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
Rotate around an arbitrary vector, similar to glRotate(), + except that it takes radians (instead of degrees). +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Same as scale(s, s, s). +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Same as scale(sx, sy, 1). +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
Scale in three dimensions. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Description copied from class: PGraphics
+
Set the current transformation matrix to identity. +

+

+
Overrides:
resetMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Description copied from class: PGraphics
+
Apply a 3x2 affine transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix3D source)
+
+
+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Apply a 4x4 transformation matrix. Same as glMultMatrix(). + This call will be slow because it will try to calculate the + inverse of the transform. So avoid it whenever possible. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
Description copied from class: PGraphics
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
Description copied from class: PGraphics
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Print the current model (or "transformation") matrix. +

+

+
Overrides:
printMatrix in class PGraphics
+
+
+
+
+
+
+ +

+beginCamera

+
+public void beginCamera()
+
+
Set matrix mode to the camera matrix (instead of the current + transformation matrix). This means applyMatrix, resetMatrix, etc. + will affect the camera. +

+ Note that the camera matrix is *not* the perspective matrix, + it is in front of the modelview matrix (hence the name "model" + and "view" for that matrix). +

+ beginCamera() specifies that all coordinate transforms until endCamera() + should be pre-applied in inverse to the camera transform matrix. + Note that this is only challenging when a user specifies an arbitrary + matrix with applyMatrix(). Then that matrix will need to be inverted, + which may not be possible. But take heart, if a user is applying a + non-invertible matrix to the camera transform, then he is clearly + up to no good, and we can wash our hands of those bad intentions. +

+ begin/endCamera clauses do not automatically reset the camera transform + matrix. That's because we set up a nice default camera transform int + setup(), and we expect it to hold through draw(). So we don't reset + the camera transform matrix at the top of draw(). That means that an + innocuous-looking clause like +

+ beginCamera();
+ translate(0, 0, 10);
+ endCamera();
+ 
+ at the top of draw(), will result in a runaway camera that shoots + infinitely out of the screen over time. In order to prevent this, + it is necessary to call some function that does a hard reset of the + camera transform matrix inside of begin/endCamera. Two options are +
+ camera(); // sets up the nice default camera transform
+ resetMatrix(); // sets up the identity camera transform
+ 
+ So to rotate a camera a constant amount, you might try +
+ beginCamera();
+ camera();
+ rotateY(PI/8);
+ endCamera();
+ 
+

+

+
Overrides:
beginCamera in class PGraphics
+
+
+
+
+
+
+ +

+endCamera

+
+public void endCamera()
+
+
Record the current settings into the camera matrix, and set + the matrix mode back to the current transformation matrix. +

+ Note that this will destroy any settings to scale(), translate(), + or whatever, because the final camera matrix will be copied + (not multiplied) into the modelview. +

+

+
Overrides:
endCamera in class PGraphics
+
+
+
+
+
+
+ +

+camera

+
+public void camera()
+
+
Set camera to the default settings. +

+ Processing camera behavior: +

+ Camera behavior can be split into two separate components, camera + transformation, and projection. The transformation corresponds to the + physical location, orientation, and scale of the camera. In a physical + camera metaphor, this is what can manipulated by handling the camera + body (with the exception of scale, which doesn't really have a physcial + analog). The projection corresponds to what can be changed by + manipulating the lens. +

+ We maintain separate matrices to represent the camera transform and + projection. An important distinction between the two is that the camera + transform should be invertible, where the projection matrix should not, + since it serves to map three dimensions to two. It is possible to bake + the two matrices into a single one just by multiplying them together, + but it isn't a good idea, since lighting, z-ordering, and z-buffering + all demand a true camera z coordinate after modelview and camera + transforms have been applied but before projection. If the camera + transform and projection are combined there is no way to recover a + good camera-space z-coordinate from a model coordinate. +

+ Fortunately, there are no functions that manipulate both camera + transformation and projection. +

+ camera() sets the camera position, orientation, and center of the scene. + It replaces the camera transform with a new one. This is different from + gluLookAt(), but I think the only reason that GLU's lookat doesn't fully + replace the camera matrix with the new one, but instead multiplies it, + is that GL doesn't enforce the separation of camera transform and + projection, so it wouldn't be safe (you'd probably stomp your projection). +

+ The transformation functions are the same ones used to manipulate the + modelview matrix (scale, translate, rotate, etc.). But they are bracketed + with beginCamera(), endCamera() to indicate that they should apply + (in inverse), to the camera transformation matrix. +

+ This differs considerably from camera transformation in OpenGL. + OpenGL only lets you say, apply everything from here out to the + projection or modelview matrix. This makes it very hard to treat camera + manipulation as if it were a physical camera. Imagine that you want to + move your camera 100 units forward. In OpenGL, you need to apply the + inverse of that transformation or else you'll move your scene 100 units + forward--whether or not you've specified modelview or projection matrix. + Remember they're just multiplied by model coods one after another. + So in order to treat a camera like a physical camera, it is necessary + to pre-apply inverse transforms to a matrix that will be applied to model + coordinates. OpenGL provides nothing of this sort, but Processing does! + This is the camera transform matrix. +

+

+
Overrides:
camera in class PGraphics
+
+
+
+
+
+
+ +

+camera

+
+public void camera(float eyeX,
+                   float eyeY,
+                   float eyeZ,
+                   float centerX,
+                   float centerY,
+                   float centerZ,
+                   float upX,
+                   float upY,
+                   float upZ)
+
+
More flexible method for dealing with camera(). +

+ The actual call is like gluLookat. Here's the real skinny on + what does what: +

+ camera(); or
+ camera(ex, ey, ez, cx, cy, cz, ux, uy, uz);
+ 
+ do not need to be called from with beginCamera();/endCamera(); + That's because they always apply to the camera transformation, + and they always totally replace it. That means that any coordinate + transforms done before camera(); in draw() will be wiped out. + It also means that camera() always operates in untransformed world + coordinates. Therefore it is always redundant to call resetMatrix(); + before camera(); This isn't technically true of gluLookat, but it's + pretty much how it's used. +

+ Now, beginCamera(); and endCamera(); are useful if you want to move + the camera around using transforms like translate(), etc. They will + wipe out any coordinate system transforms that occur before them in + draw(), but they will not automatically wipe out the camera transform. + This means that they should be at the top of draw(). It also means + that the following: +

+ beginCamera();
+ rotateY(PI/8);
+ endCamera();
+ 
+ will result in a camera that spins without stopping. If you want to + just rotate a small constant amount, try this: +
+ beginCamera();
+ camera(); // sets up the default view
+ rotateY(PI/8);
+ endCamera();
+ 
+ That will rotate a little off of the default view. Note that this + is entirely equivalent to +
+ camera(); // sets up the default view
+ beginCamera();
+ rotateY(PI/8);
+ endCamera();
+ 
+ because camera() doesn't care whether or not it's inside a + begin/end clause. Basically it's safe to use camera() or + camera(ex, ey, ez, cx, cy, cz, ux, uy, uz) as naked calls because + they do all the matrix resetting automatically. +

+

+
Overrides:
camera in class PGraphics
+
+
+
+
+
+
+ +

+printCamera

+
+public void printCamera()
+
+
Print the current camera matrix. +

+

+
Overrides:
printCamera in class PGraphics
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho()
+
+
Calls ortho() with the proper parameters for Processing's + standard orthographic projection. +

+

+
Overrides:
ortho in class PGraphics
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho(float left,
+                  float right,
+                  float bottom,
+                  float top,
+                  float near,
+                  float far)
+
+
Similar to gluOrtho(), but wipes out the current projection matrix. +

+ Implementation partially based on Mesa's matrix.c. +

+

+
Overrides:
ortho in class PGraphics
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective()
+
+
Calls perspective() with Processing's standard coordinate projection. +

+ Projection functions: +

    +
  • frustrum() +
  • ortho() +
  • perspective() +
+ Each of these three functions completely replaces the projection + matrix with a new one. They can be called inside setup(), and their + effects will be felt inside draw(). At the top of draw(), the projection + matrix is not reset. Therefore the last projection function to be + called always dominates. On resize, the default projection is always + established, which has perspective. +

+ This behavior is pretty much familiar from OpenGL, except where + functions replace matrices, rather than multiplying against the + previous. +

+

+

+
Overrides:
perspective in class PGraphics
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective(float fov,
+                        float aspect,
+                        float zNear,
+                        float zFar)
+
+
Similar to gluPerspective(). Implementation based on Mesa's glu.c +

+

+
Overrides:
perspective in class PGraphics
+
+
+
+
+
+
+ +

+frustum

+
+public void frustum(float left,
+                    float right,
+                    float bottom,
+                    float top,
+                    float znear,
+                    float zfar)
+
+
Same as glFrustum(), except that it wipes out (rather than + multiplies against) the current perspective matrix. +

+ Implementation based on the explanation in the OpenGL blue book. +

+

+
Overrides:
frustum in class PGraphics
+
+
+
+
+
+
+ +

+printProjection

+
+public void printProjection()
+
+
Print the current projection matrix. +

+

+
Overrides:
printProjection in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns its z value. + This value can be used to determine if an (x, y, z) coordinate + is in front or in back of another (x, y, z) coordinate. + The units are based on how the zbuffer is set up, and don't + relate to anything "real". They're only useful for in + comparison to another value obtained from screenZ(), + or directly out of the zbuffer[]. +

+

+
Overrides:
screenZ in class PGraphics
+
+
+
+
+
+
+ +

+modelX

+
+public float modelX(float x,
+                    float y,
+                    float z)
+
+
Description copied from class: PGraphics
+
Returns the model space x value for an x, y, z coordinate. +

+ This will give you a coordinate after it has been transformed + by translate(), rotate(), and camera(), but not yet transformed + by the projection matrix. For instance, his can be useful for + figuring out how points in 3D space relate to the edge + coordinates of a shape. +

+

+
Overrides:
modelX in class PGraphics
+
+
+
+
+
+
+ +

+modelY

+
+public float modelY(float x,
+                    float y,
+                    float z)
+
+
Description copied from class: PGraphics
+
Returns the model space y value for an x, y, z coordinate. +

+

+
Overrides:
modelY in class PGraphics
+
+
+
+
+
+
+ +

+modelZ

+
+public float modelZ(float x,
+                    float y,
+                    float z)
+
+
Description copied from class: PGraphics
+
Returns the model space z value for an x, y, z coordinate. +

+

+
Overrides:
modelZ in class PGraphics
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
Overrides:
strokeJoin in class PGraphics
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
Overrides:
strokeCap in class PGraphics
+
+
+
+
+
+
+ +

+lights

+
+public void lights()
+
+
Sets up an ambient and directional light. +
+ The Lighting Skinny:
+
+ The way lighting works is complicated enough that it's worth
+ producing a document to describe it. Lighting calculations proceed
+ pretty much exactly as described in the OpenGL red book.
+
+ Light-affecting material properties:
+
+   AMBIENT COLOR
+   - multiplies by light's ambient component
+   - for believability this should match diffuse color
+
+   DIFFUSE COLOR
+   - multiplies by light's diffuse component
+
+   SPECULAR COLOR
+   - multiplies by light's specular component
+   - usually less colored than diffuse/ambient
+
+   SHININESS
+   - the concentration of specular effect
+   - this should be set pretty high (20-50) to see really
+     noticeable specularity
+
+   EMISSIVE COLOR
+   - constant additive color effect
+
+ Light types:
+
+   AMBIENT
+   - one color
+   - no specular color
+   - no direction
+   - may have falloff (constant, linear, and quadratic)
+   - may have position (which matters in non-constant falloff case)
+   - multiplies by a material's ambient reflection
+
+   DIRECTIONAL
+   - has diffuse color
+   - has specular color
+   - has direction
+   - no position
+   - no falloff
+   - multiplies by a material's diffuse and specular reflections
+
+   POINT
+   - has diffuse color
+   - has specular color
+   - has position
+   - no direction
+   - may have falloff (constant, linear, and quadratic)
+   - multiplies by a material's diffuse and specular reflections
+
+   SPOT
+   - has diffuse color
+   - has specular color
+   - has position
+   - has direction
+   - has cone angle (set to half the total cone angle)
+   - has concentration value
+   - may have falloff (constant, linear, and quadratic)
+   - multiplies by a material's diffuse and specular reflections
+
+ Normal modes:
+
+ All of the primitives (rect, box, sphere, etc.) have their normals
+ set nicely. During beginShape/endShape normals can be set by the user.
+
+   AUTO-NORMAL
+   - if no normal is set during the shape, we are in auto-normal mode
+   - auto-normal calculates one normal per triangle (face-normal mode)
+
+   SHAPE-NORMAL
+   - if one normal is set during the shape, it will be used for
+     all vertices
+
+   VERTEX-NORMAL
+   - if multiple normals are set, each normal applies to
+     subsequent vertices
+   - (except for the first one, which applies to previous
+     and subsequent vertices)
+
+ Efficiency consequences:
+
+   There is a major efficiency consequence of position-dependent
+   lighting calculations per vertex. (See below for determining
+   whether lighting is vertex position-dependent.) If there is no
+   position dependency then the only factors that affect the lighting
+   contribution per vertex are its colors and its normal.
+   There is a major efficiency win if
+
+   1) lighting is not position dependent
+   2) we are in AUTO-NORMAL or SHAPE-NORMAL mode
+
+   because then we can calculate one lighting contribution per shape
+   (SHAPE-NORMAL) or per triangle (AUTO-NORMAL) and simply multiply it
+   into the vertex colors. The converse is our worst-case performance when
+
+   1) lighting is position dependent
+   2) we are in AUTO-NORMAL mode
+
+   because then we must calculate lighting per-face * per-vertex.
+   Each vertex has a different lighting contribution per face in
+   which it appears. Yuck.
+
+ Determining vertex position dependency:
+
+   If any of the following factors are TRUE then lighting is
+   vertex position dependent:
+
+   1) Any lights uses non-constant falloff
+   2) There are any point or spot lights
+   3) There is a light with specular color AND there is a
+      material with specular color
+
+ So worth noting is that default lighting (a no-falloff ambient
+ and a directional without specularity) is not position-dependent.
+ We should capitalize.
+
+ Simon Greenwold, April 2005
+ 
+

+

+
Overrides:
lights in class PGraphics
+
+
+
+
+
+
+ +

+noLights

+
+public void noLights()
+
+
Turn off all lights. +

+

+
Overrides:
noLights in class PGraphics
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float r,
+                         float g,
+                         float b)
+
+
Add an ambient light based on the current color mode. +

+

+
Overrides:
ambientLight in class PGraphics
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float r,
+                         float g,
+                         float b,
+                         float x,
+                         float y,
+                         float z)
+
+
Add an ambient light based on the current color mode. + This version includes an (x, y, z) position for situations + where the falloff distance is used. +

+

+
Overrides:
ambientLight in class PGraphics
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float r,
+                             float g,
+                             float b,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
Overrides:
directionalLight in class PGraphics
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float r,
+                       float g,
+                       float b,
+                       float x,
+                       float y,
+                       float z)
+
+
+
Overrides:
pointLight in class PGraphics
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float r,
+                      float g,
+                      float b,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
Overrides:
spotLight in class PGraphics
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
Set the light falloff rates for the last light that was created. + Default is lightFalloff(1, 0, 0). +

+

+
Overrides:
lightFalloff in class PGraphics
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
Set the specular color of the last light created. +

+

+
Overrides:
lightSpecular in class PGraphics
+
+
+
+
+
+
+ +

+is2D

+
+public boolean is2D()
+
+
Description copied from class: PGraphics
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
Overrides:
is2D in class PGraphics
+
+
+
+
+
+
+ +

+is3D

+
+public boolean is3D()
+
+
Description copied from class: PGraphics
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
Overrides:
is3D in class PGraphics
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PGraphicsJava2D.html b/build/javadoc/core/processing/core/PGraphicsJava2D.html new file mode 100644 index 000000000..2d3423273 --- /dev/null +++ b/build/javadoc/core/processing/core/PGraphicsJava2D.html @@ -0,0 +1,2432 @@ + + + + + +PGraphicsJava2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphicsJava2D

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphicsJava2D
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class PGraphicsJava2D
extends PGraphics
+ + +

+Subclass for PGraphics that implements the graphics API using Java2D. + +

Pixel operations too slow? As of release 0085 (the first beta), + the default renderer uses Java2D. It's more accurate than the renderer + used in alpha releases of Processing (it handles stroke caps and joins, + and has better polygon tessellation), but it's super slow for handling + pixels. At least until we get a chance to get the old 2D renderer + (now called P2D) working in a similar fashion, you can use + size(w, h, P3D) instead of size(w, h) which will + be faster for general pixel flipping madness.

+ +

To get access to the Java 2D "Graphics2D" object for the default + renderer, use: +

Graphics2D g2 = ((PGraphicsJava2D)g).g2;
+ This will let you do Java 2D stuff directly, but is not supported in + any way shape or form. Which just means "have fun, but don't complain + if it breaks."

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanfillGradient + +
+           
+ java.awt.PaintfillGradientObject + +
+           
+ java.awt.Graphics2Dg2 + +
+           
+ booleanstrokeGradient + +
+           
+ java.awt.PaintstrokeGradientObject + +
+           
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphicsJava2D() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidbackgroundImpl() + +
+          Actual implementation of clearing the background, now that the + internal variables for background color have been set.
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginRaw(PGraphics recorderRaw) + +
+          Record individual lines and triangles by echoing them to another renderer.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbezierDetail(int detail) + +
+          Ignored (not needed) in Java 2D.
+ voidbezierVertex(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+ voidbezierVertex(float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+          This feature is in testing, do not use or rely upon its implementation
+ booleancanDraw() + +
+          Some renderers have requirements re: when they are ready to draw.
+ voidcopy(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+          Copy things from one area of this image + to another area in the same image.
+ voidcurveDetail(int detail) + +
+          Ignored (not needed) in Java 2D.
+ voidcurveVertex(float x, + float y, + float z) + +
+           
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidendRaw() + +
+           
+ voidendShape(int mode) + +
+           
+ PImageget() + +
+          Returns a copy of this PImage.
+ intget(int x, + int y) + +
+          Returns an ARGB "color" type (a packed 32 bit int with the color.
+ PImagegetImpl(int x, + int y, + int w, + int h) + +
+          Internal function to actually handle getting a block of pixels that + has already been properly cropped to a valid region.
+ PMatrixgetMatrix() + +
+           
+ PMatrix2DgetMatrix(PMatrix2D target) + +
+          Copy the current transformation matrix into the specified target.
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+          Copy the current transformation matrix into the specified target.
+ voidline(float x1, + float y1, + float x2, + float y2) + +
+           
+ voidloadPixels() + +
+          Call this when you want to mess with the pixels[] array.
+ voidmask(int[] alpha) + +
+          Set alpha channel for an image.
+ voidmask(PImage alpha) + +
+          Set alpha channel for an image using another image as the source.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidpoint(float x, + float y) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidquad(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidresetMatrix() + +
+          Set the current transformation matrix to identity.
+ voidresize(int wide, + int high) + +
+          Resize this image to a new width and height.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+          Rotate about a vector in space.
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ voidscale(float s) + +
+          Scale in all dimensions.
+ voidscale(float sx, + float sy) + +
+          Scale in X and Y.
+ voidscale(float sx, + float sy, + float sz) + +
+          Scale in X, Y, and Z.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenX(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenZ(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ voidset(int x, + int y, + int argb) + +
+          Set a single pixel to the specified color.
+ voidsetMatrix(PMatrix2D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetMatrix(PMatrix3D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetSize(int iwidth, + int iheight) + +
+          Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size.
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ floattextAscent() + +
+          Returns the ascent of the current font at the current size.
+ floattextDescent() + +
+          Returns the descent of the current font at the current size.
+ voidtextSize(float size) + +
+          Same as parent, but override for native version of the font.
+ voidtexture(PImage image) + +
+          Set texture image for current shape.
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtriangle(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+ voidupdatePixels() + +
+          Update the pixels[] buffer to the PGraphics image.
+ voidupdatePixels(int x, + int y, + int c, + int d) + +
+          Update the pixels[] buffer to the PGraphics image.
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, background, background, background, background, background, background, background, beginCamera, beginShape, bezier, bezier, bezierPoint, bezierTangent, blue, box, brightness, camera, camera, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endShape, fill, fill, fill, fill, fill, fill, flush, frustum, getStyle, getStyle, green, hint, hue, image, image, image, imageMode, is2D, is3D, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, modelX, modelY, modelZ, noFill, noLights, normal, noStroke, noTint, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, rect, rectMode, red, saturation, setMatrix, setParent, setPath, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textMode, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, filter, filter, get, getCache, getImage, init, isModified, removeCache, save, set, setCache, setModified, setModified
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+g2

+
+public java.awt.Graphics2D g2
+
+
+
+
+
+ +

+fillGradient

+
+public boolean fillGradient
+
+
+
+
+
+ +

+fillGradientObject

+
+public java.awt.Paint fillGradientObject
+
+
+
+
+
+ +

+strokeGradient

+
+public boolean strokeGradient
+
+
+
+
+
+ +

+strokeGradientObject

+
+public java.awt.Paint strokeGradientObject
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphicsJava2D

+
+public PGraphicsJava2D()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setSize

+
+public void setSize(int iwidth,
+                    int iheight)
+
+
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. + + Note that this will nuke any cameraMode() settings. +

+

+
Overrides:
setSize in class PGraphics
+
+
+
+
+
+
+ +

+canDraw

+
+public boolean canDraw()
+
+
Description copied from class: PGraphics
+
Some renderers have requirements re: when they are ready to draw. +

+

+
Overrides:
canDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
Overrides:
endDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
Description copied from class: PGraphics
+
Set texture image for current shape. + Needs to be called between @see beginShape and @see endShape +

+

+
Overrides:
texture in class PGraphics
+
+
+
Parameters:
image - reference to a PImage object
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
Description copied from class: PGraphics
+
This feature is in testing, do not use or rely upon its implementation +

+

+
Overrides:
breakShape in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x1,
+                         float y1,
+                         float x2,
+                         float y2,
+                         float x3,
+                         float y3)
+
+
+
Overrides:
bezierVertex in class PGraphics
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float z2,
+                         float x3,
+                         float y3,
+                         float z3,
+                         float x4,
+                         float y4,
+                         float z4)
+
+
+
Overrides:
bezierVertex in class PGraphics
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y,
+                        float z)
+
+
+
Overrides:
curveVertex in class PGraphics
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y)
+
+
+
Overrides:
point in class PGraphics
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
Overrides:
line in class PGraphics
+
+
+
+
+
+
+ +

+triangle

+
+public void triangle(float x1,
+                     float y1,
+                     float x2,
+                     float y2,
+                     float x3,
+                     float y3)
+
+
+
Overrides:
triangle in class PGraphics
+
+
+
+
+
+
+ +

+quad

+
+public void quad(float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float x3,
+                 float y3,
+                 float x4,
+                 float y4)
+
+
+
Overrides:
quad in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Description copied from class: PGraphics
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
Overrides:
sphere in class PGraphics
+
+
+
+
+
+
+ +

+bezierDetail

+
+public void bezierDetail(int detail)
+
+
Ignored (not needed) in Java 2D. +

+

+
Overrides:
bezierDetail in class PGraphics
+
+
+
+
+
+
+ +

+curveDetail

+
+public void curveDetail(int detail)
+
+
Ignored (not needed) in Java 2D. +

+

+
Overrides:
curveDetail in class PGraphics
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
Description copied from class: PGraphics
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
Overrides:
smooth in class PGraphics
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Description copied from class: PGraphics
+
Disable smoothing. See smooth(). +

+

+
Overrides:
noSmooth in class PGraphics
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
Description copied from class: PGraphics
+
Returns the ascent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
Overrides:
textAscent in class PGraphics
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
Description copied from class: PGraphics
+
Returns the descent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
Overrides:
textDescent in class PGraphics
+
+
+
+
+
+
+ +

+textSize

+
+public void textSize(float size)
+
+
Same as parent, but override for native version of the font. +

+ Also gets called by textFont, so the metrics + will get recorded properly. +

+

+
Overrides:
textSize in class PGraphics
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Description copied from class: PGraphics
+
Push a copy of the current transformation matrix onto the stack. +

+

+
Overrides:
pushMatrix in class PGraphics
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Description copied from class: PGraphics
+
Replace the current transformation matrix with the top of the stack. +

+

+
Overrides:
popMatrix in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Description copied from class: PGraphics
+
Translate in X and Y. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Description copied from class: PGraphics
+
Two dimensional rotation. + + Same as rotateZ (this is identical to a 3D rotation along the z-axis) + but included for clarity. It'd be weird for people drawing 2D graphics + to be using rotateZ. And they might kick our a-- for the confusion. + + Additional background. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the X axis. +

+

+
Overrides:
rotateX in class PGraphics
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Y axis. +

+

+
Overrides:
rotateY in class PGraphics
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
Overrides:
rotateZ in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
Description copied from class: PGraphics
+
Rotate about a vector in space. Same as the glRotatef() function. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Description copied from class: PGraphics
+
Scale in all dimensions. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Description copied from class: PGraphics
+
Scale in X and Y. Equivalent to scale(sx, sy, 1). + + Not recommended for use in 3D, because the z-dimension is just + scaled by 1, since there's no way to know what else to scale it by. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy,
+                  float sz)
+
+
Description copied from class: PGraphics
+
Scale in X, Y, and Z. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Description copied from class: PGraphics
+
Set the current transformation matrix to identity. +

+

+
Overrides:
resetMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Description copied from class: PGraphics
+
Apply a 3x2 affine transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Description copied from class: PGraphics
+
Apply a 4x4 transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix2D getMatrix(PMatrix2D target)
+
+
Description copied from class: PGraphics
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
Description copied from class: PGraphics
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
Description copied from class: PGraphics
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
Description copied from class: PGraphics
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Description copied from class: PGraphics
+
Print the current model (or "transformation") matrix. +

+

+
Overrides:
printMatrix in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns its z value. + This value can be used to determine if an (x, y, z) coordinate + is in front or in back of another (x, y, z) coordinate. + The units are based on how the zbuffer is set up, and don't + relate to anything "real". They're only useful for in + comparison to another value obtained from screenZ(), + or directly out of the zbuffer[]. +

+

+
Overrides:
screenZ in class PGraphics
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
Overrides:
strokeCap in class PGraphics
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
Overrides:
strokeJoin in class PGraphics
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
Overrides:
strokeWeight in class PGraphics
+
+
+
+
+
+
+ +

+backgroundImpl

+
+public void backgroundImpl()
+
+
Description copied from class: PGraphics
+
Actual implementation of clearing the background, now that the + internal variables for background color have been set. Called by the + backgroundFromCalc() method, which is what all the other background() + methods call once the work is done. +

+

+
+
+
+
+
+
+
+ +

+beginRaw

+
+public void beginRaw(PGraphics recorderRaw)
+
+
Description copied from class: PGraphics
+
Record individual lines and triangles by echoing them to another renderer. +

+

+
Overrides:
beginRaw in class PGraphics
+
+
+
+
+
+
+ +

+endRaw

+
+public void endRaw()
+
+
+
Overrides:
endRaw in class PGraphics
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Description copied from class: PImage
+
Call this when you want to mess with the pixels[] array. +

+ For subclasses where the pixels[] buffer isn't set by default, + this should copy all data into the pixels[] array +

+

+
Overrides:
loadPixels in class PImage
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
Update the pixels[] buffer to the PGraphics image. +

+ Unlike in PImage, where updatePixels() only requests that the + update happens, in PGraphicsJava2D, this will happen immediately. +

+

+
Overrides:
updatePixels in class PImage
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x,
+                         int y,
+                         int c,
+                         int d)
+
+
Update the pixels[] buffer to the PGraphics image. +

+ Unlike in PImage, where updatePixels() only requests that the + update happens, in PGraphicsJava2D, this will happen immediately. +

+

+
Overrides:
updatePixels in class PImage
+
+
+
+
+
+
+ +

+resize

+
+public void resize(int wide,
+                   int high)
+
+
Description copied from class: PImage
+
Resize this image to a new width and height. + Use 0 for wide or high to make that dimension scale proportionally. +

+

+
Overrides:
resize in class PImage
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
Description copied from class: PImage
+
Returns an ARGB "color" type (a packed 32 bit int with the color. + If the coordinate is outside the image, zero is returned + (black, but completely transparent). +

+ If the image is in RGB format (i.e. on a PVideo object), + the value will get its high bits set, just to avoid cases where + they haven't been set already. +

+ If the image is in ALPHA format, this returns a white with its + alpha value set. +

+ This function is included primarily for beginners. It is quite + slow because it has to check to see if the x, y that was provided + is inside the bounds, and then has to check to see what image + type it is. If you want things to be more efficient, access the + pixels[] array directly. +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+getImpl

+
+public PImage getImpl(int x,
+                      int y,
+                      int w,
+                      int h)
+
+
Description copied from class: PImage
+
Internal function to actually handle getting a block of pixels that + has already been properly cropped to a valid region. That is, x/y/w/h + are guaranteed to be inside the image space, so the implementation can + use the fastest possible pixel copying method. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
Description copied from class: PImage
+
Returns a copy of this PImage. Equivalent to get(0, 0, width, height). +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int argb)
+
+
Description copied from class: PImage
+
Set a single pixel to the specified color. +

+

+
Overrides:
set in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image. Black colors in the source + image will make the destination image completely transparent, + and white will make things fully opaque. Gray values will + be in-between steps. +

+ Strictly speaking the "blue" value from the source image is + used as the alpha color. For a fully grayscale image, this + is correct, but for a color image it's not 100% accurate. + For a more accurate conversion, first use filter(GRAY) + which will make the image into a "correct" grayscake by + performing a proper luminance-based conversion. +

+

+
Overrides:
mask in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image using another image as the source. +

+

+
Overrides:
mask in class PImage
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
Description copied from class: PImage
+
Copy things from one area of this image + to another area in the same image. +

+

+
Overrides:
copy in class PImage
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PImage.html b/build/javadoc/core/processing/core/PImage.html new file mode 100644 index 000000000..55b4d41a0 --- /dev/null +++ b/build/javadoc/core/processing/core/PImage.html @@ -0,0 +1,1364 @@ + + + + + +PImage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PImage

+
+java.lang.Object
+  extended by processing.core.PImage
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
Direct Known Subclasses:
PGraphics
+
+
+
+
public class PImage
extends java.lang.Object
implements PConstants, java.lang.Cloneable
+ + +

+Storage class for pixel data. This is the base class for most image and + pixel information, such as PGraphics and the video library classes. +

+ Code for copying, resizing, scaling, and blending contributed + by toxi. +

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ intformat + +
+          Format for this image, one of RGB, ARGB or ALPHA.
+ intheight + +
+           
+ PAppletparent + +
+          Path to parent object that will be used with save().
+ int[]pixels + +
+           
+ intwidth + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
PImage() + +
+          Create an empty image object, set its format to RGB.
PImage(java.awt.Image img) + +
+          Construct a new PImage from a java.awt.Image.
PImage(int width, + int height) + +
+          Create a new RGB (alpha ignored) image of a specific size.
PImage(int width, + int height, + int format) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidblend(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+          Blends one area of this image to another area.
+ voidblend(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+          Copies area of one image into another PImage object.
+static intblendColor(int c1, + int c2, + int mode) + +
+          Blend two colors based on a particular mode.
+ java.lang.Objectclone() + +
+          Duplicate an image, returns new PImage object.
+ voidcopy(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+          Copy things from one area of this image + to another area in the same image.
+ voidcopy(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+          Copies area of one image into another PImage object.
+ voidfilter(int kind) + +
+          Method to apply a variety of basic filters to this image.
+ voidfilter(int kind, + float param) + +
+          Method to apply a variety of basic filters to this image.
+ PImageget() + +
+          Returns a copy of this PImage.
+ intget(int x, + int y) + +
+          Returns an ARGB "color" type (a packed 32 bit int with the color.
+ PImageget(int x, + int y, + int w, + int h) + +
+          Grab a subsection of a PImage, and copy it into a fresh PImage.
+ java.lang.ObjectgetCache(java.lang.Object parent) + +
+          Get cache storage data for the specified renderer.
+ java.awt.ImagegetImage() + +
+          Returns a BufferedImage from this PImage.
+ voidinit(int width, + int height, + int format) + +
+          Function to be used by subclasses of PImage to init later than + at the constructor, or re-init later when things changes.
+ booleanisModified() + +
+           
+ voidloadPixels() + +
+          Call this when you want to mess with the pixels[] array.
+ voidmask(int[] alpha) + +
+          Set alpha channel for an image.
+ voidmask(PImage alpha) + +
+          Set alpha channel for an image using another image as the source.
+ voidremoveCache(java.lang.Object parent) + +
+          Remove information associated with this renderer from the cache, if any.
+ voidresize(int wide, + int high) + +
+          Resize this image to a new width and height.
+ voidsave(java.lang.String path) + +
+          Save this image to disk.
+ voidset(int x, + int y, + int c) + +
+          Set a single pixel to the specified color.
+ voidset(int x, + int y, + PImage src) + +
+          Efficient method of drawing an image's pixels directly to this surface.
+ voidsetCache(java.lang.Object parent, + java.lang.Object storage) + +
+          Store data of some kind for a renderer that requires extra metadata of + some kind.
+ voidsetModified() + +
+           
+ voidsetModified(boolean m) + +
+           
+ voidupdatePixels() + +
+          Call this when finished messing with the pixels[] array.
+ voidupdatePixels(int x, + int y, + int w, + int h) + +
+          Mark the pixels in this region as needing an update.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+format

+
+public int format
+
+
Format for this image, one of RGB, ARGB or ALPHA. + note that RGB images still require 0xff in the high byte + because of how they'll be manipulated by other functions +

+

+
+
+
+ +

+pixels

+
+public int[] pixels
+
+
+
+
+
+ +

+width

+
+public int width
+
+
+
+
+
+ +

+height

+
+public int height
+
+
+
+
+
+ +

+parent

+
+public PApplet parent
+
+
Path to parent object that will be used with save(). + This prevents users from needing savePath() to use PImage.save(). +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PImage

+
+public PImage()
+
+
Create an empty image object, set its format to RGB. + The pixel array is not allocated. +

+

+
+ +

+PImage

+
+public PImage(int width,
+              int height)
+
+
Create a new RGB (alpha ignored) image of a specific size. + All pixels are set to zero, meaning black, but since the + alpha is zero, it will be transparent. +

+

+
+ +

+PImage

+
+public PImage(int width,
+              int height,
+              int format)
+
+
+
+ +

+PImage

+
+public PImage(java.awt.Image img)
+
+
Construct a new PImage from a java.awt.Image. This constructor assumes + that you've done the work of making sure a MediaTracker has been used + to fully download the data and that the img is valid. +

+

+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init(int width,
+                 int height,
+                 int format)
+
+
Function to be used by subclasses of PImage to init later than + at the constructor, or re-init later when things changes. + Used by Capture and Movie classes (and perhaps others), + because the width/height will not be known when super() is called. + (Leave this public so that other libraries can do the same.) +

+

+
+
+
+
+
+
+
+ +

+getImage

+
+public java.awt.Image getImage()
+
+
Returns a BufferedImage from this PImage. +

+

+
+
+
+
+
+
+
+ +

+setCache

+
+public void setCache(java.lang.Object parent,
+                     java.lang.Object storage)
+
+
Store data of some kind for a renderer that requires extra metadata of + some kind. Usually this is a renderer-specific representation of the + image data, for instance a BufferedImage with tint() settings applied for + PGraphicsJava2D, or resized image data and OpenGL texture indices for + PGraphicsOpenGL. +

+

+
+
+
+
+
+
+
+ +

+getCache

+
+public java.lang.Object getCache(java.lang.Object parent)
+
+
Get cache storage data for the specified renderer. Because each renderer + will cache data in different formats, it's necessary to store cache data + keyed by the renderer object. Otherwise, attempting to draw the same + image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors. +

+

+
+
+
+
Parameters:
parent - The PGraphics object (or any object, really) associated +
Returns:
data stored for the specified parent
+
+
+
+ +

+removeCache

+
+public void removeCache(java.lang.Object parent)
+
+
Remove information associated with this renderer from the cache, if any. +

+

+
+
+
+
Parameters:
parent - The PGraphics object whose cache data should be removed
+
+
+
+ +

+isModified

+
+public boolean isModified()
+
+
+
+
+
+
+
+
+
+ +

+setModified

+
+public void setModified()
+
+
+
+
+
+
+
+
+
+ +

+setModified

+
+public void setModified(boolean m)
+
+
+
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Call this when you want to mess with the pixels[] array. +

+ For subclasses where the pixels[] buffer isn't set by default, + this should copy all data into the pixels[] array +

+

+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
Call this when finished messing with the pixels[] array. +

+ Mark all pixels as needing update. +

+

+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x,
+                         int y,
+                         int w,
+                         int h)
+
+
Mark the pixels in this region as needing an update. +

+ This is not currently used by any of the renderers, however the api + is structured this way in the hope of being able to use this to + speed things up in the future. +

+

+
+
+
+
+
+
+
+ +

+clone

+
+public java.lang.Object clone()
+                       throws java.lang.CloneNotSupportedException
+
+
Duplicate an image, returns new PImage object. + The pixels[] array for the new object will be unique + and recopied from the source image. This is implemented as an + override of Object.clone(). We recommend using get() instead, + because it prevents you from needing to catch the + CloneNotSupportedException, and from doing a cast from the result. +

+

+
Overrides:
clone in class java.lang.Object
+
+
+ +
Throws: +
java.lang.CloneNotSupportedException
+
+
+
+ +

+resize

+
+public void resize(int wide,
+                   int high)
+
+
Resize this image to a new width and height. + Use 0 for wide or high to make that dimension scale proportionally. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
Returns an ARGB "color" type (a packed 32 bit int with the color. + If the coordinate is outside the image, zero is returned + (black, but completely transparent). +

+ If the image is in RGB format (i.e. on a PVideo object), + the value will get its high bits set, just to avoid cases where + they haven't been set already. +

+ If the image is in ALPHA format, this returns a white with its + alpha value set. +

+ This function is included primarily for beginners. It is quite + slow because it has to check to see if the x, y that was provided + is inside the bounds, and then has to check to see what image + type it is. If you want things to be more efficient, access the + pixels[] array directly. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public PImage get(int x,
+                  int y,
+                  int w,
+                  int h)
+
+
Grab a subsection of a PImage, and copy it into a fresh PImage. + As of release 0149, no longer honors imageMode() for the coordinates. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
Returns a copy of this PImage. Equivalent to get(0, 0, width, height). +

+

+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int c)
+
+
Set a single pixel to the specified color. +

+

+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                PImage src)
+
+
Efficient method of drawing an image's pixels directly to this surface. + No variations are employed, meaning that any scale, tint, or imageMode + settings will be ignored. +

+

+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
Set alpha channel for an image. Black colors in the source + image will make the destination image completely transparent, + and white will make things fully opaque. Gray values will + be in-between steps. +

+ Strictly speaking the "blue" value from the source image is + used as the alpha color. For a fully grayscale image, this + is correct, but for a color image it's not 100% accurate. + For a more accurate conversion, first use filter(GRAY) + which will make the image into a "correct" grayscake by + performing a proper luminance-based conversion. +

+

+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
Set alpha channel for an image using another image as the source. +

+

+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind)
+
+
Method to apply a variety of basic filters to this image. +

+

    +
  • filter(BLUR) provides a basic blur. +
  • filter(GRAY) converts the image to grayscale based on luminance. +
  • filter(INVERT) will invert the color components in the image. +
  • filter(OPAQUE) set all the high bits in the image to opaque +
  • filter(THRESHOLD) converts the image to black and white. +
  • filter(DILATE) grow white/light areas +
  • filter(ERODE) shrink white/light areas +
+ Luminance conversion code contributed by + toxi +

+ Gaussian blur code contributed by + Mario Klingemann +

+

+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind,
+                   float param)
+
+
Method to apply a variety of basic filters to this image. + These filters all take a parameter. +

+

    +
  • filter(BLUR, int radius) performs a gaussian blur of the + specified radius. +
  • filter(POSTERIZE, int levels) will posterize the image to + between 2 and 255 levels. +
  • filter(THRESHOLD, float center) allows you to set the + center point for the threshold. It takes a value from 0 to 1.0. +
+ Gaussian blur code contributed by + Mario Klingemann + and later updated by toxi for better speed. +

+

+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
Copy things from one area of this image + to another area in the same image. +

+

+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(PImage src,
+                 int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
Copies area of one image into another PImage object. +

+

+
+
+
+
+
+
+
+ +

+blendColor

+
+public static int blendColor(int c1,
+                             int c2,
+                             int mode)
+
+
Blend two colors based on a particular mode. +
    +
  • REPLACE - destination colour equals colour of source pixel: C = A. + Sometimes called "Normal" or "Copy" in other software. + +
  • BLEND - linear interpolation of colours: + C = A*factor + B + +
  • ADD - additive blending with white clip: + C = min(A*factor + B, 255). + Clipped to 0..255, Photoshop calls this "Linear Burn", + and Director calls it "Add Pin". + +
  • SUBTRACT - substractive blend with black clip: + C = max(B - A*factor, 0). + Clipped to 0..255, Photoshop calls this "Linear Dodge", + and Director calls it "Subtract Pin". + +
  • DARKEST - only the darkest colour succeeds: + C = min(A*factor, B). + Illustrator calls this "Darken". + +
  • LIGHTEST - only the lightest colour succeeds: + C = max(A*factor, B). + Illustrator calls this "Lighten". + +
  • DIFFERENCE - subtract colors from underlying image. + +
  • EXCLUSION - similar to DIFFERENCE, but less extreme. + +
  • MULTIPLY - Multiply the colors, result will always be darker. + +
  • SCREEN - Opposite multiply, uses inverse values of the colors. + +
  • OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, + and screens light values. + +
  • HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower. + +
  • SOFT_LIGHT - Mix of DARKEST and LIGHTEST. + Works like OVERLAY, but not as harsh. + +
  • DODGE - Lightens light tones and increases contrast, ignores darks. + Called "Color Dodge" in Illustrator and Photoshop. + +
  • BURN - Darker areas are applied, increasing contrast, ignores lights. + Called "Color Burn" in Illustrator and Photoshop. +
+

A useful reference for blending modes and their algorithms can be + found in the SVG + specification.

+

It is important to note that Processing uses "fast" code, not + necessarily "correct" code. No biggie, most software does. A nitpicker + can find numerous "off by 1 division" problems in the blend code where + >>8 or >>7 is used when strictly speaking + /255.0 or /127.0 should have been used.

+

For instance, exclusion (not intended for real-time use) reads + r1 + r2 - ((2 * r1 * r2) / 255) because 255 == 1.0 + not 256 == 1.0. In other words, (255*255)>>8 is not + the same as (255*255)/255. But for real-time use the shifts + are preferrable, and the difference is insignificant for applications + built with Processing.

+

+

+
+
+
+
+
+
+
+ +

+blend

+
+public void blend(int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
Blends one area of this image to another area. +

+

+
+
+
+
See Also:
blendColor(int,int,int)
+
+
+
+ +

+blend

+
+public void blend(PImage src,
+                  int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
Copies area of one image into another PImage object. +

+

+
+
+
+
See Also:
blendColor(int,int,int)
+
+
+
+ +

+save

+
+public void save(java.lang.String path)
+
+
Save this image to disk. +

+ As of revision 0100, this function requires an absolute path, + in order to avoid confusion. To save inside the sketch folder, + use the function savePath() from PApplet, or use saveFrame() instead. + As of revision 0116, savePath() is not needed if this object has been + created (as recommended) via createImage() or createGraphics() or + one of its neighbors. +

+ As of revision 0115, when using Java 1.4 and later, you can write + to several formats besides tga and tiff. If Java 1.4 is installed + and the extension used is supported (usually png, jpg, jpeg, bmp, + and tiff), then those methods will be used to write the image. + To get a list of the supported formats for writing, use:
+ println(javax.imageio.ImageIO.getReaderFormatNames()) +

+ To use the original built-in image writers, use .tga or .tif as the + extension, or don't include an extension. When no extension is used, + the extension .tif will be added to the file name. +

+ The ImageIO API claims to support wbmp files, however they probably + require a black and white image. Basic testing produced a zero-length + file with no error. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PLine.html b/build/javadoc/core/processing/core/PLine.html new file mode 100644 index 000000000..4c47d9d7b --- /dev/null +++ b/build/javadoc/core/processing/core/PLine.html @@ -0,0 +1,507 @@ + + + + + +PLine + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PLine

+
+java.lang.Object
+  extended by processing.core.PLine
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PLine
extends java.lang.Object
implements PConstants
+ + +

+Code for rendering lines with P2D and P3D. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanINTERPOLATE_ALPHA + +
+           
+ booleanINTERPOLATE_RGB + +
+           
+ booleanINTERPOLATE_THICK + +
+           
+ booleanINTERPOLATE_Z + +
+           
+ intm_drawFlags + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PLine(PGraphics g) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddraw() + +
+           
+ booleanlineClipping() + +
+           
+ voidreset() + +
+           
+ voidsetIndex(int index) + +
+           
+ voidsetIntensities(float r0, + float g0, + float b0, + float a0, + float r1, + float g1, + float b1, + float a1) + +
+           
+ voidsetVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+INTERPOLATE_RGB

+
+public boolean INTERPOLATE_RGB
+
+
+
+
+
+ +

+INTERPOLATE_ALPHA

+
+public boolean INTERPOLATE_ALPHA
+
+
+
+
+
+ +

+INTERPOLATE_Z

+
+public boolean INTERPOLATE_Z
+
+
+
+
+
+ +

+INTERPOLATE_THICK

+
+public boolean INTERPOLATE_THICK
+
+
+
+
+
+ +

+m_drawFlags

+
+public int m_drawFlags
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PLine

+
+public PLine(PGraphics g)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
+
+
+
+
+
+
+
+ +

+setVertices

+
+public void setVertices(float x0,
+                        float y0,
+                        float z0,
+                        float x1,
+                        float y1,
+                        float z1)
+
+
+
+
+
+
+
+
+
+ +

+setIntensities

+
+public void setIntensities(float r0,
+                           float g0,
+                           float b0,
+                           float a0,
+                           float r1,
+                           float g1,
+                           float b1,
+                           float a1)
+
+
+
+
+
+
+
+
+
+ +

+setIndex

+
+public void setIndex(int index)
+
+
+
+
+
+
+
+
+
+ +

+draw

+
+public void draw()
+
+
+
+
+
+
+
+
+
+ +

+lineClipping

+
+public boolean lineClipping()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PMaterial.html b/build/javadoc/core/processing/core/PMaterial.html new file mode 100644 index 000000000..fcdcc02f4 --- /dev/null +++ b/build/javadoc/core/processing/core/PMaterial.html @@ -0,0 +1,638 @@ + + + + + +PMaterial + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PMaterial

+
+java.lang.Object
+  extended by processing.core.PMaterial
+
+
+
+
public class PMaterial
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatambientB + +
+          Ka parameters of the material.
+ floatambientG + +
+          Ka parameters of the material.
+ floatambientR + +
+          Ka parameters of the material.
+ floatdiffuseB + +
+          Kd parameters of the material
+ floatdiffuseG + +
+          Kd parameters of the material
+ floatdiffuseR + +
+          Kd parameters of the material
+ floatemissiveB + +
+          Ke parameters of the material
+ floatemissiveG + +
+          Ke parameters of the material
+ floatemissiveR + +
+          Ke parameters of the material
+ floatshininess + +
+          Se parameter of the material
+ floatspecularB + +
+          Ks parameters of the material
+ floatspecularG + +
+          Ks parameters of the material
+ floatspecularR + +
+          Ks parameters of the material
+  + + + + + + + + + + +
+Constructor Summary
PMaterial(float ambientR, + float ambientG, + float ambientB, + float diffuseR, + float diffuseG, + float diffuseB, + float specularR, + float specularG, + float specularB, + float emissiveR, + float emissiveG, + float emissiveB, + float shininess) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidambient(float r, + float g, + float b) + +
+           
+ voiddiffuse(float r, + float g, + float b) + +
+           
+ voidemissive(float r, + float g, + float b) + +
+           
+ voidshininess(float s) + +
+           
+ voidspecular(float r, + float g, + float b) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+ambientR

+
+public float ambientR
+
+
Ka parameters of the material. +

+

+
+
+
+ +

+ambientG

+
+public float ambientG
+
+
Ka parameters of the material. +

+

+
+
+
+ +

+ambientB

+
+public float ambientB
+
+
Ka parameters of the material. +

+

+
+
+
+ +

+diffuseR

+
+public float diffuseR
+
+
Kd parameters of the material +

+

+
+
+
+ +

+diffuseG

+
+public float diffuseG
+
+
Kd parameters of the material +

+

+
+
+
+ +

+diffuseB

+
+public float diffuseB
+
+
Kd parameters of the material +

+

+
+
+
+ +

+specularR

+
+public float specularR
+
+
Ks parameters of the material +

+

+
+
+
+ +

+specularG

+
+public float specularG
+
+
Ks parameters of the material +

+

+
+
+
+ +

+specularB

+
+public float specularB
+
+
Ks parameters of the material +

+

+
+
+
+ +

+emissiveR

+
+public float emissiveR
+
+
Ke parameters of the material +

+

+
+
+
+ +

+emissiveG

+
+public float emissiveG
+
+
Ke parameters of the material +

+

+
+
+
+ +

+emissiveB

+
+public float emissiveB
+
+
Ke parameters of the material +

+

+
+
+
+ +

+shininess

+
+public float shininess
+
+
Se parameter of the material +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PMaterial

+
+public PMaterial(float ambientR,
+                 float ambientG,
+                 float ambientB,
+                 float diffuseR,
+                 float diffuseG,
+                 float diffuseB,
+                 float specularR,
+                 float specularG,
+                 float specularB,
+                 float emissiveR,
+                 float emissiveG,
+                 float emissiveB,
+                 float shininess)
+
+
+ + + + + + + + +
+Method Detail
+ +

+ambient

+
+public void ambient(float r,
+                    float g,
+                    float b)
+
+
+
+
+
+
+ +

+diffuse

+
+public void diffuse(float r,
+                    float g,
+                    float b)
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float r,
+                     float g,
+                     float b)
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float r,
+                     float g,
+                     float b)
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float s)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PMatrix.html b/build/javadoc/core/processing/core/PMatrix.html new file mode 100644 index 000000000..74fe0be78 --- /dev/null +++ b/build/javadoc/core/processing/core/PMatrix.html @@ -0,0 +1,972 @@ + + + + + +PMatrix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Interface PMatrix

+
+
All Known Implementing Classes:
PMatrix2D, PMatrix3D
+
+
+
+
public interface PMatrix
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapply(PMatrix source) + +
+          Multiply this matrix by another.
+ voidapply(PMatrix2D source) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ floatdeterminant() + +
+           
+ PMatrixget() + +
+          Returns a copy of this PMatrix.
+ float[]get(float[] target) + +
+          Copies the matrix contents into a float array.
+ booleaninvert() + +
+          Invert this matrix.
+ float[]mult(float[] source, + float[] target) + +
+          Multiply a multi-element vector against this matrix.
+ PVectormult(PVector source, + PVector target) + +
+          Multiply a PVector by this matrix.
+ voidpreApply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidpreApply(PMatrix2D left) + +
+          Apply another matrix to the left of this one.
+ voidpreApply(PMatrix3D left) + +
+           
+ voidreset() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidset(float[] source) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
+ voidset(PMatrix src) + +
+           
+ voidskewX(float angle) + +
+           
+ voidskewY(float angle) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ voidtranspose() + +
+          Transpose this matrix.
+  +

+ + + + + + + + +
+Method Detail
+ +

+reset

+
+void reset()
+
+
+
+
+
+
+ +

+get

+
+PMatrix get()
+
+
Returns a copy of this PMatrix. +

+

+
+
+
+
+ +

+get

+
+float[] get(float[] target)
+
+
Copies the matrix contents into a float array. + If target is null (or not the correct size), a new array will be created. +

+

+
+
+
+
+ +

+set

+
+void set(PMatrix src)
+
+
+
+
+
+
+ +

+set

+
+void set(float[] source)
+
+
+
+
+
+
+ +

+set

+
+void set(float m00,
+         float m01,
+         float m02,
+         float m10,
+         float m11,
+         float m12)
+
+
+
+
+
+
+ +

+set

+
+void set(float m00,
+         float m01,
+         float m02,
+         float m03,
+         float m10,
+         float m11,
+         float m12,
+         float m13,
+         float m20,
+         float m21,
+         float m22,
+         float m23,
+         float m30,
+         float m31,
+         float m32,
+         float m33)
+
+
+
+
+
+
+ +

+translate

+
+void translate(float tx,
+               float ty)
+
+
+
+
+
+
+ +

+translate

+
+void translate(float tx,
+               float ty,
+               float tz)
+
+
+
+
+
+
+ +

+rotate

+
+void rotate(float angle)
+
+
+
+
+
+
+ +

+rotateX

+
+void rotateX(float angle)
+
+
+
+
+
+
+ +

+rotateY

+
+void rotateY(float angle)
+
+
+
+
+
+
+ +

+rotateZ

+
+void rotateZ(float angle)
+
+
+
+
+
+
+ +

+rotate

+
+void rotate(float angle,
+            float v0,
+            float v1,
+            float v2)
+
+
+
+
+
+
+ +

+scale

+
+void scale(float s)
+
+
+
+
+
+
+ +

+scale

+
+void scale(float sx,
+           float sy)
+
+
+
+
+
+
+ +

+scale

+
+void scale(float x,
+           float y,
+           float z)
+
+
+
+
+
+
+ +

+skewX

+
+void skewX(float angle)
+
+
+
+
+
+
+ +

+skewY

+
+void skewY(float angle)
+
+
+
+
+
+
+ +

+apply

+
+void apply(PMatrix source)
+
+
Multiply this matrix by another. +

+

+
+
+
+
+ +

+apply

+
+void apply(PMatrix2D source)
+
+
+
+
+
+
+ +

+apply

+
+void apply(PMatrix3D source)
+
+
+
+
+
+
+ +

+apply

+
+void apply(float n00,
+           float n01,
+           float n02,
+           float n10,
+           float n11,
+           float n12)
+
+
+
+
+
+
+ +

+apply

+
+void apply(float n00,
+           float n01,
+           float n02,
+           float n03,
+           float n10,
+           float n11,
+           float n12,
+           float n13,
+           float n20,
+           float n21,
+           float n22,
+           float n23,
+           float n30,
+           float n31,
+           float n32,
+           float n33)
+
+
+
+
+
+
+ +

+preApply

+
+void preApply(PMatrix2D left)
+
+
Apply another matrix to the left of this one. +

+

+
+
+
+
+ +

+preApply

+
+void preApply(PMatrix3D left)
+
+
+
+
+
+
+ +

+preApply

+
+void preApply(float n00,
+              float n01,
+              float n02,
+              float n10,
+              float n11,
+              float n12)
+
+
+
+
+
+
+ +

+preApply

+
+void preApply(float n00,
+              float n01,
+              float n02,
+              float n03,
+              float n10,
+              float n11,
+              float n12,
+              float n13,
+              float n20,
+              float n21,
+              float n22,
+              float n23,
+              float n30,
+              float n31,
+              float n32,
+              float n33)
+
+
+
+
+
+
+ +

+mult

+
+PVector mult(PVector source,
+             PVector target)
+
+
Multiply a PVector by this matrix. +

+

+
+
+
+
+ +

+mult

+
+float[] mult(float[] source,
+             float[] target)
+
+
Multiply a multi-element vector against this matrix. +

+

+
+
+
+
+ +

+transpose

+
+void transpose()
+
+
Transpose this matrix. +

+

+
+
+
+
+ +

+invert

+
+boolean invert()
+
+
Invert this matrix. +

+

+ +
Returns:
true if successful
+
+
+
+ +

+determinant

+
+float determinant()
+
+
+ +
Returns:
the determinant of the matrix
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PMatrix2D.html b/build/javadoc/core/processing/core/PMatrix2D.html new file mode 100644 index 000000000..4745103f6 --- /dev/null +++ b/build/javadoc/core/processing/core/PMatrix2D.html @@ -0,0 +1,1380 @@ + + + + + +PMatrix2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PMatrix2D

+
+java.lang.Object
+  extended by processing.core.PMatrix2D
+
+
+
All Implemented Interfaces:
PMatrix
+
+
+
+
public class PMatrix2D
extends java.lang.Object
implements PMatrix
+ + +

+3x2 affine matrix implementation. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatm00 + +
+           
+ floatm01 + +
+           
+ floatm02 + +
+           
+ floatm10 + +
+           
+ floatm11 + +
+           
+ floatm12 + +
+           
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PMatrix2D() + +
+           
PMatrix2D(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
PMatrix2D(PMatrix matrix) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapply(PMatrix source) + +
+          Multiply this matrix by another.
+ voidapply(PMatrix2D source) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ floatdeterminant() + +
+           
+ PMatrix2Dget() + +
+          Returns a copy of this PMatrix.
+ float[]get(float[] target) + +
+          Copies the matrix contents into a 6 entry float array.
+ booleaninvert() + +
+          Invert this matrix.
+ float[]mult(float[] vec, + float[] out) + +
+          Multiply a two element vector against this matrix.
+ PVectormult(PVector source, + PVector target) + +
+          Multiply the x and y coordinates of a PVector against this matrix.
+ floatmultX(float x, + float y) + +
+           
+ floatmultY(float x, + float y) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidpreApply(PMatrix2D left) + +
+          Apply another matrix to the left of this one.
+ voidpreApply(PMatrix3D left) + +
+           
+ voidprint() + +
+           
+ voidreset() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidset(float[] source) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
+ voidset(PMatrix matrix) + +
+           
+ voidset(PMatrix3D src) + +
+           
+ voidskewX(float angle) + +
+           
+ voidskewY(float angle) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float x, + float y, + float z) + +
+           
+ voidtranspose() + +
+          Transpose this matrix.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+m00

+
+public float m00
+
+
+
+
+
+ +

+m01

+
+public float m01
+
+
+
+
+
+ +

+m02

+
+public float m02
+
+
+
+
+
+ +

+m10

+
+public float m10
+
+
+
+
+
+ +

+m11

+
+public float m11
+
+
+
+
+
+ +

+m12

+
+public float m12
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PMatrix2D

+
+public PMatrix2D()
+
+
+
+ +

+PMatrix2D

+
+public PMatrix2D(float m00,
+                 float m01,
+                 float m02,
+                 float m10,
+                 float m11,
+                 float m12)
+
+
+
+ +

+PMatrix2D

+
+public PMatrix2D(PMatrix matrix)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
+
Specified by:
reset in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public PMatrix2D get()
+
+
Returns a copy of this PMatrix. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public float[] get(float[] target)
+
+
Copies the matrix contents into a 6 entry float array. + If target is null (or not the correct size), a new array will be created. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(PMatrix matrix)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(PMatrix3D src)
+
+
+
+
+
+
+
+
+
+ +

+set

+
+public void set(float[] source)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m10,
+                float m11,
+                float m12)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m03,
+                float m10,
+                float m11,
+                float m12,
+                float m13,
+                float m20,
+                float m21,
+                float m22,
+                float m23,
+                float m30,
+                float m31,
+                float m32,
+                float m33)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float x,
+                      float y,
+                      float z)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
Specified by:
rotateX in interface PMatrix
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
Specified by:
rotateY in interface PMatrix
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
Specified by:
rotateZ in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+skewX

+
+public void skewX(float angle)
+
+
+
Specified by:
skewX in interface PMatrix
+
+
+
+
+
+
+ +

+skewY

+
+public void skewY(float angle)
+
+
+
Specified by:
skewY in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix source)
+
+
Description copied from interface: PMatrix
+
Multiply this matrix by another. +

+

+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix2D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix3D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n10,
+                  float n11,
+                  float n12)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n03,
+                  float n10,
+                  float n11,
+                  float n12,
+                  float n13,
+                  float n20,
+                  float n21,
+                  float n22,
+                  float n23,
+                  float n30,
+                  float n31,
+                  float n32,
+                  float n33)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix2D left)
+
+
Apply another matrix to the left of this one. +

+

+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix3D left)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n10,
+                     float n11,
+                     float n12)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n03,
+                     float n10,
+                     float n11,
+                     float n12,
+                     float n13,
+                     float n20,
+                     float n21,
+                     float n22,
+                     float n23,
+                     float n30,
+                     float n31,
+                     float n32,
+                     float n33)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public PVector mult(PVector source,
+                    PVector target)
+
+
Multiply the x and y coordinates of a PVector against this matrix. +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public float[] mult(float[] vec,
+                    float[] out)
+
+
Multiply a two element vector against this matrix. + If out is null or not length four, a new float array will be returned. + The values for vec and out can be the same (though that's less efficient). +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+transpose

+
+public void transpose()
+
+
Transpose this matrix. +

+

+
Specified by:
transpose in interface PMatrix
+
+
+
+
+
+
+ +

+invert

+
+public boolean invert()
+
+
Invert this matrix. Implementation stolen from OpenJDK. +

+

+
Specified by:
invert in interface PMatrix
+
+
+ +
Returns:
true if successful
+
+
+
+ +

+determinant

+
+public float determinant()
+
+
+
Specified by:
determinant in interface PMatrix
+
+
+ +
Returns:
the determinant of the matrix
+
+
+
+ +

+print

+
+public void print()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PMatrix3D.html b/build/javadoc/core/processing/core/PMatrix3D.html new file mode 100644 index 000000000..558398f28 --- /dev/null +++ b/build/javadoc/core/processing/core/PMatrix3D.html @@ -0,0 +1,1801 @@ + + + + + +PMatrix3D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PMatrix3D

+
+java.lang.Object
+  extended by processing.core.PMatrix3D
+
+
+
All Implemented Interfaces:
PMatrix
+
+
+
+
public final class PMatrix3D
extends java.lang.Object
implements PMatrix
+ + +

+4x4 matrix implementation. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatm00 + +
+           
+ floatm01 + +
+           
+ floatm02 + +
+           
+ floatm03 + +
+           
+ floatm10 + +
+           
+ floatm11 + +
+           
+ floatm12 + +
+           
+ floatm13 + +
+           
+ floatm20 + +
+           
+ floatm21 + +
+           
+ floatm22 + +
+           
+ floatm23 + +
+           
+ floatm30 + +
+           
+ floatm31 + +
+           
+ floatm32 + +
+           
+ floatm33 + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
PMatrix3D() + +
+           
PMatrix3D(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
PMatrix3D(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
PMatrix3D(PMatrix matrix) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapply(PMatrix source) + +
+          Multiply this matrix by another.
+ voidapply(PMatrix2D source) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ floatdeterminant() + +
+           
+ PMatrix3Dget() + +
+          Returns a copy of this PMatrix.
+ float[]get(float[] target) + +
+          Copies the matrix contents into a 16 entry float array.
+ booleaninvert() + +
+          Invert this matrix.
+ float[]mult(float[] source, + float[] target) + +
+          Multiply a three or four element vector against this matrix.
+ PVectormult(PVector source, + PVector target) + +
+          Multiply a PVector by this matrix.
+ floatmultW(float x, + float y, + float z) + +
+           
+ floatmultW(float x, + float y, + float z, + float w) + +
+           
+ floatmultX(float x, + float y) + +
+           
+ floatmultX(float x, + float y, + float z) + +
+           
+ floatmultX(float x, + float y, + float z, + float w) + +
+           
+ floatmultY(float x, + float y) + +
+           
+ floatmultY(float x, + float y, + float z) + +
+           
+ floatmultY(float x, + float y, + float z, + float w) + +
+           
+ floatmultZ(float x, + float y, + float z) + +
+           
+ floatmultZ(float x, + float y, + float z, + float w) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidpreApply(PMatrix2D left) + +
+          Apply another matrix to the left of this one.
+ voidpreApply(PMatrix3D left) + +
+          Apply another matrix to the left of this one.
+ voidprint() + +
+           
+ voidreset() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidset(float[] source) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
+ voidset(PMatrix matrix) + +
+           
+ voidskewX(float angle) + +
+           
+ voidskewY(float angle) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ voidtranspose() + +
+          Transpose this matrix.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+m00

+
+public float m00
+
+
+
+
+
+ +

+m01

+
+public float m01
+
+
+
+
+
+ +

+m02

+
+public float m02
+
+
+
+
+
+ +

+m03

+
+public float m03
+
+
+
+
+
+ +

+m10

+
+public float m10
+
+
+
+
+
+ +

+m11

+
+public float m11
+
+
+
+
+
+ +

+m12

+
+public float m12
+
+
+
+
+
+ +

+m13

+
+public float m13
+
+
+
+
+
+ +

+m20

+
+public float m20
+
+
+
+
+
+ +

+m21

+
+public float m21
+
+
+
+
+
+ +

+m22

+
+public float m22
+
+
+
+
+
+ +

+m23

+
+public float m23
+
+
+
+
+
+ +

+m30

+
+public float m30
+
+
+
+
+
+ +

+m31

+
+public float m31
+
+
+
+
+
+ +

+m32

+
+public float m32
+
+
+
+
+
+ +

+m33

+
+public float m33
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PMatrix3D

+
+public PMatrix3D()
+
+
+
+ +

+PMatrix3D

+
+public PMatrix3D(float m00,
+                 float m01,
+                 float m02,
+                 float m10,
+                 float m11,
+                 float m12)
+
+
+
+ +

+PMatrix3D

+
+public PMatrix3D(float m00,
+                 float m01,
+                 float m02,
+                 float m03,
+                 float m10,
+                 float m11,
+                 float m12,
+                 float m13,
+                 float m20,
+                 float m21,
+                 float m22,
+                 float m23,
+                 float m30,
+                 float m31,
+                 float m32,
+                 float m33)
+
+
+
+ +

+PMatrix3D

+
+public PMatrix3D(PMatrix matrix)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
+
Specified by:
reset in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public PMatrix3D get()
+
+
Returns a copy of this PMatrix. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public float[] get(float[] target)
+
+
Copies the matrix contents into a 16 entry float array. + If target is null (or not the correct size), a new array will be created. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(PMatrix matrix)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float[] source)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m10,
+                float m11,
+                float m12)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m03,
+                float m10,
+                float m11,
+                float m12,
+                float m13,
+                float m20,
+                float m21,
+                float m22,
+                float m23,
+                float m30,
+                float m31,
+                float m32,
+                float m33)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
Specified by:
rotateX in interface PMatrix
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
Specified by:
rotateY in interface PMatrix
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
Specified by:
rotateZ in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+skewX

+
+public void skewX(float angle)
+
+
+
Specified by:
skewX in interface PMatrix
+
+
+
+
+
+
+ +

+skewY

+
+public void skewY(float angle)
+
+
+
Specified by:
skewY in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix source)
+
+
Description copied from interface: PMatrix
+
Multiply this matrix by another. +

+

+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix2D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix3D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n10,
+                  float n11,
+                  float n12)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n03,
+                  float n10,
+                  float n11,
+                  float n12,
+                  float n13,
+                  float n20,
+                  float n21,
+                  float n22,
+                  float n23,
+                  float n30,
+                  float n31,
+                  float n32,
+                  float n33)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix2D left)
+
+
Description copied from interface: PMatrix
+
Apply another matrix to the left of this one. +

+

+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix3D left)
+
+
Apply another matrix to the left of this one. +

+

+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n10,
+                     float n11,
+                     float n12)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n03,
+                     float n10,
+                     float n11,
+                     float n12,
+                     float n13,
+                     float n20,
+                     float n21,
+                     float n22,
+                     float n23,
+                     float n30,
+                     float n31,
+                     float n32,
+                     float n33)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public PVector mult(PVector source,
+                    PVector target)
+
+
Description copied from interface: PMatrix
+
Multiply a PVector by this matrix. +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public float[] mult(float[] source,
+                    float[] target)
+
+
Multiply a three or four element vector against this matrix. If out is + null or not length 3 or 4, a new float array (length 3) will be returned. +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multZ

+
+public float multZ(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multW

+
+public float multW(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+multZ

+
+public float multZ(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+multW

+
+public float multW(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+transpose

+
+public void transpose()
+
+
Transpose this matrix. +

+

+
Specified by:
transpose in interface PMatrix
+
+
+
+
+
+
+ +

+invert

+
+public boolean invert()
+
+
Invert this matrix. +

+

+
Specified by:
invert in interface PMatrix
+
+
+ +
Returns:
true if successful
+
+
+
+ +

+determinant

+
+public float determinant()
+
+
+
Specified by:
determinant in interface PMatrix
+
+
+ +
Returns:
the determinant of the matrix
+
+
+
+ +

+print

+
+public void print()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PPolygon.html b/build/javadoc/core/processing/core/PPolygon.html new file mode 100644 index 000000000..a807cc4b6 --- /dev/null +++ b/build/javadoc/core/processing/core/PPolygon.html @@ -0,0 +1,243 @@ + + + + + +PPolygon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PPolygon

+
+java.lang.Object
+  extended by processing.core.PPolygon
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PPolygon
extends java.lang.Object
implements PConstants
+ + +

+Z-buffer polygon rendering object used by PGraphics2D. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PPolygon(PGraphics iparent) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PPolygon

+
+public PPolygon(PGraphics iparent)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PShape.html b/build/javadoc/core/processing/core/PShape.html new file mode 100644 index 000000000..f30506045 --- /dev/null +++ b/build/javadoc/core/processing/core/PShape.html @@ -0,0 +1,1274 @@ + + + + + +PShape + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PShape

+
+java.lang.Object
+  extended by processing.core.PShape
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
Direct Known Subclasses:
PShapeSVG
+
+
+
+
public class PShape
extends java.lang.Object
implements PConstants
+ + +

+In-progress class to handle shape data, currently to be considered of + alpha or beta quality. Major structural work may be performed on this class + after the release of Processing 1.0. Such changes may include: + +

    +
  • addition of proper accessors to read shape vertex and coloring data + (this is the second most important part of having a PShape class after all). +
  • a means of creating PShape objects ala beginShape() and endShape(). +
  • load(), update(), and cache methods ala PImage, so that shapes can + have renderer-specific optimizations, such as vertex arrays in OpenGL. +
  • splitting this class into multiple classes to handle different + varieties of shape data (primitives vs collections of vertices vs paths) +
  • change of package declaration, for instance moving the code into + package processing.shape (if the code grows too much). +
+ +

For the time being, this class and its shape() and loadShape() friends in + PApplet exist as placeholders for more exciting things to come. If you'd + like to work with this class, make a subclass (see how PShapeSVG works) + and you can play with its internal methods all you like.

+ +

Library developers are encouraged to create PShape objects when loading + shape data, so that they can eventually hook into the bounty that will be + the PShape interface, and the ease of loadShape() and shape().

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intBEZIER_VERTEX + +
+           
+static intBREAK + +
+           
+static intCURVE_VERTEX + +
+           
+static intGEOMETRY + +
+          Collections of vertices created with beginShape().
+static intGROUP + +
+          Generic, only draws its child objects.
+ floatheight + +
+           
+static intPATH + +
+          A series of vertex, curveVertex, and bezierVertex calls.
+static intPRIMITIVE + +
+          A line, ellipse, arc, image, etc.
+static intVERTEX + +
+           
+ floatwidth + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + +
+Constructor Summary
PShape() + +
+           
PShape(int family) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddChild(PShape who) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapplyMatrix(PMatrix source) + +
+           
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voiddisableStyle() + +
+          Overrides this shape's style information and uses PGraphics styles and + colors.
+ voiddraw(PGraphics g) + +
+          Called by the following (the shape() command adds the g) + PShape s = loadShapes("blah.svg"); + shape(s);
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ voidenableStyle() + +
+          Re-enables style information (fill and stroke) set in the shape.
+ PShapefindChild(java.lang.String target) + +
+          Same as getChild(name), except that it first walks all the way up the + hierarchy to the farthest parent, so that children can be found anywhere.
+ PShapegetChild(int index) + +
+           
+ PShapegetChild(java.lang.String target) + +
+           
+ intgetChildCount() + +
+           
+ floatgetHeight() + +
+          Get the height of the drawing area (not necessarily the shape boundary).
+ java.lang.StringgetName() + +
+           
+ floatgetWidth() + +
+          Get the width of the drawing area (not necessarily the shape boundary).
+ booleanisVisible() + +
+           
+ voidpost(PGraphics g) + +
+           
+ voidresetMatrix() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidsetName(java.lang.String name) + +
+           
+ voidsetVisible(boolean visible) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+GROUP

+
+public static final int GROUP
+
+
Generic, only draws its child objects. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PRIMITIVE

+
+public static final int PRIMITIVE
+
+
A line, ellipse, arc, image, etc. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PATH

+
+public static final int PATH
+
+
A series of vertex, curveVertex, and bezierVertex calls. +

+

+
See Also:
Constant Field Values
+
+
+ +

+GEOMETRY

+
+public static final int GEOMETRY
+
+
Collections of vertices created with beginShape(). +

+

+
See Also:
Constant Field Values
+
+
+ +

+width

+
+public float width
+
+
+
+
+
+ +

+height

+
+public float height
+
+
+
+
+
+ +

+VERTEX

+
+public static final int VERTEX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEZIER_VERTEX

+
+public static final int BEZIER_VERTEX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CURVE_VERTEX

+
+public static final int CURVE_VERTEX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BREAK

+
+public static final int BREAK
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+PShape

+
+public PShape()
+
+
+
+ +

+PShape

+
+public PShape(int family)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setName

+
+public void setName(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getName

+
+public java.lang.String getName()
+
+
+
+
+
+
+
+
+
+ +

+isVisible

+
+public boolean isVisible()
+
+
+
+
+
+
+
+
+
+ +

+setVisible

+
+public void setVisible(boolean visible)
+
+
+
+
+
+
+
+
+
+ +

+disableStyle

+
+public void disableStyle()
+
+
Overrides this shape's style information and uses PGraphics styles and + colors. Identical to ignoreStyles(true). Also disables styles for all + child shapes. +

+

+
+
+
+
+
+
+
+ +

+enableStyle

+
+public void enableStyle()
+
+
Re-enables style information (fill and stroke) set in the shape. +

+

+
+
+
+
+
+
+
+ +

+getWidth

+
+public float getWidth()
+
+
Get the width of the drawing area (not necessarily the shape boundary). +

+

+
+
+
+
+
+
+
+ +

+getHeight

+
+public float getHeight()
+
+
Get the height of the drawing area (not necessarily the shape boundary). +

+

+
+
+
+
+
+
+
+ +

+post

+
+public void post(PGraphics g)
+
+
+
+
+
+
+
+
+
+ +

+draw

+
+public void draw(PGraphics g)
+
+
Called by the following (the shape() command adds the g) + PShape s = loadShapes("blah.svg"); + shape(s); +

+

+
+
+
+
+
+
+
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Draws the SVG document. +

+

+
+
+
+
+
+
+
+ +

+getChildCount

+
+public int getChildCount()
+
+
+
+
+
+
+
+
+
+ +

+getChild

+
+public PShape getChild(int index)
+
+
+
+
+
+
+
+
+
+ +

+getChild

+
+public PShape getChild(java.lang.String target)
+
+
+
+
+
+
+
+
+
+ +

+findChild

+
+public PShape findChild(java.lang.String target)
+
+
Same as getChild(name), except that it first walks all the way up the + hierarchy to the farthest parent, so that children can be found anywhere. +

+

+
+
+
+
+
+
+
+ +

+addChild

+
+public void addChild(PShape who)
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
+
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
+
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PShapeSVG.html b/build/javadoc/core/processing/core/PShapeSVG.html new file mode 100644 index 000000000..6326902d8 --- /dev/null +++ b/build/javadoc/core/processing/core/PShapeSVG.html @@ -0,0 +1,460 @@ + + + + + +PShapeSVG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PShapeSVG

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.core.PShapeSVG
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PShapeSVG
extends PShape
+ + +

+SVG stands for Scalable Vector Graphics, a portable graphics format. It is + a vector format so it allows for infinite resolution and relatively small + file sizes. Most modern media software can view SVG files, including Adobe + products, Firefox, etc. Illustrator and Inkscape can edit SVG files. +

+ We have no intention of turning this into a full-featured SVG library. + The goal of this project is a basic shape importer that is small enough + to be included with applets, meaning that its download size should be + in the neighborhood of 25-30k. Starting with release 0149, this library + has been incorporated into the core via the loadShape() command, because + vector shape data is just as important as the image data from loadImage(). +

+ For more sophisticated import/export, consider the + Batik + library from the Apache Software Foundation. Future improvements to this + library may focus on this properly supporting a specific subset of SVG, + for instance the simpler SVG profiles known as + SVG Tiny or Basic, + although we still would not support the interactivity options. + +


+ + A minimal example program using SVG: + (assuming a working moo.svg is in your data folder) + +

+ PShape moo;
+
+ void setup() {
+   size(400, 400);
+   moo = loadShape("moo.svg");
+ }
+ void draw() {
+   background(255);
+   shape(moo, mouseX, mouseY);
+ }
+ 
+ + This code is based on the Candy library written by Michael Chang, which was + later revised and expanded for use as a Processing core library by Ben Fry. + Thanks to Ricard Marxer Pinon for help with better Inkscape support in 0154. + +


+ + Late October 2008 revisions from ricardmp, incorporated by fry (0154) +

    +
  • Better style attribute handling, enabling better Inkscape support. +
+ + October 2008 revisions by fry (Processing 0149, pre-1.0) +
    +
  • Candy is no longer a separate library, and is instead part of core. +
  • Loading now works through loadShape() +
  • Shapes are now drawn using the new PGraphics shape() method. +
+ + August 2008 revisions by fry (Processing 0149) +
    +
  • Major changes to rework around PShape. +
  • Now implementing more of the "transform" attribute. +
+ + February 2008 revisions by fry (Processing 0136) +
    +
  • Added support for quadratic curves in paths (Q, q, T, and t operators) +
  • Support for reading SVG font data (though not rendering it yet) +
+ + Revisions for "Candy 2" November 2006 by fry +
    +
  • Switch to the new processing.xml library +
  • Several bug fixes for parsing of shape data +
  • Support for linear and radial gradients +
  • Support for additional types of shapes +
  • Added compound shapes (shapes with interior points) +
  • Added methods to get shapes from an internal table +
+ + Revision 10/31/06 by flux +
    +
  • Now properly supports Processing 0118 +
  • Fixed a bunch of things for Casey's students and general buggity. +
  • Will now properly draw #FFFFFFFF colors (were being represented as -1) +
  • SVGs without tags are now properly caught and loaded +
  • Added a method customStyle() for overriding SVG colors/styles +
  • Added a method SVGStyle() to go back to using SVG colors/styles +
+ + Some SVG objects and features may not yet be supported. + Here is a partial list of non-included features +
    +
  • Rounded rectangles +
  • Drop shadow objects +
  • Typography +
  • Layers added for Candy 2 +
  • Patterns +
  • Embedded images +
+ + For those interested, the SVG specification can be found + here. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PShape
BEZIER_VERTEX, BREAK, CURVE_VERTEX, GEOMETRY, GROUP, height, PATH, PRIMITIVE, VERTEX, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PShapeSVG(PApplet parent, + java.lang.String filename) + +
+          Initializes a new SVG Object with the given filename.
PShapeSVG(PShapeSVG parent, + XMLElement properties) + +
+           
PShapeSVG(XMLElement svg) + +
+          Initializes a new SVG Object from the given XMLElement.
+  + + + + + + + + + + + + + + + +
+Method Summary
+ PShapegetChild(java.lang.String name) + +
+          Get a particular element based on its SVG ID.
+ voidprint() + +
+          Prints out the SVG document.
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, apply, applyMatrix, applyMatrix, applyMatrix, applyMatrix, disableStyle, draw, drawImpl, enableStyle, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PShapeSVG

+
+public PShapeSVG(PApplet parent,
+                 java.lang.String filename)
+
+
Initializes a new SVG Object with the given filename. +

+

+
+ +

+PShapeSVG

+
+public PShapeSVG(XMLElement svg)
+
+
Initializes a new SVG Object from the given XMLElement. +

+

+
+ +

+PShapeSVG

+
+public PShapeSVG(PShapeSVG parent,
+                 XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getChild

+
+public PShape getChild(java.lang.String name)
+
+
Get a particular element based on its SVG ID. When editing SVG by hand, + this is the id="" tag on any SVG element. When editing from Illustrator, + these IDs can be edited by expanding the layers palette. The names used + in the layers palette, both for the layers or the shapes and groups + beneath them can be used here. +
+ // This code grabs "Layer 3" and the shapes beneath it.
+ SVG layer3 = svg.getChild("Layer 3");
+ 
+

+

+
Overrides:
getChild in class PShape
+
+
+
+
+
+
+ +

+print

+
+public void print()
+
+
Prints out the SVG document. Useful for parsing. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PSmoothTriangle.html b/build/javadoc/core/processing/core/PSmoothTriangle.html new file mode 100644 index 000000000..936200b59 --- /dev/null +++ b/build/javadoc/core/processing/core/PSmoothTriangle.html @@ -0,0 +1,490 @@ + + + + + +PSmoothTriangle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PSmoothTriangle

+
+java.lang.Object
+  extended by processing.core.PSmoothTriangle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PSmoothTriangle
extends java.lang.Object
implements PConstants
+ + +

+Smoothed triangle renderer for P3D. + + Based off of the PPolygon class in old versions of Processing. + Name and location of this class will change in a future release. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, UP, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
PSmoothTriangle(PGraphics3D iparent) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ float[]nextVertex() + +
+           
+ voidrender() + +
+           
+ voidreset(int count) + +
+           
+ voidsetCamVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+          Pass camera-space coordinates for the triangle.
+ voidsetIntensities(float ar, + float ag, + float ab, + float aa, + float br, + float bg, + float bb, + float ba, + float cr, + float cg, + float cb, + float ca) + +
+           
+ voidsetVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ voidtexture(PImage image) + +
+           
+ voidunexpand() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PSmoothTriangle

+
+public PSmoothTriangle(PGraphics3D iparent)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset(int count)
+
+
+
+
+
+
+
+
+
+ +

+nextVertex

+
+public float[] nextVertex()
+
+
+
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
+
+
+
+
+
+
+
+ +

+render

+
+public void render()
+
+
+
+
+
+
+
+
+
+ +

+unexpand

+
+public void unexpand()
+
+
+
+
+
+
+
+
+
+ +

+setCamVertices

+
+public void setCamVertices(float x0,
+                           float y0,
+                           float z0,
+                           float x1,
+                           float y1,
+                           float z1,
+                           float x2,
+                           float y2,
+                           float z2)
+
+
Pass camera-space coordinates for the triangle. + Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. + Generally this will not need to be called manually, + currently called from PGraphics3D.render_triangles() +

+

+
+
+
+
+
+
+
+ +

+setVertices

+
+public void setVertices(float x0,
+                        float y0,
+                        float z0,
+                        float x1,
+                        float y1,
+                        float z1,
+                        float x2,
+                        float y2,
+                        float z2)
+
+
+
+
+
+
+
+
+
+ +

+setIntensities

+
+public void setIntensities(float ar,
+                           float ag,
+                           float ab,
+                           float aa,
+                           float br,
+                           float bg,
+                           float bb,
+                           float ba,
+                           float cr,
+                           float cg,
+                           float cb,
+                           float ca)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PStyle.html b/build/javadoc/core/processing/core/PStyle.html new file mode 100644 index 000000000..1211d0c09 --- /dev/null +++ b/build/javadoc/core/processing/core/PStyle.html @@ -0,0 +1,860 @@ + + + + + +PStyle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PStyle

+
+java.lang.Object
+  extended by processing.core.PStyle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PStyle
extends java.lang.Object
implements PConstants
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatambientB + +
+           
+ floatambientG + +
+           
+ floatambientR + +
+           
+ intcolorMode + +
+           
+ floatcolorModeA + +
+           
+ floatcolorModeX + +
+           
+ floatcolorModeY + +
+           
+ floatcolorModeZ + +
+           
+ intellipseMode + +
+           
+ floatemissiveB + +
+           
+ floatemissiveG + +
+           
+ floatemissiveR + +
+           
+ booleanfill + +
+           
+ intfillColor + +
+           
+ intimageMode + +
+           
+ intrectMode + +
+           
+ intshapeMode + +
+           
+ floatshininess + +
+           
+ floatspecularB + +
+           
+ floatspecularG + +
+           
+ floatspecularR + +
+           
+ booleanstroke + +
+           
+ intstrokeCap + +
+           
+ intstrokeColor + +
+           
+ intstrokeJoin + +
+           
+ floatstrokeWeight + +
+           
+ inttextAlign + +
+           
+ inttextAlignY + +
+           
+ PFonttextFont + +
+           
+ floattextLeading + +
+           
+ inttextMode + +
+           
+ floattextSize + +
+           
+ booleantint + +
+           
+ inttintColor + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PStyle() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+imageMode

+
+public int imageMode
+
+
+
+
+
+ +

+rectMode

+
+public int rectMode
+
+
+
+
+
+ +

+ellipseMode

+
+public int ellipseMode
+
+
+
+
+
+ +

+shapeMode

+
+public int shapeMode
+
+
+
+
+
+ +

+colorMode

+
+public int colorMode
+
+
+
+
+
+ +

+colorModeX

+
+public float colorModeX
+
+
+
+
+
+ +

+colorModeY

+
+public float colorModeY
+
+
+
+
+
+ +

+colorModeZ

+
+public float colorModeZ
+
+
+
+
+
+ +

+colorModeA

+
+public float colorModeA
+
+
+
+
+
+ +

+tint

+
+public boolean tint
+
+
+
+
+
+ +

+tintColor

+
+public int tintColor
+
+
+
+
+
+ +

+fill

+
+public boolean fill
+
+
+
+
+
+ +

+fillColor

+
+public int fillColor
+
+
+
+
+
+ +

+stroke

+
+public boolean stroke
+
+
+
+
+
+ +

+strokeColor

+
+public int strokeColor
+
+
+
+
+
+ +

+strokeWeight

+
+public float strokeWeight
+
+
+
+
+
+ +

+strokeCap

+
+public int strokeCap
+
+
+
+
+
+ +

+strokeJoin

+
+public int strokeJoin
+
+
+
+
+
+ +

+ambientR

+
+public float ambientR
+
+
+
+
+
+ +

+ambientG

+
+public float ambientG
+
+
+
+
+
+ +

+ambientB

+
+public float ambientB
+
+
+
+
+
+ +

+specularR

+
+public float specularR
+
+
+
+
+
+ +

+specularG

+
+public float specularG
+
+
+
+
+
+ +

+specularB

+
+public float specularB
+
+
+
+
+
+ +

+emissiveR

+
+public float emissiveR
+
+
+
+
+
+ +

+emissiveG

+
+public float emissiveG
+
+
+
+
+
+ +

+emissiveB

+
+public float emissiveB
+
+
+
+
+
+ +

+shininess

+
+public float shininess
+
+
+
+
+
+ +

+textFont

+
+public PFont textFont
+
+
+
+
+
+ +

+textAlign

+
+public int textAlign
+
+
+
+
+
+ +

+textAlignY

+
+public int textAlignY
+
+
+
+
+
+ +

+textMode

+
+public int textMode
+
+
+
+
+
+ +

+textSize

+
+public float textSize
+
+
+
+
+
+ +

+textLeading

+
+public float textLeading
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PStyle

+
+public PStyle()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PTriangle.html b/build/javadoc/core/processing/core/PTriangle.html new file mode 100644 index 000000000..eec565f07 --- /dev/null +++ b/build/javadoc/core/processing/core/PTriangle.html @@ -0,0 +1,643 @@ + + + + + +PTriangle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PTriangle

+
+java.lang.Object
+  extended by processing.core.PTriangle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PTriangle
extends java.lang.Object
implements PConstants
+ + +

+Handles rendering of single (tesselated) triangles in 3D. +

+ Originally written by sami (www.sumea.com) +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanINTERPOLATE_ALPHA + +
+           
+ booleanINTERPOLATE_RGB + +
+           
+ booleanINTERPOLATE_UV + +
+           
+ intm_drawFlags + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PTriangle(PGraphics3D g) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidrender() + +
+          Renders the polygon
+ voidreset() + +
+          Resets polygon attributes
+ voidsetCamVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+          Pass camera-space coordinates for the triangle.
+ voidsetCulling(boolean tf) + +
+          Sets backface culling on/off
+ voidsetIntensities(float r0, + float g0, + float b0, + float a0, + float r1, + float g1, + float b1, + float a1, + float r2, + float g2, + float b2, + float a2) + +
+          Sets vertex intensities in 0xRRGGBBAA format
+static voidsetInterpPower(int pwr) + +
+          Set the power of two used for linear interpolation of texture coordinates.
+ voidsetTexture(PImage image) + +
+          Sets texture image used for the polygon
+ voidsetUV(float[] u, + float[] v) + +
+           
+ voidsetUV(float u0, + float v0, + float u1, + float v1, + float u2, + float v2) + +
+          Sets the UV coordinates of the texture
+ voidsetVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+          Sets vertex coordinates for the triangle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+INTERPOLATE_UV

+
+public boolean INTERPOLATE_UV
+
+
+
+
+
+ +

+INTERPOLATE_RGB

+
+public boolean INTERPOLATE_RGB
+
+
+
+
+
+ +

+INTERPOLATE_ALPHA

+
+public boolean INTERPOLATE_ALPHA
+
+
+
+
+
+ +

+m_drawFlags

+
+public int m_drawFlags
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PTriangle

+
+public PTriangle(PGraphics3D g)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
Resets polygon attributes +

+

+
+
+
+
+
+
+
+ +

+setCulling

+
+public void setCulling(boolean tf)
+
+
Sets backface culling on/off +

+

+
+
+
+
+
+
+
+ +

+setVertices

+
+public void setVertices(float x0,
+                        float y0,
+                        float z0,
+                        float x1,
+                        float y1,
+                        float z1,
+                        float x2,
+                        float y2,
+                        float z2)
+
+
Sets vertex coordinates for the triangle +

+

+
+
+
+
+
+
+
+ +

+setCamVertices

+
+public void setCamVertices(float x0,
+                           float y0,
+                           float z0,
+                           float x1,
+                           float y1,
+                           float z1,
+                           float x2,
+                           float y2,
+                           float z2)
+
+
Pass camera-space coordinates for the triangle. + Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. + Generally this will not need to be called manually, + currently called from PGraphics3D.render_triangles() +

+

+
+
+
+
+
+
+
+ +

+setUV

+
+public void setUV(float u0,
+                  float v0,
+                  float u1,
+                  float v1,
+                  float u2,
+                  float v2)
+
+
Sets the UV coordinates of the texture +

+

+
+
+
+
+
+
+
+ +

+setIntensities

+
+public void setIntensities(float r0,
+                           float g0,
+                           float b0,
+                           float a0,
+                           float r1,
+                           float g1,
+                           float b1,
+                           float a1,
+                           float r2,
+                           float g2,
+                           float b2,
+                           float a2)
+
+
Sets vertex intensities in 0xRRGGBBAA format +

+

+
+
+
+
+
+
+
+ +

+setTexture

+
+public void setTexture(PImage image)
+
+
Sets texture image used for the polygon +

+

+
+
+
+
+
+
+
+ +

+setUV

+
+public void setUV(float[] u,
+                  float[] v)
+
+
+
+
+
+
+
+
+
+ +

+render

+
+public void render()
+
+
Renders the polygon +

+

+
+
+
+
+
+
+
+ +

+setInterpPower

+
+public static void setInterpPower(int pwr)
+
+
Set the power of two used for linear interpolation of texture coordinates. + A true texture coordinate is computed every 2^pwr pixels along a scanline. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/PVector.html b/build/javadoc/core/processing/core/PVector.html new file mode 100644 index 000000000..cdbb3c268 --- /dev/null +++ b/build/javadoc/core/processing/core/PVector.html @@ -0,0 +1,1278 @@ + + + + + +PVector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PVector

+
+java.lang.Object
+  extended by processing.core.PVector
+
+
+
+
public class PVector
extends java.lang.Object
+ + +

+A class to describe a two or three dimensional vector. +

+ The result of all functions are applied to the vector itself, with the + exception of cross(), which returns a new PVector (or writes to a specified + 'target' PVector). That is, add() will add the contents of one vector to + this one. Using add() with additional parameters allows you to put the + result into a new PVector. Functions that act on multiple vectors also + include static versions. Because creating new objects can be computationally + expensive, most functions include an optional 'target' PVector, so that a + new PVector object is not created with each operation. +

+ Initially based on the Vector3D class by Dan Shiffman. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatx + +
+          The x component of the vector.
+ floaty + +
+          The y component of the vector.
+ floatz + +
+          The z component of the vector.
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PVector() + +
+          Constructor for an empty vector: x, y, and z are set to 0.
PVector(float x, + float y) + +
+          Constructor for a 2D vector: z coordinate is set to 0.
PVector(float x, + float y, + float z) + +
+          Constructor for a 3D vector.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(float x, + float y, + float z) + +
+           
+ voidadd(PVector v) + +
+          Add a vector to this vector
+static PVectoradd(PVector v1, + PVector v2) + +
+          Add two vectors
+static PVectoradd(PVector v1, + PVector v2, + PVector target) + +
+          Add two vectors into a target vector
+static floatangleBetween(PVector v1, + PVector v2) + +
+          Calculate the angle between two vectors, using the dot product
+ float[]array() + +
+          Return a representation of this vector as a float array.
+ PVectorcross(PVector v) + +
+          Return a vector composed of the cross product between this and another.
+ PVectorcross(PVector v, + PVector target) + +
+          Perform cross product between this and another vector, and store the + result in 'target'.
+static PVectorcross(PVector v1, + PVector v2, + PVector target) + +
+           
+ floatdist(PVector v) + +
+          Calculate the Euclidean distance between two points (considering a point as a vector object)
+static floatdist(PVector v1, + PVector v2) + +
+          Calculate the Euclidean distance between two points (considering a point as a vector object)
+ voiddiv(float n) + +
+          Divide this vector by a scalar
+ voiddiv(PVector v) + +
+          Divide each element of one vector by the elements of another vector.
+static PVectordiv(PVector v, + float n) + +
+          Divide a vector by a scalar and return the result in a new vector.
+static PVectordiv(PVector v, + float n, + PVector target) + +
+           
+static PVectordiv(PVector v1, + PVector v2) + +
+          Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector.
+static PVectordiv(PVector v1, + PVector v2, + PVector target) + +
+          Divide each element of one vector by the individual elements of another + vector, and write the result into a target vector.
+ floatdot(float x, + float y, + float z) + +
+           
+ floatdot(PVector v) + +
+          Calculate the dot product with another vector
+ PVectorget() + +
+          Get a copy of this vector.
+ float[]get(float[] target) + +
+           
+ floatheading2D() + +
+          Calculate the angle of rotation for this vector (only 2D vectors)
+ voidlimit(float max) + +
+          Limit the magnitude of this vector
+ floatmag() + +
+          Calculate the magnitude (length) of the vector
+ voidmult(float n) + +
+          Multiply this vector by a scalar
+ voidmult(PVector v) + +
+          Multiply each element of one vector by the elements of another vector.
+static PVectormult(PVector v, + float n) + +
+          Multiply a vector by a scalar
+static PVectormult(PVector v, + float n, + PVector target) + +
+          Multiply a vector by a scalar, and write the result into a target PVector.
+static PVectormult(PVector v1, + PVector v2) + +
+          Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector.
+static PVectormult(PVector v1, + PVector v2, + PVector target) + +
+          Multiply each element of one vector by the individual elements of another + vector, and write the result into a target vector.
+ voidnormalize() + +
+          Normalize the vector to length 1 (make it a unit vector)
+ PVectornormalize(PVector target) + +
+          Normalize this vector, storing the result in another vector.
+ voidset(float[] source) + +
+          Set the x, y (and maybe z) coordinates using a float[] array as the source.
+ voidset(float x, + float y, + float z) + +
+          Set x, y, and z coordinates.
+ voidset(PVector v) + +
+          Set x, y, and z coordinates from a Vector3D object.
+ voidsub(float x, + float y, + float z) + +
+           
+ voidsub(PVector v) + +
+          Subtract a vector from this vector
+static PVectorsub(PVector v1, + PVector v2) + +
+          Subtract one vector from another
+static PVectorsub(PVector v1, + PVector v2, + PVector target) + +
+           
+ java.lang.StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+x

+
+public float x
+
+
The x component of the vector. +

+

+
+
+
+ +

+y

+
+public float y
+
+
The y component of the vector. +

+

+
+
+
+ +

+z

+
+public float z
+
+
The z component of the vector. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PVector

+
+public PVector()
+
+
Constructor for an empty vector: x, y, and z are set to 0. +

+

+
+ +

+PVector

+
+public PVector(float x,
+               float y,
+               float z)
+
+
Constructor for a 3D vector. +

+

+
Parameters:
x - the x coordinate.
y - the y coordinate.
z - the y coordinate.
+
+
+ +

+PVector

+
+public PVector(float x,
+               float y)
+
+
Constructor for a 2D vector: z coordinate is set to 0. +

+

+
Parameters:
x - the x coordinate.
y - the y coordinate.
+
+ + + + + + + + +
+Method Detail
+ +

+set

+
+public void set(float x,
+                float y,
+                float z)
+
+
Set x, y, and z coordinates. +

+

+
Parameters:
x - the x coordinate.
y - the y coordinate.
z - the z coordinate.
+
+
+
+ +

+set

+
+public void set(PVector v)
+
+
Set x, y, and z coordinates from a Vector3D object. +

+

+
Parameters:
v - the PVector object to be copied
+
+
+
+ +

+set

+
+public void set(float[] source)
+
+
Set the x, y (and maybe z) coordinates using a float[] array as the source. +

+

+
Parameters:
source - array to copy from
+
+
+
+ +

+get

+
+public PVector get()
+
+
Get a copy of this vector. +

+

+
+
+
+
+ +

+get

+
+public float[] get(float[] target)
+
+
+
+
+
+
+ +

+mag

+
+public float mag()
+
+
Calculate the magnitude (length) of the vector +

+

+ +
Returns:
the magnitude of the vector
+
+
+
+ +

+add

+
+public void add(PVector v)
+
+
Add a vector to this vector +

+

+
Parameters:
v - the vector to be added
+
+
+
+ +

+add

+
+public void add(float x,
+                float y,
+                float z)
+
+
+
+
+
+
+ +

+add

+
+public static PVector add(PVector v1,
+                          PVector v2)
+
+
Add two vectors +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
a new vector that is the sum of v1 and v2
+
+
+
+ +

+add

+
+public static PVector add(PVector v1,
+                          PVector v2,
+                          PVector target)
+
+
Add two vectors into a target vector +

+

+
Parameters:
v1 - a vector
v2 - another vector
target - the target vector (if null, a new vector will be created) +
Returns:
a new vector that is the sum of v1 and v2
+
+
+
+ +

+sub

+
+public void sub(PVector v)
+
+
Subtract a vector from this vector +

+

+
Parameters:
v - the vector to be subtracted
+
+
+
+ +

+sub

+
+public void sub(float x,
+                float y,
+                float z)
+
+
+
+
+
+
+ +

+sub

+
+public static PVector sub(PVector v1,
+                          PVector v2)
+
+
Subtract one vector from another +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
a new vector that is v1 - v2
+
+
+
+ +

+sub

+
+public static PVector sub(PVector v1,
+                          PVector v2,
+                          PVector target)
+
+
+
+
+
+
+ +

+mult

+
+public void mult(float n)
+
+
Multiply this vector by a scalar +

+

+
Parameters:
n - the value to multiply by
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v,
+                           float n)
+
+
Multiply a vector by a scalar +

+

+
Parameters:
v - a vector
n - scalar +
Returns:
a new vector that is v1 * n
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v,
+                           float n,
+                           PVector target)
+
+
Multiply a vector by a scalar, and write the result into a target PVector. +

+

+
Parameters:
v - a vector
n - scalar
target - PVector to store the result +
Returns:
the target vector, now set to v1 * n
+
+
+
+ +

+mult

+
+public void mult(PVector v)
+
+
Multiply each element of one vector by the elements of another vector. +

+

+
Parameters:
v - the vector to multiply by
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v1,
+                           PVector v2)
+
+
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +

+

+
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v1,
+                           PVector v2,
+                           PVector target)
+
+
Multiply each element of one vector by the individual elements of another + vector, and write the result into a target vector. +

+

+
Parameters:
v1 - the first vector
v2 - the second vector
target - PVector to store the result
+
+
+
+ +

+div

+
+public void div(float n)
+
+
Divide this vector by a scalar +

+

+
Parameters:
n - the value to divide by
+
+
+
+ +

+div

+
+public static PVector div(PVector v,
+                          float n)
+
+
Divide a vector by a scalar and return the result in a new vector. +

+

+
Parameters:
v - a vector
n - scalar +
Returns:
a new vector that is v1 / n
+
+
+
+ +

+div

+
+public static PVector div(PVector v,
+                          float n,
+                          PVector target)
+
+
+
+
+
+
+ +

+div

+
+public void div(PVector v)
+
+
Divide each element of one vector by the elements of another vector. +

+

+
+
+
+
+ +

+div

+
+public static PVector div(PVector v1,
+                          PVector v2)
+
+
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +

+

+
+
+
+
+ +

+div

+
+public static PVector div(PVector v1,
+                          PVector v2,
+                          PVector target)
+
+
Divide each element of one vector by the individual elements of another + vector, and write the result into a target vector. +

+

+
Parameters:
v1 - the first vector
v2 - the second vector
target - PVector to store the result
+
+
+
+ +

+dist

+
+public float dist(PVector v)
+
+
Calculate the Euclidean distance between two points (considering a point as a vector object) +

+

+
Parameters:
v - another vector +
Returns:
the Euclidean distance between
+
+
+
+ +

+dist

+
+public static float dist(PVector v1,
+                         PVector v2)
+
+
Calculate the Euclidean distance between two points (considering a point as a vector object) +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
the Euclidean distance between v1 and v2
+
+
+
+ +

+dot

+
+public float dot(PVector v)
+
+
Calculate the dot product with another vector +

+

+ +
Returns:
the dot product
+
+
+
+ +

+dot

+
+public float dot(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+ +

+cross

+
+public PVector cross(PVector v)
+
+
Return a vector composed of the cross product between this and another. +

+

+
+
+
+
+ +

+cross

+
+public PVector cross(PVector v,
+                     PVector target)
+
+
Perform cross product between this and another vector, and store the + result in 'target'. If target is null, a new vector is created. +

+

+
+
+
+
+ +

+cross

+
+public static PVector cross(PVector v1,
+                            PVector v2,
+                            PVector target)
+
+
+
+
+
+
+ +

+normalize

+
+public void normalize()
+
+
Normalize the vector to length 1 (make it a unit vector) +

+

+
+
+
+
+ +

+normalize

+
+public PVector normalize(PVector target)
+
+
Normalize this vector, storing the result in another vector. +

+

+
Parameters:
target - Set to null to create a new vector +
Returns:
a new vector (if target was null), or target
+
+
+
+ +

+limit

+
+public void limit(float max)
+
+
Limit the magnitude of this vector +

+

+
Parameters:
max - the maximum length to limit this vector
+
+
+
+ +

+heading2D

+
+public float heading2D()
+
+
Calculate the angle of rotation for this vector (only 2D vectors) +

+

+ +
Returns:
the angle of rotation
+
+
+
+ +

+angleBetween

+
+public static float angleBetween(PVector v1,
+                                 PVector v2)
+
+
Calculate the angle between two vectors, using the dot product +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
the angle between the vectors
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+
+ +

+array

+
+public float[] array()
+
+
Return a representation of this vector as a float array. This is only for + temporary use. If used in any other fashion, the contents should be copied + by using the get() command to copy into your own array. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/package-frame.html b/build/javadoc/core/processing/core/package-frame.html new file mode 100644 index 000000000..9903befa9 --- /dev/null +++ b/build/javadoc/core/processing/core/package-frame.html @@ -0,0 +1,87 @@ + + + + + +processing.core + + + + + + + + + + + +processing.core + + + + +
+Interfaces  + +
+PConstants +
+PMatrix
+ + + + + + +
+Classes  + +
+PApplet +
+PFont +
+PGraphics +
+PGraphics2D +
+PGraphics3D +
+PGraphicsJava2D +
+PImage +
+PLine +
+PMatrix2D +
+PMatrix3D +
+PPolygon +
+PShape +
+PShapeSVG +
+PSmoothTriangle +
+PStyle +
+PTriangle +
+PVector
+ + + + + + +
+Exceptions  + +
+PApplet.RendererChangeException
+ + + + diff --git a/build/javadoc/core/processing/core/package-summary.html b/build/javadoc/core/processing/core/package-summary.html new file mode 100644 index 000000000..a564fd008 --- /dev/null +++ b/build/javadoc/core/processing/core/package-summary.html @@ -0,0 +1,249 @@ + + + + + +processing.core + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.core +

+ + + + + + + + + + + + + +
+Interface Summary
PConstantsNumbers shared throughout processing.core.
PMatrix 
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
PAppletBase class for all sketches that use processing.core.
PFontGrayscale bitmap font class used by Processing.
PGraphicsMain graphics and rendering context, as well as the base API implementation.
PGraphics2DSubclass of PGraphics that handles fast 2D rendering using a + MemoryImageSource.
PGraphics3DSubclass of PGraphics that handles 3D rendering.
PGraphicsJava2DSubclass for PGraphics that implements the graphics API using Java2D.
PImageStorage class for pixel data.
PLineCode for rendering lines with P2D and P3D.
PMatrix2D3x2 affine matrix implementation.
PMatrix3D4x4 matrix implementation.
PPolygonZ-buffer polygon rendering object used by PGraphics2D.
PShapeIn-progress class to handle shape data, currently to be considered of + alpha or beta quality.
PShapeSVGSVG stands for Scalable Vector Graphics, a portable graphics format.
PSmoothTriangleSmoothed triangle renderer for P3D.
PStyle 
PTriangleHandles rendering of single (tesselated) triangles in 3D.
PVectorA class to describe a two or three dimensional vector.
+  + +

+ + + + + + + + + +
+Exception Summary
PApplet.RendererChangeExceptionException thrown when size() is called the first time.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/core/package-tree.html b/build/javadoc/core/processing/core/package-tree.html new file mode 100644 index 000000000..a26cb9b74 --- /dev/null +++ b/build/javadoc/core/processing/core/package-tree.html @@ -0,0 +1,186 @@ + + + + + +processing.core Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.core +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/StdXMLBuilder.html b/build/javadoc/core/processing/xml/StdXMLBuilder.html new file mode 100644 index 000000000..e23c2a535 --- /dev/null +++ b/build/javadoc/core/processing/xml/StdXMLBuilder.html @@ -0,0 +1,479 @@ + + + + + +StdXMLBuilder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class StdXMLBuilder

+
+java.lang.Object
+  extended by processing.xml.StdXMLBuilder
+
+
+
+
public class StdXMLBuilder
extends java.lang.Object
+ + +

+StdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + tree of IXMLElement from an XML data source. +

+ +

+

+
See Also:
XMLElement
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
StdXMLBuilder() + +
+          Creates the builder.
StdXMLBuilder(XMLElement parent) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddAttribute(java.lang.String key, + java.lang.String nsPrefix, + java.lang.String nsURI, + java.lang.String value, + java.lang.String type) + +
+          This method is called when a new attribute of an XML element is + encountered.
+ voidaddPCData(java.io.Reader reader, + java.lang.String systemID, + int lineNr) + +
+          This method is called when a PCDATA element is encountered.
+ voidelementAttributesProcessed(java.lang.String name, + java.lang.String nsPrefix, + java.lang.String nsURI) + +
+          This method is called when the attributes of an XML element have been + processed.
+ voidendElement(java.lang.String name, + java.lang.String nsPrefix, + java.lang.String nsURI) + +
+          This method is called when the end of an XML elemnt is encountered.
+ java.lang.ObjectgetResult() + +
+          Returns the result of the building process.
+ voidnewProcessingInstruction(java.lang.String target, + java.io.Reader reader) + +
+          This method is called when a processing instruction is encountered.
+ voidstartBuilding(java.lang.String systemID, + int lineNr) + +
+          This method is called before the parser starts processing its input.
+ voidstartElement(java.lang.String name, + java.lang.String nsPrefix, + java.lang.String nsURI, + java.lang.String systemID, + int lineNr) + +
+          This method is called when a new XML element is encountered.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StdXMLBuilder

+
+public StdXMLBuilder()
+
+
Creates the builder. +

+

+
+ +

+StdXMLBuilder

+
+public StdXMLBuilder(XMLElement parent)
+
+
+ + + + + + + + +
+Method Detail
+ +

+startBuilding

+
+public void startBuilding(java.lang.String systemID,
+                          int lineNr)
+
+
This method is called before the parser starts processing its input. +

+

+
Parameters:
systemID - the system ID of the XML data source.
lineNr - the line on which the parsing starts.
+
+
+
+ +

+newProcessingInstruction

+
+public void newProcessingInstruction(java.lang.String target,
+                                     java.io.Reader reader)
+
+
This method is called when a processing instruction is encountered. + PIs with target "xml" are handled by the parser. +

+

+
Parameters:
target - the PI target.
reader - to read the data from the PI.
+
+
+
+ +

+startElement

+
+public void startElement(java.lang.String name,
+                         java.lang.String nsPrefix,
+                         java.lang.String nsURI,
+                         java.lang.String systemID,
+                         int lineNr)
+
+
This method is called when a new XML element is encountered. +

+

+
Parameters:
name - the name of the element.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
systemID - the system ID of the XML data source.
lineNr - the line in the source where the element starts.
See Also:
endElement(java.lang.String, java.lang.String, java.lang.String)
+
+
+
+ +

+elementAttributesProcessed

+
+public void elementAttributesProcessed(java.lang.String name,
+                                       java.lang.String nsPrefix,
+                                       java.lang.String nsURI)
+
+
This method is called when the attributes of an XML element have been + processed. +

+

+
Parameters:
name - the name of the element.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
See Also:
startElement(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int), +addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+
+
+
+ +

+endElement

+
+public void endElement(java.lang.String name,
+                       java.lang.String nsPrefix,
+                       java.lang.String nsURI)
+
+
This method is called when the end of an XML elemnt is encountered. +

+

+
Parameters:
name - the name of the element.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
See Also:
startElement(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int)
+
+
+
+ +

+addAttribute

+
+public void addAttribute(java.lang.String key,
+                         java.lang.String nsPrefix,
+                         java.lang.String nsURI,
+                         java.lang.String value,
+                         java.lang.String type)
+                  throws java.lang.Exception
+
+
This method is called when a new attribute of an XML element is + encountered. +

+

+
Parameters:
key - the key (name) of the attribute.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
value - the value of the attribute.
type - the type of the attribute. If no type is known, + "CDATA" is returned. +
Throws: +
java.lang.Exception - If an exception occurred while processing the event.
+
+
+
+ +

+addPCData

+
+public void addPCData(java.io.Reader reader,
+                      java.lang.String systemID,
+                      int lineNr)
+
+
This method is called when a PCDATA element is encountered. A Java + reader is supplied from which you can read the data. The reader will + only read the data of the element. You don't need to check for + boundaries. If you don't read the full element, the rest of the data + is skipped. You also don't have to care about entities; they are + resolved by the parser. +

+

+
Parameters:
reader - the Java reader from which you can retrieve the data.
systemID - the system ID of the XML data source.
lineNr - the line in the source where the element starts.
+
+
+
+ +

+getResult

+
+public java.lang.Object getResult()
+
+
Returns the result of the building process. This method is called just + before the parse method of StdXMLParser returns. +

+

+ +
Returns:
the result of the building process.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/StdXMLParser.html b/build/javadoc/core/processing/xml/StdXMLParser.html new file mode 100644 index 000000000..4afb200b4 --- /dev/null +++ b/build/javadoc/core/processing/xml/StdXMLParser.html @@ -0,0 +1,431 @@ + + + + + +StdXMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class StdXMLParser

+
+java.lang.Object
+  extended by processing.xml.StdXMLParser
+
+
+
+
public class StdXMLParser
extends java.lang.Object
+ + +

+StdXMLParser is the core parser of NanoXML. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
StdXMLParser() + +
+          Creates a new parser.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ StdXMLBuildergetBuilder() + +
+          Returns the builder which creates the logical structure of the XML data.
+ StdXMLReadergetReader() + +
+          Returns the reader from which the parser retrieves its data.
+ XMLEntityResolvergetResolver() + +
+          Returns the entity resolver.
+ XMLValidatorgetValidator() + +
+          Returns the validator that validates the XML data.
+ java.lang.Objectparse() + +
+          Parses the data and lets the builder create the logical data structure.
+ voidsetBuilder(StdXMLBuilder builder) + +
+          Sets the builder which creates the logical structure of the XML data.
+ voidsetReader(StdXMLReader reader) + +
+          Sets the reader from which the parser retrieves its data.
+ voidsetResolver(XMLEntityResolver resolver) + +
+          Sets the entity resolver.
+ voidsetValidator(XMLValidator validator) + +
+          Sets the validator that validates the XML data.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StdXMLParser

+
+public StdXMLParser()
+
+
Creates a new parser. +

+

+ + + + + + + + +
+Method Detail
+ +

+setBuilder

+
+public void setBuilder(StdXMLBuilder builder)
+
+
Sets the builder which creates the logical structure of the XML data. +

+

+
Parameters:
builder - the non-null builder
+
+
+
+ +

+getBuilder

+
+public StdXMLBuilder getBuilder()
+
+
Returns the builder which creates the logical structure of the XML data. +

+

+ +
Returns:
the builder
+
+
+
+ +

+setValidator

+
+public void setValidator(XMLValidator validator)
+
+
Sets the validator that validates the XML data. +

+

+
Parameters:
validator - the non-null validator
+
+
+
+ +

+getValidator

+
+public XMLValidator getValidator()
+
+
Returns the validator that validates the XML data. +

+

+ +
Returns:
the validator
+
+
+
+ +

+setResolver

+
+public void setResolver(XMLEntityResolver resolver)
+
+
Sets the entity resolver. +

+

+
Parameters:
resolver - the non-null resolver
+
+
+
+ +

+getResolver

+
+public XMLEntityResolver getResolver()
+
+
Returns the entity resolver. +

+

+ +
Returns:
the non-null resolver
+
+
+
+ +

+setReader

+
+public void setReader(StdXMLReader reader)
+
+
Sets the reader from which the parser retrieves its data. +

+

+
Parameters:
reader - the reader
+
+
+
+ +

+getReader

+
+public StdXMLReader getReader()
+
+
Returns the reader from which the parser retrieves its data. +

+

+ +
Returns:
the reader
+
+
+
+ +

+parse

+
+public java.lang.Object parse()
+                       throws XMLException
+
+
Parses the data and lets the builder create the logical data structure. +

+

+ +
Returns:
the logical structure built by the builder +
Throws: +
net.n3.nanoxml.XMLException - if an error occurred reading or parsing the data +
XMLException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/StdXMLReader.html b/build/javadoc/core/processing/xml/StdXMLReader.html new file mode 100644 index 000000000..0c0863b74 --- /dev/null +++ b/build/javadoc/core/processing/xml/StdXMLReader.html @@ -0,0 +1,637 @@ + + + + + +StdXMLReader + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class StdXMLReader

+
+java.lang.Object
+  extended by processing.xml.StdXMLReader
+
+
+
+
public class StdXMLReader
extends java.lang.Object
+ + +

+StdXMLReader reads the data to be parsed. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
StdXMLReader(java.io.InputStream stream) + +
+          Initializes the XML reader.
StdXMLReader(java.io.Reader reader) + +
+          Initializes the XML reader.
StdXMLReader(java.lang.String publicID, + java.lang.String systemID) + +
+          Initializes the reader from a system and public ID.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanatEOF() + +
+          Returns true if there are no more characters left to be read.
+ booleanatEOFOfCurrentStream() + +
+          Returns true if the current stream has no more characters left to be + read.
+static StdXMLReaderfileReader(java.lang.String filename) + +
+          Creates a new reader using a file as input.
+ intgetLineNr() + +
+          Returns the line number of the data in the current stream.
+ java.lang.StringgetPublicID() + +
+          Returns the current public ID.
+ intgetStreamLevel() + +
+          Returns the current "level" of the stream on the stack of streams.
+ java.lang.StringgetSystemID() + +
+          Returns the current system ID.
+ java.io.ReaderopenStream(java.lang.String publicID, + java.lang.String systemID) + +
+          Opens a stream from a public and system ID.
+ charread() + +
+          Reads a character.
+ voidsetPublicID(java.lang.String publicID) + +
+          Sets the public ID of the current stream.
+ voidsetSystemID(java.lang.String systemID) + +
+          Sets the system ID of the current stream.
+ voidstartNewStream(java.io.Reader reader) + +
+          Starts a new stream from a Java reader.
+ voidstartNewStream(java.io.Reader reader, + boolean isInternalEntity) + +
+          Starts a new stream from a Java reader.
+static StdXMLReaderstringReader(java.lang.String str) + +
+          Creates a new reader using a string as input.
+ voidunread(char ch) + +
+          Pushes the last character read back to the stream.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StdXMLReader

+
+public StdXMLReader(java.lang.String publicID,
+                    java.lang.String systemID)
+             throws java.net.MalformedURLException,
+                    java.io.FileNotFoundException,
+                    java.io.IOException
+
+
Initializes the reader from a system and public ID. +

+

+
Parameters:
publicID - the public ID which may be null.
systemID - the non-null system ID. +
Throws: +
java.net.MalformedURLException - if the system ID does not contain a valid URL +
java.io.FileNotFoundException - if the system ID refers to a local file which does not exist +
java.io.IOException - if an error occurred opening the stream
+
+
+ +

+StdXMLReader

+
+public StdXMLReader(java.io.Reader reader)
+
+
Initializes the XML reader. +

+

+
Parameters:
reader - the input for the XML data.
+
+
+ +

+StdXMLReader

+
+public StdXMLReader(java.io.InputStream stream)
+             throws java.io.IOException
+
+
Initializes the XML reader. +

+

+
Parameters:
stream - the input for the XML data. +
Throws: +
java.io.IOException - if an I/O error occurred
+
+ + + + + + + + +
+Method Detail
+ +

+stringReader

+
+public static StdXMLReader stringReader(java.lang.String str)
+
+
Creates a new reader using a string as input. +

+

+
Parameters:
str - the string containing the XML data
+
+
+
+ +

+fileReader

+
+public static StdXMLReader fileReader(java.lang.String filename)
+                               throws java.io.FileNotFoundException,
+                                      java.io.IOException
+
+
Creates a new reader using a file as input. +

+

+
Parameters:
filename - the name of the file containing the XML data +
Throws: +
java.io.FileNotFoundException - if the file could not be found +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+read

+
+public char read()
+          throws java.io.IOException
+
+
Reads a character. +

+

+ +
Returns:
the character +
Throws: +
java.io.IOException - if no character could be read
+
+
+
+ +

+atEOFOfCurrentStream

+
+public boolean atEOFOfCurrentStream()
+                             throws java.io.IOException
+
+
Returns true if the current stream has no more characters left to be + read. +

+

+ +
Throws: +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+atEOF

+
+public boolean atEOF()
+              throws java.io.IOException
+
+
Returns true if there are no more characters left to be read. +

+

+ +
Throws: +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+unread

+
+public void unread(char ch)
+            throws java.io.IOException
+
+
Pushes the last character read back to the stream. +

+

+
Parameters:
ch - the character to push back. +
Throws: +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+openStream

+
+public java.io.Reader openStream(java.lang.String publicID,
+                                 java.lang.String systemID)
+                          throws java.net.MalformedURLException,
+                                 java.io.FileNotFoundException,
+                                 java.io.IOException
+
+
Opens a stream from a public and system ID. +

+

+
Parameters:
publicID - the public ID, which may be null
systemID - the system ID, which is never null +
Throws: +
java.net.MalformedURLException - if the system ID does not contain a valid URL +
java.io.FileNotFoundException - if the system ID refers to a local file which does not exist +
java.io.IOException - if an error occurred opening the stream
+
+
+
+ +

+startNewStream

+
+public void startNewStream(java.io.Reader reader)
+
+
Starts a new stream from a Java reader. The new stream is used + temporary to read data from. If that stream is exhausted, control + returns to the parent stream. +

+

+
Parameters:
reader - the non-null reader to read the new data from
+
+
+
+ +

+startNewStream

+
+public void startNewStream(java.io.Reader reader,
+                           boolean isInternalEntity)
+
+
Starts a new stream from a Java reader. The new stream is used + temporary to read data from. If that stream is exhausted, control + returns to the parent stream. +

+

+
Parameters:
reader - the non-null reader to read the new data from
isInternalEntity - true if the reader is produced by resolving + an internal entity
+
+
+
+ +

+getStreamLevel

+
+public int getStreamLevel()
+
+
Returns the current "level" of the stream on the stack of streams. +

+

+
+
+
+
+ +

+getLineNr

+
+public int getLineNr()
+
+
Returns the line number of the data in the current stream. +

+

+
+
+
+
+ +

+setSystemID

+
+public void setSystemID(java.lang.String systemID)
+                 throws java.net.MalformedURLException
+
+
Sets the system ID of the current stream. +

+

+
Parameters:
systemID - the system ID +
Throws: +
java.net.MalformedURLException - if the system ID does not contain a valid URL
+
+
+
+ +

+setPublicID

+
+public void setPublicID(java.lang.String publicID)
+
+
Sets the public ID of the current stream. +

+

+
Parameters:
publicID - the public ID
+
+
+
+ +

+getSystemID

+
+public java.lang.String getSystemID()
+
+
Returns the current system ID. +

+

+
+
+
+
+ +

+getPublicID

+
+public java.lang.String getPublicID()
+
+
Returns the current public ID. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLElement.html b/build/javadoc/core/processing/xml/XMLElement.html new file mode 100644 index 000000000..c1d65ba73 --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLElement.html @@ -0,0 +1,1829 @@ + + + + + +XMLElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLElement

+
+java.lang.Object
+  extended by processing.xml.XMLElement
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class XMLElement
extends java.lang.Object
implements java.io.Serializable
+ + +

+XMLElement is an XML element. This is the base class used for the + Processing XML library, representing a single node of an XML tree. + + This code is based on a modified version of NanoXML by Marc De Scheemaecker. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Field Summary
+static intNO_LINE + +
+          No line number defined.
+  + + + + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
XMLElement() + +
+          Creates an empty element to be used for #PCDATA content.
XMLElement(PApplet parent, + java.lang.String filename) + +
+          Begin parsing XML data passed in from a PApplet.
XMLElement(java.io.Reader r) + +
+           
XMLElement(java.lang.String xml) + +
+           
XMLElement(java.lang.String fullName, + java.lang.String namespace, + java.lang.String systemID, + int lineNr) + +
+          Creates an empty element.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddChild(XMLElement child) + +
+          Adds a child element.
+ XMLElementcreateElement(java.lang.String fullName, + java.lang.String namespace) + +
+          Creates an empty element.
+ XMLElementcreateElement(java.lang.String fullName, + java.lang.String namespace, + java.lang.String systemID, + int lineNr) + +
+          Creates an empty element.
+ XMLElementcreatePCDataElement() + +
+          Creates an element to be used for #PCDATA content.
+ java.util.Enumeration<java.lang.String>enumerateAttributeNames() + +
+          Returns an enumeration of all attribute names.
+ java.util.Enumeration<XMLElement>enumerateChildren() + +
+          Returns an enumeration of all child elements.
+ booleanequals(java.lang.Object rawElement) + +
+          Returns true if the element equals another element.
+ booleanequalsXMLElement(XMLElement rawElement) + +
+          Returns true if the element equals another element.
+ java.lang.StringgetAttribute(java.lang.String name) + +
+          Returns the value of an attribute.
+ java.lang.StringgetAttribute(java.lang.String name, + java.lang.String defaultValue) + +
+          Returns the value of an attribute.
+ java.lang.StringgetAttribute(java.lang.String name, + java.lang.String namespace, + java.lang.String defaultValue) + +
+          Returns the value of an attribute.
+ intgetAttributeCount() + +
+          Returns the number of attributes.
+ java.lang.StringgetAttributeNamespace(java.lang.String name) + +
+          Returns the namespace of an attribute.
+ java.util.PropertiesgetAttributes() + +
+          Returns all attributes as a Properties object.
+ java.util.PropertiesgetAttributesInNamespace(java.lang.String namespace) + +
+          Returns all attributes in a specific namespace as a Properties object.
+ java.lang.StringgetAttributeType(java.lang.String name) + +
+          Returns the type of an attribute.
+ java.lang.StringgetAttributeType(java.lang.String name, + java.lang.String namespace) + +
+          Returns the type of an attribute.
+ XMLElementgetChild(int which) + +
+          Quick accessor for an element at a particular index.
+ XMLElementgetChild(java.lang.String name) + +
+          Get a child by its name or path.
+ XMLElementgetChildAtIndex(int index) + +
+          Returns the child at a specific index.
+ intgetChildCount() + +
+          Returns the number of children.
+ XMLElement[]getChildren() + +
+          Returns an array containing all the child elements.
+ XMLElement[]getChildren(java.lang.String name) + +
+          Get any children that match this name or path.
+ java.lang.StringgetContent() + +
+          Return the #PCDATA content of the element.
+ doublegetDoubleAttribute(java.lang.String name) + +
+           
+ doublegetDoubleAttribute(java.lang.String name, + double defaultValue) + +
+          Returns the value of an attribute.
+ doublegetDoubleAttribute(java.lang.String name, + java.lang.String namespace, + double defaultValue) + +
+          Returns the value of an attribute.
+ floatgetFloatAttribute(java.lang.String name) + +
+           
+ floatgetFloatAttribute(java.lang.String name, + float defaultValue) + +
+          Returns the value of an attribute.
+ floatgetFloatAttribute(java.lang.String name, + java.lang.String namespace, + float defaultValue) + +
+          Returns the value of an attribute.
+ intgetIntAttribute(java.lang.String name) + +
+           
+ intgetIntAttribute(java.lang.String name, + int defaultValue) + +
+          Returns the value of an attribute.
+ intgetIntAttribute(java.lang.String name, + java.lang.String namespace, + int defaultValue) + +
+          Returns the value of an attribute.
+ intgetLineNr() + +
+          Returns the line number in the data where the element started.
+ java.lang.StringgetLocalName() + +
+          Returns the name of the element.
+ java.lang.StringgetName() + +
+          Returns the full name (i.e.
+ java.lang.StringgetNamespace() + +
+          Returns the namespace of the element.
+ XMLElementgetParent() + +
+          Returns the parent element.
+ java.lang.StringgetStringAttribute(java.lang.String name) + +
+           
+ java.lang.StringgetStringAttribute(java.lang.String name, + java.lang.String defaultValue) + +
+           
+ java.lang.StringgetStringAttribute(java.lang.String name, + java.lang.String namespace, + java.lang.String defaultValue) + +
+           
+ java.lang.StringgetSystemID() + +
+          Returns the system ID of the data where the element started.
+ booleanhasAttribute(java.lang.String name) + +
+          Returns whether an attribute exists.
+ booleanhasAttribute(java.lang.String name, + java.lang.String namespace) + +
+          Returns whether an attribute exists.
+ booleanhasChildren() + +
+          Returns whether the element has children.
+ voidinsertChild(XMLElement child, + int index) + +
+          Inserts a child element.
+ booleanisLeaf() + +
+          Returns whether the element is a leaf element.
+ java.lang.String[]listChildren() + +
+          Put the names of all children into an array.
+ voidremoveAttribute(java.lang.String name) + +
+          Removes an attribute.
+ voidremoveAttribute(java.lang.String name, + java.lang.String namespace) + +
+          Removes an attribute.
+ voidremoveChild(XMLElement child) + +
+          Removes a child element.
+ voidremoveChildAtIndex(int index) + +
+          Removes the child located at a certain index.
+ voidsetAttribute(java.lang.String name, + java.lang.String value) + +
+          Sets an attribute.
+ voidsetAttribute(java.lang.String fullName, + java.lang.String namespace, + java.lang.String value) + +
+          Sets an attribute.
+ voidsetContent(java.lang.String content) + +
+          Sets the #PCDATA content.
+ voidsetName(java.lang.String name) + +
+          Sets the full name.
+ voidsetName(java.lang.String fullName, + java.lang.String namespace) + +
+          Sets the name.
+ java.lang.StringtoString(boolean pretty) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+NO_LINE

+
+public static final int NO_LINE
+
+
No line number defined. +

+

+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+XMLElement

+
+public XMLElement()
+
+
Creates an empty element to be used for #PCDATA content. +

+

+
+ +

+XMLElement

+
+public XMLElement(java.lang.String fullName,
+                  java.lang.String namespace,
+                  java.lang.String systemID,
+                  int lineNr)
+
+
Creates an empty element. +

+

+
Parameters:
fullName - the full name of the element
namespace - the namespace URI.
systemID - the system ID of the XML data where the element starts.
lineNr - the line in the XML data where the element starts.
+
+
+ +

+XMLElement

+
+public XMLElement(PApplet parent,
+                  java.lang.String filename)
+
+
Begin parsing XML data passed in from a PApplet. This code + wraps exception handling, for more advanced exception handling, + use the constructor that takes a Reader or InputStream. +

+

+
Parameters:
filename -
parent -
+
+
+ +

+XMLElement

+
+public XMLElement(java.io.Reader r)
+
+
+
+ +

+XMLElement

+
+public XMLElement(java.lang.String xml)
+
+
+ + + + + + + + +
+Method Detail
+ +

+createPCDataElement

+
+public XMLElement createPCDataElement()
+
+
Creates an element to be used for #PCDATA content. +

+

+
+
+
+
+
+
+
+ +

+createElement

+
+public XMLElement createElement(java.lang.String fullName,
+                                java.lang.String namespace)
+
+
Creates an empty element. +

+

+
+
+
+
Parameters:
fullName - the full name of the element
namespace - the namespace URI.
+
+
+
+ +

+createElement

+
+public XMLElement createElement(java.lang.String fullName,
+                                java.lang.String namespace,
+                                java.lang.String systemID,
+                                int lineNr)
+
+
Creates an empty element. +

+

+
+
+
+
Parameters:
fullName - the full name of the element
namespace - the namespace URI.
systemID - the system ID of the XML data where the element starts.
lineNr - the line in the XML data where the element starts.
+
+
+
+ +

+getParent

+
+public XMLElement getParent()
+
+
Returns the parent element. This method returns null for the root + element. +

+

+
+
+
+
+
+
+
+ +

+getName

+
+public java.lang.String getName()
+
+
Returns the full name (i.e. the name including an eventual namespace + prefix) of the element. +

+

+
+
+
+ +
Returns:
the name, or null if the element only contains #PCDATA.
+
+
+
+ +

+getLocalName

+
+public java.lang.String getLocalName()
+
+
Returns the name of the element. +

+

+
+
+
+ +
Returns:
the name, or null if the element only contains #PCDATA.
+
+
+
+ +

+getNamespace

+
+public java.lang.String getNamespace()
+
+
Returns the namespace of the element. +

+

+
+
+
+ +
Returns:
the namespace, or null if no namespace is associated with the + element.
+
+
+
+ +

+setName

+
+public void setName(java.lang.String name)
+
+
Sets the full name. This method also sets the short name and clears the + namespace URI. +

+

+
+
+
+
Parameters:
name - the non-null name.
+
+
+
+ +

+setName

+
+public void setName(java.lang.String fullName,
+                    java.lang.String namespace)
+
+
Sets the name. +

+

+
+
+
+
Parameters:
fullName - the non-null full name.
namespace - the namespace URI, which may be null.
+
+
+
+ +

+addChild

+
+public void addChild(XMLElement child)
+
+
Adds a child element. +

+

+
+
+
+
Parameters:
child - the non-null child to add.
+
+
+
+ +

+insertChild

+
+public void insertChild(XMLElement child,
+                        int index)
+
+
Inserts a child element. +

+

+
+
+
+
Parameters:
child - the non-null child to add.
index - where to put the child.
+
+
+
+ +

+removeChild

+
+public void removeChild(XMLElement child)
+
+
Removes a child element. +

+

+
+
+
+
Parameters:
child - the non-null child to remove.
+
+
+
+ +

+removeChildAtIndex

+
+public void removeChildAtIndex(int index)
+
+
Removes the child located at a certain index. +

+

+
+
+
+
Parameters:
index - the index of the child, where the first child has index 0.
+
+
+
+ +

+enumerateChildren

+
+public java.util.Enumeration<XMLElement> enumerateChildren()
+
+
Returns an enumeration of all child elements. +

+

+
+
+
+ +
Returns:
the non-null enumeration
+
+
+
+ +

+isLeaf

+
+public boolean isLeaf()
+
+
Returns whether the element is a leaf element. +

+

+
+
+
+ +
Returns:
true if the element has no children.
+
+
+
+ +

+hasChildren

+
+public boolean hasChildren()
+
+
Returns whether the element has children. +

+

+
+
+
+ +
Returns:
true if the element has children.
+
+
+
+ +

+getChildCount

+
+public int getChildCount()
+
+
Returns the number of children. +

+

+
+
+
+ +
Returns:
the count.
+
+
+
+ +

+listChildren

+
+public java.lang.String[] listChildren()
+
+
Put the names of all children into an array. Same as looping through + each child and calling getName() on each XMLElement. +

+

+
+
+
+
+
+
+
+ +

+getChildren

+
+public XMLElement[] getChildren()
+
+
Returns an array containing all the child elements. +

+

+
+
+
+
+
+
+
+ +

+getChild

+
+public XMLElement getChild(int which)
+
+
Quick accessor for an element at a particular index. +

+

+
+
+
+
+
+
+
+ +

+getChild

+
+public XMLElement getChild(java.lang.String name)
+
+
Get a child by its name or path. +

+

+
+
+
+
Parameters:
name - element name or path/to/element +
Returns:
the element
+
+
+
+ +

+getChildAtIndex

+
+public XMLElement getChildAtIndex(int index)
+                           throws java.lang.ArrayIndexOutOfBoundsException
+
+
Returns the child at a specific index. +

+

+
+
+
+
Parameters:
index - the index of the child +
Returns:
the non-null child +
Throws: +
java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.
+
+
+
+ +

+getChildren

+
+public XMLElement[] getChildren(java.lang.String name)
+
+
Get any children that match this name or path. Similar to getChild(), + but will grab multiple matches rather than only the first. +

+

+
+
+
+
Parameters:
name - element name or path/to/element +
Returns:
array of child elements that match
+
+
+
+ +

+getAttributeCount

+
+public int getAttributeCount()
+
+
Returns the number of attributes. +

+

+
+
+
+
+
+
+
+ +

+getAttribute

+
+public java.lang.String getAttribute(java.lang.String name)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute. +
Returns:
the value, or null if the attribute does not exist.
+
+
+
+ +

+getAttribute

+
+public java.lang.String getAttribute(java.lang.String name,
+                                     java.lang.String defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getAttribute

+
+public java.lang.String getAttribute(java.lang.String name,
+                                     java.lang.String namespace,
+                                     java.lang.String defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getStringAttribute

+
+public java.lang.String getStringAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getStringAttribute

+
+public java.lang.String getStringAttribute(java.lang.String name,
+                                           java.lang.String defaultValue)
+
+
+
+
+
+
+
+
+
+ +

+getStringAttribute

+
+public java.lang.String getStringAttribute(java.lang.String name,
+                                           java.lang.String namespace,
+                                           java.lang.String defaultValue)
+
+
+
+
+
+
+
+
+
+ +

+getIntAttribute

+
+public int getIntAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getIntAttribute

+
+public int getIntAttribute(java.lang.String name,
+                           int defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getIntAttribute

+
+public int getIntAttribute(java.lang.String name,
+                           java.lang.String namespace,
+                           int defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getFloatAttribute

+
+public float getFloatAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getFloatAttribute

+
+public float getFloatAttribute(java.lang.String name,
+                               float defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getFloatAttribute

+
+public float getFloatAttribute(java.lang.String name,
+                               java.lang.String namespace,
+                               float defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getDoubleAttribute

+
+public double getDoubleAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getDoubleAttribute

+
+public double getDoubleAttribute(java.lang.String name,
+                                 double defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getDoubleAttribute

+
+public double getDoubleAttribute(java.lang.String name,
+                                 java.lang.String namespace,
+                                 double defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getAttributeType

+
+public java.lang.String getAttributeType(java.lang.String name)
+
+
Returns the type of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute. +
Returns:
the type, or null if the attribute does not exist.
+
+
+
+ +

+getAttributeNamespace

+
+public java.lang.String getAttributeNamespace(java.lang.String name)
+
+
Returns the namespace of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute. +
Returns:
the namespace, or null if there is none associated.
+
+
+
+ +

+getAttributeType

+
+public java.lang.String getAttributeType(java.lang.String name,
+                                         java.lang.String namespace)
+
+
Returns the type of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null. +
Returns:
the type, or null if the attribute does not exist.
+
+
+
+ +

+setAttribute

+
+public void setAttribute(java.lang.String name,
+                         java.lang.String value)
+
+
Sets an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
value - the non-null value of the attribute.
+
+
+
+ +

+setAttribute

+
+public void setAttribute(java.lang.String fullName,
+                         java.lang.String namespace,
+                         java.lang.String value)
+
+
Sets an attribute. +

+

+
+
+
+
Parameters:
fullName - the non-null full name of the attribute.
namespace - the namespace URI of the attribute, which may be null.
value - the non-null value of the attribute.
+
+
+
+ +

+removeAttribute

+
+public void removeAttribute(java.lang.String name)
+
+
Removes an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
+
+
+
+ +

+removeAttribute

+
+public void removeAttribute(java.lang.String name,
+                            java.lang.String namespace)
+
+
Removes an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI of the attribute, which may be null.
+
+
+
+ +

+enumerateAttributeNames

+
+public java.util.Enumeration<java.lang.String> enumerateAttributeNames()
+
+
Returns an enumeration of all attribute names. +

+

+
+
+
+ +
Returns:
the non-null enumeration.
+
+
+
+ +

+hasAttribute

+
+public boolean hasAttribute(java.lang.String name)
+
+
Returns whether an attribute exists. +

+

+
+
+
+ +
Returns:
true if the attribute exists.
+
+
+
+ +

+hasAttribute

+
+public boolean hasAttribute(java.lang.String name,
+                            java.lang.String namespace)
+
+
Returns whether an attribute exists. +

+

+
+
+
+ +
Returns:
true if the attribute exists.
+
+
+
+ +

+getAttributes

+
+public java.util.Properties getAttributes()
+
+
Returns all attributes as a Properties object. +

+

+
+
+
+ +
Returns:
the non-null set.
+
+
+
+ +

+getAttributesInNamespace

+
+public java.util.Properties getAttributesInNamespace(java.lang.String namespace)
+
+
Returns all attributes in a specific namespace as a Properties object. +

+

+
+
+
+
Parameters:
namespace - the namespace URI of the attributes, which may be null. +
Returns:
the non-null set.
+
+
+
+ +

+getSystemID

+
+public java.lang.String getSystemID()
+
+
Returns the system ID of the data where the element started. +

+

+
+
+
+ +
Returns:
the system ID, or null if unknown.
See Also:
getLineNr()
+
+
+
+ +

+getLineNr

+
+public int getLineNr()
+
+
Returns the line number in the data where the element started. +

+

+
+
+
+ +
Returns:
the line number, or NO_LINE if unknown.
See Also:
NO_LINE, +getSystemID()
+
+
+
+ +

+getContent

+
+public java.lang.String getContent()
+
+
Return the #PCDATA content of the element. If the element has a + combination of #PCDATA content and child elements, the #PCDATA + sections can be retrieved as unnamed child objects. In this case, + this method returns null. +

+

+
+
+
+ +
Returns:
the content.
+
+
+
+ +

+setContent

+
+public void setContent(java.lang.String content)
+
+
Sets the #PCDATA content. It is an error to call this method with a + non-null value if there are child objects. +

+

+
+
+
+
Parameters:
content - the (possibly null) content.
+
+
+
+ +

+equals

+
+public boolean equals(java.lang.Object rawElement)
+
+
Returns true if the element equals another element. +

+

+
Overrides:
equals in class java.lang.Object
+
+
+
Parameters:
rawElement - the element to compare to
+
+
+
+ +

+equalsXMLElement

+
+public boolean equalsXMLElement(XMLElement rawElement)
+
+
Returns true if the element equals another element. +

+

+
+
+
+
Parameters:
rawElement - the element to compare to
+
+
+
+ +

+toString

+
+public java.lang.String toString(boolean pretty)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLEntityResolver.html b/build/javadoc/core/processing/xml/XMLEntityResolver.html new file mode 100644 index 000000000..6dd8bf5b6 --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLEntityResolver.html @@ -0,0 +1,329 @@ + + + + + +XMLEntityResolver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLEntityResolver

+
+java.lang.Object
+  extended by processing.xml.XMLEntityResolver
+
+
+
+
public class XMLEntityResolver
extends java.lang.Object
+ + +

+An XMLEntityResolver resolves entities. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
XMLEntityResolver() + +
+          Initializes the resolver.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddExternalEntity(java.lang.String name, + java.lang.String publicID, + java.lang.String systemID) + +
+          Adds an external entity.
+ voidaddInternalEntity(java.lang.String name, + java.lang.String value) + +
+          Adds an internal entity.
+ java.io.ReadergetEntity(StdXMLReader xmlReader, + java.lang.String name) + +
+          Returns a Java reader containing the value of an entity.
+ booleanisExternalEntity(java.lang.String name) + +
+          Returns true if an entity is external.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLEntityResolver

+
+public XMLEntityResolver()
+
+
Initializes the resolver. +

+

+ + + + + + + + +
+Method Detail
+ +

+addInternalEntity

+
+public void addInternalEntity(java.lang.String name,
+                              java.lang.String value)
+
+
Adds an internal entity. +

+

+
Parameters:
name - the name of the entity.
value - the value of the entity.
+
+
+
+ +

+addExternalEntity

+
+public void addExternalEntity(java.lang.String name,
+                              java.lang.String publicID,
+                              java.lang.String systemID)
+
+
Adds an external entity. +

+

+
Parameters:
name - the name of the entity.
publicID - the public ID of the entity, which may be null.
systemID - the system ID of the entity.
+
+
+
+ +

+getEntity

+
+public java.io.Reader getEntity(StdXMLReader xmlReader,
+                                java.lang.String name)
+                         throws XMLParseException
+
+
Returns a Java reader containing the value of an entity. +

+

+
Parameters:
xmlReader - the current XML reader
name - the name of the entity. +
Returns:
the reader, or null if the entity could not be resolved. +
Throws: +
XMLParseException
+
+
+
+ +

+isExternalEntity

+
+public boolean isExternalEntity(java.lang.String name)
+
+
Returns true if an entity is external. +

+

+
Parameters:
name - the name of the entity.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLException.html b/build/javadoc/core/processing/xml/XMLException.html new file mode 100644 index 000000000..48cdd0b2b --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLException.html @@ -0,0 +1,512 @@ + + + + + +XMLException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.xml.XMLException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
Direct Known Subclasses:
XMLParseException, XMLValidationException
+
+
+
+
public class XMLException
extends java.lang.Exception
+ + +

+An XMLException is thrown when an exception occurred while processing the + XML data. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
XMLException(java.lang.Exception e) + +
+          Creates a new exception.
XMLException(java.lang.String msg) + +
+          Creates a new exception.
XMLException(java.lang.String systemID, + int lineNr, + java.lang.Exception e) + +
+          Creates a new exception.
XMLException(java.lang.String systemID, + int lineNr, + java.lang.Exception e, + java.lang.String msg, + boolean reportParams) + +
+          Creates a new exception.
XMLException(java.lang.String systemID, + int lineNr, + java.lang.String msg) + +
+          Creates a new exception.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.ExceptiongetException() + +
+          Returns the encapsulated exception, or null if no exception is + encapsulated.
+ intgetLineNr() + +
+          Returns the line number in the XML data where the exception occurred.
+ java.lang.StringgetSystemID() + +
+          Returns the system ID of the XML data where the exception occurred.
+ voidprintStackTrace() + +
+          Dumps the exception stack to System.err.
+ voidprintStackTrace(java.io.PrintStream stream) + +
+          Dumps the exception stack to an output stream.
+ voidprintStackTrace(java.io.PrintWriter writer) + +
+          Dumps the exception stack to a print writer.
+ java.lang.StringtoString() + +
+          Returns a string representation of the exception.
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLException

+
+public XMLException(java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
msg - the message of the exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.Exception e)
+
+
Creates a new exception. +

+

+
Parameters:
e - the encapsulated exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.String systemID,
+                    int lineNr,
+                    java.lang.Exception e)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID of the XML data where the exception + occurred
lineNr - the line number in the XML data where the exception + occurred.
e - the encapsulated exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.String systemID,
+                    int lineNr,
+                    java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID of the XML data where the exception + occurred
lineNr - the line number in the XML data where the exception + occurred.
msg - the message of the exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.String systemID,
+                    int lineNr,
+                    java.lang.Exception e,
+                    java.lang.String msg,
+                    boolean reportParams)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the exception + occurred.
e - the encapsulated exception.
msg - the message of the exception.
reportParams - true if the systemID, lineNr and e params need to be + appended to the message
+
+ + + + + + + + +
+Method Detail
+ +

+getSystemID

+
+public java.lang.String getSystemID()
+
+
Returns the system ID of the XML data where the exception occurred. + If there is no system ID known, null is returned. +

+

+
+
+
+
+ +

+getLineNr

+
+public int getLineNr()
+
+
Returns the line number in the XML data where the exception occurred. + If there is no line number known, -1 is returned. +

+

+
+
+
+
+ +

+getException

+
+public java.lang.Exception getException()
+
+
Returns the encapsulated exception, or null if no exception is + encapsulated. +

+

+
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace(java.io.PrintWriter writer)
+
+
Dumps the exception stack to a print writer. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
Parameters:
writer - the print writer
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace(java.io.PrintStream stream)
+
+
Dumps the exception stack to an output stream. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
Parameters:
stream - the output stream
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace()
+
+
Dumps the exception stack to System.err. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
Returns a string representation of the exception. +

+

+
Overrides:
toString in class java.lang.Throwable
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLParseException.html b/build/javadoc/core/processing/xml/XMLParseException.html new file mode 100644 index 000000000..2332c23bb --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLParseException.html @@ -0,0 +1,276 @@ + + + + + +XMLParseException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLParseException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.xml.XMLException
+              extended by processing.xml.XMLParseException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class XMLParseException
extends XMLException
+ + +

+An XMLParseException is thrown when the XML passed to the XML parser is not + well-formed. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
XMLParseException(java.lang.String msg) + +
+          Creates a new exception.
XMLParseException(java.lang.String systemID, + int lineNr, + java.lang.String msg) + +
+          Creates a new exception.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class processing.xml.XMLException
getException, getLineNr, getSystemID, printStackTrace, printStackTrace, printStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLParseException

+
+public XMLParseException(java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
msg - the message of the exception.
+
+
+ +

+XMLParseException

+
+public XMLParseException(java.lang.String systemID,
+                         int lineNr,
+                         java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the exception + occurred.
msg - the message of the exception.
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLValidationException.html b/build/javadoc/core/processing/xml/XMLValidationException.html new file mode 100644 index 000000000..d73f6475c --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLValidationException.html @@ -0,0 +1,519 @@ + + + + + +XMLValidationException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLValidationException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.xml.XMLException
+              extended by processing.xml.XMLValidationException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class XMLValidationException
extends XMLException
+ + +

+An XMLValidationException is thrown when the XML passed to the XML parser is + well-formed but not valid. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intATTRIBUTE_WITH_INVALID_VALUE + +
+          An attribute has an invalid value.
+static intMISC_ERROR + +
+          Another error than those specified in this class was encountered.
+static intMISSING_ATTRIBUTE + +
+          An attribute was missing.
+static intMISSING_ELEMENT + +
+          An element was missing.
+static intMISSING_PCDATA + +
+          A PCDATA element was missing.
+static intUNEXPECTED_ATTRIBUTE + +
+          An unexpected attribute was encountered.
+static intUNEXPECTED_ELEMENT + +
+          An unexpected element was encountered.
+static intUNEXPECTED_PCDATA + +
+          An unexpected PCDATA element was encountered.
+  + + + + + + + + + + +
+Constructor Summary
XMLValidationException(int errorType, + java.lang.String systemID, + int lineNr, + java.lang.String elementName, + java.lang.String attributeName, + java.lang.String attributeValue, + java.lang.String msg) + +
+          Creates a new exception.
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetAttributeName() + +
+          Returns the name of the attribute in which the validation is violated.
+ java.lang.StringgetAttributeValue() + +
+          Returns the value of the attribute in which the validation is violated.
+ java.lang.StringgetElementName() + +
+          Returns the name of the element in which the validation is violated.
+ + + + + + + +
Methods inherited from class processing.xml.XMLException
getException, getLineNr, getSystemID, printStackTrace, printStackTrace, printStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+MISSING_ELEMENT

+
+public static final int MISSING_ELEMENT
+
+
An element was missing. +

+

+
See Also:
Constant Field Values
+
+
+ +

+UNEXPECTED_ELEMENT

+
+public static final int UNEXPECTED_ELEMENT
+
+
An unexpected element was encountered. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MISSING_ATTRIBUTE

+
+public static final int MISSING_ATTRIBUTE
+
+
An attribute was missing. +

+

+
See Also:
Constant Field Values
+
+
+ +

+UNEXPECTED_ATTRIBUTE

+
+public static final int UNEXPECTED_ATTRIBUTE
+
+
An unexpected attribute was encountered. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ATTRIBUTE_WITH_INVALID_VALUE

+
+public static final int ATTRIBUTE_WITH_INVALID_VALUE
+
+
An attribute has an invalid value. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MISSING_PCDATA

+
+public static final int MISSING_PCDATA
+
+
A PCDATA element was missing. +

+

+
See Also:
Constant Field Values
+
+
+ +

+UNEXPECTED_PCDATA

+
+public static final int UNEXPECTED_PCDATA
+
+
An unexpected PCDATA element was encountered. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MISC_ERROR

+
+public static final int MISC_ERROR
+
+
Another error than those specified in this class was encountered. +

+

+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+XMLValidationException

+
+public XMLValidationException(int errorType,
+                              java.lang.String systemID,
+                              int lineNr,
+                              java.lang.String elementName,
+                              java.lang.String attributeName,
+                              java.lang.String attributeValue,
+                              java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
errorType - the type of validity error
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the + exception occurred.
elementName - the name of the offending element
attributeName - the name of the offending attribute
attributeValue - the value of the offending attribute
msg - the message of the exception.
+
+ + + + + + + + +
+Method Detail
+ +

+getElementName

+
+public java.lang.String getElementName()
+
+
Returns the name of the element in which the validation is violated. + If there is no current element, null is returned. +

+

+
+
+
+
+ +

+getAttributeName

+
+public java.lang.String getAttributeName()
+
+
Returns the name of the attribute in which the validation is violated. + If there is no current attribute, null is returned. +

+

+
+
+
+
+ +

+getAttributeValue

+
+public java.lang.String getAttributeValue()
+
+
Returns the value of the attribute in which the validation is violated. + If there is no current attribute, null is returned. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLValidator.html b/build/javadoc/core/processing/xml/XMLValidator.html new file mode 100644 index 000000000..9649cf9a1 --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLValidator.html @@ -0,0 +1,441 @@ + + + + + +XMLValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLValidator

+
+java.lang.Object
+  extended by processing.xml.XMLValidator
+
+
+
+
public class XMLValidator
extends java.lang.Object
+ + +

+XMLValidator implementation based on NonValidator (which implemented + IXMLValidator in the original NanoXML). + This implementation processes the DTD and handles entity definitions. + It does not do any validation itself. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
XMLValidator() + +
+          Creates the "validator".
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidattributeAdded(java.lang.String key, + java.lang.String value, + java.lang.String systemId, + int lineNr) + +
+          Indicates that an attribute has been added to the current element.
+ voidelementAttributesProcessed(java.lang.String name, + java.util.Properties extraAttributes, + java.lang.String systemId, + int lineNr) + +
+          This method is called when the attributes of an XML element have been + processed.
+ voidelementEnded(java.lang.String name, + java.lang.String systemId, + int lineNr) + +
+          Indicates that the current element has ended.
+ voidelementStarted(java.lang.String name, + java.lang.String systemId, + int lineNr) + +
+          Indicates that an element has been started.
+ XMLEntityResolvergetParameterEntityResolver() + +
+          Returns the parameter entity resolver.
+ voidparseDTD(java.lang.String publicID, + StdXMLReader reader, + XMLEntityResolver entityResolver, + boolean external) + +
+          Parses the DTD.
+ voidPCDataAdded(java.lang.String systemId, + int lineNr) + +
+          Indicates that a new #PCDATA element has been encountered.
+ voidsetParameterEntityResolver(XMLEntityResolver resolver) + +
+          Sets the parameter entity resolver.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLValidator

+
+public XMLValidator()
+
+
Creates the "validator". +

+

+ + + + + + + + +
+Method Detail
+ +

+setParameterEntityResolver

+
+public void setParameterEntityResolver(XMLEntityResolver resolver)
+
+
Sets the parameter entity resolver. +

+

+
Parameters:
resolver - the entity resolver.
+
+
+
+ +

+getParameterEntityResolver

+
+public XMLEntityResolver getParameterEntityResolver()
+
+
Returns the parameter entity resolver. +

+

+ +
Returns:
the entity resolver.
+
+
+
+ +

+parseDTD

+
+public void parseDTD(java.lang.String publicID,
+                     StdXMLReader reader,
+                     XMLEntityResolver entityResolver,
+                     boolean external)
+              throws java.lang.Exception
+
+
Parses the DTD. The validator object is responsible for reading the + full DTD. +

+

+
Parameters:
publicID - the public ID, which may be null.
reader - the reader to read the DTD from.
entityResolver - the entity resolver.
external - true if the DTD is external. +
Throws: +
java.lang.Exception - If something went wrong.
+
+
+
+ +

+elementStarted

+
+public void elementStarted(java.lang.String name,
+                           java.lang.String systemId,
+                           int lineNr)
+
+
Indicates that an element has been started. +

+

+
Parameters:
name - the name of the element.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+elementEnded

+
+public void elementEnded(java.lang.String name,
+                         java.lang.String systemId,
+                         int lineNr)
+
+
Indicates that the current element has ended. +

+

+
Parameters:
name - the name of the element.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+elementAttributesProcessed

+
+public void elementAttributesProcessed(java.lang.String name,
+                                       java.util.Properties extraAttributes,
+                                       java.lang.String systemId,
+                                       int lineNr)
+
+
This method is called when the attributes of an XML element have been + processed. + If there are attributes with a default value which have not been + specified yet, they have to be put into extraAttributes. +

+

+
Parameters:
name - the name of the element.
extraAttributes - where to put extra attributes.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+attributeAdded

+
+public void attributeAdded(java.lang.String key,
+                           java.lang.String value,
+                           java.lang.String systemId,
+                           int lineNr)
+
+
Indicates that an attribute has been added to the current element. +

+

+
Parameters:
key - the name of the attribute.
value - the value of the attribute.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+PCDataAdded

+
+public void PCDataAdded(java.lang.String systemId,
+                        int lineNr)
+
+
Indicates that a new #PCDATA element has been encountered. +

+

+
Parameters:
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/XMLWriter.html b/build/javadoc/core/processing/xml/XMLWriter.html new file mode 100644 index 000000000..0f7242177 --- /dev/null +++ b/build/javadoc/core/processing/xml/XMLWriter.html @@ -0,0 +1,364 @@ + + + + + +XMLWriter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLWriter

+
+java.lang.Object
+  extended by processing.xml.XMLWriter
+
+
+
+
public class XMLWriter
extends java.lang.Object
+ + +

+An XMLWriter writes XML data to a stream. +

+ +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
XMLWriter(java.io.OutputStream stream) + +
+          Creates a new XML writer.
XMLWriter(java.io.Writer writer) + +
+          Creates a new XML writer.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidwrite(XMLElement xml) + +
+          Writes an XML element.
+ voidwrite(XMLElement xml, + boolean prettyPrint) + +
+          Writes an XML element.
+ voidwrite(XMLElement xml, + boolean prettyPrint, + int indent) + +
+          Writes an XML element.
+ voidwrite(XMLElement xml, + boolean prettyPrint, + int indent, + boolean collapseEmptyElements) + +
+          Writes an XML element.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLWriter

+
+public XMLWriter(java.io.Writer writer)
+
+
Creates a new XML writer. +

+

+
Parameters:
writer - where to write the output to.
+
+
+ +

+XMLWriter

+
+public XMLWriter(java.io.OutputStream stream)
+
+
Creates a new XML writer. +

+

+
Parameters:
stream - where to write the output to.
+
+ + + + + + + + +
+Method Detail
+ +

+write

+
+public void write(XMLElement xml)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write. +
Throws: +
java.io.IOException
+
+
+
+ +

+write

+
+public void write(XMLElement xml,
+                  boolean prettyPrint)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write.
prettyPrint - if spaces need to be inserted to make the output more + readable +
Throws: +
java.io.IOException
+
+
+
+ +

+write

+
+public void write(XMLElement xml,
+                  boolean prettyPrint,
+                  int indent)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write.
prettyPrint - if spaces need to be inserted to make the output more + readable
indent - how many spaces to indent the element. +
Throws: +
java.io.IOException
+
+
+
+ +

+write

+
+public void write(XMLElement xml,
+                  boolean prettyPrint,
+                  int indent,
+                  boolean collapseEmptyElements)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write.
prettyPrint - if spaces need to be inserted to make the output more + readable
indent - how many spaces to indent the element. +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/package-frame.html b/build/javadoc/core/processing/xml/package-frame.html new file mode 100644 index 000000000..3e9262294 --- /dev/null +++ b/build/javadoc/core/processing/xml/package-frame.html @@ -0,0 +1,58 @@ + + + + + +processing.xml + + + + + + + + + + + +processing.xml + + + + +
+Classes  + +
+StdXMLBuilder +
+StdXMLParser +
+StdXMLReader +
+XMLElement +
+XMLEntityResolver +
+XMLValidator +
+XMLWriter
+ + + + + + +
+Exceptions  + +
+XMLException +
+XMLParseException +
+XMLValidationException
+ + + + diff --git a/build/javadoc/core/processing/xml/package-summary.html b/build/javadoc/core/processing/xml/package-summary.html new file mode 100644 index 000000000..206b1e5ea --- /dev/null +++ b/build/javadoc/core/processing/xml/package-summary.html @@ -0,0 +1,202 @@ + + + + + +processing.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.xml +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
StdXMLBuilderStdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + tree of IXMLElement from an XML data source.
StdXMLParserStdXMLParser is the core parser of NanoXML.
StdXMLReaderStdXMLReader reads the data to be parsed.
XMLElementXMLElement is an XML element.
XMLEntityResolverAn XMLEntityResolver resolves entities.
XMLValidatorXMLValidator implementation based on NonValidator (which implemented + IXMLValidator in the original NanoXML).
XMLWriterAn XMLWriter writes XML data to a stream.
+  + +

+ + + + + + + + + + + + + + + + + +
+Exception Summary
XMLExceptionAn XMLException is thrown when an exception occurred while processing the + XML data.
XMLParseExceptionAn XMLParseException is thrown when the XML passed to the XML parser is not + well-formed.
XMLValidationExceptionAn XMLValidationException is thrown when the XML passed to the XML parser is + well-formed but not valid.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/processing/xml/package-tree.html b/build/javadoc/core/processing/xml/package-tree.html new file mode 100644 index 000000000..2d29ebb8a --- /dev/null +++ b/build/javadoc/core/processing/xml/package-tree.html @@ -0,0 +1,154 @@ + + + + + +processing.xml Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.xml +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/resources/inherit.gif b/build/javadoc/core/resources/inherit.gif new file mode 100644 index 000000000..c814867a1 Binary files /dev/null and b/build/javadoc/core/resources/inherit.gif differ diff --git a/build/javadoc/core/serialized-form.html b/build/javadoc/core/serialized-form.html new file mode 100644 index 000000000..b74fc64ad --- /dev/null +++ b/build/javadoc/core/serialized-form.html @@ -0,0 +1,1207 @@ + + + + + +Serialized Form + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Serialized Form

+
+
+ + + + + +
+Package processing.core
+ +

+ + + + + +
+Class processing.core.PApplet extends java.applet.Applet implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+g

+
+PGraphics g
+
+
The PGraphics renderer associated with this PApplet +

+

+
+
+
+

+frame

+
+java.awt.Frame frame
+
+
The frame containing this applet (if any) +

+

+
+
+
+

+screen

+
+java.awt.Dimension screen
+
+
The screen size when the applet was started. +

+ Access this via screen.width and screen.height. To make an applet + run at full screen, use size(screen.width, screen.height). +

+ If you have multiple displays, this will be the size of the main + display. Running full screen across multiple displays isn't + particularly supported, and requires more monkeying with the values. + This probably can't/won't be fixed until/unless I get a dual head + system. +

+ Note that this won't update if you change the resolution + of your screen once the the applet is running. +

+ This variable is not static, because future releases need to be better + at handling multiple displays. +

+

+
+
+
+

+recorder

+
+PGraphics recorder
+
+
A leech graphics object that is echoing all events. +

+

+
+
+
+

+args

+
+java.lang.String[] args
+
+
Command line options passed in from main(). +

+ This does not include the arguments passed in to PApplet itself. +

+

+
+
+
+

+sketchPath

+
+java.lang.String sketchPath
+
+
Path to sketch folder +

+

+
+
+
+

+defaultSize

+
+boolean defaultSize
+
+
true if no size() command has been executed. This is used to wait until + a size has been set before placing in the window and showing it. +

+

+
+
+
+

+resizeRequest

+
+boolean resizeRequest
+
+
+
+
+
+

+resizeWidth

+
+int resizeWidth
+
+
+
+
+
+

+resizeHeight

+
+int resizeHeight
+
+
+
+
+
+

+pixels

+
+int[] pixels
+
+
Pixel buffer from this applet's PGraphics. +

+ When used with OpenGL or Java2D, this value will + be null until loadPixels() has been called. +

+

+
+
+
+

+width

+
+int width
+
+
width of this applet's associated PGraphics +

+

+
+
+
+

+height

+
+int height
+
+
height of this applet's associated PGraphics +

+

+
+
+
+

+mouseX

+
+int mouseX
+
+
current x position of the mouse +

+

+
+
+
+

+mouseY

+
+int mouseY
+
+
current y position of the mouse +

+

+
+
+
+

+pmouseX

+
+int pmouseX
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+

+pmouseY

+
+int pmouseY
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+

+dmouseX

+
+int dmouseX
+
+
previous mouseX/Y for the draw loop, separated out because this is + separate from the pmouseX/Y when inside the mouse event handlers. +

+

+
+
+
+

+dmouseY

+
+int dmouseY
+
+
previous mouseX/Y for the draw loop, separated out because this is + separate from the pmouseX/Y when inside the mouse event handlers. +

+

+
+
+
+

+emouseX

+
+int emouseX
+
+
pmouseX/Y for the event handlers (mousePressed(), mouseDragged() etc) + these are different because mouse events are queued to the end of + draw, so the previous position has to be updated on each event, + as opposed to the pmouseX/Y that's used inside draw, which is expected + to be updated once per trip through draw(). +

+

+
+
+
+

+emouseY

+
+int emouseY
+
+
pmouseX/Y for the event handlers (mousePressed(), mouseDragged() etc) + these are different because mouse events are queued to the end of + draw, so the previous position has to be updated on each event, + as opposed to the pmouseX/Y that's used inside draw, which is expected + to be updated once per trip through draw(). +

+

+
+
+
+

+firstMouse

+
+boolean firstMouse
+
+
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump. +

+ Just using (frameCount == 0) won't work since mouseXxxxx() + may not be called until a couple frames into things. +

+

+
+
+
+

+mouseButton

+
+int mouseButton
+
+
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. +

+ If running on Mac OS, a ctrl-click will be interpreted as + the righthand mouse button (unlike Java, which reports it as + the left mouse). +

+

+
+
+
+

+mousePressed

+
+boolean mousePressed
+
+
+
+
+
+

+mouseEvent

+
+java.awt.event.MouseEvent mouseEvent
+
+
+
+
+
+

+key

+
+char key
+
+
Last key pressed. +

+ If it's a coded key, i.e. UP/DOWN/CTRL/SHIFT/ALT, + this will be set to CODED (0xffff or 65535). +

+

+
+
+
+

+keyCode

+
+int keyCode
+
+
When "key" is set to CODED, this will contain a Java key code. +

+ For the arrow keys, keyCode will be one of UP, DOWN, LEFT and RIGHT. + Also available are ALT, CONTROL and SHIFT. A full set of constants + can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables. +

+

+
+
+
+

+keyPressed

+
+boolean keyPressed
+
+
true if the mouse is currently pressed. +

+

+
+
+
+

+keyEvent

+
+java.awt.event.KeyEvent keyEvent
+
+
the last KeyEvent object passed into a mouse function. +

+

+
+
+
+

+focused

+
+boolean focused
+
+
Gets set to true/false as the applet gains/loses focus. +

+

+
+
+
+

+online

+
+boolean online
+
+
true if the applet is online. +

+ This can be used to test how the applet should behave + since online situations are different (no file writing, etc). +

+

+
+
+
+

+millisOffset

+
+long millisOffset
+
+
Time in milliseconds when the applet was started. +

+ Used by the millis() function. +

+

+
+
+
+

+frameRate

+
+float frameRate
+
+
The current value of frames per second. +

+ The initial value will be 10 fps, and will be updated with each + frame thereafter. The value is not instantaneous (since that + wouldn't be very useful since it would jump around so much), + but is instead averaged (integrated) over several frames. + As such, this value won't be valid until after 5-10 frames. +

+

+
+
+
+

+frameRateLastNanos

+
+long frameRateLastNanos
+
+
Last time in nanoseconds that frameRate was checked +

+

+
+
+
+

+frameRateTarget

+
+float frameRateTarget
+
+
As of release 0116, frameRate(60) is called as a default +

+

+
+
+
+

+frameRatePeriod

+
+long frameRatePeriod
+
+
+
+
+
+

+looping

+
+boolean looping
+
+
+
+
+
+

+redraw

+
+boolean redraw
+
+
flag set to true when a redraw is asked for by the user +

+

+
+
+
+

+frameCount

+
+int frameCount
+
+
How many frames have been displayed since the applet started. +

+ This value is read-only do not attempt to set it, + otherwise bad things will happen. +

+ Inside setup(), frameCount is 0. + For the first iteration of draw(), frameCount will equal 1. +

+

+
+
+
+

+finished

+
+boolean finished
+
+
true if this applet has had it. +

+

+
+
+
+

+exitCalled

+
+boolean exitCalled
+
+
true if exit() has been called so that things shut down + once the main thread kicks off. +

+

+
+
+
+

+thread

+
+java.lang.Thread thread
+
+
+
+
+
+

+sizeMethods

+
+PApplet.RegisteredMethods sizeMethods
+
+
+
+
+
+

+preMethods

+
+PApplet.RegisteredMethods preMethods
+
+
+
+
+
+

+drawMethods

+
+PApplet.RegisteredMethods drawMethods
+
+
+
+
+
+

+postMethods

+
+PApplet.RegisteredMethods postMethods
+
+
+
+
+
+

+mouseEventMethods

+
+PApplet.RegisteredMethods mouseEventMethods
+
+
+
+
+
+

+keyEventMethods

+
+PApplet.RegisteredMethods keyEventMethods
+
+
+
+
+
+

+disposeMethods

+
+PApplet.RegisteredMethods disposeMethods
+
+
+
+
+
+

+external

+
+boolean external
+
+
true if this sketch is being run by the PDE +

+

+
+
+
+

+mouseEventQueue

+
+java.awt.event.MouseEvent[] mouseEventQueue
+
+
+
+
+
+

+mouseEventCount

+
+int mouseEventCount
+
+
+
+
+
+

+keyEventQueue

+
+java.awt.event.KeyEvent[] keyEventQueue
+
+
+
+
+
+

+keyEventCount

+
+int keyEventCount
+
+
+
+
+
+

+cursorType

+
+int cursorType
+
+
+
+
+
+

+cursorVisible

+
+boolean cursorVisible
+
+
+
+
+
+

+invisibleCursor

+
+PImage invisibleCursor
+
+
+
+
+
+

+internalRandom

+
+java.util.Random internalRandom
+
+
+
+
+
+

+perlin_octaves

+
+int perlin_octaves
+
+
+
+
+
+

+perlin_amp_falloff

+
+float perlin_amp_falloff
+
+
+
+
+
+

+perlin_TWOPI

+
+int perlin_TWOPI
+
+
+
+
+
+

+perlin_PI

+
+int perlin_PI
+
+
+
+
+
+

+perlin_cosTable

+
+float[] perlin_cosTable
+
+
+
+
+
+

+perlin

+
+float[] perlin
+
+
+
+
+
+

+perlinRandom

+
+java.util.Random perlinRandom
+
+
+
+
+
+

+loadImageFormats

+
+java.lang.String[] loadImageFormats
+
+
+
+
+
+

+requestImageMax

+
+int requestImageMax
+
+
By trial and error, four image loading threads seem to work best when + loading images from online. This is consistent with the number of open + connections that web browsers will maintain. The variable is made public + (however no accessor has been added since it's esoteric) if you really + want to have control over the value used. For instance, when loading local + files, it might be better to only have a single thread (or two) loading + images so that you're disk isn't simply jumping around. +

+

+
+
+
+

+requestImageCount

+
+int requestImageCount
+
+
+
+
+
+

+selectedFile

+
+java.io.File selectedFile
+
+
+
+
+
+

+parentFrame

+
+java.awt.Frame parentFrame
+
+
+
+
+ +

+ + + + + +
+Class processing.core.PApplet.RendererChangeException extends java.lang.RuntimeException implements Serializable
+ +

+


+ + + + + +
+Package processing.xml
+ +

+ + + + + +
+Class processing.xml.XMLElement extends java.lang.Object implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+parent

+
+XMLElement parent
+
+
The parent element. +

+

+
+
+
+

+attributes

+
+java.util.Vector<E> attributes
+
+
The attributes of the element. +

+

+
+
+
+

+children

+
+java.util.Vector<E> children
+
+
The child elements. +

+

+
+
+
+

+name

+
+java.lang.String name
+
+
The name of the element. +

+

+
+
+
+

+fullName

+
+java.lang.String fullName
+
+
The full name of the element. +

+

+
+
+
+

+namespace

+
+java.lang.String namespace
+
+
The namespace URI. +

+

+
+
+
+

+content

+
+java.lang.String content
+
+
The content of the element. +

+

+
+
+
+

+systemID

+
+java.lang.String systemID
+
+
The system ID of the source data where this element is located. +

+

+
+
+
+

+lineNr

+
+int lineNr
+
+
The line in the source data where this element starts. +

+

+
+
+ +

+ + + + + +
+Class processing.xml.XMLException extends java.lang.Exception implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+msg

+
+java.lang.String msg
+
+
The message of the exception. +

+

+
+
+
+

+systemID

+
+java.lang.String systemID
+
+
The system ID of the XML data where the exception occurred. +

+

+
+
+
+

+lineNr

+
+int lineNr
+
+
The line number in the XML data where the exception occurred. +

+

+
+
+
+

+encapsulatedException

+
+java.lang.Exception encapsulatedException
+
+
Encapsulated exception. +

+

+
+
+ +

+ + + + + +
+Class processing.xml.XMLParseException extends XMLException implements Serializable
+ +

+ +

+ + + + + +
+Class processing.xml.XMLValidationException extends XMLException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+elementName

+
+java.lang.String elementName
+
+
The name of the element where the exception occurred. +

+

+
+
+
+

+attributeName

+
+java.lang.String attributeName
+
+
The name of the attribute where the exception occurred. +

+

+
+
+
+

+attributeValue

+
+java.lang.String attributeValue
+
+
The value of the attribute where the exception occurred. +

+

+
+
+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/core/stylesheet.css b/build/javadoc/core/stylesheet.css new file mode 100644 index 000000000..46c958625 --- /dev/null +++ b/build/javadoc/core/stylesheet.css @@ -0,0 +1,185 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF } + +/* Headings */ +h1 { font-size: 145% } + + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ +.TableRowColor { background: #FFFFFF } /* White */ + + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } + + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ + +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} + + + +/* + * Processing - Styling + * + * fjenett - mail@florianjenett.de - 2005.08.14 + * + */ + + +/* first let's restyle what's there .. */ + +/* Table colors */ +.TableHeadingColor { + background: #CCCCBE; + color: #5A5A46; + } +.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ +.TableRowColor { background: #FFFFFF } /* White */ + + +/* Font used in left-hand frame lists */ +.FrameTitleFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif +} +.FrameHeadingFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #5A5A46; +} +.FrameItemFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif +} + + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#CCCCBE;} /* Light */ +.NavBarCell1Rev { background-color:#5A5A46;} /* Dark */ + +.NavBarFont1 { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color:#5A5A46; +} +.NavBarFont1Rev { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color:#FFFFFF; +} + +.NavBarCell2 { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +.NavBarCell3 { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color:#FFFFFF;} + + +/* try to style some more ... */ + +body, +html +{ + font-size: smaller; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #333333; + } + +h1, h2, h3, h4, h5, h6 { + + color: #5A5A46; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight: normal; + + line-height: normal; +} + +h1, h2, h3, h4 { + word-spacing: 0.2em; + font-weight: bold; +} + +h4, h5, h6 { + font-weight: bold; +} +/* Font Sizes */ +h1 { font-size: 1.5em; } +h2 { font-size: 1.4em; } +h3 { font-size: 1.3em; } +h4 { font-size: 1.2em; } +h5 { font-size: 1.1em; } +h6 { font-size: 1em; } +p { font-size: 1em; } + +dl, dd, dt, +dt > b +{ + color: #666666; + font-size: 1em; +} + +code, +pre +{ + font-size: 1.2em; + color:#333333; +} + +pre +{ + font-size: 1.2em; +} + +/* force the table-headers small .. */ +b +{ + font-size: small; +} + +tr, +td +{ + border-top: 0px solid; + border-left: 0px solid; + border-color: #999999; +} + +table +{ + border: 0px; +} + +img +{ + border: 0px solid #000000; +} + +a { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} + +a:hover +a:active { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} + +a:visited, +a:link:visited { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} \ No newline at end of file diff --git a/build/javadoc/everything/allclasses-frame.html b/build/javadoc/everything/allclasses-frame.html new file mode 100644 index 000000000..3a1c80db1 --- /dev/null +++ b/build/javadoc/everything/allclasses-frame.html @@ -0,0 +1,317 @@ + + + + + +All Classes + + + + + + + + + + +All Classes +
+ + + + + +
Advapi32 +
+Advapi32.ChangeServiceConfig2Info +
+Advapi32.Handler +
+Advapi32.HandlerEx +
+Advapi32.SERVICE_DESCRIPTION +
+Advapi32.SERVICE_MAIN_FUNCTION +
+Advapi32.SERVICE_STATUS +
+Advapi32.SERVICE_TABLE_ENTRY +
+Archiver +
+AutoFormat +
+Base +
+Capture +
+Client +
+ColorSelector +
+Commander +
+Compiler +
+CreateFont +
+CTokenMarker +
+DefaultInputHandler +
+DiscourseFormat +
+Editor +
+EditorConsole +
+EditorHeader +
+EditorLineStatus +
+EditorListener +
+EditorStatus +
+EditorToolbar +
+EventThread +
+ExtendedCommonASTWithHiddenTokens +
+FindReplace +
+FixEncoding +
+InputHandler +
+InputHandler.backspace +
+InputHandler.backspace_word +
+InputHandler.delete +
+InputHandler.delete_word +
+InputHandler.document_end +
+InputHandler.document_home +
+InputHandler.end +
+InputHandler.home +
+InputHandler.insert_break +
+InputHandler.insert_char +
+InputHandler.insert_tab +
+InputHandler.MacroRecorder +
+InputHandler.next_char +
+InputHandler.next_line +
+InputHandler.next_page +
+InputHandler.next_word +
+InputHandler.NonRecordable +
+InputHandler.NonRepeatable +
+InputHandler.overwrite +
+InputHandler.prev_char +
+InputHandler.prev_line +
+InputHandler.prev_page +
+InputHandler.prev_word +
+InputHandler.repeat +
+InputHandler.toggle_rect +
+InputHandler.Wrapper +
+JavaLexer +
+JavaRecognizer +
+JavaTokenTypes +
+JEditTextArea +
+KeywordMap +
+MessageConsumer +
+Movie +
+MovieMaker +
+Options +
+PApplet +
+PApplet.RendererChangeException +
+PConstants +
+PdeEmitter +
+PdeKeywords +
+PdeLexer +
+PdePartialTokenTypes +
+PdePreprocessor +
+PdeRecognizer +
+PdeTextAreaDefaults +
+PdeTokenTypes +
+PFont +
+PGraphics +
+PGraphics2D +
+PGraphics3D +
+PGraphicsJava2D +
+PGraphicsOpenGL +
+PGraphicsPDF +
+PImage +
+Platform +
+Platform +
+Platform +
+Platform +
+PLine +
+PMatrix +
+PMatrix2D +
+PMatrix3D +
+PPolygon +
+Preferences +
+PresentMode +
+PShape +
+PShapeSVG +
+PSmoothTriangle +
+PStyle +
+PTriangle +
+PVector +
+RawDXF +
+Registry +
+Registry.REGISTRY_ROOT_KEY +
+Runner +
+RunnerException +
+RunnerListener +
+Serial +
+Server +
+Sketch +
+SketchCode +
+StdXMLBuilder +
+StdXMLParser +
+StdXMLReader +
+StreamRedirectThread +
+SyntaxDocument +
+SyntaxStyle +
+SyntaxUtilities +
+TextAreaDefaults +
+TextAreaPainter +
+TextAreaPainter.Highlight +
+TextUtilities +
+Theme +
+ThinkDifferent +
+Token +
+TokenMarker +
+TokenStreamCopyingHiddenTokenFilter +
+Tool +
+UpdateCheck +
+WebServer +
+WINBASE +
+WINBASE.FILETIME +
+WINBASE.SECURITY_ATTRIBUTES +
+WINERROR +
+WINNT +
+WINREG +
+XMLElement +
+XMLEntityResolver +
+XMLException +
+XMLParseException +
+XMLValidationException +
+XMLValidator +
+XMLWriter +
+
+ + + diff --git a/build/javadoc/everything/allclasses-noframe.html b/build/javadoc/everything/allclasses-noframe.html new file mode 100644 index 000000000..6570797b5 --- /dev/null +++ b/build/javadoc/everything/allclasses-noframe.html @@ -0,0 +1,317 @@ + + + + + +All Classes + + + + + + + + + + +All Classes +
+ + + + + +
Advapi32 +
+Advapi32.ChangeServiceConfig2Info +
+Advapi32.Handler +
+Advapi32.HandlerEx +
+Advapi32.SERVICE_DESCRIPTION +
+Advapi32.SERVICE_MAIN_FUNCTION +
+Advapi32.SERVICE_STATUS +
+Advapi32.SERVICE_TABLE_ENTRY +
+Archiver +
+AutoFormat +
+Base +
+Capture +
+Client +
+ColorSelector +
+Commander +
+Compiler +
+CreateFont +
+CTokenMarker +
+DefaultInputHandler +
+DiscourseFormat +
+Editor +
+EditorConsole +
+EditorHeader +
+EditorLineStatus +
+EditorListener +
+EditorStatus +
+EditorToolbar +
+EventThread +
+ExtendedCommonASTWithHiddenTokens +
+FindReplace +
+FixEncoding +
+InputHandler +
+InputHandler.backspace +
+InputHandler.backspace_word +
+InputHandler.delete +
+InputHandler.delete_word +
+InputHandler.document_end +
+InputHandler.document_home +
+InputHandler.end +
+InputHandler.home +
+InputHandler.insert_break +
+InputHandler.insert_char +
+InputHandler.insert_tab +
+InputHandler.MacroRecorder +
+InputHandler.next_char +
+InputHandler.next_line +
+InputHandler.next_page +
+InputHandler.next_word +
+InputHandler.NonRecordable +
+InputHandler.NonRepeatable +
+InputHandler.overwrite +
+InputHandler.prev_char +
+InputHandler.prev_line +
+InputHandler.prev_page +
+InputHandler.prev_word +
+InputHandler.repeat +
+InputHandler.toggle_rect +
+InputHandler.Wrapper +
+JavaLexer +
+JavaRecognizer +
+JavaTokenTypes +
+JEditTextArea +
+KeywordMap +
+MessageConsumer +
+Movie +
+MovieMaker +
+Options +
+PApplet +
+PApplet.RendererChangeException +
+PConstants +
+PdeEmitter +
+PdeKeywords +
+PdeLexer +
+PdePartialTokenTypes +
+PdePreprocessor +
+PdeRecognizer +
+PdeTextAreaDefaults +
+PdeTokenTypes +
+PFont +
+PGraphics +
+PGraphics2D +
+PGraphics3D +
+PGraphicsJava2D +
+PGraphicsOpenGL +
+PGraphicsPDF +
+PImage +
+Platform +
+Platform +
+Platform +
+Platform +
+PLine +
+PMatrix +
+PMatrix2D +
+PMatrix3D +
+PPolygon +
+Preferences +
+PresentMode +
+PShape +
+PShapeSVG +
+PSmoothTriangle +
+PStyle +
+PTriangle +
+PVector +
+RawDXF +
+Registry +
+Registry.REGISTRY_ROOT_KEY +
+Runner +
+RunnerException +
+RunnerListener +
+Serial +
+Server +
+Sketch +
+SketchCode +
+StdXMLBuilder +
+StdXMLParser +
+StdXMLReader +
+StreamRedirectThread +
+SyntaxDocument +
+SyntaxStyle +
+SyntaxUtilities +
+TextAreaDefaults +
+TextAreaPainter +
+TextAreaPainter.Highlight +
+TextUtilities +
+Theme +
+ThinkDifferent +
+Token +
+TokenMarker +
+TokenStreamCopyingHiddenTokenFilter +
+Tool +
+UpdateCheck +
+WebServer +
+WINBASE +
+WINBASE.FILETIME +
+WINBASE.SECURITY_ATTRIBUTES +
+WINERROR +
+WINNT +
+WINREG +
+XMLElement +
+XMLEntityResolver +
+XMLException +
+XMLParseException +
+XMLValidationException +
+XMLValidator +
+XMLWriter +
+
+ + + diff --git a/build/javadoc/everything/antlr/ExtendedCommonASTWithHiddenTokens.html b/build/javadoc/everything/antlr/ExtendedCommonASTWithHiddenTokens.html new file mode 100644 index 000000000..ccb3a8ec3 --- /dev/null +++ b/build/javadoc/everything/antlr/ExtendedCommonASTWithHiddenTokens.html @@ -0,0 +1,441 @@ + + + + + +ExtendedCommonASTWithHiddenTokens + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +antlr +
+Class ExtendedCommonASTWithHiddenTokens

+
+java.lang.Object
+  extended by antlr.BaseAST
+      extended by antlr.CommonAST
+          extended by antlr.CommonASTWithHiddenTokens
+              extended by antlr.ExtendedCommonASTWithHiddenTokens
+
+
+
All Implemented Interfaces:
antlr.collections.AST, java.io.Serializable
+
+
+
+
public class ExtendedCommonASTWithHiddenTokens
extends antlr.CommonASTWithHiddenTokens
+ + +

+A CommonAST whose initialization copies hidden token + information from the Token used to create a node. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
ExtendedCommonASTWithHiddenTokens() + +
+           
ExtendedCommonASTWithHiddenTokens(antlr.Token tok) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetHiddenAfterString() + +
+           
+ java.lang.StringgetHiddenBeforeString() + +
+           
+ voidinitialize(antlr.collections.AST ast) + +
+           
+ voidxmlSerialize(java.io.Writer out) + +
+           
+ voidxmlSerializeNode(java.io.Writer out) + +
+           
+ voidxmlSerializeRootClose(java.io.Writer out) + +
+           
+ voidxmlSerializeRootOpen(java.io.Writer out) + +
+           
+ + + + + + + +
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore, initialize
+ + + + + + + +
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
+ + + + + + + +
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ExtendedCommonASTWithHiddenTokens

+
+public ExtendedCommonASTWithHiddenTokens()
+
+
+
+ +

+ExtendedCommonASTWithHiddenTokens

+
+public ExtendedCommonASTWithHiddenTokens(antlr.Token tok)
+
+
+ + + + + + + + +
+Method Detail
+ +

+initialize

+
+public void initialize(antlr.collections.AST ast)
+
+
+
Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class antlr.CommonASTWithHiddenTokens
+
+
+
+
+
+
+ +

+getHiddenAfterString

+
+public java.lang.String getHiddenAfterString()
+
+
+
+
+
+
+ +

+getHiddenBeforeString

+
+public java.lang.String getHiddenBeforeString()
+
+
+
+
+
+
+ +

+xmlSerializeNode

+
+public void xmlSerializeNode(java.io.Writer out)
+                      throws java.io.IOException
+
+
+
Overrides:
xmlSerializeNode in class antlr.BaseAST
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+xmlSerializeRootOpen

+
+public void xmlSerializeRootOpen(java.io.Writer out)
+                          throws java.io.IOException
+
+
+
Overrides:
xmlSerializeRootOpen in class antlr.BaseAST
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+xmlSerializeRootClose

+
+public void xmlSerializeRootClose(java.io.Writer out)
+                           throws java.io.IOException
+
+
+
Overrides:
xmlSerializeRootClose in class antlr.BaseAST
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+xmlSerialize

+
+public void xmlSerialize(java.io.Writer out)
+                  throws java.io.IOException
+
+
+
Overrides:
xmlSerialize in class antlr.BaseAST
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/TokenStreamCopyingHiddenTokenFilter.html b/build/javadoc/everything/antlr/TokenStreamCopyingHiddenTokenFilter.html new file mode 100644 index 000000000..4d9ade528 --- /dev/null +++ b/build/javadoc/everything/antlr/TokenStreamCopyingHiddenTokenFilter.html @@ -0,0 +1,372 @@ + + + + + +TokenStreamCopyingHiddenTokenFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +antlr +
+Class TokenStreamCopyingHiddenTokenFilter

+
+java.lang.Object
+  extended by antlr.TokenStreamBasicFilter
+      extended by antlr.TokenStreamHiddenTokenFilter
+          extended by antlr.TokenStreamCopyingHiddenTokenFilter
+
+
+
All Implemented Interfaces:
antlr.ASdebug.IASDebugStream, antlr.TokenStream
+
+
+
+
public class TokenStreamCopyingHiddenTokenFilter
extends antlr.TokenStreamHiddenTokenFilter
implements antlr.TokenStream
+ + +

+This class provides TokenStreamHiddenTokenFilters with the concept of + tokens which can be copied so that they are seen by both the hidden token + stream as well as the parser itself. This is useful when one wants to use + an existing parser (like the Java parser included with ANTLR) that throws + away some tokens to create a parse tree which can be used to spit out + a copy of the code with only minor modifications. + + This code is partially derived from the public domain ANLTR TokenStream +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
TokenStreamCopyingHiddenTokenFilter(antlr.TokenStream input) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidcopy(int tokenType) + +
+          Indicate that all tokens of type tokenType should be copied.
+ voidlinkAndCopyToken(antlr.CommonHiddenStreamToken prev, + antlr.CommonHiddenStreamToken monitored) + +
+           
+ antlr.TokennextToken() + +
+          Return the next monitored token.
+ antlr.CommonHiddenStreamTokenpartialCloneToken(antlr.CommonHiddenStreamToken t) + +
+          Create a clone of the important parts of the given token.
+ + + + + + + +
Methods inherited from class antlr.TokenStreamHiddenTokenFilter
getDiscardMask, getHiddenAfter, getHiddenBefore, getHideMask, getInitialHiddenToken, hide, hide
+ + + + + + + +
Methods inherited from class antlr.TokenStreamBasicFilter
discard, discard, getEntireText, getOffsetInfo
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+TokenStreamCopyingHiddenTokenFilter

+
+public TokenStreamCopyingHiddenTokenFilter(antlr.TokenStream input)
+
+
+ + + + + + + + +
+Method Detail
+ +

+copy

+
+public void copy(int tokenType)
+
+
Indicate that all tokens of type tokenType should be copied. The copy + is put in the stream of hidden tokens, and the original is returned in the + stream of normal tokens. +

+

+
+
+
+
Parameters:
tokenType - integer representing the token type to copied
+
+
+
+ +

+partialCloneToken

+
+public antlr.CommonHiddenStreamToken partialCloneToken(antlr.CommonHiddenStreamToken t)
+
+
Create a clone of the important parts of the given token. Note that this + does NOT copy the hiddenBefore and hiddenAfter fields. +

+

+
+
+
+
Parameters:
t - token to partially clone +
Returns:
newly created partial clone
+
+
+
+ +

+linkAndCopyToken

+
+public void linkAndCopyToken(antlr.CommonHiddenStreamToken prev,
+                             antlr.CommonHiddenStreamToken monitored)
+
+
+
+
+
+
+
+
+
+ +

+nextToken

+
+public antlr.Token nextToken()
+                      throws antlr.TokenStreamException
+
+
Return the next monitored token. + Test the token following the monitored token. + If following is another monitored token, save it + for the next invocation of nextToken (like a single + lookahead token) and return it then. + If following is unmonitored, nondiscarded (hidden) + channel token, add it to the monitored token. + + Note: EOF must be a monitored Token. +

+

+
Specified by:
nextToken in interface antlr.TokenStream
Overrides:
nextToken in class antlr.TokenStreamHiddenTokenFilter
+
+
+ +
Throws: +
antlr.TokenStreamException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/java/JavaLexer.html b/build/javadoc/everything/antlr/java/JavaLexer.html new file mode 100644 index 000000000..7df953296 --- /dev/null +++ b/build/javadoc/everything/antlr/java/JavaLexer.html @@ -0,0 +1,1941 @@ + + + + + +JavaLexer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +antlr.java +
+Class JavaLexer

+
+java.lang.Object
+  extended by antlr.CharScanner
+      extended by antlr.java.JavaLexer
+
+
+
All Implemented Interfaces:
JavaTokenTypes, antlr.TokenStream
+
+
+
+
public class JavaLexer
extends antlr.CharScanner
implements JavaTokenTypes, antlr.TokenStream
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static antlr.collections.impl.BitSet_tokenSet_0 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_1 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_2 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_3 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_4 + +
+           
+ + + + + + + +
Fields inherited from class antlr.CharScanner
EOF_CHAR
+ + + + + + + +
Fields inherited from interface antlr.java.JavaTokenTypes
ABSTRACT, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CTOR_CALL, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, ELIST, EMPTY_STAT, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RPAREN, SEMI, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRICTFP, STRING_LITERAL, SUPER_CTOR_CALL, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WS
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
JavaLexer(antlr.InputBuffer ib) + +
+           
JavaLexer(java.io.InputStream in) + +
+           
JavaLexer(antlr.LexerSharedInputState state) + +
+           
JavaLexer(java.io.Reader in) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidmASSIGN(boolean _createToken) + +
+           
+ voidmBAND_ASSIGN(boolean _createToken) + +
+           
+ voidmBAND(boolean _createToken) + +
+           
+ voidmBNOT(boolean _createToken) + +
+           
+ voidmBOR_ASSIGN(boolean _createToken) + +
+           
+ voidmBOR(boolean _createToken) + +
+           
+ voidmBSR_ASSIGN(boolean _createToken) + +
+           
+ voidmBSR(boolean _createToken) + +
+           
+ voidmBXOR_ASSIGN(boolean _createToken) + +
+           
+ voidmBXOR(boolean _createToken) + +
+           
+ voidmCHAR_LITERAL(boolean _createToken) + +
+           
+ voidmCOLON(boolean _createToken) + +
+           
+ voidmCOMMA(boolean _createToken) + +
+           
+ voidmDEC(boolean _createToken) + +
+           
+ voidmDIV_ASSIGN(boolean _createToken) + +
+           
+ voidmDIV(boolean _createToken) + +
+           
+ voidmEQUAL(boolean _createToken) + +
+           
+ voidmGE(boolean _createToken) + +
+           
+ voidmGT(boolean _createToken) + +
+           
+ voidmIDENT(boolean _createToken) + +
+           
+ voidmINC(boolean _createToken) + +
+           
+ voidmLAND(boolean _createToken) + +
+           
+ voidmLBRACK(boolean _createToken) + +
+           
+ voidmLCURLY(boolean _createToken) + +
+           
+ voidmLE(boolean _createToken) + +
+           
+ voidmLNOT(boolean _createToken) + +
+           
+ voidmLOR(boolean _createToken) + +
+           
+ voidmLPAREN(boolean _createToken) + +
+           
+ voidmLT(boolean _createToken) + +
+           
+ voidmMINUS_ASSIGN(boolean _createToken) + +
+           
+ voidmMINUS(boolean _createToken) + +
+           
+ voidmML_COMMENT(boolean _createToken) + +
+           
+ voidmMOD_ASSIGN(boolean _createToken) + +
+           
+ voidmMOD(boolean _createToken) + +
+           
+ voidmNOT_EQUAL(boolean _createToken) + +
+           
+ voidmNUM_INT(boolean _createToken) + +
+           
+ voidmPLUS_ASSIGN(boolean _createToken) + +
+           
+ voidmPLUS(boolean _createToken) + +
+           
+ voidmQUESTION(boolean _createToken) + +
+           
+ voidmRBRACK(boolean _createToken) + +
+           
+ voidmRCURLY(boolean _createToken) + +
+           
+ voidmRPAREN(boolean _createToken) + +
+           
+ voidmSEMI(boolean _createToken) + +
+           
+ voidmSL_ASSIGN(boolean _createToken) + +
+           
+ voidmSL_COMMENT(boolean _createToken) + +
+           
+ voidmSL(boolean _createToken) + +
+           
+ voidmSR_ASSIGN(boolean _createToken) + +
+           
+ voidmSR(boolean _createToken) + +
+           
+ voidmSTAR_ASSIGN(boolean _createToken) + +
+           
+ voidmSTAR(boolean _createToken) + +
+           
+ voidmSTRING_LITERAL(boolean _createToken) + +
+           
+ voidmWS(boolean _createToken) + +
+           
+ antlr.TokennextToken() + +
+           
+ + + + + + + +
Methods inherited from class antlr.CharScanner
append, append, commit, consume, consumeUntil, consumeUntil, getCaseSensitive, getCaseSensitiveLiterals, getColumn, getCommitToPath, getFilename, getInputBuffer, getInputState, getLine, getTabSize, getText, getTokenObject, LA, mark, match, match, match, matchNot, matchRange, newline, panic, panic, reportError, reportError, reportWarning, resetText, rewind, setCaseSensitive, setColumn, setCommitToPath, setFilename, setInputState, setLine, setTabSize, setText, setTokenObjectClass, tab, testLiteralsTable, testLiteralsTable, toLower, traceIn, traceIndent, traceOut, uponEOF
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+_tokenSet_0

+
+public static final antlr.collections.impl.BitSet _tokenSet_0
+
+
+
+
+
+ +

+_tokenSet_1

+
+public static final antlr.collections.impl.BitSet _tokenSet_1
+
+
+
+
+
+ +

+_tokenSet_2

+
+public static final antlr.collections.impl.BitSet _tokenSet_2
+
+
+
+
+
+ +

+_tokenSet_3

+
+public static final antlr.collections.impl.BitSet _tokenSet_3
+
+
+
+
+
+ +

+_tokenSet_4

+
+public static final antlr.collections.impl.BitSet _tokenSet_4
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+JavaLexer

+
+public JavaLexer(java.io.InputStream in)
+
+
+
+ +

+JavaLexer

+
+public JavaLexer(java.io.Reader in)
+
+
+
+ +

+JavaLexer

+
+public JavaLexer(antlr.InputBuffer ib)
+
+
+
+ +

+JavaLexer

+
+public JavaLexer(antlr.LexerSharedInputState state)
+
+
+ + + + + + + + +
+Method Detail
+ +

+nextToken

+
+public antlr.Token nextToken()
+                      throws antlr.TokenStreamException
+
+
+
Specified by:
nextToken in interface antlr.TokenStream
+
+
+ +
Throws: +
antlr.TokenStreamException
+
+
+
+ +

+mQUESTION

+
+public final void mQUESTION(boolean _createToken)
+                     throws antlr.RecognitionException,
+                            antlr.CharStreamException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLPAREN

+
+public final void mLPAREN(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mRPAREN

+
+public final void mRPAREN(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLBRACK

+
+public final void mLBRACK(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mRBRACK

+
+public final void mRBRACK(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLCURLY

+
+public final void mLCURLY(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mRCURLY

+
+public final void mRCURLY(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mCOLON

+
+public final void mCOLON(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mCOMMA

+
+public final void mCOMMA(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mASSIGN

+
+public final void mASSIGN(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mEQUAL

+
+public final void mEQUAL(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLNOT

+
+public final void mLNOT(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBNOT

+
+public final void mBNOT(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mNOT_EQUAL

+
+public final void mNOT_EQUAL(boolean _createToken)
+                      throws antlr.RecognitionException,
+                             antlr.CharStreamException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mDIV

+
+public final void mDIV(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mDIV_ASSIGN

+
+public final void mDIV_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mPLUS

+
+public final void mPLUS(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mPLUS_ASSIGN

+
+public final void mPLUS_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mINC

+
+public final void mINC(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMINUS

+
+public final void mMINUS(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMINUS_ASSIGN

+
+public final void mMINUS_ASSIGN(boolean _createToken)
+                         throws antlr.RecognitionException,
+                                antlr.CharStreamException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mDEC

+
+public final void mDEC(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSTAR

+
+public final void mSTAR(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSTAR_ASSIGN

+
+public final void mSTAR_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMOD

+
+public final void mMOD(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMOD_ASSIGN

+
+public final void mMOD_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSR

+
+public final void mSR(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSR_ASSIGN

+
+public final void mSR_ASSIGN(boolean _createToken)
+                      throws antlr.RecognitionException,
+                             antlr.CharStreamException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBSR

+
+public final void mBSR(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBSR_ASSIGN

+
+public final void mBSR_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mGE

+
+public final void mGE(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mGT

+
+public final void mGT(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSL

+
+public final void mSL(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSL_ASSIGN

+
+public final void mSL_ASSIGN(boolean _createToken)
+                      throws antlr.RecognitionException,
+                             antlr.CharStreamException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLE

+
+public final void mLE(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLT

+
+public final void mLT(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBXOR

+
+public final void mBXOR(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBXOR_ASSIGN

+
+public final void mBXOR_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBOR

+
+public final void mBOR(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBOR_ASSIGN

+
+public final void mBOR_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLOR

+
+public final void mLOR(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBAND

+
+public final void mBAND(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBAND_ASSIGN

+
+public final void mBAND_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLAND

+
+public final void mLAND(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSEMI

+
+public final void mSEMI(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mWS

+
+public final void mWS(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSL_COMMENT

+
+public final void mSL_COMMENT(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mML_COMMENT

+
+public final void mML_COMMENT(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mCHAR_LITERAL

+
+public final void mCHAR_LITERAL(boolean _createToken)
+                         throws antlr.RecognitionException,
+                                antlr.CharStreamException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSTRING_LITERAL

+
+public final void mSTRING_LITERAL(boolean _createToken)
+                           throws antlr.RecognitionException,
+                                  antlr.CharStreamException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mIDENT

+
+public final void mIDENT(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mNUM_INT

+
+public final void mNUM_INT(boolean _createToken)
+                    throws antlr.RecognitionException,
+                           antlr.CharStreamException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/java/JavaRecognizer.html b/build/javadoc/everything/antlr/java/JavaRecognizer.html new file mode 100644 index 000000000..f0f21fd43 --- /dev/null +++ b/build/javadoc/everything/antlr/java/JavaRecognizer.html @@ -0,0 +1,2841 @@ + + + + + +JavaRecognizer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +antlr.java +
+Class JavaRecognizer

+
+java.lang.Object
+  extended by antlr.Parser
+      extended by antlr.LLkParser
+          extended by antlr.java.JavaRecognizer
+
+
+
All Implemented Interfaces:
JavaTokenTypes
+
+
+
+
public class JavaRecognizer
extends antlr.LLkParser
implements JavaTokenTypes
+ + +

+Java 1.3 Recognizer +

+ Run 'java Main [-showtree] directory-full-of-java-files'
+
+ [The -showtree option pops up a Swing frame that shows
+  the AST constructed from the parser.]
+
+ Run 'java Main '
+
+ Contributing authors:
+                John Mitchell           johnm@non.net
+                Terence Parr            parrt@magelang.com
+                John Lilley                     jlilley@empathy.com
+                Scott Stanchfield       thetick@magelang.com
+                Markus Mohnen       mohnen@informatik.rwth-aachen.de
+      Peter Williams      pete.williams@sun.com
+      Allan Jacobs        Allan.Jacobs@eng.sun.com
+      Steve Messick       messick@redhills.com
+      John Pybus                        john@pybus.org
+
+ Version 1.00 December 9, 1997 -- initial release
+ Version 1.01 December 10, 1997
+                fixed bug in octal def (0..7 not 0..8)
+ Version 1.10 August 1998 (parrt)
+                added tree construction
+                fixed definition of WS,comments for mac,pc,unix newlines
+                added unary plus
+ Version 1.11 (Nov 20, 1998)
+                Added "shutup" option to turn off last ambig warning.
+                Fixed inner class def to allow named class defs as statements
+                synchronized requires compound not simple statement
+                add [] after builtInType DOT class in primaryExpression
+                "const" is reserved but not valid..removed from modifiers
+ Version 1.12 (Feb 2, 1999)
+                Changed LITERAL_xxx to xxx in tree grammar.
+                Updated java.g to use tokens {...} now for 2.6.0 (new feature).
+
+ Version 1.13 (Apr 23, 1999)
+                Didn't have (stat)? for else clause in tree parser.
+                Didn't gen ASTs for interface extends.  Updated tree parser too.
+                Updated to 2.6.0.
+ Version 1.14 (Jun 20, 1999)
+                Allowed final/abstract on local classes.
+                Removed local interfaces from methods
+                Put instanceof precedence where it belongs...in relationalExpr
+                        It also had expr not type as arg; fixed it.
+                Missing ! on SEMI in classBlock
+                fixed: (expr) + "string" was parsed incorrectly (+ as unary plus).
+                fixed: didn't like Object[].class in parser or tree parser
+ Version 1.15 (Jun 26, 1999)
+                Screwed up rule with instanceof in it. :(  Fixed.
+                Tree parser didn't like (expr).something; fixed.
+                Allowed multiple inheritance in tree grammar. oops.
+ Version 1.16 (August 22, 1999)
+                Extending an interface built a wacky tree: had extra EXTENDS.
+                Tree grammar didn't allow multiple superinterfaces.
+                Tree grammar didn't allow empty var initializer: {}
+ Version 1.17 (October 12, 1999)
+                ESC lexer rule allowed 399 max not 377 max.
+                java.tree.g didn't handle the expression of synchronized
+                statements.
+ Version 1.18 (August 12, 2001)
+        Terence updated to Java 2 Version 1.3 by
+                observing/combining work of Allan Jacobs and Steve
+                Messick.  Handles 1.3 src.  Summary:
+                o  primary didn't include boolean.class kind of thing
+        o  constructor calls parsed explicitly now:
+                   see explicitConstructorInvocation
+                o  add strictfp modifier
+        o  missing objBlock after new expression in tree grammar
+                o  merged local class definition alternatives, moved after declaration
+                o  fixed problem with ClassName.super.field
+        o  reordered some alternatives to make things more efficient
+                o  long and double constants were not differentiated from int/float
+                o  whitespace rule was inefficient: matched only one char
+                o  add an examples directory with some nasty 1.3 cases
+                o  made Main.java use buffered IO and a Reader for Unicode support
+                o  supports UNICODE?
+                   Using Unicode charVocabulay makes code file big, but only
+                   in the bitsets at the end. I need to make ANTLR generate
+                   unicode bitsets more efficiently.
+ Version 1.19 (April 25, 2002)
+                Terence added in nice fixes by John Pybus concerning floating
+                constants and problems with super() calls.  John did a nice
+                reorg of the primary/postfix expression stuff to read better
+                and makes f.g.super() parse properly (it was METHOD_CALL not
+                a SUPER_CTOR_CALL).  Also:
+
+                o  "finally" clause was a root...made it a child of "try"
+                o  Added stuff for asserts too for Java 1.4, but *commented out*
+                   as it is not backward compatible.
+
+ Version 1.20 (October 27, 2002)
+
+      Terence ended up reorging John Pybus' stuff to
+      remove some nondeterminisms and some syntactic predicates.
+      Note that the grammar is stricter now; e.g., this(...) must
+        be the first statement.
+
+      Trinary ?: operator wasn't working as array name:
+          (isBig ? bigDigits : digits)[i];
+
+      Checked parser/tree parser on source for
+          Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4,
+            and the 110k-line jGuru server source.
+
+ This grammar is in the PUBLIC DOMAIN
+ 
+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static java.lang.String[]_tokenNames + +
+           
+static antlr.collections.impl.BitSet_tokenSet_0 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_1 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_10 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_11 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_12 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_13 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_14 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_15 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_16 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_17 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_18 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_19 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_2 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_20 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_21 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_22 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_23 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_24 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_25 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_26 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_27 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_3 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_4 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_5 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_6 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_7 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_8 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_9 + +
+           
+ + + + + + + +
Fields inherited from interface antlr.java.JavaTokenTypes
ABSTRACT, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CTOR_CALL, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, ELIST, EMPTY_STAT, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RPAREN, SEMI, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRICTFP, STRING_LITERAL, SUPER_CTOR_CALL, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WS
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
JavaRecognizer(antlr.ParserSharedInputState state) + +
+           
JavaRecognizer(antlr.TokenBuffer tokenBuf) + +
+           
JavaRecognizer(antlr.TokenStream lexer) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaCase() + +
+           
+ voidadditiveExpression() + +
+           
+ voidandExpression() + +
+           
+ voidargList() + +
+           
+ voidarrayInitializer() + +
+           
+ voidassignmentExpression() + +
+           
+ voidbuiltInType() + +
+           
+ voidbuiltInTypeSpec(boolean addImagNode) + +
+           
+ voidcasesGroup() + +
+           
+ voidcaseSList() + +
+           
+ voidclassBlock() + +
+           
+ voidclassDefinition(antlr.collections.AST modifiers) + +
+           
+ voidclassTypeSpec(boolean addImagNode) + +
+           
+ voidcompilationUnit() + +
+           
+ voidcompoundStatement() + +
+           
+ voidconditionalExpression() + +
+           
+ voidconstant() + +
+           
+ voidconstructorBody() + +
+           
+ voidctorHead() + +
+           
+ voiddeclaration() + +
+          A declaration is the creation of a reference or primitive-type variable + Create a separate Type/Var tree for each var in the var list.
+ voiddeclaratorBrackets(antlr.collections.AST typ) + +
+           
+ voidequalityExpression() + +
+           
+ voidexclusiveOrExpression() + +
+           
+ voidexplicitConstructorInvocation() + +
+          Catch obvious constructor calls, but not the expr.super(...) calls
+ voidexpression() + +
+           
+ voidexpressionList() + +
+           
+ voidfield() + +
+           
+ voidfinallyClause() + +
+           
+ voidforCond() + +
+           
+ voidforInit() + +
+           
+ voidforIter() + +
+           
+ voidhandler() + +
+           
+ voididentifier() + +
+           
+ voididentifierStar() + +
+           
+ voididentPrimary() + +
+          Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + and a.b.c.class refs.
+ voidimplementsClause() + +
+           
+ voidimportDefinition() + +
+           
+ voidinclusiveOrExpression() + +
+           
+ voidinitializer() + +
+           
+ voidinterfaceDefinition(antlr.collections.AST modifiers) + +
+           
+ voidinterfaceExtends() + +
+           
+ voidlogicalAndExpression() + +
+           
+ voidlogicalOrExpression() + +
+           
+ voidmodifier() + +
+           
+ voidmodifiers() + +
+           
+ voidmultiplicativeExpression() + +
+           
+ voidnewArrayDeclarator() + +
+           
+ voidnewExpression() + +
+          object instantiation.
+ voidpackageDefinition() + +
+           
+ voidparameterDeclaration() + +
+           
+ voidparameterDeclarationList() + +
+           
+ voidparameterModifier() + +
+           
+ voidpostfixExpression() + +
+           
+ voidprimaryExpression() + +
+           
+ voidrelationalExpression() + +
+           
+ voidshiftExpression() + +
+           
+ voidstatement() + +
+           
+ voidsuperClassClause() + +
+           
+ voidthrowsClause() + +
+           
+ voidtryBlock() + +
+           
+ voidtype() + +
+           
+ voidtypeDefinition() + +
+           
+ voidtypeSpec(boolean addImagNode) + +
+           
+ voidunaryExpression() + +
+           
+ voidunaryExpressionNotPlusMinus() + +
+           
+ voidvariableDeclarator(antlr.collections.AST mods, + antlr.collections.AST t) + +
+          Declaration of a variable.
+ voidvariableDefinitions(antlr.collections.AST mods, + antlr.collections.AST t) + +
+           
+ voidvarInitializer() + +
+           
+ + + + + + + +
Methods inherited from class antlr.LLkParser
consume, LA, LT, traceIn, traceOut
+ + + + + + + +
Methods inherited from class antlr.Parser
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, recover, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+_tokenNames

+
+public static final java.lang.String[] _tokenNames
+
+
+
+
+
+ +

+_tokenSet_0

+
+public static final antlr.collections.impl.BitSet _tokenSet_0
+
+
+
+
+
+ +

+_tokenSet_1

+
+public static final antlr.collections.impl.BitSet _tokenSet_1
+
+
+
+
+
+ +

+_tokenSet_2

+
+public static final antlr.collections.impl.BitSet _tokenSet_2
+
+
+
+
+
+ +

+_tokenSet_3

+
+public static final antlr.collections.impl.BitSet _tokenSet_3
+
+
+
+
+
+ +

+_tokenSet_4

+
+public static final antlr.collections.impl.BitSet _tokenSet_4
+
+
+
+
+
+ +

+_tokenSet_5

+
+public static final antlr.collections.impl.BitSet _tokenSet_5
+
+
+
+
+
+ +

+_tokenSet_6

+
+public static final antlr.collections.impl.BitSet _tokenSet_6
+
+
+
+
+
+ +

+_tokenSet_7

+
+public static final antlr.collections.impl.BitSet _tokenSet_7
+
+
+
+
+
+ +

+_tokenSet_8

+
+public static final antlr.collections.impl.BitSet _tokenSet_8
+
+
+
+
+
+ +

+_tokenSet_9

+
+public static final antlr.collections.impl.BitSet _tokenSet_9
+
+
+
+
+
+ +

+_tokenSet_10

+
+public static final antlr.collections.impl.BitSet _tokenSet_10
+
+
+
+
+
+ +

+_tokenSet_11

+
+public static final antlr.collections.impl.BitSet _tokenSet_11
+
+
+
+
+
+ +

+_tokenSet_12

+
+public static final antlr.collections.impl.BitSet _tokenSet_12
+
+
+
+
+
+ +

+_tokenSet_13

+
+public static final antlr.collections.impl.BitSet _tokenSet_13
+
+
+
+
+
+ +

+_tokenSet_14

+
+public static final antlr.collections.impl.BitSet _tokenSet_14
+
+
+
+
+
+ +

+_tokenSet_15

+
+public static final antlr.collections.impl.BitSet _tokenSet_15
+
+
+
+
+
+ +

+_tokenSet_16

+
+public static final antlr.collections.impl.BitSet _tokenSet_16
+
+
+
+
+
+ +

+_tokenSet_17

+
+public static final antlr.collections.impl.BitSet _tokenSet_17
+
+
+
+
+
+ +

+_tokenSet_18

+
+public static final antlr.collections.impl.BitSet _tokenSet_18
+
+
+
+
+
+ +

+_tokenSet_19

+
+public static final antlr.collections.impl.BitSet _tokenSet_19
+
+
+
+
+
+ +

+_tokenSet_20

+
+public static final antlr.collections.impl.BitSet _tokenSet_20
+
+
+
+
+
+ +

+_tokenSet_21

+
+public static final antlr.collections.impl.BitSet _tokenSet_21
+
+
+
+
+
+ +

+_tokenSet_22

+
+public static final antlr.collections.impl.BitSet _tokenSet_22
+
+
+
+
+
+ +

+_tokenSet_23

+
+public static final antlr.collections.impl.BitSet _tokenSet_23
+
+
+
+
+
+ +

+_tokenSet_24

+
+public static final antlr.collections.impl.BitSet _tokenSet_24
+
+
+
+
+
+ +

+_tokenSet_25

+
+public static final antlr.collections.impl.BitSet _tokenSet_25
+
+
+
+
+
+ +

+_tokenSet_26

+
+public static final antlr.collections.impl.BitSet _tokenSet_26
+
+
+
+
+
+ +

+_tokenSet_27

+
+public static final antlr.collections.impl.BitSet _tokenSet_27
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+JavaRecognizer

+
+public JavaRecognizer(antlr.TokenBuffer tokenBuf)
+
+
+
+ +

+JavaRecognizer

+
+public JavaRecognizer(antlr.TokenStream lexer)
+
+
+
+ +

+JavaRecognizer

+
+public JavaRecognizer(antlr.ParserSharedInputState state)
+
+
+ + + + + + + + +
+Method Detail
+ +

+compilationUnit

+
+public final void compilationUnit()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+packageDefinition

+
+public final void packageDefinition()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+importDefinition

+
+public final void importDefinition()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+typeDefinition

+
+public final void typeDefinition()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+identifier

+
+public final void identifier()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+identifierStar

+
+public final void identifierStar()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+modifiers

+
+public final void modifiers()
+                     throws antlr.RecognitionException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+classDefinition

+
+public final void classDefinition(antlr.collections.AST modifiers)
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+interfaceDefinition

+
+public final void interfaceDefinition(antlr.collections.AST modifiers)
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+declaration

+
+public final void declaration()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
A declaration is the creation of a reference or primitive-type variable + Create a separate Type/Var tree for each var in the var list. +

+

+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+typeSpec

+
+public final void typeSpec(boolean addImagNode)
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+variableDefinitions

+
+public final void variableDefinitions(antlr.collections.AST mods,
+                                      antlr.collections.AST t)
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+classTypeSpec

+
+public final void classTypeSpec(boolean addImagNode)
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+builtInTypeSpec

+
+public final void builtInTypeSpec(boolean addImagNode)
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+builtInType

+
+public final void builtInType()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+type

+
+public final void type()
+                throws antlr.RecognitionException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+modifier

+
+public final void modifier()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+superClassClause

+
+public final void superClassClause()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+implementsClause

+
+public final void implementsClause()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+classBlock

+
+public final void classBlock()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+interfaceExtends

+
+public final void interfaceExtends()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+field

+
+public final void field()
+                 throws antlr.RecognitionException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+ctorHead

+
+public final void ctorHead()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+constructorBody

+
+public final void constructorBody()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+parameterDeclarationList

+
+public final void parameterDeclarationList()
+                                    throws antlr.RecognitionException,
+                                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+declaratorBrackets

+
+public final void declaratorBrackets(antlr.collections.AST typ)
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+throwsClause

+
+public final void throwsClause()
+                        throws antlr.RecognitionException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+compoundStatement

+
+public final void compoundStatement()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+explicitConstructorInvocation

+
+public final void explicitConstructorInvocation()
+                                         throws antlr.RecognitionException,
+                                                antlr.TokenStreamException
+
+
Catch obvious constructor calls, but not the expr.super(...) calls +

+

+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+statement

+
+public final void statement()
+                     throws antlr.RecognitionException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+argList

+
+public final void argList()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+variableDeclarator

+
+public final void variableDeclarator(antlr.collections.AST mods,
+                                     antlr.collections.AST t)
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
Declaration of a variable. This can be a class/instance variable, + or a local variable in a method + It can also include possible initialization. +

+

+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+varInitializer

+
+public final void varInitializer()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+initializer

+
+public final void initializer()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+arrayInitializer

+
+public final void arrayInitializer()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+expression

+
+public final void expression()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+parameterDeclaration

+
+public final void parameterDeclaration()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+parameterModifier

+
+public final void parameterModifier()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+forInit

+
+public final void forInit()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+forCond

+
+public final void forCond()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+forIter

+
+public final void forIter()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+casesGroup

+
+public final void casesGroup()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+tryBlock

+
+public final void tryBlock()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+aCase

+
+public final void aCase()
+                 throws antlr.RecognitionException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+caseSList

+
+public final void caseSList()
+                     throws antlr.RecognitionException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+expressionList

+
+public final void expressionList()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+handler

+
+public final void handler()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+finallyClause

+
+public final void finallyClause()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+assignmentExpression

+
+public final void assignmentExpression()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+conditionalExpression

+
+public final void conditionalExpression()
+                                 throws antlr.RecognitionException,
+                                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+logicalOrExpression

+
+public final void logicalOrExpression()
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+logicalAndExpression

+
+public final void logicalAndExpression()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+inclusiveOrExpression

+
+public final void inclusiveOrExpression()
+                                 throws antlr.RecognitionException,
+                                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+exclusiveOrExpression

+
+public final void exclusiveOrExpression()
+                                 throws antlr.RecognitionException,
+                                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+andExpression

+
+public final void andExpression()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+equalityExpression

+
+public final void equalityExpression()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+relationalExpression

+
+public final void relationalExpression()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+shiftExpression

+
+public final void shiftExpression()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+additiveExpression

+
+public final void additiveExpression()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+multiplicativeExpression

+
+public final void multiplicativeExpression()
+                                    throws antlr.RecognitionException,
+                                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+unaryExpression

+
+public final void unaryExpression()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+unaryExpressionNotPlusMinus

+
+public final void unaryExpressionNotPlusMinus()
+                                       throws antlr.RecognitionException,
+                                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+postfixExpression

+
+public final void postfixExpression()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+primaryExpression

+
+public final void primaryExpression()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+newExpression

+
+public final void newExpression()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
object instantiation. + Trees are built as illustrated by the following input/tree pairs: + + new T() + + new + | + T -- ELIST + | + arg1 -- arg2 -- .. -- argn + + new int[] + + new + | + int -- ARRAY_DECLARATOR + + new int[] {1,2} + + new + | + int -- ARRAY_DECLARATOR -- ARRAY_INIT + | + EXPR -- EXPR + | | + 1 2 + + new int[3] + new + | + int -- ARRAY_DECLARATOR + | + EXPR + | + 3 + + new int[1][2] + + new + | + int -- ARRAY_DECLARATOR + | + ARRAY_DECLARATOR -- EXPR + | | + EXPR 1 + | + 2 +

+

+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+identPrimary

+
+public final void identPrimary()
+                        throws antlr.RecognitionException,
+                               antlr.TokenStreamException
+
+
Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + and a.b.c.class refs. Also this(...) and super(...). Match + this or super. +

+

+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+constant

+
+public final void constant()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+newArrayDeclarator

+
+public final void newArrayDeclarator()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/java/JavaTokenTypes.html b/build/javadoc/everything/antlr/java/JavaTokenTypes.html new file mode 100644 index 000000000..66a451c55 --- /dev/null +++ b/build/javadoc/everything/antlr/java/JavaTokenTypes.html @@ -0,0 +1,2901 @@ + + + + + +JavaTokenTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +antlr.java +
+Interface JavaTokenTypes

+
+
All Known Implementing Classes:
JavaLexer, JavaRecognizer
+
+
+
+
public interface JavaTokenTypes
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intABSTRACT + +
+           
+static intARRAY_DECLARATOR + +
+           
+static intARRAY_INIT + +
+           
+static intASSIGN + +
+           
+static intBAND + +
+           
+static intBAND_ASSIGN + +
+           
+static intBLOCK + +
+           
+static intBNOT + +
+           
+static intBOR + +
+           
+static intBOR_ASSIGN + +
+           
+static intBSR + +
+           
+static intBSR_ASSIGN + +
+           
+static intBXOR + +
+           
+static intBXOR_ASSIGN + +
+           
+static intCASE_GROUP + +
+           
+static intCHAR_LITERAL + +
+           
+static intCLASS_DEF + +
+           
+static intCOLON + +
+           
+static intCOMMA + +
+           
+static intCTOR_CALL + +
+           
+static intCTOR_DEF + +
+           
+static intDEC + +
+           
+static intDIV + +
+           
+static intDIV_ASSIGN + +
+           
+static intDOT + +
+           
+static intELIST + +
+           
+static intEMPTY_STAT + +
+           
+static intEOF + +
+           
+static intEQUAL + +
+           
+static intESC + +
+           
+static intEXPONENT + +
+           
+static intEXPR + +
+           
+static intEXTENDS_CLAUSE + +
+           
+static intFINAL + +
+           
+static intFLOAT_SUFFIX + +
+           
+static intFOR_CONDITION + +
+           
+static intFOR_INIT + +
+           
+static intFOR_ITERATOR + +
+           
+static intGE + +
+           
+static intGT + +
+           
+static intHEX_DIGIT + +
+           
+static intIDENT + +
+           
+static intIMPLEMENTS_CLAUSE + +
+           
+static intIMPORT + +
+           
+static intINC + +
+           
+static intINDEX_OP + +
+           
+static intINSTANCE_INIT + +
+           
+static intINTERFACE_DEF + +
+           
+static intLABELED_STAT + +
+           
+static intLAND + +
+           
+static intLBRACK + +
+           
+static intLCURLY + +
+           
+static intLE + +
+           
+static intLITERAL_assert + +
+           
+static intLITERAL_boolean + +
+           
+static intLITERAL_break + +
+           
+static intLITERAL_byte + +
+           
+static intLITERAL_case + +
+           
+static intLITERAL_catch + +
+           
+static intLITERAL_char + +
+           
+static intLITERAL_class + +
+           
+static intLITERAL_continue + +
+           
+static intLITERAL_default + +
+           
+static intLITERAL_do + +
+           
+static intLITERAL_double + +
+           
+static intLITERAL_else + +
+           
+static intLITERAL_extends + +
+           
+static intLITERAL_false + +
+           
+static intLITERAL_finally + +
+           
+static intLITERAL_float + +
+           
+static intLITERAL_for + +
+           
+static intLITERAL_if + +
+           
+static intLITERAL_implements + +
+           
+static intLITERAL_import + +
+           
+static intLITERAL_instanceof + +
+           
+static intLITERAL_int + +
+           
+static intLITERAL_interface + +
+           
+static intLITERAL_long + +
+           
+static intLITERAL_native + +
+           
+static intLITERAL_new + +
+           
+static intLITERAL_null + +
+           
+static intLITERAL_package + +
+           
+static intLITERAL_private + +
+           
+static intLITERAL_protected + +
+           
+static intLITERAL_public + +
+           
+static intLITERAL_return + +
+           
+static intLITERAL_short + +
+           
+static intLITERAL_static + +
+           
+static intLITERAL_super + +
+           
+static intLITERAL_switch + +
+           
+static intLITERAL_synchronized + +
+           
+static intLITERAL_this + +
+           
+static intLITERAL_threadsafe + +
+           
+static intLITERAL_throw + +
+           
+static intLITERAL_throws + +
+           
+static intLITERAL_transient + +
+           
+static intLITERAL_true + +
+           
+static intLITERAL_try + +
+           
+static intLITERAL_void + +
+           
+static intLITERAL_volatile + +
+           
+static intLITERAL_while + +
+           
+static intLNOT + +
+           
+static intLOR + +
+           
+static intLPAREN + +
+           
+static intLT + +
+           
+static intMETHOD_CALL + +
+           
+static intMETHOD_DEF + +
+           
+static intMINUS + +
+           
+static intMINUS_ASSIGN + +
+           
+static intML_COMMENT + +
+           
+static intMOD + +
+           
+static intMOD_ASSIGN + +
+           
+static intMODIFIERS + +
+           
+static intNOT_EQUAL + +
+           
+static intNULL_TREE_LOOKAHEAD + +
+           
+static intNUM_DOUBLE + +
+           
+static intNUM_FLOAT + +
+           
+static intNUM_INT + +
+           
+static intNUM_LONG + +
+           
+static intOBJBLOCK + +
+           
+static intPACKAGE_DEF + +
+           
+static intPARAMETER_DEF + +
+           
+static intPARAMETERS + +
+           
+static intPLUS + +
+           
+static intPLUS_ASSIGN + +
+           
+static intPOST_DEC + +
+           
+static intPOST_INC + +
+           
+static intQUESTION + +
+           
+static intRBRACK + +
+           
+static intRCURLY + +
+           
+static intRPAREN + +
+           
+static intSEMI + +
+           
+static intSL + +
+           
+static intSL_ASSIGN + +
+           
+static intSL_COMMENT + +
+           
+static intSLIST + +
+           
+static intSR + +
+           
+static intSR_ASSIGN + +
+           
+static intSTAR + +
+           
+static intSTAR_ASSIGN + +
+           
+static intSTATIC_INIT + +
+           
+static intSTRICTFP + +
+           
+static intSTRING_LITERAL + +
+           
+static intSUPER_CTOR_CALL + +
+           
+static intTYPE + +
+           
+static intTYPECAST + +
+           
+static intUNARY_MINUS + +
+           
+static intUNARY_PLUS + +
+           
+static intVARIABLE_DEF + +
+           
+static intVOCAB + +
+           
+static intWS + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+EOF

+
+static final int EOF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NULL_TREE_LOOKAHEAD

+
+static final int NULL_TREE_LOOKAHEAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLOCK

+
+static final int BLOCK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MODIFIERS

+
+static final int MODIFIERS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OBJBLOCK

+
+static final int OBJBLOCK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SLIST

+
+static final int SLIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CTOR_DEF

+
+static final int CTOR_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHOD_DEF

+
+static final int METHOD_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VARIABLE_DEF

+
+static final int VARIABLE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INSTANCE_INIT

+
+static final int INSTANCE_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STATIC_INIT

+
+static final int STATIC_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TYPE

+
+static final int TYPE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CLASS_DEF

+
+static final int CLASS_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INTERFACE_DEF

+
+static final int INTERFACE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PACKAGE_DEF

+
+static final int PACKAGE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARRAY_DECLARATOR

+
+static final int ARRAY_DECLARATOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXTENDS_CLAUSE

+
+static final int EXTENDS_CLAUSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IMPLEMENTS_CLAUSE

+
+static final int IMPLEMENTS_CLAUSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PARAMETERS

+
+static final int PARAMETERS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PARAMETER_DEF

+
+static final int PARAMETER_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LABELED_STAT

+
+static final int LABELED_STAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TYPECAST

+
+static final int TYPECAST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INDEX_OP

+
+static final int INDEX_OP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POST_INC

+
+static final int POST_INC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POST_DEC

+
+static final int POST_DEC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHOD_CALL

+
+static final int METHOD_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXPR

+
+static final int EXPR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARRAY_INIT

+
+static final int ARRAY_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IMPORT

+
+static final int IMPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNARY_MINUS

+
+static final int UNARY_MINUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNARY_PLUS

+
+static final int UNARY_PLUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CASE_GROUP

+
+static final int CASE_GROUP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ELIST

+
+static final int ELIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_INIT

+
+static final int FOR_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_CONDITION

+
+static final int FOR_CONDITION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_ITERATOR

+
+static final int FOR_ITERATOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EMPTY_STAT

+
+static final int EMPTY_STAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FINAL

+
+static final int FINAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ABSTRACT

+
+static final int ABSTRACT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRICTFP

+
+static final int STRICTFP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SUPER_CTOR_CALL

+
+static final int SUPER_CTOR_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CTOR_CALL

+
+static final int CTOR_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_package

+
+static final int LITERAL_package
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SEMI

+
+static final int SEMI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_import

+
+static final int LITERAL_import
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LBRACK

+
+static final int LBRACK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RBRACK

+
+static final int RBRACK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_void

+
+static final int LITERAL_void
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_boolean

+
+static final int LITERAL_boolean
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_byte

+
+static final int LITERAL_byte
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_char

+
+static final int LITERAL_char
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_short

+
+static final int LITERAL_short
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_int

+
+static final int LITERAL_int
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_float

+
+static final int LITERAL_float
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_long

+
+static final int LITERAL_long
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_double

+
+static final int LITERAL_double
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IDENT

+
+static final int IDENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DOT

+
+static final int DOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STAR

+
+static final int STAR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_private

+
+static final int LITERAL_private
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_public

+
+static final int LITERAL_public
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_protected

+
+static final int LITERAL_protected
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_static

+
+static final int LITERAL_static
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_transient

+
+static final int LITERAL_transient
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_native

+
+static final int LITERAL_native
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_threadsafe

+
+static final int LITERAL_threadsafe
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_synchronized

+
+static final int LITERAL_synchronized
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_volatile

+
+static final int LITERAL_volatile
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_class

+
+static final int LITERAL_class
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_extends

+
+static final int LITERAL_extends
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_interface

+
+static final int LITERAL_interface
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LCURLY

+
+static final int LCURLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RCURLY

+
+static final int RCURLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMMA

+
+static final int COMMA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_implements

+
+static final int LITERAL_implements
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LPAREN

+
+static final int LPAREN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RPAREN

+
+static final int RPAREN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_this

+
+static final int LITERAL_this
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_super

+
+static final int LITERAL_super
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ASSIGN

+
+static final int ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_throws

+
+static final int LITERAL_throws
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COLON

+
+static final int COLON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_if

+
+static final int LITERAL_if
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_else

+
+static final int LITERAL_else
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_for

+
+static final int LITERAL_for
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_while

+
+static final int LITERAL_while
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_do

+
+static final int LITERAL_do
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_break

+
+static final int LITERAL_break
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_continue

+
+static final int LITERAL_continue
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_return

+
+static final int LITERAL_return
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_switch

+
+static final int LITERAL_switch
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_throw

+
+static final int LITERAL_throw
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_assert

+
+static final int LITERAL_assert
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_case

+
+static final int LITERAL_case
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_default

+
+static final int LITERAL_default
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_try

+
+static final int LITERAL_try
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_finally

+
+static final int LITERAL_finally
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_catch

+
+static final int LITERAL_catch
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PLUS_ASSIGN

+
+static final int PLUS_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MINUS_ASSIGN

+
+static final int MINUS_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STAR_ASSIGN

+
+static final int STAR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIV_ASSIGN

+
+static final int DIV_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOD_ASSIGN

+
+static final int MOD_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR_ASSIGN

+
+static final int SR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BSR_ASSIGN

+
+static final int BSR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL_ASSIGN

+
+static final int SL_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BAND_ASSIGN

+
+static final int BAND_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BXOR_ASSIGN

+
+static final int BXOR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOR_ASSIGN

+
+static final int BOR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUESTION

+
+static final int QUESTION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LOR

+
+static final int LOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LAND

+
+static final int LAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOR

+
+static final int BOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BXOR

+
+static final int BXOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BAND

+
+static final int BAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NOT_EQUAL

+
+static final int NOT_EQUAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EQUAL

+
+static final int EQUAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LT

+
+static final int LT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GT

+
+static final int GT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LE

+
+static final int LE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GE

+
+static final int GE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_instanceof

+
+static final int LITERAL_instanceof
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL

+
+static final int SL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR

+
+static final int SR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BSR

+
+static final int BSR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PLUS

+
+static final int PLUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MINUS

+
+static final int MINUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIV

+
+static final int DIV
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOD

+
+static final int MOD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INC

+
+static final int INC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DEC

+
+static final int DEC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BNOT

+
+static final int BNOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LNOT

+
+static final int LNOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_true

+
+static final int LITERAL_true
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_false

+
+static final int LITERAL_false
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_null

+
+static final int LITERAL_null
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_new

+
+static final int LITERAL_new
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_INT

+
+static final int NUM_INT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CHAR_LITERAL

+
+static final int CHAR_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRING_LITERAL

+
+static final int STRING_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_FLOAT

+
+static final int NUM_FLOAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_LONG

+
+static final int NUM_LONG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_DOUBLE

+
+static final int NUM_DOUBLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WS

+
+static final int WS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL_COMMENT

+
+static final int SL_COMMENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ML_COMMENT

+
+static final int ML_COMMENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ESC

+
+static final int ESC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HEX_DIGIT

+
+static final int HEX_DIGIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VOCAB

+
+static final int VOCAB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXPONENT

+
+static final int EXPONENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FLOAT_SUFFIX

+
+static final int FLOAT_SUFFIX
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/java/package-frame.html b/build/javadoc/everything/antlr/java/package-frame.html new file mode 100644 index 000000000..6d8d6301b --- /dev/null +++ b/build/javadoc/everything/antlr/java/package-frame.html @@ -0,0 +1,44 @@ + + + + + +antlr.java + + + + + + + + + + + +antlr.java + + + + +
+Interfaces  + +
+JavaTokenTypes
+ + + + + + +
+Classes  + +
+JavaLexer +
+JavaRecognizer
+ + + + diff --git a/build/javadoc/everything/antlr/java/package-summary.html b/build/javadoc/everything/antlr/java/package-summary.html new file mode 100644 index 000000000..6ff4f2e09 --- /dev/null +++ b/build/javadoc/everything/antlr/java/package-summary.html @@ -0,0 +1,169 @@ + + + + + +antlr.java + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package antlr.java +

+ + + + + + + + + +
+Interface Summary
JavaTokenTypes 
+  + +

+ + + + + + + + + + + + + +
+Class Summary
JavaLexer 
JavaRecognizerJava 1.3 Recognizer
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/java/package-tree.html b/build/javadoc/everything/antlr/java/package-tree.html new file mode 100644 index 000000000..bcdc25db0 --- /dev/null +++ b/build/javadoc/everything/antlr/java/package-tree.html @@ -0,0 +1,160 @@ + + + + + +antlr.java Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package antlr.java +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object +
+

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/package-frame.html b/build/javadoc/everything/antlr/package-frame.html new file mode 100644 index 000000000..19cc33ca8 --- /dev/null +++ b/build/javadoc/everything/antlr/package-frame.html @@ -0,0 +1,33 @@ + + + + + +antlr + + + + + + + + + + + +antlr + + + + +
+Classes  + +
+ExtendedCommonASTWithHiddenTokens +
+TokenStreamCopyingHiddenTokenFilter
+ + + + diff --git a/build/javadoc/everything/antlr/package-summary.html b/build/javadoc/everything/antlr/package-summary.html new file mode 100644 index 000000000..30e42cde1 --- /dev/null +++ b/build/javadoc/everything/antlr/package-summary.html @@ -0,0 +1,158 @@ + + + + + +antlr + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package antlr +

+ + + + + + + + + + + + + +
+Class Summary
ExtendedCommonASTWithHiddenTokensA CommonAST whose initialization copies hidden token + information from the Token used to create a node.
TokenStreamCopyingHiddenTokenFilterThis class provides TokenStreamHiddenTokenFilters with the concept of + tokens which can be copied so that they are seen by both the hidden token + stream as well as the parser itself.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/antlr/package-tree.html b/build/javadoc/everything/antlr/package-tree.html new file mode 100644 index 000000000..409da74a3 --- /dev/null +++ b/build/javadoc/everything/antlr/package-tree.html @@ -0,0 +1,160 @@ + + + + + +antlr Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package antlr +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • antlr.BaseAST (implements antlr.collections.AST, java.io.Serializable) + +
    • antlr.TokenStreamBasicFilter (implements antlr.ASdebug.IASDebugStream, antlr.TokenStream) + +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/constant-values.html b/build/javadoc/everything/constant-values.html new file mode 100644 index 000000000..83fa18f44 --- /dev/null +++ b/build/javadoc/everything/constant-values.html @@ -0,0 +1,5331 @@ + + + + + +Constant Field Values + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Constant Field Values

+
+
+Contents + + + + + + +
+antlr.java.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
antlr.java.JavaTokenTypes
+public static final intABSTRACT40
+public static final intARRAY_DECLARATOR17
+public static final intARRAY_INIT29
+public static final intASSIGN81
+public static final intBAND116
+public static final intBAND_ASSIGN108
+public static final intBLOCK4
+public static final intBNOT133
+public static final intBOR114
+public static final intBOR_ASSIGN110
+public static final intBSR126
+public static final intBSR_ASSIGN106
+public static final intBXOR115
+public static final intBXOR_ASSIGN109
+public static final intCASE_GROUP33
+public static final intCHAR_LITERAL140
+public static final intCLASS_DEF14
+public static final intCOLON83
+public static final intCOMMA75
+public static final intCTOR_CALL43
+public static final intCTOR_DEF8
+public static final intDEC132
+public static final intDIV129
+public static final intDIV_ASSIGN103
+public static final intDOT59
+public static final intELIST34
+public static final intEMPTY_STAT38
+public static final intEOF1
+public static final intEQUAL118
+public static final intESC148
+public static final intEXPONENT151
+public static final intEXPR28
+public static final intEXTENDS_CLAUSE18
+public static final intFINAL39
+public static final intFLOAT_SUFFIX152
+public static final intFOR_CONDITION36
+public static final intFOR_INIT35
+public static final intFOR_ITERATOR37
+public static final intGE122
+public static final intGT120
+public static final intHEX_DIGIT149
+public static final intIDENT58
+public static final intIMPLEMENTS_CLAUSE19
+public static final intIMPORT30
+public static final intINC131
+public static final intINDEX_OP24
+public static final intINSTANCE_INIT11
+public static final intINTERFACE_DEF15
+public static final intLABELED_STAT22
+public static final intLAND113
+public static final intLBRACK47
+public static final intLCURLY73
+public static final intLE121
+public static final intLITERAL_assert94
+public static final intLITERAL_boolean50
+public static final intLITERAL_break89
+public static final intLITERAL_byte51
+public static final intLITERAL_case95
+public static final intLITERAL_catch99
+public static final intLITERAL_char52
+public static final intLITERAL_class70
+public static final intLITERAL_continue90
+public static final intLITERAL_default96
+public static final intLITERAL_do88
+public static final intLITERAL_double57
+public static final intLITERAL_else85
+public static final intLITERAL_extends71
+public static final intLITERAL_false136
+public static final intLITERAL_finally98
+public static final intLITERAL_float55
+public static final intLITERAL_for86
+public static final intLITERAL_if84
+public static final intLITERAL_implements76
+public static final intLITERAL_import46
+public static final intLITERAL_instanceof123
+public static final intLITERAL_int54
+public static final intLITERAL_interface72
+public static final intLITERAL_long56
+public static final intLITERAL_native66
+public static final intLITERAL_new138
+public static final intLITERAL_null137
+public static final intLITERAL_package44
+public static final intLITERAL_private61
+public static final intLITERAL_protected63
+public static final intLITERAL_public62
+public static final intLITERAL_return91
+public static final intLITERAL_short53
+public static final intLITERAL_static64
+public static final intLITERAL_super80
+public static final intLITERAL_switch92
+public static final intLITERAL_synchronized68
+public static final intLITERAL_this79
+public static final intLITERAL_threadsafe67
+public static final intLITERAL_throw93
+public static final intLITERAL_throws82
+public static final intLITERAL_transient65
+public static final intLITERAL_true135
+public static final intLITERAL_try97
+public static final intLITERAL_void49
+public static final intLITERAL_volatile69
+public static final intLITERAL_while87
+public static final intLNOT134
+public static final intLOR112
+public static final intLPAREN77
+public static final intLT119
+public static final intMETHOD_CALL27
+public static final intMETHOD_DEF9
+public static final intMINUS128
+public static final intMINUS_ASSIGN101
+public static final intML_COMMENT147
+public static final intMOD130
+public static final intMOD_ASSIGN104
+public static final intMODIFIERS5
+public static final intNOT_EQUAL117
+public static final intNULL_TREE_LOOKAHEAD3
+public static final intNUM_DOUBLE144
+public static final intNUM_FLOAT142
+public static final intNUM_INT139
+public static final intNUM_LONG143
+public static final intOBJBLOCK6
+public static final intPACKAGE_DEF16
+public static final intPARAMETER_DEF21
+public static final intPARAMETERS20
+public static final intPLUS127
+public static final intPLUS_ASSIGN100
+public static final intPOST_DEC26
+public static final intPOST_INC25
+public static final intQUESTION111
+public static final intRBRACK48
+public static final intRCURLY74
+public static final intRPAREN78
+public static final intSEMI45
+public static final intSL124
+public static final intSL_ASSIGN107
+public static final intSL_COMMENT146
+public static final intSLIST7
+public static final intSR125
+public static final intSR_ASSIGN105
+public static final intSTAR60
+public static final intSTAR_ASSIGN102
+public static final intSTATIC_INIT12
+public static final intSTRICTFP41
+public static final intSTRING_LITERAL141
+public static final intSUPER_CTOR_CALL42
+public static final intTYPE13
+public static final intTYPECAST23
+public static final intUNARY_MINUS31
+public static final intUNARY_PLUS32
+public static final intVARIABLE_DEF10
+public static final intVOCAB150
+public static final intWS145
+ +

+ +

+ + + + + +
+processing.app.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.WebServer
+public static final intHTTP_ACCEPTED202
+public static final intHTTP_BAD_GATEWAY502
+public static final intHTTP_BAD_METHOD405
+public static final intHTTP_BAD_REQUEST400
+public static final intHTTP_CLIENT_TIMEOUT408
+public static final intHTTP_CONFLICT409
+public static final intHTTP_CREATED201
+public static final intHTTP_ENTITY_TOO_LARGE413
+public static final intHTTP_FORBIDDEN403
+public static final intHTTP_GATEWAY_TIMEOUT504
+public static final intHTTP_GONE410
+public static final intHTTP_INTERNAL_ERROR501
+public static final intHTTP_LENGTH_REQUIRED411
+public static final intHTTP_MOVED_PERM301
+public static final intHTTP_MOVED_TEMP302
+public static final intHTTP_MULT_CHOICE300
+public static final intHTTP_NO_CONTENT204
+public static final intHTTP_NOT_ACCEPTABLE406
+public static final intHTTP_NOT_AUTHORITATIVE203
+public static final intHTTP_NOT_FOUND404
+public static final intHTTP_NOT_MODIFIED304
+public static final intHTTP_OK200
+public static final intHTTP_PARTIAL206
+public static final intHTTP_PAYMENT_REQUIRED402
+public static final intHTTP_PRECON_FAILED412
+public static final intHTTP_PROXY_AUTH407
+public static final intHTTP_REQ_TOO_LONG414
+public static final intHTTP_RESET205
+public static final intHTTP_SEE_OTHER303
+public static final intHTTP_SERVER_ERROR500
+public static final intHTTP_UNAUTHORIZED401
+public static final intHTTP_UNAVAILABLE503
+public static final intHTTP_UNSUPPORTED_TYPE415
+public static final intHTTP_USE_PROXY305
+public static final intHTTP_VERSION505
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.preproc.PdePartialTokenTypes
+public static final intABSTRACT40
+public static final intARRAY_DECLARATOR17
+public static final intARRAY_INIT29
+public static final intASSIGN81
+public static final intBAND116
+public static final intBAND_ASSIGN108
+public static final intBLOCK4
+public static final intBNOT133
+public static final intBOR114
+public static final intBOR_ASSIGN110
+public static final intBSR126
+public static final intBSR_ASSIGN106
+public static final intBXOR115
+public static final intBXOR_ASSIGN109
+public static final intCASE_GROUP33
+public static final intCHAR_LITERAL140
+public static final intCLASS_DEF14
+public static final intCOLON83
+public static final intCOMMA75
+public static final intCONSTRUCTOR_CAST153
+public static final intCTOR_CALL43
+public static final intCTOR_DEF8
+public static final intDEC132
+public static final intDIV129
+public static final intDIV_ASSIGN103
+public static final intDOT59
+public static final intELIST34
+public static final intEMPTY_FIELD154
+public static final intEMPTY_STAT38
+public static final intEOF1
+public static final intEQUAL118
+public static final intESC148
+public static final intEXPONENT151
+public static final intEXPR28
+public static final intEXTENDS_CLAUSE18
+public static final intFINAL39
+public static final intFLOAT_SUFFIX152
+public static final intFOR_CONDITION36
+public static final intFOR_INIT35
+public static final intFOR_ITERATOR37
+public static final intGE122
+public static final intGT120
+public static final intHEX_DIGIT149
+public static final intIDENT58
+public static final intIMPLEMENTS_CLAUSE19
+public static final intIMPORT30
+public static final intINC131
+public static final intINDEX_OP24
+public static final intINSTANCE_INIT11
+public static final intINTERFACE_DEF15
+public static final intLABELED_STAT22
+public static final intLAND113
+public static final intLBRACK47
+public static final intLCURLY73
+public static final intLE121
+public static final intLITERAL_assert94
+public static final intLITERAL_boolean50
+public static final intLITERAL_break89
+public static final intLITERAL_byte51
+public static final intLITERAL_case95
+public static final intLITERAL_catch99
+public static final intLITERAL_char52
+public static final intLITERAL_class70
+public static final intLITERAL_color156
+public static final intLITERAL_continue90
+public static final intLITERAL_default96
+public static final intLITERAL_do88
+public static final intLITERAL_double57
+public static final intLITERAL_else85
+public static final intLITERAL_extends71
+public static final intLITERAL_false136
+public static final intLITERAL_finally98
+public static final intLITERAL_float55
+public static final intLITERAL_for86
+public static final intLITERAL_if84
+public static final intLITERAL_implements76
+public static final intLITERAL_import46
+public static final intLITERAL_instanceof123
+public static final intLITERAL_int54
+public static final intLITERAL_interface72
+public static final intLITERAL_long56
+public static final intLITERAL_native66
+public static final intLITERAL_new138
+public static final intLITERAL_null137
+public static final intLITERAL_package44
+public static final intLITERAL_private61
+public static final intLITERAL_protected63
+public static final intLITERAL_public62
+public static final intLITERAL_return91
+public static final intLITERAL_short53
+public static final intLITERAL_static64
+public static final intLITERAL_super80
+public static final intLITERAL_switch92
+public static final intLITERAL_synchronized68
+public static final intLITERAL_this79
+public static final intLITERAL_threadsafe67
+public static final intLITERAL_throw93
+public static final intLITERAL_throws82
+public static final intLITERAL_transient65
+public static final intLITERAL_true135
+public static final intLITERAL_try97
+public static final intLITERAL_void49
+public static final intLITERAL_volatile69
+public static final intLITERAL_while87
+public static final intLNOT134
+public static final intLOR112
+public static final intLPAREN77
+public static final intLT119
+public static final intMETHOD_CALL27
+public static final intMETHOD_DEF9
+public static final intMINUS128
+public static final intMINUS_ASSIGN101
+public static final intML_COMMENT147
+public static final intMOD130
+public static final intMOD_ASSIGN104
+public static final intMODIFIERS5
+public static final intNOT_EQUAL117
+public static final intNULL_TREE_LOOKAHEAD3
+public static final intNUM_DOUBLE144
+public static final intNUM_FLOAT142
+public static final intNUM_INT139
+public static final intNUM_LONG143
+public static final intOBJBLOCK6
+public static final intPACKAGE_DEF16
+public static final intPARAMETER_DEF21
+public static final intPARAMETERS20
+public static final intPLUS127
+public static final intPLUS_ASSIGN100
+public static final intPOST_DEC26
+public static final intPOST_INC25
+public static final intQUESTION111
+public static final intRBRACK48
+public static final intRCURLY74
+public static final intRPAREN78
+public static final intSEMI45
+public static final intSL124
+public static final intSL_ASSIGN107
+public static final intSL_COMMENT146
+public static final intSLIST7
+public static final intSR125
+public static final intSR_ASSIGN105
+public static final intSTAR60
+public static final intSTAR_ASSIGN102
+public static final intSTATIC_INIT12
+public static final intSTRICTFP41
+public static final intSTRING_LITERAL141
+public static final intSUPER_CTOR_CALL42
+public static final intTYPE13
+public static final intTYPECAST23
+public static final intUNARY_MINUS31
+public static final intUNARY_PLUS32
+public static final intVARIABLE_DEF10
+public static final intVOCAB150
+public static final intWEBCOLOR_LITERAL155
+public static final intWS145
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + +
processing.app.preproc.PdePreprocessor
+public static final intACTIVE1
+public static final intJAVA2
+public static final intSTATIC0
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.preproc.PdeTokenTypes
+public static final intABSTRACT40
+public static final intARRAY_DECLARATOR17
+public static final intARRAY_INIT29
+public static final intASSIGN81
+public static final intBAND116
+public static final intBAND_ASSIGN108
+public static final intBLOCK4
+public static final intBNOT133
+public static final intBOR114
+public static final intBOR_ASSIGN110
+public static final intBSR126
+public static final intBSR_ASSIGN106
+public static final intBXOR115
+public static final intBXOR_ASSIGN109
+public static final intCASE_GROUP33
+public static final intCHAR_LITERAL140
+public static final intCLASS_DEF14
+public static final intCOLON83
+public static final intCOMMA75
+public static final intCONSTRUCTOR_CAST153
+public static final intCTOR_CALL43
+public static final intCTOR_DEF8
+public static final intDEC132
+public static final intDIV129
+public static final intDIV_ASSIGN103
+public static final intDOT59
+public static final intELIST34
+public static final intEMPTY_FIELD154
+public static final intEMPTY_STAT38
+public static final intEOF1
+public static final intEQUAL118
+public static final intESC148
+public static final intEXPONENT151
+public static final intEXPR28
+public static final intEXTENDS_CLAUSE18
+public static final intFINAL39
+public static final intFLOAT_SUFFIX152
+public static final intFOR_CONDITION36
+public static final intFOR_INIT35
+public static final intFOR_ITERATOR37
+public static final intGE122
+public static final intGT120
+public static final intHEX_DIGIT149
+public static final intIDENT58
+public static final intIMPLEMENTS_CLAUSE19
+public static final intIMPORT30
+public static final intINC131
+public static final intINDEX_OP24
+public static final intINSTANCE_INIT11
+public static final intINTERFACE_DEF15
+public static final intLABELED_STAT22
+public static final intLAND113
+public static final intLBRACK47
+public static final intLCURLY73
+public static final intLE121
+public static final intLITERAL_assert94
+public static final intLITERAL_boolean50
+public static final intLITERAL_break89
+public static final intLITERAL_byte51
+public static final intLITERAL_case95
+public static final intLITERAL_catch99
+public static final intLITERAL_char52
+public static final intLITERAL_class70
+public static final intLITERAL_color156
+public static final intLITERAL_continue90
+public static final intLITERAL_default96
+public static final intLITERAL_do88
+public static final intLITERAL_double57
+public static final intLITERAL_else85
+public static final intLITERAL_extends71
+public static final intLITERAL_false136
+public static final intLITERAL_finally98
+public static final intLITERAL_float55
+public static final intLITERAL_for86
+public static final intLITERAL_if84
+public static final intLITERAL_implements76
+public static final intLITERAL_import46
+public static final intLITERAL_instanceof123
+public static final intLITERAL_int54
+public static final intLITERAL_interface72
+public static final intLITERAL_long56
+public static final intLITERAL_native66
+public static final intLITERAL_new138
+public static final intLITERAL_null137
+public static final intLITERAL_package44
+public static final intLITERAL_private61
+public static final intLITERAL_protected63
+public static final intLITERAL_public62
+public static final intLITERAL_return91
+public static final intLITERAL_short53
+public static final intLITERAL_static64
+public static final intLITERAL_super80
+public static final intLITERAL_switch92
+public static final intLITERAL_synchronized68
+public static final intLITERAL_this79
+public static final intLITERAL_threadsafe67
+public static final intLITERAL_throw93
+public static final intLITERAL_throws82
+public static final intLITERAL_transient65
+public static final intLITERAL_true135
+public static final intLITERAL_try97
+public static final intLITERAL_void49
+public static final intLITERAL_volatile69
+public static final intLITERAL_while87
+public static final intLNOT134
+public static final intLOR112
+public static final intLPAREN77
+public static final intLT119
+public static final intMETHOD_CALL27
+public static final intMETHOD_DEF9
+public static final intMINUS128
+public static final intMINUS_ASSIGN101
+public static final intML_COMMENT147
+public static final intMOD130
+public static final intMOD_ASSIGN104
+public static final intMODIFIERS5
+public static final intNOT_EQUAL117
+public static final intNULL_TREE_LOOKAHEAD3
+public static final intNUM_DOUBLE144
+public static final intNUM_FLOAT142
+public static final intNUM_INT139
+public static final intNUM_LONG143
+public static final intOBJBLOCK6
+public static final intPACKAGE_DEF16
+public static final intPARAMETER_DEF21
+public static final intPARAMETERS20
+public static final intPLUS127
+public static final intPLUS_ASSIGN100
+public static final intPOST_DEC26
+public static final intPOST_INC25
+public static final intQUESTION111
+public static final intRBRACK48
+public static final intRCURLY74
+public static final intRPAREN78
+public static final intSEMI45
+public static final intSL124
+public static final intSL_ASSIGN107
+public static final intSL_COMMENT146
+public static final intSLIST7
+public static final intSR125
+public static final intSR_ASSIGN105
+public static final intSTAR60
+public static final intSTAR_ASSIGN102
+public static final intSTATIC_INIT12
+public static final intSTRICTFP41
+public static final intSTRING_LITERAL141
+public static final intSUPER_CTOR_CALL42
+public static final intTYPE13
+public static final intTYPECAST23
+public static final intUNARY_MINUS31
+public static final intUNARY_PLUS32
+public static final intVARIABLE_DEF10
+public static final intVOCAB150
+public static final intWEBCOLOR_LITERAL155
+public static final intWS145
+ +

+ +

+ + + + + + + + + + + + +
processing.app.syntax.InputHandler
+public static final java.lang.StringSMART_HOME_END_PROPERTY"InputHandler.homeEnd"
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.syntax.Token
+public static final byteCOMMENT11
+public static final byteCOMMENT22
+public static final byteEND127
+public static final byteID_COUNT11
+public static final byteINTERNAL_FIRST100
+public static final byteINTERNAL_LAST126
+public static final byteINVALID10
+public static final byteKEYWORD16
+public static final byteKEYWORD27
+public static final byteKEYWORD38
+public static final byteLABEL5
+public static final byteLITERAL13
+public static final byteLITERAL24
+public static final byteNULL0
+public static final byteOPERATOR9
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.windows.WINERROR
+public static final intERROR_FILE_NOT_FOUND2
+public static final intERROR_MORE_DATA234
+public static final intERROR_SUCCESS0
+public static final intNO_ERROR0
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.windows.WINNT
+public static final intDELETE65536
+public static final intGENERIC_EXECUTE536870912
+public static final intKEY_CREATE_LINK32
+public static final intKEY_CREATE_SUB_KEY4
+public static final intKEY_ENUMERATE_SUB_KEYS8
+public static final intKEY_NOTIFY16
+public static final intKEY_QUERY_VALUE1
+public static final intKEY_READ131097
+public static final intKEY_SET_VALUE2
+public static final intKEY_WRITE131078
+public static final intREAD_CONTROL131072
+public static final intREG_BINARY3
+public static final intREG_DWORD4
+public static final intREG_DWORD_BIG_ENDIAN5
+public static final intREG_DWORD_LITTLE_ENDIAN4
+public static final intREG_EXPAND_SZ2
+public static final intREG_FULL_RESOURCE_DESCRIPTOR9
+public static final intREG_LINK6
+public static final intREG_MULTI_SZ7
+public static final intREG_NONE0
+public static final intREG_OPTION_BACKUP_RESTORE4
+public static final intREG_OPTION_CREATE_LINK2
+public static final intREG_OPTION_NON_VOLATILE0
+public static final intREG_OPTION_OPEN_LINK8
+public static final intREG_OPTION_RESERVED0
+public static final intREG_OPTION_VOLATILE1
+public static final intREG_RESOURCE_LIST8
+public static final intREG_RESOURCE_REQUIREMENTS_LIST10
+public static final intREG_SZ1
+public static final intSERVICE_WIN32_OWN_PROCESS16
+public static final intSPECIFIC_RIGHTS_ALL65535
+public static final intSTANDARD_RIGHTS_ALL2031616
+public static final intSTANDARD_RIGHTS_EXECUTE131072
+public static final intSTANDARD_RIGHTS_READ131072
+public static final intSTANDARD_RIGHTS_REQUIRED983040
+public static final intSTANDARD_RIGHTS_WRITE131072
+public static final intSYNCHRONIZE1048576
+public static final intWRITE_DAC262144
+public static final intWRITE_OWNER524288
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.app.windows.WINREG
+public static final intHKEY_CLASSES_ROOT-2147483648
+public static final intHKEY_CURRENT_USER-2147483647
+public static final intHKEY_LOCAL_MACHINE-2147483646
+public static final intHKEY_USERS-2147483645
+ +

+ +

+ + + + + +
+processing.core.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PApplet
+public static final java.lang.StringARGS_BGCOLOR"--bgcolor"
+public static final java.lang.StringARGS_DISPLAY"--display"
+public static final java.lang.StringARGS_EDITOR_LOCATION"--editor-location"
+public static final java.lang.StringARGS_EXCLUSIVE"--exclusive"
+public static final java.lang.StringARGS_EXTERNAL"--external"
+public static final java.lang.StringARGS_HIDE_STOP"--hide-stop"
+public static final java.lang.StringARGS_LOCATION"--location"
+public static final java.lang.StringARGS_PRESENT"--present"
+public static final java.lang.StringARGS_SKETCH_FOLDER"--sketch-path"
+public static final java.lang.StringARGS_STOP_COLOR"--stop-color"
+public static final intDEFAULT_HEIGHT100
+public static final intDEFAULT_WIDTH100
+public static final java.lang.StringEXTERNAL_MOVE"__MOVE__"
+public static final java.lang.StringEXTERNAL_STOP"__STOP__"
+public static final intMIN_WINDOW_HEIGHT128
+public static final intMIN_WINDOW_WIDTH128
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PConstants
+public static final intA6
+public static final intAB27
+public static final intADD2
+public static final intAG26
+public static final intALPHA4
+public static final intALPHA_MASK-16777216
+public static final intALT18
+public static final intAMBIENT0
+public static final intAR25
+public static final intARC32
+public static final intARGB2
+public static final intARROW0
+public static final intB5
+public static final charBACKSPACE8
+public static final intBASELINE0
+public static final intBEEN_LIT35
+public static final intBEVEL32
+public static final intBLEND1
+public static final intBLUE_MASK255
+public static final intBLUR11
+public static final intBOTTOM102
+public static final intBOX41
+public static final intBURN8192
+public static final intCENTER3
+public static final intCENTER_DIAMETER3
+public static final intCENTER_RADIUS2
+public static final intCHATTER0
+public static final intCLOSE2
+public static final intCMYK5
+public static final intCODED65535
+public static final intCOMPLAINT1
+public static final intCONTROL17
+public static final intCORNER0
+public static final intCORNERS1
+public static final intCROSS1
+public static final intCUSTOM0
+public static final intDA6
+public static final intDARKEST16
+public static final intDB5
+public static final floatDEG_TO_RAD0.01745329238474369f
+public static final charDELETE127
+public static final intDG4
+public static final intDIAMETER3
+public static final intDIFFERENCE32
+public static final intDILATE18
+public static final intDIRECTIONAL1
+public static final intDISABLE_ACCURATE_TEXTURES-7
+public static final intDISABLE_DEPTH_SORT-5
+public static final intDISABLE_DEPTH_TEST4
+public static final intDISABLE_OPENGL_2X_SMOOTH1
+public static final intDISABLE_OPENGL_ERROR_REPORT6
+public static final intDODGE4096
+public static final intDOWN40
+public static final intDR3
+public static final java.lang.StringDXF"processing.dxf.RawDXF"
+public static final intEB34
+public static final intEDGE12
+public static final intEG33
+public static final intELLIPSE31
+public static final intENABLE_ACCURATE_TEXTURES7
+public static final intENABLE_DEPTH_SORT5
+public static final intENABLE_DEPTH_TEST-4
+public static final intENABLE_NATIVE_FONTS3
+public static final intENABLE_OPENGL_2X_SMOOTH-1
+public static final intENABLE_OPENGL_4X_SMOOTH2
+public static final intENABLE_OPENGL_ERROR_REPORT-6
+public static final charENTER10
+public static final floatEPSILON9.999999747378752E-5f
+public static final intER32
+public static final intERODE17
+public static final java.lang.StringERROR_BACKGROUND_IMAGE_FORMAT"background images should be RGB or ARGB"
+public static final java.lang.StringERROR_BACKGROUND_IMAGE_SIZE"background image must be the same size as your application"
+public static final java.lang.StringERROR_PUSHMATRIX_OVERFLOW"Too many calls to pushMatrix()."
+public static final java.lang.StringERROR_PUSHMATRIX_UNDERFLOW"Too many calls to popMatrix(), and not enough to pushMatrix()."
+public static final java.lang.StringERROR_TEXTFONT_NULL_PFONT"A null PFont was passed to textFont()"
+public static final charESC27
+public static final intEXCLUSION64
+public static final intG4
+public static final intGIF3
+public static final intGRAY12
+public static final intGREEN_MASK65280
+public static final floatHALF_PI1.5707963705062866f
+public static final intHAND12
+public static final intHARD_LIGHT1024
+public static final intHINT_COUNT10
+public static final intHSB3
+public static final intIMAGE2
+public static final intINVERT13
+public static final java.lang.StringJAVA2D"processing.core.PGraphicsJava2D"
+public static final intJPEG2
+public static final intLEFT37
+public static final intLIGHTEST8
+public static final intLINE4
+public static final intLINES4
+public static final intLINUX3
+public static final intMACOSX2
+public static final floatMAX_FLOAT3.4028234663852886E38f
+public static final intMAX_INT2147483647
+public static final floatMIN_FLOAT-3.4028234663852886E38f
+public static final intMIN_INT-2147483648
+public static final intMITER8
+public static final intMODEL4
+public static final intMOVE13
+public static final intMULTIPLY128
+public static final intNORMAL1
+public static final intNORMALIZED1
+public static final intNX9
+public static final intNY10
+public static final intNZ11
+public static final intOPAQUE14
+public static final intOPEN1
+public static final java.lang.StringOPENGL"processing.opengl.PGraphicsOpenGL"
+public static final intORTHOGRAPHIC2
+public static final intOTHER0
+public static final intOVERLAY512
+public static final java.lang.StringP2D"processing.core.PGraphics2D"
+public static final java.lang.StringP3D"processing.core.PGraphics3D"
+public static final intPATH21
+public static final java.lang.StringPDF"processing.pdf.PGraphicsPDF"
+public static final intPERSPECTIVE3
+public static final floatPI3.1415927410125732f
+public static final intPOINT2
+public static final intPOINTS2
+public static final intPOLYGON20
+public static final intPOSTERIZE15
+public static final intPROBLEM2
+public static final intPROJECT4
+public static final intQUAD16
+public static final intQUAD_STRIP17
+public static final intQUADS16
+public static final floatQUARTER_PI0.7853981852531433f
+public static final intR3
+public static final floatRAD_TO_DEG57.2957763671875f
+public static final intRADIUS2
+public static final intRECT30
+public static final intRED_MASK16711680
+public static final intREPLACE0
+public static final charRETURN13
+public static final intRGB1
+public static final intRIGHT39
+public static final intROUND2
+public static final intSA16
+public static final intSB15
+public static final intSCREEN256
+public static final intSG14
+public static final intSHAPE5
+public static final intSHIFT16
+public static final intSHINE31
+public static final intSOFT_LIGHT2048
+public static final intSPB30
+public static final intSPG29
+public static final intSPHERE40
+public static final intSPOT3
+public static final intSPR28
+public static final intSQUARE1
+public static final intSR13
+public static final intSUBTRACT4
+public static final intSW17
+public static final charTAB9
+public static final intTARGA1
+public static final intTEXT2
+public static final floatTHIRD_PI1.0471975803375244f
+public static final intTHRESHOLD16
+public static final intTIFF0
+public static final intTOP101
+public static final intTRIANGLE8
+public static final intTRIANGLE_FAN11
+public static final intTRIANGLE_STRIP10
+public static final intTRIANGLES9
+public static final floatTWO_PI6.2831854820251465f
+public static final intTX18
+public static final intTY19
+public static final intTZ20
+public static final intU7
+public static final intUP38
+public static final intV8
+public static final intVERTEX_FIELD_COUNT36
+public static final intVW24
+public static final intVX21
+public static final intVY22
+public static final intVZ23
+public static final intWAIT3
+public static final java.lang.StringWHITESPACE" \t\n\r\f\u00a0"
+public static final intWINDOWS1
+public static final intX0
+public static final intY1
+public static final intZ2
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PGraphics3D
+public static final intMAX_LIGHTS8
+public static final intTRI_COLOR_COUNT7
+public static final intTRI_DIFFUSE_A3
+public static final intTRI_DIFFUSE_B2
+public static final intTRI_DIFFUSE_G1
+public static final intTRI_DIFFUSE_R0
+public static final intTRI_SPECULAR_B6
+public static final intTRI_SPECULAR_G5
+public static final intTRI_SPECULAR_R4
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.core.PShape
+public static final intBEZIER_VERTEX1
+public static final intBREAK3
+public static final intCURVE_VERTEX2
+public static final intGEOMETRY3
+public static final intGROUP0
+public static final intPATH2
+public static final intPRIMITIVE1
+public static final intVERTEX0
+ +

+ +

+ + + + + +
+processing.video.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.video.Capture
+public static final intCOMPONENT2
+public static final intCOMPOSITE0
+public static final intNTSC0
+public static final intPAL1
+public static final intSECAM2
+public static final intSVIDEO1
+public static final intTUNER6
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.video.MovieMaker
+public static final intANIMATION1919706400
+public static final intBASE1650553701
+public static final intBEST1023
+public static final intBMP1465011269
+public static final intCINEPAK1668704612
+public static final intCMYK1668118891
+public static final intCOMPONENT2037741106
+public static final intGIF1734960672
+public static final intGRAPHICS1936548640
+public static final intH2611748121137
+public static final intH2631748121139
+public static final intHIGH768
+public static final intJPEG1785750887
+public static final intLOSSLESS1024
+public static final intLOW256
+public static final intMEDIUM512
+public static final intMOTION_JPEG_A1835692129
+public static final intMOTION_JPEG_B1835692130
+public static final intMS_VIDEO1836283491
+public static final intRAW1918990112
+public static final intSORENSON1398165809
+public static final intVIDEO1919973985
+public static final intWORST0
+ +

+ +

+ + + + + +
+processing.xml.*
+ +

+ + + + + + + + + + + + +
processing.xml.XMLElement
+public static final intNO_LINE-1
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
processing.xml.XMLValidationException
+public static final intATTRIBUTE_WITH_INVALID_VALUE5
+public static final intMISC_ERROR0
+public static final intMISSING_ATTRIBUTE3
+public static final intMISSING_ELEMENT1
+public static final intMISSING_PCDATA6
+public static final intUNEXPECTED_ATTRIBUTE4
+public static final intUNEXPECTED_ELEMENT2
+public static final intUNEXPECTED_PCDATA7
+ +

+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/deprecated-list.html b/build/javadoc/everything/deprecated-list.html new file mode 100644 index 000000000..9323d4dfc --- /dev/null +++ b/build/javadoc/everything/deprecated-list.html @@ -0,0 +1,194 @@ + + + + + +Deprecated List + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents + + + + + + + + + + + + + + + +
+Deprecated Fields
processing.core.PConstants.CENTER_DIAMETER +
+          Use DIAMETER instead. 
processing.core.PConstants.CENTER_RADIUS +
+          Use RADIUS instead. 
processing.core.PConstants.NORMALIZED +
+          use NORMAL instead 
+  +

+ + + + + + + + + + + + + + + + + +
+Deprecated Methods
processing.core.PApplet.arraycopy(Object, int, Object, int, int) +
+          Use arrayCopy() instead. 
processing.core.PApplet.arraycopy(Object, Object) +
+          Use arrayCopy() instead. 
processing.core.PApplet.arraycopy(Object, Object, int) +
+          Use arrayCopy() instead. 
processing.core.PApplet.openStream(String) +
+          As of release 0136, use createInput() instead. 
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/help-doc.html b/build/javadoc/everything/help-doc.html new file mode 100644 index 000000000..95e3d1459 --- /dev/null +++ b/build/javadoc/everything/help-doc.html @@ -0,0 +1,212 @@ + + + + + +API Help + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Overview

+
+ +

+The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

    +
  • Interfaces (italic)
  • Classes
  • Enums
  • Exceptions
  • Errors
  • Annotation Types
+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description +

    +

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary +

    +

  • Field Detail
  • Constructor Detail
  • Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

    +
  • Annotation Type declaration
  • Annotation Type description
  • Required Element Summary
  • Optional Element Summary
  • Element Detail
+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

    +
  • Enum declaration
  • Enum description
  • Enum Constant Summary
  • Enum Constant Detail
+
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
    +
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/index-all.html b/build/javadoc/everything/index-all.html new file mode 100644 index 000000000..d3529cbbe --- /dev/null +++ b/build/javadoc/everything/index-all.html @@ -0,0 +1,11887 @@ + + + + + +Index + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _
+

+A

+
+
A - +Static variable in interface processing.core.PConstants +
  +
AB - +Static variable in interface processing.core.PConstants +
  +
abs(float) - +Static method in class processing.core.PApplet +
  +
abs(int) - +Static method in class processing.core.PApplet +
  +
ABSTRACT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ABSTRACT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ABSTRACT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
aCase() - +Method in class antlr.java.JavaRecognizer +
  +
aCase() - +Method in class processing.app.preproc.PdeRecognizer +
  +
acos(float) - +Static method in class processing.core.PApplet +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.EditorStatus +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.FindReplace +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.backspace +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.backspace_word +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.delete +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.delete_word +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.document_end +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.document_home +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.end +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.home +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.insert_break +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.insert_char +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.insert_tab +
  +
actionPerformed(ActionListener, String) - +Method in interface processing.app.syntax.InputHandler.MacroRecorder +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.next_char +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.next_line +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.next_page +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.next_word +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.overwrite +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.prev_char +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.prev_line +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.prev_page +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.prev_word +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.repeat +
  +
actionPerformed(ActionEvent) - +Method in class processing.app.syntax.InputHandler.toggle_rect +
  +
activate(int) - +Method in class processing.app.EditorToolbar +
Set a particular button to be active. +
ACTIVE - +Static variable in class processing.app.preproc.PdePreprocessor +
  +
active() - +Method in class processing.net.Client +
Return true if this client is still active and hasn't run + into any trouble. +
activeProgram() - +Method in class processing.app.preproc.PdeRecognizer +
  +
add(String, byte) - +Method in class processing.app.syntax.KeywordMap +
Adds a key-value mapping. +
add(Object, Method) - +Method in class processing.core.PApplet.RegisteredMethods +
  +
ADD - +Static variable in interface processing.core.PConstants +
  +
add(PVector) - +Method in class processing.core.PVector +
Add a vector to this vector +
add(float, float, float) - +Method in class processing.core.PVector +
  +
add(PVector, PVector) - +Static method in class processing.core.PVector +
Add two vectors +
add(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
Add two vectors into a target vector +
addAttribute(String, String, String, String, String) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a new attribute of an XML element is + encountered. +
addCaretListener(CaretListener) - +Method in class processing.app.syntax.JEditTextArea +
Adds a caret change listener to this text area. +
addChild(PShape) - +Method in class processing.core.PShape +
  +
addChild(XMLElement) - +Method in class processing.xml.XMLElement +
Adds a child element. +
addCustomHighlight(TextAreaPainter.Highlight) - +Method in class processing.app.syntax.TextAreaPainter +
Adds a custom highlight painter. +
addDefaultKeyBindings() - +Method in class processing.app.syntax.DefaultInputHandler +
Sets up the default key bindings. +
addDefaultKeyBindings() - +Method in class processing.app.syntax.InputHandler +
Adds the default key bindings to this input handler. +
addExternalEntity(String, String, String) - +Method in class processing.xml.XMLEntityResolver +
Adds an external entity. +
addFile(File) - +Method in class processing.app.Sketch +
Add a file to the sketch. +
addFonts(String) - +Method in class processing.pdf.PGraphicsPDF +
Add a directory that should be searched for font data. +
addFrame() - +Method in class processing.video.MovieMaker +
  +
addFrame(int[], int, int) - +Method in class processing.video.MovieMaker +
  +
addInternalEntity(String, String) - +Method in class processing.xml.XMLEntityResolver +
Adds an internal entity. +
additiveExpression() - +Method in class antlr.java.JavaRecognizer +
  +
additiveExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
addKeyBinding(String, ActionListener) - +Method in class processing.app.syntax.DefaultInputHandler +
Adds a key binding to this input handler. +
addKeyBinding(String, ActionListener) - +Method in class processing.app.syntax.InputHandler +
Adds a key binding to this input handler. +
addListeners() - +Method in class processing.core.PApplet +
  +
addPCData(Reader, String, int) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a PCDATA element is encountered. +
addPreprocOffset(int) - +Method in class processing.app.SketchCode +
  +
addUndoableEdit(UndoableEdit) - +Method in class processing.app.syntax.SyntaxDocument +
Adds an undoable edit to this document's undo list. +
Advapi32 - Interface in processing.app.windows
 
Advapi32.ChangeServiceConfig2Info - Class in processing.app.windows
 
Advapi32.ChangeServiceConfig2Info() - +Constructor for class processing.app.windows.Advapi32.ChangeServiceConfig2Info +
  +
Advapi32.Handler - Interface in processing.app.windows
 
Advapi32.HandlerEx - Interface in processing.app.windows
 
Advapi32.SERVICE_DESCRIPTION - Class in processing.app.windows
 
Advapi32.SERVICE_DESCRIPTION() - +Constructor for class processing.app.windows.Advapi32.SERVICE_DESCRIPTION +
  +
Advapi32.SERVICE_MAIN_FUNCTION - Interface in processing.app.windows
 
Advapi32.SERVICE_STATUS - Class in processing.app.windows
 
Advapi32.SERVICE_STATUS() - +Constructor for class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
Advapi32.SERVICE_TABLE_ENTRY - Class in processing.app.windows
 
Advapi32.SERVICE_TABLE_ENTRY() - +Constructor for class processing.app.windows.Advapi32.SERVICE_TABLE_ENTRY +
  +
AG - +Static variable in interface processing.core.PConstants +
  +
alpha(int) - +Method in class processing.core.PApplet +
  +
ALPHA - +Static variable in interface processing.core.PConstants +
  +
alpha(int) - +Method in class processing.core.PGraphics +
  +
ALPHA_MASK - +Static variable in interface processing.core.PConstants +
  +
ALT - +Static variable in interface processing.core.PConstants +
  +
ambient(int) - +Method in class processing.core.PApplet +
  +
ambient(float) - +Method in class processing.core.PApplet +
  +
ambient(float, float, float) - +Method in class processing.core.PApplet +
  +
AMBIENT - +Static variable in interface processing.core.PConstants +
  +
ambient(int) - +Method in class processing.core.PGraphics +
  +
ambient(float) - +Method in class processing.core.PGraphics +
  +
ambient(float, float, float) - +Method in class processing.core.PGraphics +
  +
ambientB - +Variable in class processing.core.PGraphics +
  +
ambientB - +Variable in class processing.core.PStyle +
  +
ambientG - +Variable in class processing.core.PGraphics +
  +
ambientG - +Variable in class processing.core.PStyle +
  +
ambientLight(float, float, float) - +Method in class processing.core.PApplet +
  +
ambientLight(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
ambientLight(float, float, float) - +Method in class processing.core.PGraphics +
  +
ambientLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
ambientLight(float, float, float) - +Method in class processing.core.PGraphics3D +
Add an ambient light based on the current color mode. +
ambientLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Add an ambient light based on the current color mode. +
ambientLight(float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
ambientLight(float, float, float, float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
ambientR - +Variable in class processing.core.PGraphics +
  +
ambientR - +Variable in class processing.core.PStyle +
  +
andExpression() - +Method in class antlr.java.JavaRecognizer +
  +
andExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
angleBetween(PVector, PVector) - +Static method in class processing.core.PVector +
Calculate the angle between two vectors, using the dot product +
ANIMATION - +Static variable in class processing.video.MovieMaker +
  +
antlr - package antlr
 
antlr.java - package antlr.java
 
append(byte[], byte) - +Static method in class processing.core.PApplet +
  +
append(char[], char) - +Static method in class processing.core.PApplet +
  +
append(int[], int) - +Static method in class processing.core.PApplet +
  +
append(float[], float) - +Static method in class processing.core.PApplet +
  +
append(String[], String) - +Static method in class processing.core.PApplet +
  +
append(Object, Object) - +Static method in class processing.core.PApplet +
  +
appendFormattedLine(StringBuffer, int) - +Method in class processing.app.tools.DiscourseFormat +
  +
apply(PMatrix) - +Method in interface processing.core.PMatrix +
Multiply this matrix by another. +
apply(PMatrix2D) - +Method in interface processing.core.PMatrix +
  +
apply(PMatrix3D) - +Method in interface processing.core.PMatrix +
  +
apply(float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
apply(PMatrix) - +Method in class processing.core.PMatrix2D +
  +
apply(PMatrix2D) - +Method in class processing.core.PMatrix2D +
  +
apply(PMatrix3D) - +Method in class processing.core.PMatrix2D +
  +
apply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
apply(PMatrix) - +Method in class processing.core.PMatrix3D +
  +
apply(PMatrix2D) - +Method in class processing.core.PMatrix3D +
  +
apply(PMatrix3D) - +Method in class processing.core.PMatrix3D +
  +
apply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
apply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
apply(PMatrix3D) - +Method in class processing.core.PShape +
  +
applyMatrix(PMatrix) - +Method in class processing.core.PApplet +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PApplet +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
applyMatrix(PMatrix3D) - +Method in class processing.core.PApplet +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
applyMatrix(PMatrix) - +Method in class processing.core.PGraphics +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PGraphics +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Apply a 3x2 affine transformation matrix. +
applyMatrix(PMatrix3D) - +Method in class processing.core.PGraphics +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Apply a 4x4 transformation matrix. +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
Apply a 3x2 affine transformation matrix. +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PGraphics3D +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
applyMatrix(PMatrix3D) - +Method in class processing.core.PGraphics3D +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Apply a 4x4 transformation matrix. +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
applyMatrix(PMatrix) - +Method in class processing.core.PShape +
  +
applyMatrix(PMatrix2D) - +Method in class processing.core.PShape +
  +
applyMatrix(float, float, float, float, float, float) - +Method in class processing.core.PShape +
  +
applyMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PShape +
  +
applyPreferences() - +Method in class processing.app.EditorListener +
  +
AR - +Static variable in interface processing.core.PConstants +
  +
arc(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
ARC - +Static variable in interface processing.core.PConstants +
  +
arc(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Identical parameters and placement to ellipse, + but draws only an arc of that ellipse. +
Archiver - Class in processing.app.tools
 
Archiver() - +Constructor for class processing.app.tools.Archiver +
  +
ARGB - +Static variable in interface processing.core.PConstants +
  +
argList() - +Method in class antlr.java.JavaRecognizer +
  +
argList() - +Method in class processing.app.preproc.PdeRecognizer +
  +
args - +Variable in class processing.core.PApplet +
Command line options passed in from main(). +
ARGS_BGCOLOR - +Static variable in class processing.core.PApplet +
  +
ARGS_DISPLAY - +Static variable in class processing.core.PApplet +
  +
ARGS_EDITOR_LOCATION - +Static variable in class processing.core.PApplet +
Position of the upper-lefthand corner of the editor window + that launched this applet. +
ARGS_EXCLUSIVE - +Static variable in class processing.core.PApplet +
  +
ARGS_EXTERNAL - +Static variable in class processing.core.PApplet +
Location for where to position the applet window on screen. +
ARGS_HIDE_STOP - +Static variable in class processing.core.PApplet +
  +
ARGS_LOCATION - +Static variable in class processing.core.PApplet +
  +
ARGS_PRESENT - +Static variable in class processing.core.PApplet +
  +
ARGS_SKETCH_FOLDER - +Static variable in class processing.core.PApplet +
Allows the user or PdeEditor to set a specific sketch folder path. +
ARGS_STOP_COLOR - +Static variable in class processing.core.PApplet +
  +
array() - +Method in class processing.core.PVector +
Return a representation of this vector as a float array. +
ARRAY_DECLARATOR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ARRAY_DECLARATOR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ARRAY_DECLARATOR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
ARRAY_INIT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ARRAY_INIT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ARRAY_INIT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
arrayCopy(Object, int, Object, int, int) - +Static method in class processing.core.PApplet +
Calls System.arraycopy(), included here so that we can + avoid people needing to learn about the System object + before they can just copy an array. +
arrayCopy(Object, Object, int) - +Static method in class processing.core.PApplet +
Convenience method for arraycopy(). +
arrayCopy(Object, Object) - +Static method in class processing.core.PApplet +
Shortcut to copy the entire contents of + the source into the destination array. +
arraycopy(Object, int, Object, int, int) - +Static method in class processing.core.PApplet +
Deprecated. Use arrayCopy() instead. +
arraycopy(Object, Object, int) - +Static method in class processing.core.PApplet +
Deprecated. Use arrayCopy() instead. +
arraycopy(Object, Object) - +Static method in class processing.core.PApplet +
Deprecated. Use arrayCopy() instead. +
arrayInitializer() - +Method in class antlr.java.JavaRecognizer +
  +
arrayInitializer() - +Method in class processing.app.preproc.PdeRecognizer +
  +
ARROW - +Static variable in interface processing.core.PConstants +
  +
ascent - +Variable in class processing.core.PFont +
  +
ascent() - +Method in class processing.core.PFont +
Returns the ascent of this font from the baseline. +
asin(float) - +Static method in class processing.core.PApplet +
  +
ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
assignmentExpression() - +Method in class antlr.java.JavaRecognizer +
  +
assignmentExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
atan(float) - +Static method in class processing.core.PApplet +
  +
atan2(float, float) - +Static method in class processing.core.PApplet +
  +
atEOF() - +Method in class processing.xml.StdXMLReader +
Returns true if there are no more characters left to be read. +
atEOFOfCurrentStream() - +Method in class processing.xml.StdXMLReader +
Returns true if the current stream has no more characters left to be + read. +
ATTRIBUTE_WITH_INVALID_VALUE - +Static variable in exception processing.xml.XMLValidationException +
An attribute has an invalid value. +
attributeAdded(String, String, String, int) - +Method in class processing.xml.XMLValidator +
Indicates that an attribute has been added to the current element. +
AutoFormat - Class in processing.app.tools
Alternate handler for dealing with auto format.
AutoFormat() - +Constructor for class processing.app.tools.AutoFormat +
  +
available() - +Method in class processing.net.Client +
Returns the number of bytes that have been read from serial + and are waiting to be dealt with by the user. +
available() - +Method in class processing.net.Server +
Returns the next client in line that has something to say. +
available() - +Method in class processing.serial.Serial +
Returns the number of bytes that have been read from serial + and are waiting to be dealt with by the user. +
available() - +Method in class processing.video.Capture +
True if a frame is ready to be read. +
available() - +Method in class processing.video.Movie +
  +
+
+

+B

+
+
B - +Static variable in interface processing.core.PConstants +
  +
background(int) - +Method in class processing.core.PApplet +
  +
background(int, float) - +Method in class processing.core.PApplet +
  +
background(float) - +Method in class processing.core.PApplet +
  +
background(float, float) - +Method in class processing.core.PApplet +
  +
background(float, float, float) - +Method in class processing.core.PApplet +
  +
background(float, float, float, float) - +Method in class processing.core.PApplet +
  +
background(PImage) - +Method in class processing.core.PApplet +
  +
background(int) - +Method in class processing.core.PGraphics +
Set the background to a gray or ARGB color. +
background(int, float) - +Method in class processing.core.PGraphics +
See notes about alpha in background(x, y, z, a). +
background(float) - +Method in class processing.core.PGraphics +
Set the background to a grayscale value, based on the + current colorMode. +
background(float, float) - +Method in class processing.core.PGraphics +
See notes about alpha in background(x, y, z, a). +
background(float, float, float) - +Method in class processing.core.PGraphics +
Set the background to an r, g, b or h, s, b value, + based on the current colorMode. +
background(float, float, float, float) - +Method in class processing.core.PGraphics +
Clear the background with a color that includes an alpha value. +
background(PImage) - +Method in class processing.core.PGraphics +
Takes an RGB or ARGB image and sets it as the background. +
backgroundColor - +Variable in class processing.core.PGraphics +
Last background color that was set, zero if an image +
backgroundImpl() - +Method in class processing.core.PGraphicsJava2D +
  +
BACKSPACE - +Static variable in class processing.app.syntax.InputHandler +
  +
BACKSPACE - +Static variable in interface processing.core.PConstants +
  +
BACKSPACE_WORD - +Static variable in class processing.app.syntax.InputHandler +
  +
BAND - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BAND - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BAND - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
BAND_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BAND_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BAND_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
Base - Class in processing.app
The base class for the main processing application.
Base(String[]) - +Constructor for class processing.app.Base +
  +
BASE - +Static variable in class processing.video.MovieMaker +
  +
BASELINE - +Static variable in interface processing.core.PConstants +
Default vertical alignment for text placement +
BEEN_LIT - +Static variable in interface processing.core.PConstants +
  +
begin(int) - +Method in class processing.opengl.PGraphicsOpenGL.TessCallback +
  +
beginCamera() - +Method in class processing.core.PApplet +
  +
beginCamera() - +Method in class processing.core.PGraphics +
  +
beginCamera() - +Method in class processing.core.PGraphics3D +
Set matrix mode to the camera matrix (instead of the current + transformation matrix). +
beginCompoundEdit() - +Method in class processing.app.syntax.SyntaxDocument +
Starts a compound edit that can be undone in one operation. +
beginDraw() - +Method in class processing.core.PGraphics +
Prepares the PGraphics for drawing. +
beginDraw() - +Method in class processing.core.PGraphics2D +
  +
beginDraw() - +Method in class processing.core.PGraphics3D +
  +
beginDraw() - +Method in class processing.core.PGraphicsJava2D +
  +
beginDraw() - +Method in class processing.dxf.RawDXF +
  +
beginDraw() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
beginDraw() - +Method in class processing.pdf.PGraphicsPDF +
  +
beginGL() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
beginRaw(String, String) - +Method in class processing.core.PApplet +
Begin recording raw shape data to a renderer of the specified type, + using the width and height of the main drawing surface. +
beginRaw(PGraphics) - +Method in class processing.core.PApplet +
Begin recording raw shape data to the specified renderer. +
beginRaw(PGraphics) - +Method in class processing.core.PGraphics +
Record individual lines and triangles by echoing them to another renderer. +
beginRaw(PGraphics) - +Method in class processing.core.PGraphicsJava2D +
  +
beginRecord(String, String) - +Method in class processing.core.PApplet +
Begin recording to a new renderer of the specified type, using the width + and height of the main drawing surface. +
beginRecord(PGraphics) - +Method in class processing.core.PApplet +
Begin recording (echoing) commands to the specified PGraphics object. +
beginShape() - +Method in class processing.core.PApplet +
  +
beginShape(int) - +Method in class processing.core.PApplet +
  +
beginShape() - +Method in class processing.core.PGraphics +
Start a new shape of type POLYGON +
beginShape(int) - +Method in class processing.core.PGraphics +
Start a new shape. +
beginShape(int) - +Method in class processing.core.PGraphics2D +
  +
beginShape(int) - +Method in class processing.core.PGraphics3D +
  +
beginShape(int) - +Method in class processing.core.PGraphicsJava2D +
  +
beginShape(int) - +Method in class processing.dxf.RawDXF +
  +
BEST - +Static variable in class processing.video.MovieMaker +
  +
BEVEL - +Static variable in interface processing.core.PConstants +
  +
bezier(float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezier(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Draw a cubic bezier curve. +
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
bezier(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
BEZIER_VERTEX - +Static variable in class processing.core.PShape +
  +
bezierDetail(int) - +Method in class processing.core.PApplet +
  +
bezierDetail - +Variable in class processing.core.PGraphics +
  +
bezierDetail(int) - +Method in class processing.core.PGraphics +
  +
bezierDetail(int) - +Method in class processing.core.PGraphicsJava2D +
Ignored (not needed) in Java 2D. +
bezierPoint(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierPoint(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Evalutes quadratic bezier at point t for points a, b, c, d. +
bezierTangent(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierTangent(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Provide the tangent at the given point on the bezier curve. +
bezierVertex(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierVertex(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
bezierVertex(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
bezierVertex(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
bezierVertex(float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
bezierVertex(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
bgcolor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
BIG_ENDIAN - +Static variable in class processing.opengl.PGraphicsOpenGL +
Set to true if the host system is big endian (PowerPC, MIPS, SPARC), + false if little endian (x86 Intel for Mac or PC). +
binary(byte) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of a byte. +
binary(char) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of a char. +
binary(int) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of an int. +
binary(int, int) - +Static method in class processing.core.PApplet +
Returns a String that contains the binary value of an int. +
bInheritHandle - +Variable in class processing.app.windows.WINBASE.SECURITY_ATTRIBUTES +
  +
blend(int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
blend(PImage, int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
BLEND - +Static variable in interface processing.core.PConstants +
  +
blend(int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Blends one area of this image to another area. +
blend(PImage, int, int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Copies area of one image into another PImage object. +
blend(int, int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
blend(PImage, int, int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
blend(int, int, int, int, int, int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
blend(PImage, int, int, int, int, int, int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
blendColor(int, int, int) - +Static method in class processing.core.PApplet +
  +
blendColor(int, int, int) - +Static method in class processing.core.PImage +
Blend two colors based on a particular mode. +
blinkCaret() - +Method in class processing.app.syntax.JEditTextArea +
Blinks the caret. +
BLOCK - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BLOCK - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BLOCK - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
blockCaret - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
blue(int) - +Method in class processing.core.PApplet +
  +
blue(int) - +Method in class processing.core.PGraphics +
  +
BLUE_MASK - +Static variable in interface processing.core.PConstants +
  +
BLUR - +Static variable in interface processing.core.PConstants +
  +
BMP - +Static variable in class processing.video.MovieMaker +
  +
BNOT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BNOT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BNOT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
BOR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BOR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BOR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
BOR_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BOR_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BOR_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
BOTTOM - +Static variable in interface processing.core.PConstants +
Align text from the bottom, using the baseline. +
box(float) - +Method in class processing.core.PApplet +
  +
box(float, float, float) - +Method in class processing.core.PApplet +
  +
BOX - +Static variable in interface processing.core.PConstants +
  +
box(float) - +Method in class processing.core.PGraphics +
  +
box(float, float, float) - +Method in class processing.core.PGraphics +
  +
box(float) - +Method in class processing.core.PGraphics2D +
  +
box(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
box(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
box(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
bracketHighlight - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
bracketHighlightColor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
BREAK - +Static variable in class processing.core.PShape +
  +
breakShape() - +Method in class processing.core.PApplet +
  +
breakShape() - +Method in class processing.core.PGraphics +
This feature is in testing, do not use or rely upon its implementation +
breakShape() - +Method in class processing.core.PGraphics2D +
  +
breakShape() - +Method in class processing.core.PGraphicsJava2D +
  +
brightness(int) - +Method in class processing.core.PApplet +
  +
brightness(int) - +Method in class processing.core.PGraphics +
  +
BSR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BSR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BSR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
BSR_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BSR_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BSR_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
buffer(int) - +Method in class processing.serial.Serial +
Set number of bytes to buffer before calling serialEvent() + in the host applet. +
bufferUntil(int) - +Method in class processing.serial.Serial +
Set a specific byte to buffer until before calling + serialEvent() in the host applet. +
build(String) - +Method in class processing.app.Sketch +
Preprocess and compile all the code for this sketch. +
build() - +Method in class processing.app.tools.CreateFont +
  +
buildZip(File, String, ZipOutputStream) - +Method in class processing.app.tools.Archiver +
  +
builtInConsCastType() - +Method in class processing.app.preproc.PdeRecognizer +
  +
builtInConsCastTypeSpec(boolean) - +Method in class processing.app.preproc.PdeRecognizer +
  +
builtInType() - +Method in class antlr.java.JavaRecognizer +
  +
builtInType() - +Method in class processing.app.preproc.PdeRecognizer +
  +
builtInTypeSpec(boolean) - +Method in class antlr.java.JavaRecognizer +
  +
builtInTypeSpec(boolean) - +Method in class processing.app.preproc.PdeRecognizer +
  +
BURN - +Static variable in interface processing.core.PConstants +
  +
BUTTON_HEIGHT - +Static variable in class processing.app.Preferences +
Standardized button height. +
BUTTON_WIDTH - +Static variable in class processing.app.Preferences +
Standardized width for buttons. +
BXOR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BXOR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BXOR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
BXOR_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
BXOR_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
BXOR_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
+
+

+C

+
+
calcFolderSize(File) - +Static method in class processing.app.Base +
Calculate the size of the contents of a folder. +
callback(int) - +Method in interface processing.app.windows.Advapi32.Handler +
  +
callback(int, int, Pointer, Pointer) - +Method in interface processing.app.windows.Advapi32.HandlerEx +
  +
callback(int, Pointer) - +Method in interface processing.app.windows.Advapi32.SERVICE_MAIN_FUNCTION +
  +
camera() - +Method in class processing.core.PApplet +
  +
camera(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
camera() - +Method in class processing.core.PGraphics +
  +
camera(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
camera - +Variable in class processing.core.PGraphics3D +
The camera matrix, the modelview will be set to this on beginDraw. +
camera() - +Method in class processing.core.PGraphics3D +
Set camera to the default settings. +
camera(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
More flexible method for dealing with camera(). +
cameraAspect - +Variable in class processing.core.PGraphics3D +
Aspect ratio of camera's view. +
cameraFar - +Variable in class processing.core.PGraphics3D +
  +
cameraFOV - +Variable in class processing.core.PGraphics3D +
Camera field of view. +
cameraNear - +Variable in class processing.core.PGraphics3D +
  +
cameraX - +Variable in class processing.core.PGraphics3D +
Position of the camera. +
cameraY - +Variable in class processing.core.PGraphics3D +
Position of the camera. +
cameraZ - +Variable in class processing.core.PGraphics3D +
Position of the camera. +
canDraw() - +Method in class processing.core.PGraphics +
Some renderers have requirements re: when they are ready to draw. +
canDraw() - +Method in class processing.core.PGraphics2D +
  +
canDraw() - +Method in class processing.core.PGraphicsJava2D +
  +
canDraw() - +Method in class processing.opengl.PGraphicsOpenGL +
OpenGL cannot draw until a proper native peer is available, so this + returns the value of PApplet.isDisplayable() (inherited from Component). +
Capture - Class in processing.video
Watchin' shit on the telly.
Capture(PApplet, int, int) - +Constructor for class processing.video.Capture +
  +
Capture(PApplet, int, int, int) - +Constructor for class processing.video.Capture +
  +
Capture(PApplet, int, int, String) - +Constructor for class processing.video.Capture +
  +
Capture(PApplet, int, int, String, int) - +Constructor for class processing.video.Capture +
If 'name' is null or the empty string, it won't set a specific + device, which means that QuickTime will use that last device + used by a QuickTime application. +
capture - +Variable in class processing.video.Capture +
  +
caretBlinks - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
caretColor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
caretVisible - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
CASE_GROUP - +Static variable in interface antlr.java.JavaTokenTypes +
  +
CASE_GROUP - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
CASE_GROUP - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
casesGroup() - +Method in class antlr.java.JavaRecognizer +
  +
casesGroup() - +Method in class processing.app.preproc.PdeRecognizer +
  +
caseSList() - +Method in class antlr.java.JavaRecognizer +
  +
caseSList() - +Method in class processing.app.preproc.PdeRecognizer +
  +
ceil(float) - +Static method in class processing.core.PApplet +
  +
CENTER - +Static variable in interface processing.core.PConstants +
Draw from the center, using second pair of values as the diameter. +
CENTER_DIAMETER - +Static variable in interface processing.core.PConstants +
Deprecated. Use DIAMETER instead. +
CENTER_RADIUS - +Static variable in interface processing.core.PConstants +
Deprecated. Use RADIUS instead. +
changedUpdate(DocumentEvent) - +Method in class processing.app.tools.ColorSelector +
  +
ChangeServiceConfig2(Pointer, int, Advapi32.ChangeServiceConfig2Info) - +Method in interface processing.app.windows.Advapi32 +
  +
channel - +Variable in class processing.video.Capture +
the guy who's doing all the work +
CHAR_LITERAL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
CHAR_LITERAL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
CHAR_LITERAL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
charCount - +Variable in class processing.core.PFont +
  +
CHATTER - +Static variable in interface processing.core.PConstants +
  +
checkName(String) - +Static method in class processing.app.Sketch +
Convert to sanitized name and alert the user + if changes were made. +
CINEPAK - +Static variable in class processing.video.MovieMaker +
  +
CLASS_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
CLASS_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
CLASS_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
classBlock() - +Method in class antlr.java.JavaRecognizer +
  +
classBlock() - +Method in class processing.app.preproc.PdeRecognizer +
  +
classDefinition(AST) - +Method in class antlr.java.JavaRecognizer +
  +
classDefinition(AST) - +Method in class processing.app.preproc.PdeRecognizer +
  +
classTypeSpec(boolean) - +Method in class antlr.java.JavaRecognizer +
  +
classTypeSpec(boolean) - +Method in class processing.app.preproc.PdeRecognizer +
  +
clear() - +Method in class processing.app.EditorConsole +
  +
clear() - +Method in class processing.net.Client +
Ignore all the bytes read so far and empty the buffer. +
clear() - +Method in class processing.serial.Serial +
Ignore all the bytes read so far and empty the buffer. +
Client - Class in processing.net
 
Client(PApplet, String, int) - +Constructor for class processing.net.Client +
  +
Client(PApplet, Socket) - +Constructor for class processing.net.Client +
  +
clientCount - +Variable in class processing.net.Server +
Number of clients currently connected. +
clients - +Variable in class processing.net.Server +
Array of client objects, useful length is determined by clientCount. +
clone() - +Method in class processing.core.PImage +
Duplicate an image, returns new PImage object. +
close() - +Method in class processing.app.debug.Runner +
  +
CLOSE - +Static variable in interface processing.core.PConstants +
  +
CloseServiceHandle(Pointer) - +Method in interface processing.app.windows.Advapi32 +
  +
CMYK - +Static variable in interface processing.core.PConstants +
  +
CMYK - +Static variable in class processing.video.MovieMaker +
  +
CODED - +Static variable in interface processing.core.PConstants +
  +
COLON - +Static variable in interface antlr.java.JavaTokenTypes +
  +
COLON - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
COLON - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
color(int) - +Method in class processing.core.PApplet +
  +
color(float) - +Method in class processing.core.PApplet +
  +
color(int, int) - +Method in class processing.core.PApplet +
As of 0116 this also takes color(#FF8800, alpha) +
color(float, float) - +Method in class processing.core.PApplet +
  +
color(int, int, int) - +Method in class processing.core.PApplet +
  +
color(float, float, float) - +Method in class processing.core.PApplet +
  +
color(int, int, int, int) - +Method in class processing.core.PApplet +
  +
color(float, float, float, float) - +Method in class processing.core.PApplet +
  +
color(int) - +Method in class processing.core.PGraphics +
  +
color(float) - +Method in class processing.core.PGraphics +
  +
color(int, int) - +Method in class processing.core.PGraphics +
  +
color(int, float) - +Method in class processing.core.PGraphics +
  +
color(float, float) - +Method in class processing.core.PGraphics +
  +
color(int, int, int) - +Method in class processing.core.PGraphics +
  +
color(float, float, float) - +Method in class processing.core.PGraphics +
  +
color(int, int, int, int) - +Method in class processing.core.PGraphics +
  +
color(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
colorMethodCall() - +Method in class processing.app.preproc.PdeRecognizer +
  +
colorMode(int) - +Method in class processing.core.PApplet +
  +
colorMode(int, float) - +Method in class processing.core.PApplet +
  +
colorMode(int, float, float, float) - +Method in class processing.core.PApplet +
  +
colorMode(int, float, float, float, float) - +Method in class processing.core.PApplet +
  +
colorMode - +Variable in class processing.core.PGraphics +
The current colorMode +
colorMode(int) - +Method in class processing.core.PGraphics +
Callback to handle clearing the background when begin/endRaw is in use. +
colorMode(int, float) - +Method in class processing.core.PGraphics +
  +
colorMode(int, float, float, float) - +Method in class processing.core.PGraphics +
Set the colorMode and the maximum values for (r, g, b) + or (h, s, b). +
colorMode(int, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
colorMode - +Variable in class processing.core.PStyle +
  +
colorModeA - +Variable in class processing.core.PGraphics +
Max value for alpha set by colorMode +
colorModeA - +Variable in class processing.core.PStyle +
  +
colorModeX - +Variable in class processing.core.PGraphics +
Max value for red (or hue) set by colorMode +
colorModeX - +Variable in class processing.core.PStyle +
  +
colorModeY - +Variable in class processing.core.PGraphics +
Max value for green (or saturation) set by colorMode +
colorModeY - +Variable in class processing.core.PStyle +
  +
colorModeZ - +Variable in class processing.core.PGraphics +
Max value for blue (or value) set by colorMode +
colorModeZ - +Variable in class processing.core.PStyle +
  +
ColorSelector - Class in processing.app.tools
Color selector tool for the Tools menu.
ColorSelector() - +Constructor for class processing.app.tools.ColorSelector +
  +
ColorSelector.ColorRange - Class in processing.app.tools
 
ColorSelector.ColorRange() - +Constructor for class processing.app.tools.ColorSelector.ColorRange +
  +
ColorSelector.ColorSlider - Class in processing.app.tools
 
ColorSelector.ColorSlider() - +Constructor for class processing.app.tools.ColorSelector.ColorSlider +
  +
cols - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
combine(double[], Object[], float[], Object[]) - +Method in class processing.opengl.PGraphicsOpenGL.TessCallback +
Implementation of the GLU_TESS_COMBINE callback. +
COMMA - +Static variable in interface antlr.java.JavaTokenTypes +
  +
COMMA - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
COMMA - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
Commander - Class in processing.app
Class to handle running Processing from the command line.
Commander(String[]) - +Constructor for class processing.app.Commander +
  +
comment() - +Method in class processing.app.tools.AutoFormat +
  +
COMMENT1 - +Static variable in class processing.app.syntax.Token +
Comment 1 token id. +
COMMENT2 - +Static variable in class processing.app.syntax.Token +
Comment 2 token id. +
compilationUnit() - +Method in class antlr.java.JavaRecognizer +
  +
compilationUnit() - +Method in class processing.app.preproc.PdeRecognizer +
  +
compile(Sketch, String, String) - +Method in class processing.app.debug.Compiler +
Compile with ECJ. +
Compiler - Class in processing.app.debug
 
Compiler() - +Constructor for class processing.app.debug.Compiler +
  +
COMPLAINT - +Static variable in interface processing.core.PConstants +
  +
COMPONENT - +Static variable in class processing.video.Capture +
  +
COMPONENT - +Static variable in class processing.video.MovieMaker +
  +
COMPOSITE - +Static variable in class processing.video.Capture +
  +
compoundStatement() - +Method in class antlr.java.JavaRecognizer +
  +
compoundStatement() - +Method in class processing.app.preproc.PdeRecognizer +
  +
concat(boolean[], boolean[]) - +Static method in class processing.core.PApplet +
  +
concat(byte[], byte[]) - +Static method in class processing.core.PApplet +
  +
concat(char[], char[]) - +Static method in class processing.core.PApplet +
  +
concat(int[], int[]) - +Static method in class processing.core.PApplet +
  +
concat(float[], float[]) - +Static method in class processing.core.PApplet +
  +
concat(String[], String[]) - +Static method in class processing.core.PApplet +
  +
concat(Object, Object) - +Static method in class processing.core.PApplet +
  +
conditionalExpression() - +Method in class antlr.java.JavaRecognizer +
  +
conditionalExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
consCastTypeSpec(boolean) - +Method in class processing.app.preproc.PdeRecognizer +
  +
constant() - +Method in class antlr.java.JavaRecognizer +
  +
constant() - +Method in class processing.app.preproc.PdeRecognizer +
  +
constrain(int, int, int) - +Static method in class processing.core.PApplet +
  +
constrain(float, float, float) - +Static method in class processing.core.PApplet +
  +
CONSTRUCTOR_CAST - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
CONSTRUCTOR_CAST - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
constructorBody() - +Method in class antlr.java.JavaRecognizer +
  +
constructorBody() - +Method in class processing.app.preproc.PdeRecognizer +
  +
constructorCast() - +Method in class processing.app.preproc.PdeRecognizer +
  +
contentsToClassPath(File) - +Static method in class processing.app.debug.Compiler +
Given a folder, return a list of absolute paths to all jar or zip files + inside that folder, separated by pathSeparatorChar. +
CONTROL - +Static variable in interface processing.core.PConstants +
  +
ControlService(Pointer, int, Advapi32.SERVICE_STATUS) - +Method in interface processing.app.windows.Advapi32 +
  +
ConvertSidToStringSid(byte[], PointerByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
ConvertStringSidToSid(String, PointerByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
copy(int) - +Method in class antlr.TokenStreamCopyingHiddenTokenFilter +
Indicate that all tokens of type tokenType should be copied. +
copy() - +Method in class processing.app.syntax.DefaultInputHandler +
Returns a copy of this input handler that shares the same + key bindings. +
copy() - +Method in class processing.app.syntax.InputHandler +
Returns a copy of this input handler that shares the same + key bindings. +
copy() - +Method in class processing.app.syntax.JEditTextArea +
Places the selected text into the clipboard. +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
copy(PImage, int, int, int, int, int, int, int, int) - +Method in class processing.core.PApplet +
  +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Copy things from one area of this image + to another area in the same image. +
copy(PImage, int, int, int, int, int, int, int, int) - +Method in class processing.core.PImage +
Copies area of one image into another PImage object. +
copy(int, int, int, int, int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
copy(PImage, int, int, int, int, int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
copyDir(File, File) - +Static method in class processing.app.Base +
Copy a folder from one place to another. +
copyFile(File, File) - +Static method in class processing.app.Base +
  +
CORNER - +Static variable in interface processing.core.PConstants +
Draw mode convention to use (x, y) to (width, height) +
CORNERS - +Static variable in interface processing.core.PConstants +
Draw mode convention to use (x1, y1) to (x2, y2) coordinates +
cos(float) - +Static method in class processing.core.PApplet +
  +
countLines(String) - +Static method in class processing.app.Base +
Get the number of lines in a file by counting the number of newline + characters inside a String (and adding 1). +
cpp_comment() - +Method in class processing.app.tools.AutoFormat +
  +
createElement(String, String) - +Method in class processing.xml.XMLElement +
Creates an empty element. +
createElement(String, String, String, int) - +Method in class processing.xml.XMLElement +
Creates an empty element. +
CreateFont - Class in processing.app.tools
gui interface to font creation heaven/hell.
CreateFont() - +Constructor for class processing.app.tools.CreateFont +
  +
createFont(String, float) - +Method in class processing.core.PApplet +
  +
createFont(String, float, boolean) - +Method in class processing.core.PApplet +
  +
createFont(String, float, boolean, char[]) - +Method in class processing.core.PApplet +
Create a .vlw font on the fly from either a font name that's + installed on the system, or from a .ttf or .otf that's inside + the data folder of this sketch. +
createGraphics(int, int, String) - +Method in class processing.core.PApplet +
Create an offscreen PGraphics object for drawing. +
createGraphics(int, int, String, String) - +Method in class processing.core.PApplet +
Create an offscreen graphics surface for drawing, in this case + for a renderer that writes to a file (such as PDF or DXF). +
createImage(int, int, int) - +Method in class processing.core.PApplet +
Preferred method of creating new PImage objects, ensures that a + reference to the parent PApplet is included, which makes save() work + without needing an absolute path. +
createInput(String) - +Method in class processing.core.PApplet +
Simplified method to open a Java InputStream. +
createInput(File) - +Static method in class processing.core.PApplet +
  +
createInputRaw(String) - +Method in class processing.core.PApplet +
Call openStream() without automatic gzip decompression. +
createKey(Registry.REGISTRY_ROOT_KEY, String, String) - +Static method in class processing.app.windows.Registry +
Create a new key. +
createOutput(String) - +Method in class processing.core.PApplet +
Similar to createInput() (formerly openStream), this creates a Java + OutputStream for a given filename or path. +
createOutput(File) - +Static method in class processing.core.PApplet +
  +
createPath(String) - +Static method in class processing.core.PApplet +
Takes a path and creates any in-between folders if they don't + already exist. +
createPath(File) - +Static method in class processing.core.PApplet +
  +
createPCDataElement() - +Method in class processing.xml.XMLElement +
Creates an element to be used for #PCDATA content. +
createReader(String) - +Method in class processing.core.PApplet +
I want to read lines from a file. +
createReader(File) - +Static method in class processing.core.PApplet +
I want to read lines from a file. +
createReader(InputStream) - +Static method in class processing.core.PApplet +
I want to read lines from a stream. +
CreateService(Pointer, String, String, int, int, int, int, String, String, IntByReference, String, String, String) - +Method in interface processing.app.windows.Advapi32 +
  +
createTempFolder(String) - +Static method in class processing.app.Base +
Get the path to the platform's temporary folder, by creating + a temporary temporary file and getting its parent folder. +
createWriter(String) - +Method in class processing.core.PApplet +
I want to print lines to a file. +
createWriter(File) - +Static method in class processing.core.PApplet +
I want to print lines to a file. +
createWriter(OutputStream) - +Static method in class processing.core.PApplet +
I want to print lines to a file. +
crop - +Variable in class processing.video.Capture +
True if this image is currently being cropped +
crop(int, int, int, int) - +Method in class processing.video.Capture +
Set the video to crop from its original. +
cropH - +Variable in class processing.video.Capture +
  +
cropW - +Variable in class processing.video.Capture +
  +
cropX - +Variable in class processing.video.Capture +
  +
cropY - +Variable in class processing.video.Capture +
  +
CROSS - +Static variable in interface processing.core.PConstants +
  +
cross(PVector) - +Method in class processing.core.PVector +
Return a vector composed of the cross product between this and another. +
cross(PVector, PVector) - +Method in class processing.core.PVector +
Perform cross product between this and another vector, and store the + result in 'target'. +
cross(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
  +
CTokenMarker - Class in processing.app.syntax
C token marker.
CTokenMarker() - +Constructor for class processing.app.syntax.CTokenMarker +
  +
CTokenMarker(boolean, KeywordMap) - +Constructor for class processing.app.syntax.CTokenMarker +
  +
CTOR_CALL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
CTOR_CALL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
CTOR_CALL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
CTOR_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
CTOR_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
CTOR_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
ctorHead() - +Method in class antlr.java.JavaRecognizer +
  +
ctorHead() - +Method in class processing.app.preproc.PdeRecognizer +
  +
currentLightFalloffConstant - +Variable in class processing.core.PGraphics3D +
Current light falloff +
currentLightFalloffLinear - +Variable in class processing.core.PGraphics3D +
  +
currentLightFalloffQuadratic - +Variable in class processing.core.PGraphics3D +
  +
currentLightSpecular - +Variable in class processing.core.PGraphics3D +
Current specular color for lighting +
cursor(int) - +Method in class processing.core.PApplet +
Set the cursor type +
cursor(PImage) - +Method in class processing.core.PApplet +
Replace the cursor with the specified PImage. +
cursor(PImage, int, int) - +Method in class processing.core.PApplet +
Set a custom cursor to an image with a specific hotspot. +
cursor() - +Method in class processing.core.PApplet +
Show the cursor after noCursor() was called. +
curve(float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curve(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curve(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
Draws a segment of Catmull-Rom curve. +
curve(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
curve(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
CURVE_VERTEX - +Static variable in class processing.core.PShape +
  +
curveDetail(int) - +Method in class processing.core.PApplet +
  +
curveDetail(int) - +Method in class processing.core.PGraphics +
  +
curveDetail(int) - +Method in class processing.core.PGraphicsJava2D +
Ignored (not needed) in Java 2D. +
curvePoint(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curvePoint(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Get a location along a catmull-rom curve segment. +
curveTangent(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
curveTangent(float, float, float, float, float) - +Method in class processing.core.PGraphics +
Calculate the tangent at a t value (0..1) on a Catmull-Rom curve. +
curveTightness(float) - +Method in class processing.core.PApplet +
  +
curveTightness - +Variable in class processing.core.PGraphics +
  +
curveTightness(float) - +Method in class processing.core.PGraphics +
  +
curveVertex(float, float) - +Method in class processing.core.PApplet +
  +
curveVertex(float, float, float) - +Method in class processing.core.PApplet +
  +
curveVertex(float, float) - +Method in class processing.core.PGraphics +
  +
curveVertex(float, float, float) - +Method in class processing.core.PGraphics +
  +
curveVertex(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
CUSTOM - +Static variable in interface processing.core.PConstants +
  +
cut() - +Method in class processing.app.syntax.JEditTextArea +
Deletes the selected text from the text area and places it + into the clipboard. +
+
+

+D

+
+
DA - +Static variable in interface processing.core.PConstants +
  +
DARKEST - +Static variable in interface processing.core.PConstants +
  +
data - +Variable in class processing.video.Capture +
Temporary storage for the raw image + data read directly from the capture device +
databits - +Variable in class processing.serial.Serial +
  +
dataFile(String) - +Method in class processing.core.PApplet +
Return a full path to an item in the data folder as a File object. +
dataHeight - +Variable in class processing.video.Capture +
  +
dataPath(String) - +Method in class processing.core.PApplet +
Return a full path to an item in the data folder. +
dataRowBytes - +Variable in class processing.video.Capture +
  +
dataWidth - +Variable in class processing.video.Capture +
  +
day() - +Static method in class processing.core.PApplet +
Get the current day of the month (1 through 31). +
DB - +Static variable in interface processing.core.PConstants +
  +
deactivate(int) - +Method in class processing.app.EditorToolbar +
Set a particular button to be active. +
DEC - +Static variable in interface antlr.java.JavaTokenTypes +
  +
DEC - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
DEC - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
declaration() - +Method in class antlr.java.JavaRecognizer +
A declaration is the creation of a reference or primitive-type variable + Create a separate Type/Var tree for each var in the var list. +
declaration() - +Method in class processing.app.preproc.PdeRecognizer +
  +
declaratorBrackets(AST) - +Method in class antlr.java.JavaRecognizer +
  +
declaratorBrackets(AST) - +Method in class processing.app.preproc.PdeRecognizer +
  +
DEFAULT_CHARSET - +Static variable in class processing.core.PFont +
The default Processing character set. +
DEFAULT_HEIGHT - +Static variable in class processing.core.PApplet +
  +
DEFAULT_WIDTH - +Static variable in class processing.core.PApplet +
Default width and height for applet when not specified +
DefaultInputHandler - Class in processing.app.syntax
The default input handler.
DefaultInputHandler() - +Constructor for class processing.app.syntax.DefaultInputHandler +
Creates a new input handler with no key bindings defined. +
defaultSize - +Variable in class processing.core.PApplet +
true if no size() command has been executed. +
DEG_TO_RAD - +Static variable in interface processing.core.PConstants +
  +
degrees(float) - +Static method in class processing.core.PApplet +
  +
delay(int) - +Method in class processing.core.PApplet +
The delay() function causes the program to halt for a specified time. +
DELETE - +Static variable in class processing.app.syntax.InputHandler +
  +
DELETE - +Static variable in interface processing.app.windows.WINNT +
  +
DELETE - +Static variable in interface processing.core.PConstants +
  +
DELETE_WORD - +Static variable in class processing.app.syntax.InputHandler +
  +
deleteKey(Registry.REGISTRY_ROOT_KEY, String, String) - +Static method in class processing.app.windows.Registry +
Delete a key. +
deleteLines(int, int) - +Method in class processing.app.syntax.TokenMarker +
Informs the token marker that line have been deleted from + the document. +
DeleteService(Pointer) - +Method in interface processing.app.windows.Advapi32 +
  +
deleteValue(Registry.REGISTRY_ROOT_KEY, String, String) - +Static method in class processing.app.windows.Registry +
Delete a value. +
descent - +Variable in class processing.core.PFont +
  +
descent() - +Method in class processing.core.PFont +
Returns how far this font descends from the baseline. +
deselectMenu() - +Method in class processing.app.EditorHeader +
  +
destroy() - +Method in class processing.core.PApplet +
Called by the browser or applet viewer to inform this applet + that it is being reclaimed and that it should destroy + any resources that it has allocated. +
determinant() - +Method in interface processing.core.PMatrix +
  +
determinant() - +Method in class processing.core.PMatrix2D +
  +
determinant() - +Method in class processing.core.PMatrix3D +
  +
DG - +Static variable in interface processing.core.PConstants +
  +
DIAMETER - +Static variable in interface processing.core.PConstants +
Synonym for the CENTER constant. +
die(String) - +Method in class processing.core.PApplet +
Function for an applet/application to kill itself and + display an error. +
die(String, Exception) - +Method in class processing.core.PApplet +
Same as above but with an exception. +
DIFFERENCE - +Static variable in interface processing.core.PConstants +
  +
DILATE - +Static variable in interface processing.core.PConstants +
  +
DIRECTIONAL - +Static variable in interface processing.core.PConstants +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
directionalLight(float, float, float, float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
DISABLE_ACCURATE_TEXTURES - +Static variable in interface processing.core.PConstants +
  +
DISABLE_DEPTH_SORT - +Static variable in interface processing.core.PConstants +
  +
DISABLE_DEPTH_TEST - +Static variable in interface processing.core.PConstants +
  +
DISABLE_OPENGL_2X_SMOOTH - +Static variable in interface processing.core.PConstants +
  +
DISABLE_OPENGL_ERROR_REPORT - +Static variable in interface processing.core.PConstants +
  +
disableStyle() - +Method in class processing.core.PShape +
Overrides this shape's style information and uses PGraphics styles and + colors. +
disconnect(Client) - +Method in class processing.net.Server +
Disconnect a particular client. +
DiscourseFormat - Class in processing.app.tools
Format for Discourse Tool +

+ Original code by owd.

DiscourseFormat(Editor) - +Constructor for class processing.app.tools.DiscourseFormat +
Creates a new window with the formated (YaBB tags) sketchcode + from the actual Processing Tab ready to send to the processing discourse + web (copy & paste) +
displayable() - +Method in class processing.core.PApplet +
  +
displayable() - +Method in class processing.core.PGraphics +
Return true if this renderer should be drawn to the screen. +
displayable() - +Method in class processing.dxf.RawDXF +
  +
displayable() - +Method in class processing.pdf.PGraphicsPDF +
Don't open a window for this renderer, it won't be used. +
dispose() - +Method in class processing.core.PGraphics +
Handle any takedown for this graphics context. +
dispose() - +Method in class processing.dxf.RawDXF +
  +
dispose() - +Method in class processing.net.Client +
Disconnect from the server: internal use only. +
dispose() - +Method in class processing.net.Server +
Disconnect all clients and stop the server: internal use only. +
dispose() - +Method in class processing.pdf.PGraphicsPDF +
  +
dispose() - +Method in class processing.serial.Serial +
Used by PApplet to shut things down. +
dispose() - +Method in class processing.video.Capture +
Called by PApplet to shut down video so that QuickTime + can be used later by another applet. +
dispose() - +Method in class processing.video.Movie +
Call this to halt the movie from running, and stop its thread. +
dispose() - +Method in class processing.video.MovieMaker +
  +
dist(float, float, float, float) - +Static method in class processing.core.PApplet +
  +
dist(float, float, float, float, float, float) - +Static method in class processing.core.PApplet +
  +
dist(PVector) - +Method in class processing.core.PVector +
Calculate the Euclidean distance between two points (considering a point as a vector object) +
dist(PVector, PVector) - +Static method in class processing.core.PVector +
Calculate the Euclidean distance between two points (considering a point as a vector object) +
DIV - +Static variable in interface antlr.java.JavaTokenTypes +
  +
DIV - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
DIV - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
div(float) - +Method in class processing.core.PVector +
Divide this vector by a scalar +
div(PVector, float) - +Static method in class processing.core.PVector +
Divide a vector by a scalar and return the result in a new vector. +
div(PVector, float, PVector) - +Static method in class processing.core.PVector +
  +
div(PVector) - +Method in class processing.core.PVector +
Divide each element of one vector by the elements of another vector. +
div(PVector, PVector) - +Static method in class processing.core.PVector +
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +
div(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
Divide each element of one vector by the individual elements of another + vector, and write the result into a target vector. +
DIV_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
DIV_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
DIV_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
document - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
DOCUMENT_END - +Static variable in class processing.app.syntax.InputHandler +
  +
DOCUMENT_HOME - +Static variable in class processing.app.syntax.InputHandler +
  +
DODGE - +Static variable in interface processing.core.PConstants +
  +
DOT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
DOT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
DOT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
dot(PVector) - +Method in class processing.core.PVector +
Calculate the dot product with another vector +
dot(float, float, float) - +Method in class processing.core.PVector +
  +
DOWN - +Static variable in interface processing.core.PConstants +
  +
DR - +Static variable in interface processing.core.PConstants +
  +
draw() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
draw() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
draw() - +Method in class processing.core.PApplet +
  +
draw() - +Method in class processing.core.PLine +
  +
draw(PGraphics) - +Method in class processing.core.PShape +
Called by the following (the shape() command adds the g) + PShape s = loadShapes("blah.svg"); + shape(s); +
drawImpl(PGraphics) - +Method in class processing.core.PShape +
Draws the SVG document. +
duration() - +Method in class processing.video.Movie +
Get the full length of this movie (in seconds). +
dwCheckPoint - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
dwControlsAccepted - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
dwCurrentState - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
dwHighDateTime - +Variable in class processing.app.windows.WINBASE.FILETIME +
  +
dwLowDateTime - +Variable in class processing.app.windows.WINBASE.FILETIME +
  +
dwServiceSpecificExitCode - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
dwServiceType - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
dwWaitHint - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
dwWin32ExitCode - +Variable in class processing.app.windows.Advapi32.SERVICE_STATUS +
  +
DXF - +Static variable in interface processing.core.PConstants +
  +
+
+

+E

+
+
EB - +Static variable in interface processing.core.PConstants +
  +
edge(boolean) - +Method in class processing.core.PApplet +
  +
EDGE - +Static variable in interface processing.core.PConstants +
  +
edge - +Variable in class processing.core.PGraphics +
  +
edge(boolean) - +Method in class processing.core.PGraphics +
Sets whether the upcoming vertex is part of an edge. +
edge(boolean) - +Method in class processing.opengl.PGraphicsOpenGL.TessCallback +
  +
edit(String, String) - +Method in class processing.app.EditorStatus +
  +
editable - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
Editor - Class in processing.app
Main editor panel for the Processing Development Environment.
Editor(Base, String, int[]) - +Constructor for class processing.app.Editor +
  +
EditorConsole - Class in processing.app
Message console that sits below the editing area.
EditorConsole(Editor) - +Constructor for class processing.app.EditorConsole +
  +
EditorHeader - Class in processing.app
Sketch tabs at the top of the editor window.
EditorHeader(Editor) - +Constructor for class processing.app.EditorHeader +
  +
EditorLineStatus - Class in processing.app
Li'l status bar fella that shows the line number.
EditorLineStatus(JEditTextArea) - +Constructor for class processing.app.EditorLineStatus +
  +
editorLineStatus - +Variable in class processing.app.syntax.JEditTextArea +
The component that tracks the current line number. +
EditorListener - Class in processing.app
Filters key events for tab expansion/indent/etc.
EditorListener(Editor, JEditTextArea) - +Constructor for class processing.app.EditorListener +
  +
editorListener - +Variable in class processing.app.syntax.JEditTextArea +
Forwards key events directly to the input handler. +
EditorStatus - Class in processing.app
Panel just below the editing area that contains status messages.
EditorStatus(Editor) - +Constructor for class processing.app.EditorStatus +
  +
EditorToolbar - Class in processing.app
run/stop/etc buttons for the ide
EditorToolbar(Editor, JMenu) - +Constructor for class processing.app.EditorToolbar +
  +
EG - +Static variable in interface processing.core.PConstants +
  +
electricScroll - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
elementAttributesProcessed(String, String, String) - +Method in class processing.xml.StdXMLBuilder +
This method is called when the attributes of an XML element have been + processed. +
elementAttributesProcessed(String, Properties, String, int) - +Method in class processing.xml.XMLValidator +
This method is called when the attributes of an XML element have been + processed. +
elementEnded(String, String, int) - +Method in class processing.xml.XMLValidator +
Indicates that the current element has ended. +
elementStarted(String, String, int) - +Method in class processing.xml.XMLValidator +
Indicates that an element has been started. +
ELIST - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ELIST - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ELIST - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
ellipse(float, float, float, float) - +Method in class processing.core.PApplet +
  +
ELLIPSE - +Static variable in interface processing.core.PConstants +
  +
ellipse(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
ellipseMode(int) - +Method in class processing.core.PApplet +
  +
ellipseMode - +Variable in class processing.core.PGraphics +
The current ellipse mode (read-only) +
ellipseMode(int) - +Method in class processing.core.PGraphics +
  +
ellipseMode - +Variable in class processing.core.PStyle +
  +
emissive(int) - +Method in class processing.core.PApplet +
  +
emissive(float) - +Method in class processing.core.PApplet +
  +
emissive(float, float, float) - +Method in class processing.core.PApplet +
  +
emissive(int) - +Method in class processing.core.PGraphics +
  +
emissive(float) - +Method in class processing.core.PGraphics +
  +
emissive(float, float, float) - +Method in class processing.core.PGraphics +
  +
emissiveB - +Variable in class processing.core.PGraphics +
  +
emissiveB - +Variable in class processing.core.PStyle +
  +
emissiveG - +Variable in class processing.core.PGraphics +
  +
emissiveG - +Variable in class processing.core.PStyle +
  +
emissiveR - +Variable in class processing.core.PGraphics +
  +
emissiveR - +Variable in class processing.core.PStyle +
  +
empty() - +Method in class processing.app.EditorStatus +
  +
EMPTY_FIELD - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EMPTY_FIELD - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
EMPTY_STAT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
EMPTY_STAT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EMPTY_STAT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
ENABLE_ACCURATE_TEXTURES - +Static variable in interface processing.core.PConstants +
  +
ENABLE_DEPTH_SORT - +Static variable in interface processing.core.PConstants +
  +
ENABLE_DEPTH_TEST - +Static variable in interface processing.core.PConstants +
  +
ENABLE_NATIVE_FONTS - +Static variable in interface processing.core.PConstants +
  +
ENABLE_OPENGL_2X_SMOOTH - +Static variable in interface processing.core.PConstants +
  +
ENABLE_OPENGL_4X_SMOOTH - +Static variable in interface processing.core.PConstants +
  +
ENABLE_OPENGL_ERROR_REPORT - +Static variable in interface processing.core.PConstants +
  +
enableStyle() - +Method in class processing.core.PShape +
Re-enables style information (fill and stroke) set in the shape. +
END - +Static variable in class processing.app.syntax.InputHandler +
  +
END - +Static variable in class processing.app.syntax.Token +
The token type, that along with a length of 0 + marks the end of the token list. +
end() - +Method in class processing.opengl.PGraphicsOpenGL.TessCallback +
  +
endCamera() - +Method in class processing.core.PApplet +
  +
endCamera() - +Method in class processing.core.PGraphics +
  +
endCamera() - +Method in class processing.core.PGraphics3D +
Record the current settings into the camera matrix, and set + the matrix mode back to the current transformation matrix. +
endCompoundEdit() - +Method in class processing.app.syntax.SyntaxDocument +
Ends a compound edit that can be undone in one operation. +
endDraw() - +Method in class processing.core.PGraphics +
This will finalize rendering so that it can be shown on-screen. +
endDraw() - +Method in class processing.core.PGraphics2D +
  +
endDraw() - +Method in class processing.core.PGraphics3D +
See notes in PGraphics. +
endDraw() - +Method in class processing.core.PGraphicsJava2D +
  +
endDraw() - +Method in class processing.dxf.RawDXF +
  +
endDraw() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
endDraw() - +Method in class processing.pdf.PGraphicsPDF +
  +
endElement(String, String, String) - +Method in class processing.xml.StdXMLBuilder +
This method is called when the end of an XML elemnt is encountered. +
endGL() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
endRaw() - +Method in class processing.core.PApplet +
Stop recording raw shape data to the specified renderer. +
endRaw() - +Method in class processing.core.PGraphics +
  +
endRaw() - +Method in class processing.core.PGraphicsJava2D +
  +
endRecord() - +Method in class processing.core.PApplet +
  +
endShape() - +Method in class processing.core.PApplet +
  +
endShape(int) - +Method in class processing.core.PApplet +
  +
endShape() - +Method in class processing.core.PGraphics +
  +
endShape(int) - +Method in class processing.core.PGraphics +
  +
endShape(int) - +Method in class processing.core.PGraphics2D +
  +
endShape(int) - +Method in class processing.core.PGraphics3D +
  +
endShape(int) - +Method in class processing.core.PGraphicsJava2D +
  +
endShape(int) - +Method in class processing.dxf.RawDXF +
  +
ENTER - +Static variable in interface processing.core.PConstants +
  +
enumerateAttributeNames() - +Method in class processing.xml.XMLElement +
Returns an enumeration of all attribute names. +
enumerateChildren() - +Method in class processing.xml.XMLElement +
Returns an enumeration of all child elements. +
EOF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
EOF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EOF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
eolMarkerColor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
eolMarkers - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
EPSILON - +Static variable in interface processing.core.PConstants +
  +
EQUAL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
EQUAL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EQUAL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
equalityExpression() - +Method in class antlr.java.JavaRecognizer +
  +
equalityExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
equals(Object) - +Method in class processing.xml.XMLElement +
Returns true if the element equals another element. +
equalsXMLElement(XMLElement) - +Method in class processing.xml.XMLElement +
Returns true if the element equals another element. +
ER - +Static variable in interface processing.core.PConstants +
  +
ERODE - +Static variable in interface processing.core.PConstants +
  +
error(String) - +Method in class processing.app.EditorStatus +
  +
error(int) - +Method in class processing.opengl.PGraphicsOpenGL.TessCallback +
  +
ERROR_BACKGROUND_IMAGE_FORMAT - +Static variable in interface processing.core.PConstants +
  +
ERROR_BACKGROUND_IMAGE_SIZE - +Static variable in interface processing.core.PConstants +
  +
ERROR_FILE_NOT_FOUND - +Static variable in interface processing.app.windows.WINERROR +
  +
ERROR_MORE_DATA - +Static variable in interface processing.app.windows.WINERROR +
  +
ERROR_PUSHMATRIX_OVERFLOW - +Static variable in interface processing.core.PConstants +
  +
ERROR_PUSHMATRIX_UNDERFLOW - +Static variable in interface processing.core.PConstants +
  +
ERROR_SUCCESS - +Static variable in interface processing.app.windows.WINERROR +
  +
ERROR_TEXTFONT_NULL_PFONT - +Static variable in interface processing.core.PConstants +
  +
errorMessage(String, Throwable) - +Static method in class processing.serial.Serial +
General error reporting, all corraled here just in case + I think of something slightly more intelligent to do. +
ESC - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ESC - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ESC - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
ESC - +Static variable in interface processing.core.PConstants +
  +
EventThread - Class in processing.app.debug
This class processes incoming JDI events and displays them
exception(ExceptionEvent) - +Method in class processing.app.debug.Runner +
  +
EXCLUSION - +Static variable in interface processing.core.PConstants +
  +
exclusiveOrExpression() - +Method in class antlr.java.JavaRecognizer +
  +
exclusiveOrExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
exec(String[]) - +Static method in class processing.core.PApplet +
  +
executeAction(ActionListener, Object, String) - +Method in class processing.app.syntax.InputHandler +
Executes the specified action, repeating and recording it as + necessary. +
exit() - +Method in class processing.core.PApplet +
Call to safely exit the sketch when finished. +
exp(float) - +Static method in class processing.core.PApplet +
  +
expand(boolean[]) - +Static method in class processing.core.PApplet +
  +
expand(boolean[], int) - +Static method in class processing.core.PApplet +
  +
expand(byte[]) - +Static method in class processing.core.PApplet +
  +
expand(byte[], int) - +Static method in class processing.core.PApplet +
  +
expand(char[]) - +Static method in class processing.core.PApplet +
  +
expand(char[], int) - +Static method in class processing.core.PApplet +
  +
expand(int[]) - +Static method in class processing.core.PApplet +
  +
expand(int[], int) - +Static method in class processing.core.PApplet +
  +
expand(float[]) - +Static method in class processing.core.PApplet +
  +
expand(float[], int) - +Static method in class processing.core.PApplet +
  +
expand(String[]) - +Static method in class processing.core.PApplet +
  +
expand(String[], int) - +Static method in class processing.core.PApplet +
  +
expand(Object) - +Static method in class processing.core.PApplet +
  +
expand(Object, int) - +Static method in class processing.core.PApplet +
  +
explicitConstructorInvocation() - +Method in class antlr.java.JavaRecognizer +
Catch obvious constructor calls, but not the expr.super(...) calls +
explicitConstructorInvocation() - +Method in class processing.app.preproc.PdeRecognizer +
  +
EXPONENT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
EXPONENT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EXPONENT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
exportApplet(String) - +Method in class processing.app.Sketch +
Handle export to applet. +
exportApplication(String, int) - +Method in class processing.app.Sketch +
Export to application without GUI. +
exportApplicationPrompt() - +Method in class processing.app.Sketch +
  +
EXPR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
EXPR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EXPR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
expression() - +Method in class antlr.java.JavaRecognizer +
  +
expression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
expressionList() - +Method in class antlr.java.JavaRecognizer +
  +
expressionList() - +Method in class processing.app.preproc.PdeRecognizer +
  +
ExtendedCommonASTWithHiddenTokens - Class in antlr
A CommonAST whose initialization copies hidden token + information from the Token used to create a node.
ExtendedCommonASTWithHiddenTokens() - +Constructor for class antlr.ExtendedCommonASTWithHiddenTokens +
  +
ExtendedCommonASTWithHiddenTokens(Token) - +Constructor for class antlr.ExtendedCommonASTWithHiddenTokens +
  +
EXTENDS_CLAUSE - +Static variable in interface antlr.java.JavaTokenTypes +
  +
EXTENDS_CLAUSE - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
EXTENDS_CLAUSE - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
EXTERNAL_MOVE - +Static variable in class processing.core.PApplet +
When run externally to a PDE Editor, this is sent by the applet + whenever the window is moved. +
EXTERNAL_STOP - +Static variable in class processing.core.PApplet +
When run externally to a PdeEditor, + this is sent by the applet when it quits. +
+
+

+F

+
+
fgcolor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
field() - +Method in class antlr.java.JavaRecognizer +
  +
field() - +Method in class processing.app.preproc.PdeRecognizer +
  +
fileReader(String) - +Static method in class processing.xml.StdXMLReader +
Creates a new reader using a file as input. +
fill(int) - +Method in class processing.core.PApplet +
  +
fill(int, float) - +Method in class processing.core.PApplet +
  +
fill(float) - +Method in class processing.core.PApplet +
  +
fill(float, float) - +Method in class processing.core.PApplet +
  +
fill(float, float, float) - +Method in class processing.core.PApplet +
  +
fill(float, float, float, float) - +Method in class processing.core.PApplet +
  +
fill - +Variable in class processing.core.PGraphics +
true if fill() is enabled, (read-only) +
fill(int) - +Method in class processing.core.PGraphics +
Set the fill to either a grayscale value or an ARGB int. +
fill(int, float) - +Method in class processing.core.PGraphics +
  +
fill(float) - +Method in class processing.core.PGraphics +
  +
fill(float, float) - +Method in class processing.core.PGraphics +
  +
fill(float, float, float) - +Method in class processing.core.PGraphics +
  +
fill(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
fill - +Variable in class processing.core.PStyle +
  +
fillColor - +Variable in class processing.core.PGraphics +
fill that was last set (read-only) +
fillColor - +Variable in class processing.core.PStyle +
  +
fillGradient - +Variable in class processing.core.PGraphicsJava2D +
  +
fillGradientObject - +Variable in class processing.core.PGraphicsJava2D +
  +
filter - +Static variable in class processing.app.preproc.PdePreprocessor +
Used by PdeEmitter.dumpHiddenTokens() +
filter(int) - +Method in class processing.core.PApplet +
  +
filter(int, float) - +Method in class processing.core.PApplet +
  +
filter(int) - +Method in class processing.core.PImage +
Method to apply a variety of basic filters to this image. +
filter(int, float) - +Method in class processing.core.PImage +
Method to apply a variety of basic filters to this image. +
filter(int) - +Method in class processing.opengl.PGraphicsOpenGL +
This is really inefficient and not a good idea in OpenGL. +
filter(int, float) - +Method in class processing.opengl.PGraphicsOpenGL +
This is really inefficient and not a good idea in OpenGL. +
filter(int) - +Method in class processing.pdf.PGraphicsPDF +
  +
filter(int, float) - +Method in class processing.pdf.PGraphicsPDF +
  +
FINAL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
FINAL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
FINAL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
finallyClause() - +Method in class antlr.java.JavaRecognizer +
  +
finallyClause() - +Method in class processing.app.preproc.PdeRecognizer +
  +
find(boolean) - +Method in class processing.app.FindReplace +
  +
findChild(String) - +Method in class processing.core.PShape +
Same as getChild(name), except that it first walks all the way up the + hierarchy to the farthest parent, so that children can be found anywhere. +
findFont() - +Method in class processing.core.PFont +
Attempt to find the native version of this font. +
findFont(String) - +Static method in class processing.core.PFont +
Starting with Java 1.5, Apple broke the ability to specify most fonts. +
findMatchingBracket(Document, int) - +Static method in class processing.app.syntax.TextUtilities +
Returns the offset of the bracket matching the one at the + specified offset of the document, or -1 if the bracket is + unmatched (or if the character is not a bracket). +
FindReplace - Class in processing.app
Find & Replace window for the Processing editor.
FindReplace(Editor) - +Constructor for class processing.app.FindReplace +
  +
findWordEnd(String, int, String) - +Static method in class processing.app.syntax.TextUtilities +
Locates the end of the word at the specified position. +
findWordStart(String, int, String) - +Static method in class processing.app.syntax.TextUtilities +
Locates the start of the word at the specified position. +
finish() - +Method in class processing.video.MovieMaker +
Close out and finish the movie file. +
finished - +Variable in class processing.core.PApplet +
true if this applet has had it. +
firstMouse - +Variable in class processing.core.PApplet +
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump. +
FixEncoding - Class in processing.app.tools
 
FixEncoding() - +Constructor for class processing.app.tools.FixEncoding +
  +
FLOAT_SUFFIX - +Static variable in interface antlr.java.JavaTokenTypes +
  +
FLOAT_SUFFIX - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
FLOAT_SUFFIX - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
floor(float) - +Static method in class processing.core.PApplet +
  +
flush() - +Method in class processing.core.PApplet +
  +
flush() - +Method in class processing.core.PGraphics +
  +
flush() - +Method in class processing.core.PGraphics3D +
Emit any sorted geometry that's been collected on this frame. +
focused - +Variable in class processing.core.PApplet +
Gets set to true/false as the applet gains/loses focus. +
focusGained() - +Method in class processing.core.PApplet +
  +
focusGained(FocusEvent) - +Method in class processing.core.PApplet +
  +
focusLost() - +Method in class processing.core.PApplet +
  +
focusLost(FocusEvent) - +Method in class processing.core.PApplet +
  +
font - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
FOR_CONDITION - +Static variable in interface antlr.java.JavaTokenTypes +
  +
FOR_CONDITION - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
FOR_CONDITION - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
FOR_INIT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
FOR_INIT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
FOR_INIT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
FOR_ITERATOR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
FOR_ITERATOR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
FOR_ITERATOR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
forCond() - +Method in class antlr.java.JavaRecognizer +
  +
forCond() - +Method in class processing.app.preproc.PdeRecognizer +
  +
forInit() - +Method in class antlr.java.JavaRecognizer +
  +
forInit() - +Method in class processing.app.preproc.PdeRecognizer +
  +
forIter() - +Method in class antlr.java.JavaRecognizer +
  +
forIter() - +Method in class processing.app.preproc.PdeRecognizer +
  +
format - +Variable in class processing.core.PImage +
Format for this image, one of RGB, ARGB or ALPHA. +
format(int) - +Method in class processing.video.Capture +
Set the video format standard to use on the + video digitizer: NTSC, PAL, or SECAM. +
foundMain - +Static variable in class processing.app.preproc.PdePreprocessor +
  +
fprintf(String) - +Method in class processing.app.tools.AutoFormat +
  +
frame - +Variable in class processing.core.PApplet +
The frame containing this applet (if any) +
frameCount - +Variable in class processing.core.PApplet +
How many frames have been displayed since the applet started. +
frameRate - +Variable in class processing.core.PApplet +
The current value of frames per second. +
frameRate(float) - +Method in class processing.core.PApplet +
Set a target frameRate. +
frameRate - +Variable in class processing.video.Capture +
  +
frameRate(int) - +Method in class processing.video.Capture +
Set the frameRate for how quickly new frames are read + from the capture device. +
frameRate(int) - +Method in class processing.video.Movie +
Set how often new frames are to be read from the movie. +
frustum(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
frustum(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
frustum(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Same as glFrustum(), except that it wipes out (rather than + multiplies against) the current perspective matrix. +
+
+

+G

+
+
g - +Variable in class processing.core.PApplet +
The PGraphics renderer associated with this PApplet +
G - +Static variable in interface processing.core.PConstants +
  +
g2 - +Variable in class processing.core.PGraphicsJava2D +
  +
GE - +Static variable in interface antlr.java.JavaTokenTypes +
  +
GE - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
GE - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
GENERIC_EXECUTE - +Static variable in interface processing.app.windows.WINNT +
  +
GEOMETRY - +Static variable in class processing.core.PShape +
Collections of vertices created with beginShape(). +
get(String) - +Static method in class processing.app.Preferences +
  +
get(String) - +Static method in class processing.app.Theme +
  +
get(int, int) - +Method in class processing.core.PApplet +
  +
get(int, int, int, int) - +Method in class processing.core.PApplet +
  +
get() - +Method in class processing.core.PApplet +
  +
get(int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
get() - +Method in class processing.core.PGraphicsJava2D +
  +
get(int, int) - +Method in class processing.core.PImage +
Returns an ARGB "color" type (a packed 32 bit int with the color. +
get(int, int, int, int) - +Method in class processing.core.PImage +
Grab a subsection of a PImage, and copy it into a fresh PImage. +
get() - +Method in class processing.core.PImage +
Returns a copy of this PImage. +
get() - +Method in interface processing.core.PMatrix +
Returns a copy of this PMatrix. +
get(float[]) - +Method in interface processing.core.PMatrix +
Copies the matrix contents into a float array. +
get() - +Method in class processing.core.PMatrix2D +
Returns a copy of this PMatrix. +
get(float[]) - +Method in class processing.core.PMatrix2D +
Copies the matrix contents into a 6 entry float array. +
get() - +Method in class processing.core.PMatrix3D +
Returns a copy of this PMatrix. +
get(float[]) - +Method in class processing.core.PMatrix3D +
Copies the matrix contents into a 16 entry float array. +
get() - +Method in class processing.core.PVector +
Get a copy of this vector. +
get(float[]) - +Method in class processing.core.PVector +
  +
get(int, int) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
get() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
get(int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
get(int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
get() - +Method in class processing.pdf.PGraphicsPDF +
  +
get_string() - +Method in class processing.app.tools.AutoFormat +
  +
getAction(String) - +Static method in class processing.app.syntax.InputHandler +
Returns a named text area action. +
getActionName(ActionListener) - +Static method in class processing.app.syntax.InputHandler +
Returns the name of the specified text area action. +
getActions() - +Static method in class processing.app.syntax.InputHandler +
Returns an enumeration of all available actions. +
getAppletClassName2() - +Method in class processing.app.Sketch +
  +
getAttribute(String) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getAttribute(String, String) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getAttribute(String, String, String) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getAttributeCount() - +Method in class processing.xml.XMLElement +
Returns the number of attributes. +
getAttributeName() - +Method in exception processing.xml.XMLValidationException +
Returns the name of the attribute in which the validation is violated. +
getAttributeNamespace(String) - +Method in class processing.xml.XMLElement +
Returns the namespace of an attribute. +
getAttributes() - +Method in class processing.xml.XMLElement +
Returns all attributes as a Properties object. +
getAttributesInNamespace(String) - +Method in class processing.xml.XMLElement +
Returns all attributes in a specific namespace as a Properties object. +
getAttributeType(String) - +Method in class processing.xml.XMLElement +
Returns the type of an attribute. +
getAttributeType(String, String) - +Method in class processing.xml.XMLElement +
Returns the type of an attribute. +
getAttributeValue() - +Method in exception processing.xml.XMLValidationException +
Returns the value of the attribute in which the validation is violated. +
getBoolean(String) - +Static method in class processing.app.Preferences +
  +
getBoolean(String) - +Static method in class processing.app.Theme +
  +
getBracketHighlightColor() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the bracket highlight color. +
getBracketLine() - +Method in class processing.app.syntax.JEditTextArea +
Returns the line of the highlighted bracket (the bracket + matching the one before the caret) +
getBracketPosition() - +Method in class processing.app.syntax.JEditTextArea +
Returns the position of the highlighted bracket (the bracket + matching the one before the caret) +
getBuilder() - +Method in class processing.xml.StdXMLParser +
Returns the builder which creates the logical structure of the XML data. +
getBuildFolder() - +Static method in class processing.app.Base +
  +
getCache(Object) - +Method in class processing.core.PApplet +
  +
getCache(Object) - +Method in class processing.core.PImage +
Get cache storage data for the specified renderer. +
getCaretColor() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the caret color. +
getCaretLine() - +Method in class processing.app.syntax.JEditTextArea +
Returns the caret line. +
getCaretOffset() - +Method in class processing.app.Editor +
Get the position (character offset) of the caret. +
getCaretPosition() - +Method in class processing.app.syntax.JEditTextArea +
Returns the caret position. +
getChild(int) - +Method in class processing.core.PShape +
  +
getChild(String) - +Method in class processing.core.PShape +
  +
getChild(String) - +Method in class processing.core.PShapeSVG +
Get a particular element based on its SVG ID. +
getChild(int) - +Method in class processing.xml.XMLElement +
Quick accessor for an element at a particular index. +
getChild(String) - +Method in class processing.xml.XMLElement +
Get a child by its name or path. +
getChildAtIndex(int) - +Method in class processing.xml.XMLElement +
Returns the child at a specific index. +
getChildCount() - +Method in class processing.core.PShape +
  +
getChildCount() - +Method in class processing.xml.XMLElement +
Returns the number of children. +
getChildren() - +Method in class processing.xml.XMLElement +
Returns an array containing all the child elements. +
getChildren(String) - +Method in class processing.xml.XMLElement +
Get any children that match this name or path. +
getchr() - +Method in class processing.app.tools.AutoFormat +
  +
getClassPath() - +Method in class processing.app.Sketch +
  +
getCode() - +Method in class processing.app.Sketch +
  +
getCode(int) - +Method in class processing.app.Sketch +
  +
getCodeColumn() - +Method in exception processing.app.debug.RunnerException +
  +
getCodeCount() - +Method in class processing.app.Sketch +
  +
getCodeFolder() - +Method in class processing.app.Sketch +
Returns the location of the sketch's code folder. +
getCodeIndex() - +Method in exception processing.app.debug.RunnerException +
  +
getCodeIndex(SketchCode) - +Method in class processing.app.Sketch +
  +
getCodeLine() - +Method in exception processing.app.debug.RunnerException +
  +
getColor(String) - +Static method in class processing.app.Preferences +
  +
getColor() - +Method in class processing.app.syntax.SyntaxStyle +
Returns the color specified in this style. +
getColor(String) - +Static method in class processing.app.Theme +
  +
getContent() - +Method in class processing.xml.XMLElement +
Return the #PCDATA content of the element. +
getContentFile(String) - +Static method in class processing.app.Base +
Get a path for something in the Processing lib folder. +
getContext() - +Method in class processing.opengl.PGraphicsOpenGL +
Get the current context, for use by libraries that need to talk to it. +
getCurrentCode() - +Method in class processing.app.Sketch +
  +
getCurrentLine() - +Method in class processing.app.syntax.TextAreaPainter +
Accessor used by tools that want to hook in and grab the formatting. +
getCurrentLineIndex() - +Method in class processing.app.syntax.TextAreaPainter +
Accessor used by tools that want to hook in and grab the formatting. +
getCurrentLineTokens() - +Method in class processing.app.syntax.TextAreaPainter +
Accessor used by tools that want to hook in and grab the formatting. +
getDataFolder() - +Method in class processing.app.Sketch +
Returns the location of the sketch's data folder. +
getDefault(String) - +Static method in class processing.app.Preferences +
  +
getDefault(String) - +Static method in class processing.app.Theme +
  +
getDefaultExtension() - +Method in class processing.app.Sketch +
Returns the default extension for this editor setup. +
getDefaults() - +Static method in class processing.app.syntax.TextAreaDefaults +
Returns a new TextAreaDefaults object with the default values filled + in. +
getDefaultSketchbookFolder() - +Method in class processing.app.macosx.Platform +
  +
getDefaultSketchbookFolder() - +Method in class processing.app.Platform +
  +
getDefaultSketchbookFolder() - +Method in class processing.app.windows.Platform +
  +
getDefaultSyntaxStyles() - +Static method in class processing.app.syntax.SyntaxUtilities +
Returns the default style table. +
getDocument() - +Method in class processing.app.SketchCode +
  +
getDocument() - +Method in class processing.app.syntax.JEditTextArea +
Returns the document this text area is editing. +
getDocumentLength() - +Method in class processing.app.syntax.JEditTextArea +
Returns the length of the document. +
getDoubleAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getDoubleAttribute(String, double) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getDoubleAttribute(String, String, double) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getElectricScroll() - +Method in class processing.app.syntax.JEditTextArea +
Returns the number of lines from the top and button of the + text area that are always visible. +
getElementName() - +Method in exception processing.xml.XMLValidationException +
Returns the name of the element in which the validation is violated. +
getEntity(StdXMLReader, String) - +Method in class processing.xml.XMLEntityResolver +
Returns a Java reader containing the value of an entity. +
getEOLMarkerColor() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the EOL marker color. +
getEOLMarkersPainted() - +Method in class processing.app.syntax.TextAreaPainter +
Returns true if EOL markers are drawn, false otherwise. +
getExamplesPath() - +Static method in class processing.app.Base +
  +
getException() - +Method in exception processing.xml.XMLException +
Returns the encapsulated exception, or null if no exception is + encapsulated. +
getExtension() - +Method in class processing.app.SketchCode +
  +
getExtensions() - +Method in class processing.app.Sketch +
Returns a String[] array of proper extensions. +
getExtraImports() - +Method in class processing.app.preproc.PdePreprocessor +
  +
getFile() - +Method in class processing.app.SketchCode +
  +
getFileName() - +Method in class processing.app.SketchCode +
  +
getFirstLine() - +Method in class processing.app.syntax.JEditTextArea +
Returns the line displayed at the text area's origin. +
getFloatAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getFloatAttribute(String, float) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getFloatAttribute(String, String, float) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getFolder() - +Method in class processing.app.Sketch +
Returns the sketch folder. +
getFont(String) - +Static method in class processing.app.Preferences +
  +
getFont(String) - +Static method in class processing.app.Theme +
  +
getFont() - +Method in class processing.core.PFont +
Return the native java.awt.Font associated with this PFont (if any). +
getFontMetrics(Font, JComponent) - +Method in class processing.app.syntax.SyntaxStyle +
Returns the font metrics for the styled font. +
getFontMetrics() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the font metrics used by this component. +
getHeight() - +Method in class processing.core.PShape +
Get the height of the drawing area (not necessarily the shape boundary). +
getHiddenAfterString() - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
getHiddenBeforeString() - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
getHorizontalOffset() - +Method in class processing.app.syntax.JEditTextArea +
Returns the horizontal offset of drawn lines. +
getIgnoreCase() - +Method in class processing.app.syntax.KeywordMap +
Returns true if the keyword map is set to be case insensitive, + false otherwise. +
getImage() - +Method in class processing.core.PImage +
Returns a BufferedImage from this PImage. +
getImpl(int, int, int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
getInputHandler() - +Method in class processing.app.syntax.JEditTextArea +
Returns the input handler. +
getIntAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getIntAttribute(String, int) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getIntAttribute(String, String, int) - +Method in class processing.xml.XMLElement +
Returns the value of an attribute. +
getInteger(String) - +Static method in class processing.app.Preferences +
  +
getInteger(String) - +Static method in class processing.app.Theme +
  +
getIntValue(Registry.REGISTRY_ROOT_KEY, String, String) - +Static method in class processing.app.windows.Registry +
Read an int value. +
getInvalidLinesPainted() - +Method in class processing.app.syntax.TextAreaPainter +
Returns true if invalid lines are painted as red tildes (~), + false otherwise. +
getKeywords() - +Static method in class processing.app.syntax.CTokenMarker +
  +
getKeywords() - +Static method in class processing.app.syntax.PdeKeywords +
Handles loading of keywords file. +
getLibImage(String, Component) - +Static method in class processing.app.Base +
Return an Image object from inside the Processing lib folder. +
getLibrariesPath() - +Static method in class processing.app.Base +
  +
getLibraryPath() - +Method in class processing.app.Sketch +
  +
getLibStream(String) - +Static method in class processing.app.Base +
Return an InputStream for a file inside the Processing lib folder. +
getLineCount() - +Method in class processing.app.Editor +
Get the number of lines in the currently displayed buffer. +
getLineCount() - +Method in class processing.app.SketchCode +
  +
getLineCount() - +Method in class processing.app.syntax.JEditTextArea +
Returns the number of lines in the document. +
getLineCount() - +Method in class processing.app.syntax.TokenMarker +
Returns the number of lines in this token marker. +
getLineHighlightColor() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the line highlight color. +
getLineLength(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the length of the specified line. +
getLineNr() - +Method in class processing.xml.StdXMLReader +
Returns the line number of the data in the current stream. +
getLineNr() - +Method in class processing.xml.XMLElement +
Returns the line number in the data where the element started. +
getLineNr() - +Method in exception processing.xml.XMLException +
Returns the line number in the XML data where the exception occurred. +
getLineOfOffset(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the line containing the specified offset. +
getLineStartOffset(int) - +Method in class processing.app.Editor +
Get character offset for the start of a given line of text. +
getLineStartOffset(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the start offset of the specified line. +
getLineStopOffset(int) - +Method in class processing.app.Editor +
Get character offset for end of a given line of text. +
getLineStopOffset(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the end offset of the specified line. +
getLineText(int) - +Method in class processing.app.Editor +
Get text for a specified line. +
getLineText(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the text on the specified line. +
getLineText(int, Segment) - +Method in class processing.app.syntax.JEditTextArea +
Copies the text on the specified line into a segment. +
getLocalName() - +Method in class processing.xml.XMLElement +
Returns the name of the element. +
getMacroRecorder() - +Method in class processing.app.syntax.InputHandler +
Returns the macro recorder. +
getMagicCaretPosition() - +Method in class processing.app.syntax.JEditTextArea +
Returns the `magic' caret position. +
getMainFilePath() - +Method in class processing.app.Sketch +
Returns path to the main .pde file for this sketch. +
getMarkLine() - +Method in class processing.app.syntax.JEditTextArea +
Returns the mark line. +
getMarkPosition() - +Method in class processing.app.syntax.JEditTextArea +
Returns the mark position. +
getMatrix() - +Method in class processing.core.PApplet +
  +
getMatrix(PMatrix2D) - +Method in class processing.core.PApplet +
  +
getMatrix(PMatrix3D) - +Method in class processing.core.PApplet +
  +
getMatrix() - +Method in class processing.core.PGraphics +
  +
getMatrix(PMatrix2D) - +Method in class processing.core.PGraphics +
Copy the current transformation matrix into the specified target. +
getMatrix(PMatrix3D) - +Method in class processing.core.PGraphics +
Copy the current transformation matrix into the specified target. +
getMatrix() - +Method in class processing.core.PGraphics3D +
  +
getMatrix(PMatrix3D) - +Method in class processing.core.PGraphics3D +
  +
getMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
getMatrix(PMatrix2D) - +Method in class processing.core.PGraphicsJava2D +
  +
getMatrix(PMatrix3D) - +Method in class processing.core.PGraphicsJava2D +
  +
getMaximumSize() - +Method in class processing.app.EditorHeader +
  +
getMaximumSize() - +Method in class processing.app.EditorLineStatus +
  +
getMaximumSize() - +Method in class processing.app.EditorStatus +
  +
getMaximumSize() - +Method in class processing.app.EditorToolbar +
  +
getMaximumSize() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
getMaximumSize() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
getMaximumSize() - +Method in class processing.app.tools.CreateFont +
make the window vertically resizable +
getMenuTitle() - +Method in class processing.app.tools.Archiver +
  +
getMenuTitle() - +Method in class processing.app.tools.AutoFormat +
  +
getMenuTitle() - +Method in class processing.app.tools.ColorSelector +
  +
getMenuTitle() - +Method in class processing.app.tools.CreateFont +
  +
getMenuTitle() - +Method in class processing.app.tools.FixEncoding +
  +
getMenuTitle() - +Method in interface processing.app.tools.Tool +
  +
getMessage() - +Method in exception processing.app.debug.RunnerException +
Override getMessage() in Throwable, so that I can set + the message text outside the constructor. +
getMinimumSize() - +Method in class processing.app.Editor +
Hack for #@#)$(* Mac OS X 10.2. +
getMinimumSize() - +Method in class processing.app.EditorHeader +
  +
getMinimumSize() - +Method in class processing.app.EditorLineStatus +
  +
getMinimumSize() - +Method in class processing.app.EditorStatus +
  +
getMinimumSize() - +Method in class processing.app.EditorToolbar +
  +
getMinimumSize() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the painter's minimum size. +
getMinimumSize() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
getMinimumSize() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
getMinimumSize() - +Method in class processing.app.tools.CreateFont +
  +
getName() - +Method in class processing.app.Sketch +
Returns the name of this sketch. +
getName() - +Method in class processing.core.PShape +
  +
getName() - +Method in class processing.xml.XMLElement +
Returns the full name (i.e. +
getNamespace() - +Method in class processing.xml.XMLElement +
Returns the namespace of the element. +
getnl() - +Method in class processing.app.tools.AutoFormat +
  +
getPainter() - +Method in class processing.app.syntax.JEditTextArea +
Returns the object responsible for painting this text area. +
getParameterEntityResolver() - +Method in class processing.xml.XMLValidator +
Returns the parameter entity resolver. +
getParent() - +Method in class processing.xml.XMLElement +
Returns the parent element. +
getPlatformIndex(String) - +Static method in class processing.app.Base +
  +
getPlatformName() - +Static method in class processing.app.Base +
Get list of platform constants. +
getPlatformName(int) - +Static method in class processing.app.Base +
Map a platform constant to its name. +
getPreferredSize() - +Method in class processing.app.EditorHeader +
  +
getPreferredSize() - +Method in class processing.app.EditorLineStatus +
  +
getPreferredSize() - +Method in class processing.app.EditorStatus +
  +
getPreferredSize() - +Method in class processing.app.EditorToolbar +
  +
getPreferredSize() - +Method in class processing.app.Preferences +
  +
getPreferredSize() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the painter's preferred size. +
getPreferredSize() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
getPreferredSize() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
getPreprocOffset() - +Method in class processing.app.SketchCode +
  +
getPrettyName() - +Method in class processing.app.SketchCode +
  +
getPrimaryFile() - +Method in class processing.app.Sketch +
Returns a file object for the primary .pde of this sketch. +
getProgram() - +Method in class processing.app.SketchCode +
  +
getPublicID() - +Method in class processing.xml.StdXMLReader +
Returns the current public ID. +
getReader() - +Method in class processing.xml.StdXMLParser +
Returns the reader from which the parser retrieves its data. +
getReference(String) - +Static method in class processing.app.syntax.PdeKeywords +
  +
getRepeatCount() - +Method in class processing.app.syntax.InputHandler +
Returns the number of times the next action will be repeated. +
getResolver() - +Method in class processing.xml.StdXMLParser +
Returns the entity resolver. +
getResult() - +Method in class processing.xml.StdXMLBuilder +
Returns the result of the building process. +
getRightClickPopup() - +Method in class processing.app.syntax.JEditTextArea +
Returns the right click popup menu. +
getScrollPosition() - +Method in class processing.app.Editor +
  +
getScrollPosition() - +Method in class processing.app.SketchCode +
  +
getScrollPosition() - +Method in class processing.app.syntax.JEditTextArea +
Get current position of the vertical scroll bar. +
getSelectedText() - +Method in class processing.app.Editor +
Called to update the text but not switch to a different set of code + (which would affect the undo manager). +
getSelectedText() - +Method in class processing.app.syntax.JEditTextArea +
Returns the selected text, or null if no selection is active. +
getSelectionColor() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the selection color. +
getSelectionStart() - +Method in class processing.app.Editor +
Get the beginning point of the current selection. +
getSelectionStart() - +Method in class processing.app.SketchCode +
  +
getSelectionStart() - +Method in class processing.app.syntax.JEditTextArea +
Returns the selection start offset. +
getSelectionStart(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the offset where the selection starts on the specified + line. +
getSelectionStartLine() - +Method in class processing.app.syntax.JEditTextArea +
Returns the selection start line. +
getSelectionStop() - +Method in class processing.app.Editor +
Get the end point of the current selection. +
getSelectionStop() - +Method in class processing.app.SketchCode +
  +
getSelectionStop() - +Method in class processing.app.syntax.JEditTextArea +
Returns the selection end offset. +
getSelectionStop(int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the offset where the selection ends on the specified + line. +
getSelectionStopLine() - +Method in class processing.app.syntax.JEditTextArea +
Returns the selection end line. +
getSelector() - +Static method in class processing.app.PresentMode +
  +
getSettingsFile(String) - +Static method in class processing.app.Base +
Convenience method to get a File object for the specified filename inside + the settings folder. +
getSettingsFolder() - +Static method in class processing.app.Base +
  +
getSettingsFolder() - +Method in class processing.app.macosx.Platform +
  +
getSettingsFolder() - +Method in class processing.app.Platform +
  +
getSettingsFolder() - +Method in class processing.app.windows.Platform +
  +
getSketch() - +Method in class processing.app.Editor +
Gets the current sketch object. +
getSketchbookFolder() - +Static method in class processing.app.Base +
  +
getSketchbookLibrariesFolder() - +Static method in class processing.app.Base +
  +
getSketchHeight() - +Method in class processing.core.PApplet +
  +
getSketchLocation() - +Method in class processing.app.Editor +
Get the last location of the sketch's run window. +
getSketchRenderer() - +Method in class processing.core.PApplet +
  +
getSketchWidth() - +Method in class processing.core.PApplet +
  +
getStreamLevel() - +Method in class processing.xml.StdXMLReader +
Returns the current "level" of the stream on the stack of streams. +
getStringAttribute(String) - +Method in class processing.xml.XMLElement +
  +
getStringAttribute(String, String) - +Method in class processing.xml.XMLElement +
  +
getStringAttribute(String, String, String) - +Method in class processing.xml.XMLElement +
  +
getStringValue(Registry.REGISTRY_ROOT_KEY, String, String) - +Static method in class processing.app.windows.Registry +
Read a String value. +
getStyle(String) - +Static method in class processing.app.Preferences +
  +
getStyle(String) - +Static method in class processing.app.Theme +
  +
getStyle() - +Method in class processing.core.PGraphics +
  +
getStyle(PStyle) - +Method in class processing.core.PGraphics +
  +
getStyledFont(Font) - +Method in class processing.app.syntax.SyntaxStyle +
Returns the specified font, but with the style's bold and + italic flags applied. +
getStyles() - +Method in class processing.app.syntax.TextAreaPainter +
Returns the syntax styles used to paint colorized text. +
getSubKeys(Registry.REGISTRY_ROOT_KEY, String) - +Static method in class processing.app.windows.Registry +
Get all sub keys of a key. +
getSystemID() - +Method in class processing.xml.StdXMLReader +
Returns the current system ID. +
getSystemID() - +Method in class processing.xml.XMLElement +
Returns the system ID of the data where the element started. +
getSystemID() - +Method in exception processing.xml.XMLException +
Returns the system ID of the XML data where the exception occurred. +
getText() - +Method in class processing.app.Editor +
Get the contents of the current buffer. +
getText(int, int) - +Method in class processing.app.Editor +
Get a range of text from the current buffer. +
getText() - +Method in class processing.app.syntax.JEditTextArea +
Returns the entire text of this text area. +
getText(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Returns the specified substring of the document. +
getText(int, int, Segment) - +Method in class processing.app.syntax.JEditTextArea +
Copies the specified substring of the document into a segment. +
getTextArea() - +Method in class processing.app.Editor +
Get the JEditTextArea object for use (not recommended). +
getTextArea(EventObject) - +Static method in class processing.app.syntax.InputHandler +
Returns the text area that fired the specified event. +
getThemeImage(String, Component) - +Static method in class processing.app.Base +
Get an image associated with the current color theme. +
getTokenMarker() - +Method in class processing.app.syntax.JEditTextArea +
Returns the document's token marker. +
getTokenMarker() - +Method in class processing.app.syntax.SyntaxDocument +
Returns the token marker that is to be used to split lines + of this document up into tokens. +
getToolsFolder() - +Static method in class processing.app.Base +
  +
getToolsPath() - +Static method in class processing.app.Base +
  +
getToolTipText(MouseEvent) - +Method in class processing.app.syntax.TextAreaPainter +
Returns the tool tip to display at the specified location. +
getToolTipText(MouseEvent) - +Method in interface processing.app.syntax.TextAreaPainter.Highlight +
Returns the tool tip to display at the specified + location. +
getUndo() - +Method in class processing.app.SketchCode +
  +
getValidator() - +Method in class processing.xml.StdXMLParser +
Returns the validator that validates the XML data. +
getValues(Registry.REGISTRY_ROOT_KEY, String) - +Static method in class processing.app.windows.Registry +
Get all values under a key. +
getVisibleLines() - +Method in class processing.app.syntax.JEditTextArea +
Returns the number of lines visible in this text area. +
getWidth() - +Method in class processing.core.PShape +
Get the width of the drawing area (not necessarily the shape boundary). +
GIF - +Static variable in interface processing.core.PConstants +
  +
GIF - +Static variable in class processing.video.MovieMaker +
  +
gl - +Variable in class processing.opengl.PGraphicsOpenGL +
  +
glu - +Variable in class processing.opengl.PGraphicsOpenGL +
  +
gotelse() - +Method in class processing.app.tools.AutoFormat +
  +
grabLines() - +Method in class processing.app.tools.AutoFormat +
  +
grabNextKeyStroke(ActionListener) - +Method in class processing.app.syntax.InputHandler +
Grabs the next key typed event and invokes the specified + action with the key as a the action command. +
GRAPHICS - +Static variable in class processing.video.MovieMaker +
  +
GRAY - +Static variable in interface processing.core.PConstants +
  +
green(int) - +Method in class processing.core.PApplet +
  +
green(int) - +Method in class processing.core.PGraphics +
  +
GREEN_MASK - +Static variable in interface processing.core.PConstants +
  +
GROUP - +Static variable in class processing.core.PShape +
Generic, only draws its child objects. +
GT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
GT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
GT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
+
+

+H

+
+
H261 - +Static variable in class processing.video.MovieMaker +
  +
H263 - +Static variable in class processing.video.MovieMaker +
  +
H264 - +Static variable in class processing.video.MovieMaker +
  +
HALF_PI - +Static variable in interface processing.core.PConstants +
  +
HAND - +Static variable in interface processing.core.PConstants +
  +
handle() - +Method in class processing.core.PApplet.RegisteredMethods +
  +
handle(Object[]) - +Method in class processing.core.PApplet.RegisteredMethods +
  +
handleAbout() - +Method in class processing.app.Base +
Show the About box. +
handleAbout(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handleAddFile() - +Method in class processing.app.Sketch +
Prompt the user for a new file to the sketch, then call the + other addFile() function to actually add it. +
handleClose(Editor) - +Method in class processing.app.Base +
Close a sketch as specified by its editor window. +
handleClose() - +Method in class processing.app.FindReplace +
  +
handleCopy() - +Method in class processing.app.Editor +
Implements Edit → Copy. +
handleCut() - +Method in class processing.app.Editor +
Implements Edit → Cut. +
handleDeleteCode() - +Method in class processing.app.Sketch +
Remove a piece of code from the sketch and from the disk. +
handleDraw() - +Method in class processing.core.PApplet +
  +
handleExport() - +Method in class processing.app.Editor +
Called by Sketch → Export. +
handleExportApplication() - +Method in class processing.app.Editor +
Handler for Sketch → Export Application +
handleMouse(int, int) - +Method in class processing.app.EditorToolbar +
  +
handleNew() - +Method in class processing.app.Base +
Create a new untitled document in a new sketch window. +
handleNewCode() - +Method in class processing.app.Sketch +
Handler for the New Code menu option. +
handleNewReplace() - +Method in class processing.app.Base +
Replace the sketch in the current window with a new untitled document. +
handleNextCode() - +Method in class processing.app.Sketch +
Move to the next tab. +
handleOpen(String) - +Method in class processing.app.Base +
Open a sketch in a new window. +
handleOpenApplication(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handleOpenFile(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handleOpenPrompt() - +Method in class processing.app.Base +
Prompt for a sketch to open, and open it in a new window. +
handleOpenReplace(String) - +Method in class processing.app.Base +
Open a sketch, replacing the sketch in the current window. +
handlePageSetup() - +Method in class processing.app.Editor +
Handler for File → Page Setup. +
handlePaste() - +Method in class processing.app.Editor +
Implements Edit → Paste. +
handlePreferences(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handlePrefs() - +Method in class processing.app.Base +
Show the Preferences window. +
handlePrevCode() - +Method in class processing.app.Sketch +
Move to the previous tab. +
handlePrint() - +Method in class processing.app.Editor +
Handler for File → Print. +
handlePrintFile(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handleQuit() - +Method in class processing.app.Base +
Handler for File → Quit. +
handleQuit() - +Method in class processing.app.EditorConsole +
Close the streams so that the temporary files can be deleted. +
handleQuit(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handler() - +Method in class antlr.java.JavaRecognizer +
  +
handler() - +Method in class processing.app.preproc.PdeRecognizer +
  +
handleRenameCode() - +Method in class processing.app.Sketch +
Handler for the Rename Code menu option. +
handleReOpenApplication(ApplicationEvent) - +Method in class processing.app.macosx.ThinkDifferent +
  +
handleRun(boolean) - +Method in class processing.app.Editor +
Implements Sketch → Run. +
handleSave(boolean) - +Method in class processing.app.Editor +
Actually handle the save command. +
handleSaveAs() - +Method in class processing.app.Editor +
  +
handleSelectAll() - +Method in class processing.app.Editor +
Implements Edit → Select All. +
handleStop() - +Method in class processing.app.Editor +
Implements Sketch → Stop, or pressing Stop on the toolbar. +
HARD_LIGHT - +Static variable in interface processing.core.PConstants +
  +
hasAttribute(String) - +Method in class processing.xml.XMLElement +
Returns whether an attribute exists. +
hasAttribute(String, String) - +Method in class processing.xml.XMLElement +
Returns whether an attribute exists. +
hasChildren() - +Method in class processing.xml.XMLElement +
Returns whether the element has children. +
hasCodeIndex() - +Method in exception processing.app.debug.RunnerException +
  +
hasCodeLine() - +Method in exception processing.app.debug.RunnerException +
  +
hasDefaultExtension(SketchCode) - +Method in class processing.app.Sketch +
True if the specified code has the default file extension. +
heading2D() - +Method in class processing.core.PVector +
Calculate the angle of rotation for this vector (only 2D vectors) +
height - +Variable in class processing.core.PApplet +
height of this applet's associated PGraphics +
height - +Variable in class processing.core.PFont +
  +
height - +Variable in class processing.core.PImage +
  +
height - +Variable in class processing.core.PShape +
  +
hex(byte) - +Static method in class processing.core.PApplet +
  +
hex(char) - +Static method in class processing.core.PApplet +
  +
hex(int) - +Static method in class processing.core.PApplet +
  +
hex(int, int) - +Static method in class processing.core.PApplet +
  +
HEX_DIGIT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
HEX_DIGIT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
HEX_DIGIT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
hideExtension(String) - +Method in class processing.app.Sketch +
True if the specified extension should be hidden when shown on a tab. +
hideStackTrace() - +Method in exception processing.app.debug.RunnerException +
  +
HIGH - +Static variable in class processing.video.MovieMaker +
  +
hint(int) - +Method in class processing.core.PApplet +
  +
hint(int) - +Method in class processing.core.PGraphics +
Enable a hint option. +
hint(int) - +Method in class processing.core.PGraphics3D +
  +
hint(int) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
HINT_COUNT - +Static variable in interface processing.core.PConstants +
  +
HKEY_CLASSES_ROOT - +Static variable in interface processing.app.windows.WINREG +
  +
HKEY_CURRENT_USER - +Static variable in interface processing.app.windows.WINREG +
  +
HKEY_LOCAL_MACHINE - +Static variable in interface processing.app.windows.WINREG +
  +
HKEY_USERS - +Static variable in interface processing.app.windows.WINREG +
  +
HOME - +Static variable in class processing.app.syntax.InputHandler +
  +
hour() - +Static method in class processing.core.PApplet +
Hour position of the current time in international format (0-23). +
HSB - +Static variable in interface processing.core.PConstants +
  +
hue(int) - +Method in class processing.core.PApplet +
  +
hue(int) - +Method in class processing.core.PGraphics +
  +
+
+

+I

+
+
ICON_IMAGE - +Static variable in class processing.core.PApplet +
GIF image of the Processing logo. +
id - +Variable in class processing.app.syntax.Token +
The id of this token. +
ID_COUNT - +Static variable in class processing.app.syntax.Token +
The total number of defined token ids. +
IDENT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
IDENT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
IDENT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
identifier() - +Method in class antlr.java.JavaRecognizer +
  +
identifier() - +Method in class processing.app.preproc.PdeRecognizer +
  +
identifierStar() - +Method in class antlr.java.JavaRecognizer +
  +
identifierStar() - +Method in class processing.app.preproc.PdeRecognizer +
  +
identPrimary() - +Method in class antlr.java.JavaRecognizer +
Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + and a.b.c.class refs. +
identPrimary() - +Method in class processing.app.preproc.PdeRecognizer +
  +
image(PImage, float, float) - +Method in class processing.core.PApplet +
  +
image(PImage, float, float, float, float) - +Method in class processing.core.PApplet +
  +
image(PImage, float, float, float, float, int, int, int, int) - +Method in class processing.core.PApplet +
  +
IMAGE - +Static variable in interface processing.core.PConstants +
texture coordinates based on image width/height +
image - +Variable in class processing.core.PGraphics +
Java AWT Image object associated with this renderer. +
image(PImage, float, float) - +Method in class processing.core.PGraphics +
  +
image(PImage, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
image(PImage, float, float, float, float, int, int, int, int) - +Method in class processing.core.PGraphics +
Draw an image(), also specifying u/v coordinates. +
imageMode(int) - +Method in class processing.core.PApplet +
  +
imageMode - +Variable in class processing.core.PGraphics +
The current image alignment (read-only) +
imageMode(int) - +Method in class processing.core.PGraphics +
The mode can only be set to CORNERS, CORNER, and CENTER. +
imageMode - +Variable in class processing.core.PStyle +
  +
images - +Variable in class processing.core.PFont +
  +
IMPLEMENTS_CLAUSE - +Static variable in interface antlr.java.JavaTokenTypes +
  +
IMPLEMENTS_CLAUSE - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
IMPLEMENTS_CLAUSE - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
implementsClause() - +Method in class antlr.java.JavaRecognizer +
  +
implementsClause() - +Method in class processing.app.preproc.PdeRecognizer +
  +
IMPORT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
IMPORT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
IMPORT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
importDefinition() - +Method in class antlr.java.JavaRecognizer +
  +
importDefinition() - +Method in class processing.app.preproc.PdeRecognizer +
  +
importLibrary(String) - +Method in class processing.app.Sketch +
Add import statements to the current tab for all of packages inside + the specified jar file. +
INC - +Static variable in interface antlr.java.JavaTokenTypes +
  +
INC - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
INC - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
inclusiveOrExpression() - +Method in class antlr.java.JavaRecognizer +
  +
inclusiveOrExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
indent_puts() - +Method in class processing.app.tools.AutoFormat +
  +
index(char) - +Method in class processing.core.PFont +
Get index for the char (convert from unicode to bagel charset). +
INDEX_OP - +Static variable in interface antlr.java.JavaTokenTypes +
  +
INDEX_OP - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
INDEX_OP - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
init(Base) - +Method in class processing.app.macosx.Platform +
  +
init(Base) - +Method in class processing.app.Platform +
  +
init(JEditTextArea, TextAreaPainter.Highlight) - +Method in interface processing.app.syntax.TextAreaPainter.Highlight +
Called after the highlight painter has been added. +
init(Editor) - +Method in class processing.app.tools.Archiver +
  +
init(Editor) - +Method in class processing.app.tools.AutoFormat +
  +
init(Editor) - +Method in class processing.app.tools.ColorSelector +
  +
init(Editor) - +Method in class processing.app.tools.CreateFont +
  +
init(Editor) - +Method in class processing.app.tools.FixEncoding +
  +
init(Editor) - +Method in interface processing.app.tools.Tool +
  +
init(Base) - +Method in class processing.app.windows.Platform +
  +
init() - +Method in class processing.core.PApplet +
  +
init(int, int, int) - +Method in class processing.core.PImage +
Function to be used by subclasses of PImage to init later than + at the constructor, or re-init later when things changes. +
init(PApplet, int, int, String, int) - +Method in class processing.video.Capture +
  +
init(PApplet, String, int) - +Method in class processing.video.Movie +
  +
initialize(AST) - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
initializer() - +Method in class antlr.java.JavaRecognizer +
  +
initializer() - +Method in class processing.app.preproc.PdeRecognizer +
  +
input - +Variable in class processing.net.Client +
  +
input - +Variable in class processing.serial.Serial +
  +
InputHandler - Class in processing.app.syntax
An input handler converts the user's key strokes into concrete actions.
InputHandler() - +Constructor for class processing.app.syntax.InputHandler +
  +
inputHandler - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
InputHandler.backspace - Class in processing.app.syntax
 
InputHandler.backspace() - +Constructor for class processing.app.syntax.InputHandler.backspace +
  +
InputHandler.backspace_word - Class in processing.app.syntax
 
InputHandler.backspace_word() - +Constructor for class processing.app.syntax.InputHandler.backspace_word +
  +
InputHandler.delete - Class in processing.app.syntax
 
InputHandler.delete() - +Constructor for class processing.app.syntax.InputHandler.delete +
  +
InputHandler.delete_word - Class in processing.app.syntax
 
InputHandler.delete_word() - +Constructor for class processing.app.syntax.InputHandler.delete_word +
  +
InputHandler.document_end - Class in processing.app.syntax
 
InputHandler.document_end(boolean) - +Constructor for class processing.app.syntax.InputHandler.document_end +
  +
InputHandler.document_home - Class in processing.app.syntax
 
InputHandler.document_home(boolean) - +Constructor for class processing.app.syntax.InputHandler.document_home +
  +
InputHandler.end - Class in processing.app.syntax
 
InputHandler.end(boolean) - +Constructor for class processing.app.syntax.InputHandler.end +
  +
InputHandler.home - Class in processing.app.syntax
 
InputHandler.home(boolean) - +Constructor for class processing.app.syntax.InputHandler.home +
  +
InputHandler.insert_break - Class in processing.app.syntax
 
InputHandler.insert_break() - +Constructor for class processing.app.syntax.InputHandler.insert_break +
  +
InputHandler.insert_char - Class in processing.app.syntax
 
InputHandler.insert_char() - +Constructor for class processing.app.syntax.InputHandler.insert_char +
  +
InputHandler.insert_tab - Class in processing.app.syntax
 
InputHandler.insert_tab() - +Constructor for class processing.app.syntax.InputHandler.insert_tab +
  +
InputHandler.MacroRecorder - Interface in processing.app.syntax
Macro recorder.
InputHandler.next_char - Class in processing.app.syntax
 
InputHandler.next_char(boolean) - +Constructor for class processing.app.syntax.InputHandler.next_char +
  +
InputHandler.next_line - Class in processing.app.syntax
 
InputHandler.next_line(boolean) - +Constructor for class processing.app.syntax.InputHandler.next_line +
  +
InputHandler.next_page - Class in processing.app.syntax
 
InputHandler.next_page(boolean) - +Constructor for class processing.app.syntax.InputHandler.next_page +
  +
InputHandler.next_word - Class in processing.app.syntax
 
InputHandler.next_word(boolean) - +Constructor for class processing.app.syntax.InputHandler.next_word +
  +
InputHandler.NonRecordable - Interface in processing.app.syntax
If an action implements this interface, it should not be recorded + by the macro recorder.
InputHandler.NonRepeatable - Interface in processing.app.syntax
If an action implements this interface, it should not be repeated.
InputHandler.overwrite - Class in processing.app.syntax
 
InputHandler.overwrite() - +Constructor for class processing.app.syntax.InputHandler.overwrite +
  +
InputHandler.prev_char - Class in processing.app.syntax
 
InputHandler.prev_char(boolean) - +Constructor for class processing.app.syntax.InputHandler.prev_char +
  +
InputHandler.prev_line - Class in processing.app.syntax
 
InputHandler.prev_line(boolean) - +Constructor for class processing.app.syntax.InputHandler.prev_line +
  +
InputHandler.prev_page - Class in processing.app.syntax
 
InputHandler.prev_page(boolean) - +Constructor for class processing.app.syntax.InputHandler.prev_page +
  +
InputHandler.prev_word - Class in processing.app.syntax
 
InputHandler.prev_word(boolean) - +Constructor for class processing.app.syntax.InputHandler.prev_word +
  +
InputHandler.repeat - Class in processing.app.syntax
 
InputHandler.repeat() - +Constructor for class processing.app.syntax.InputHandler.repeat +
  +
InputHandler.toggle_rect - Class in processing.app.syntax
 
InputHandler.toggle_rect() - +Constructor for class processing.app.syntax.InputHandler.toggle_rect +
  +
InputHandler.Wrapper - Interface in processing.app.syntax
For use by EditAction.Wrapper only.
INSERT_BREAK - +Static variable in class processing.app.syntax.InputHandler +
  +
INSERT_CHAR - +Static variable in class processing.app.syntax.InputHandler +
  +
INSERT_TAB - +Static variable in class processing.app.syntax.InputHandler +
  +
insertChild(XMLElement, int) - +Method in class processing.xml.XMLElement +
Inserts a child element. +
insertLines(int, int) - +Method in class processing.app.syntax.TokenMarker +
Informs the token marker that lines have been inserted into + the document. +
insertText(String) - +Method in class processing.app.Editor +
  +
insertUpdate(DocumentEvent) - +Method in class processing.app.tools.ColorSelector +
  +
INSTANCE - +Static variable in interface processing.app.windows.Advapi32 +
  +
INSTANCE_INIT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
INSTANCE_INIT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
INSTANCE_INIT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
INTERFACE_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
INTERFACE_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
INTERFACE_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
interfaceDefinition(AST) - +Method in class antlr.java.JavaRecognizer +
  +
interfaceDefinition(AST) - +Method in class processing.app.preproc.PdeRecognizer +
  +
interfaceExtends() - +Method in class antlr.java.JavaRecognizer +
  +
interfaceExtends() - +Method in class processing.app.preproc.PdeRecognizer +
  +
INTERNAL_FIRST - +Static variable in class processing.app.syntax.Token +
The first id that can be used for internal state + in a token marker. +
INTERNAL_LAST - +Static variable in class processing.app.syntax.Token +
The last id that can be used for internal state + in a token marker. +
internalCloseRunner() - +Method in class processing.app.Editor +
Handle internal shutdown of the runner. +
internalRunnerClosed() - +Method in class processing.app.Editor +
Called by Runner to notify that the sketch has stopped running. +
INTERPOLATE_ALPHA - +Variable in class processing.core.PLine +
  +
INTERPOLATE_ALPHA - +Variable in class processing.core.PTriangle +
  +
INTERPOLATE_RGB - +Variable in class processing.core.PLine +
  +
INTERPOLATE_RGB - +Variable in class processing.core.PTriangle +
  +
INTERPOLATE_THICK - +Variable in class processing.core.PLine +
  +
INTERPOLATE_UV - +Variable in class processing.core.PTriangle +
  +
INTERPOLATE_Z - +Variable in class processing.core.PLine +
  +
INVALID - +Static variable in class processing.app.syntax.Token +
Invalid token id. +
invalidateLine(int) - +Method in class processing.app.syntax.TextAreaPainter +
Marks a line as needing a repaint. +
invalidateLineRange(int, int) - +Method in class processing.app.syntax.TextAreaPainter +
Marks a range of lines as needing a repaint. +
invalidateSelectedLines() - +Method in class processing.app.syntax.TextAreaPainter +
Repaints the lines containing the selection. +
INVERT - +Static variable in interface processing.core.PConstants +
  +
invert() - +Method in interface processing.core.PMatrix +
Invert this matrix. +
invert() - +Method in class processing.core.PMatrix2D +
Invert this matrix. +
invert() - +Method in class processing.core.PMatrix3D +
Invert this matrix. +
ip() - +Method in class processing.net.Client +
Returns the ip address of this feller as a String. +
is2D() - +Method in class processing.core.PGraphics +
Return true if this renderer supports 2D drawing. +
is2D() - +Method in class processing.core.PGraphics3D +
  +
is3D() - +Method in class processing.core.PGraphics +
Return true if this renderer supports 2D drawing. +
is3D() - +Method in class processing.core.PGraphics3D +
  +
isBlockCaretEnabled() - +Method in class processing.app.syntax.TextAreaPainter +
Returns true if the caret should be drawn as a block, false otherwise. +
isBold() - +Method in class processing.app.syntax.SyntaxStyle +
Returns true if boldface is enabled for this style. +
isBracketHighlightEnabled() - +Method in class processing.app.syntax.TextAreaPainter +
Returns true if bracket highlighting is enabled, false otherwise. +
isCaretBlinkEnabled() - +Method in class processing.app.syntax.JEditTextArea +
Returns true if the caret is blinking, false otherwise. +
isCaretVisible() - +Method in class processing.app.syntax.JEditTextArea +
Returns true if the caret is visible, false otherwise. +
isDefaultExtension(String) - +Method in class processing.app.Sketch +
True if the specified extension is the default file extension. +
isEditable() - +Method in class processing.app.syntax.JEditTextArea +
Returns true if this text area is editable, false otherwise. +
isExtension(String) - +Method in class processing.app.SketchCode +
  +
isExternalEntity(String) - +Method in class processing.xml.XMLEntityResolver +
Returns true if an entity is external. +
isItalic() - +Method in class processing.app.syntax.SyntaxStyle +
Returns true if italics is enabled for this style. +
isLeaf() - +Method in class processing.xml.XMLElement +
Returns whether the element is a leaf element. +
isLineHighlightEnabled() - +Method in class processing.app.syntax.TextAreaPainter +
Returns true if line highlight is enabled, false otherwise. +
isLinux() - +Static method in class processing.app.Base +
true if running on linux. +
isMacOS() - +Static method in class processing.app.Base +
returns true if Processing is running on a Mac OS X machine. +
isManagingFocus() - +Method in class processing.app.syntax.JEditTextArea +
Returns if this component can be traversed by pressing + the Tab key. +
isManagingFocus() - +Method in class processing.app.syntax.TextAreaPainter +
Returns if this component can be traversed by pressing the + Tab key. +
isModified() - +Method in class processing.app.Sketch +
  +
isModified() - +Method in class processing.app.SketchCode +
  +
isModified() - +Method in class processing.core.PImage +
  +
isNextLineRequested() - +Method in class processing.app.syntax.TokenMarker +
Returns true if the next line should be repainted. +
isOverwriteEnabled() - +Method in class processing.app.syntax.JEditTextArea +
Returns true if overwrite mode is enabled, false otherwise. +
isPlain() - +Method in class processing.app.syntax.SyntaxStyle +
Returns true if no font styles are enabled. +
isReadOnly() - +Method in class processing.app.Sketch +
Returns true if this is a read-only sketch. +
isRepeatEnabled() - +Method in class processing.app.syntax.InputHandler +
Returns if repeating is enabled. +
isSanitaryName(String) - +Static method in class processing.app.Sketch +
Return true if the name is valid for a Processing sketch. +
isSelectionActive() - +Method in class processing.app.Editor +
True if some text is currently selected. +
isSelectionActive() - +Method in class processing.app.syntax.JEditTextArea +
  +
isSelectionRectangular() - +Method in class processing.app.syntax.JEditTextArea +
Returns true if the selection is rectangular, false otherwise. +
isUntitled() - +Method in class processing.app.Sketch +
  +
isVisible() - +Method in class processing.core.PShape +
  +
isWindows() - +Static method in class processing.app.Base +
returns true if running on windows. +
+
+

+J

+
+
JAVA - +Static variable in class processing.app.preproc.PdePreprocessor +
  +
JAVA2D - +Static variable in interface processing.core.PConstants +
  +
JavaLexer - Class in antlr.java
 
JavaLexer(InputStream) - +Constructor for class antlr.java.JavaLexer +
  +
JavaLexer(Reader) - +Constructor for class antlr.java.JavaLexer +
  +
JavaLexer(InputBuffer) - +Constructor for class antlr.java.JavaLexer +
  +
JavaLexer(LexerSharedInputState) - +Constructor for class antlr.java.JavaLexer +
  +
javaProgram() - +Method in class processing.app.preproc.PdeRecognizer +
  +
JavaRecognizer - Class in antlr.java
Java 1.3 Recognizer
JavaRecognizer(TokenBuffer) - +Constructor for class antlr.java.JavaRecognizer +
  +
JavaRecognizer(TokenStream) - +Constructor for class antlr.java.JavaRecognizer +
  +
JavaRecognizer(ParserSharedInputState) - +Constructor for class antlr.java.JavaRecognizer +
  +
JavaTokenTypes - Interface in antlr.java
 
javaVersion - +Static variable in class processing.core.PApplet +
Version of Java that's in use, whether 1.1 or 1.3 or whatever, + stored as a float. +
javaVersionName - +Static variable in class processing.core.PApplet +
Full name of the Java version (i.e. +
JEditTextArea - Class in processing.app.syntax
jEdit's text area component.
JEditTextArea(TextAreaDefaults) - +Constructor for class processing.app.syntax.JEditTextArea +
Creates a new JEditTextArea with the specified settings. +
join(String[], char) - +Static method in class processing.core.PApplet +
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +
join(String[], String) - +Static method in class processing.core.PApplet +
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +
JPEG - +Static variable in interface processing.core.PConstants +
  +
JPEG - +Static variable in class processing.video.MovieMaker +
  +
jump(float) - +Method in class processing.video.Movie +
Jump to a specific location (in seconds). +
+
+

+K

+
+
kern(char, char) - +Method in class processing.core.PFont +
Currently un-implemented for .vlw fonts, + but honored for layout in case subclasses use it. +
key - +Variable in class processing.core.PApplet +
Last key pressed. +
KEY_CREATE_LINK - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_CREATE_SUB_KEY - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_ENUMERATE_SUB_KEYS - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_NOTIFY - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_QUERY_VALUE - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_READ - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_SET_VALUE - +Static variable in interface processing.app.windows.WINNT +
  +
KEY_WRITE - +Static variable in interface processing.app.windows.WINNT +
  +
keyCode - +Variable in class processing.core.PApplet +
When "key" is set to CODED, this will contain a Java key code. +
keyEvent - +Variable in class processing.core.PApplet +
the last KeyEvent object passed into a mouse function. +
keyPressed(KeyEvent) - +Method in class processing.app.EditorListener +
Intercepts key pressed events for JEditTextArea. +
keyPressed(KeyEvent) - +Method in class processing.app.syntax.DefaultInputHandler +
Handle a key pressed event. +
keyPressed - +Variable in class processing.core.PApplet +
true if the mouse is currently pressed. +
keyPressed(KeyEvent) - +Method in class processing.core.PApplet +
Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + 'keyCode', and 'keyEvent' variables to no longer work; + key events will no longer be queued until the end of draw(); + and the keyPressed(), keyReleased() and keyTyped() methods + will no longer be called. +
keyPressed() - +Method in class processing.core.PApplet +
Called each time a single key on the keyboard is pressed. +
keyReleased(KeyEvent) - +Method in class processing.core.PApplet +
  +
keyReleased() - +Method in class processing.core.PApplet +
See keyPressed(). +
keyTyped(KeyEvent) - +Method in class processing.app.EditorListener +
  +
keyTyped(KeyEvent) - +Method in class processing.app.syntax.DefaultInputHandler +
Handle a key typed event. +
keyTyped(KeyEvent) - +Method in class processing.core.PApplet +
  +
keyTyped() - +Method in class processing.core.PApplet +
Only called for "regular" keys like letters, + see keyPressed() for full documentation. +
KEYWORD1 - +Static variable in class processing.app.syntax.Token +
Keyword 1 token id. +
KEYWORD2 - +Static variable in class processing.app.syntax.Token +
Keyword 2 token id. +
KEYWORD3 - +Static variable in class processing.app.syntax.Token +
Keyword 3 token id. +
KeywordMap - Class in processing.app.syntax
A KeywordMap is similar to a hashtable in that it maps keys + to values.
KeywordMap(boolean) - +Constructor for class processing.app.syntax.KeywordMap +
Creates a new KeywordMap. +
KeywordMap(boolean, int) - +Constructor for class processing.app.syntax.KeywordMap +
Creates a new KeywordMap. +
+
+

+L

+
+
LABEL - +Static variable in class processing.app.syntax.Token +
Label token id. +
LABELED_STAT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LABELED_STAT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LABELED_STAT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LAND - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LAND - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LAND - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
last() - +Method in class processing.serial.Serial +
Same as read() but returns the very last value received + and clears the buffer. +
lastChar() - +Method in class processing.serial.Serial +
Just like last() and readChar(). +
launch() - +Method in class processing.app.debug.Runner +
  +
launch(String) - +Static method in class processing.app.WebServer +
  +
LBRACK - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LBRACK - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LBRACK - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LCURLY - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LCURLY - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LCURLY - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LE - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LE - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LE - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LEFT - +Static variable in interface processing.core.PConstants +
  +
LEFT_OF_SCROLLBAR - +Static variable in class processing.app.syntax.JEditTextArea +
Adding components with this name to the text area will place + them left of the horizontal scroll bar. +
leftExtent - +Variable in class processing.core.PFont +
  +
length - +Variable in class processing.app.syntax.Token +
The length of this token. +
lerp(float, float, float) - +Static method in class processing.core.PApplet +
  +
lerpColor(int, int, float) - +Method in class processing.core.PApplet +
  +
lerpColor(int, int, float, int) - +Static method in class processing.core.PApplet +
  +
lerpColor(int, int, float) - +Method in class processing.core.PGraphics +
Interpolate between two colors, using the current color mode. +
lerpColor(int, int, float, int) - +Static method in class processing.core.PGraphics +
Interpolate between two colors. +
librariesClassPath - +Static variable in class processing.app.Base +
  +
lightCount - +Variable in class processing.core.PGraphics3D +
  +
lightDiffuse - +Variable in class processing.core.PGraphics3D +
Diffuse colors for lights. +
LIGHTEST - +Static variable in interface processing.core.PConstants +
  +
lightFalloff(float, float, float) - +Method in class processing.core.PApplet +
  +
lightFalloff(float, float, float) - +Method in class processing.core.PGraphics +
  +
lightFalloff(float, float, float) - +Method in class processing.core.PGraphics3D +
Set the light falloff rates for the last light that was created. +
lightFalloff(float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
lightFalloffConstant - +Variable in class processing.core.PGraphics3D +
Light falloff +
lightFalloffLinear - +Variable in class processing.core.PGraphics3D +
  +
lightFalloffQuadratic - +Variable in class processing.core.PGraphics3D +
  +
lightNormal - +Variable in class processing.core.PGraphics3D +
Light direction (normalized vector) +
lightPosition - +Variable in class processing.core.PGraphics3D +
Light positions +
lights() - +Method in class processing.core.PApplet +
  +
lights() - +Method in class processing.core.PGraphics +
  +
lights() - +Method in class processing.core.PGraphics3D +
Sets up an ambient and directional light. +
lightSpecular(float, float, float) - +Method in class processing.core.PApplet +
  +
lightSpecular(float, float, float) - +Method in class processing.core.PGraphics +
  +
lightSpecular - +Variable in class processing.core.PGraphics3D +
Specular colors for lights. +
lightSpecular(float, float, float) - +Method in class processing.core.PGraphics3D +
Set the specular color of the last light created. +
lightSpecular(float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
lightSpotAngle - +Variable in class processing.core.PGraphics3D +
Light spot angle +
lightSpotAngleCos - +Variable in class processing.core.PGraphics3D +
Cosine of light spot angle +
lightSpotConcentration - +Variable in class processing.core.PGraphics3D +
Light spot concentration +
lightType - +Variable in class processing.core.PGraphics3D +
Light types +
limit(float) - +Method in class processing.core.PVector +
Limit the magnitude of this vector +
line(float, float, float, float) - +Method in class processing.core.PApplet +
  +
line(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
LINE - +Static variable in interface processing.core.PConstants +
  +
line(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
line(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
line - +Variable in class processing.core.PGraphics3D +
  +
line(float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
lineClipping() - +Method in class processing.core.PLine +
  +
lineHighlight - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
lineHighlightColor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
LINES - +Static variable in interface processing.core.PConstants +
  +
lineToY(int) - +Method in class processing.app.syntax.JEditTextArea +
Converts a line index to a y co-ordinate. +
link(String) - +Method in class processing.core.PApplet +
  +
link(String, String) - +Method in class processing.core.PApplet +
Link to an external page without all the muss. +
linkAndCopyToken(CommonHiddenStreamToken, CommonHiddenStreamToken) - +Method in class antlr.TokenStreamCopyingHiddenTokenFilter +
  +
LINUX - +Static variable in interface processing.core.PConstants +
  +
list() - +Static method in class processing.core.PFont +
Get a list of the fonts installed on the system that can be used + by Java. +
list() - +Static method in class processing.serial.Serial +
If this just hangs and never completes on Windows, + it may be because the DLL doesn't have its exec bit set. +
list() - +Static method in class processing.video.Capture +
Get a list of all available captures as a String array. +
listChildren() - +Method in class processing.xml.XMLElement +
Put the names of all children into an array. +
listFiles(String, boolean) - +Static method in class processing.app.Base +
Recursively creates a list of all files within the specified folder, + and returns a list of their relative paths. +
listFiles(File, boolean) - +Static method in class processing.app.Base +
  +
listFonts() - +Method in class processing.pdf.PGraphicsPDF +
List the fonts known to the PDF renderer. +
LITERAL1 - +Static variable in class processing.app.syntax.Token +
Literal 1 token id. +
LITERAL2 - +Static variable in class processing.app.syntax.Token +
Literal 2 token id. +
LITERAL_assert - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_assert - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_assert - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_boolean - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_boolean - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_boolean - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_break - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_break - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_break - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_byte - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_byte - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_byte - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_case - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_case - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_case - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_catch - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_catch - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_catch - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_char - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_char - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_char - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_class - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_class - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_class - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_color - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_color - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_continue - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_continue - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_continue - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_default - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_default - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_default - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_do - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_do - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_do - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_double - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_double - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_double - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_else - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_else - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_else - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_extends - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_extends - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_extends - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_false - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_false - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_false - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_finally - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_finally - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_finally - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_float - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_float - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_float - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_for - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_for - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_for - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_if - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_if - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_if - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_implements - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_implements - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_implements - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_import - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_import - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_import - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_instanceof - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_instanceof - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_instanceof - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_int - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_int - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_int - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_interface - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_interface - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_interface - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_long - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_long - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_long - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_native - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_native - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_native - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_new - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_new - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_new - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_null - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_null - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_null - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_package - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_package - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_package - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_private - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_private - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_private - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_protected - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_protected - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_protected - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_public - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_public - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_public - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_return - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_return - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_return - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_short - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_short - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_short - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_static - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_static - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_static - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_super - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_super - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_super - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_switch - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_switch - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_switch - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_synchronized - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_synchronized - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_synchronized - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_this - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_this - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_this - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_threadsafe - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_threadsafe - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_threadsafe - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_throw - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_throw - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_throw - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_throws - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_throws - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_throws - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_transient - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_transient - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_transient - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_true - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_true - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_true - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_try - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_try - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_try - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_void - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_void - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_void - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_volatile - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_volatile - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_volatile - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LITERAL_while - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LITERAL_while - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LITERAL_while - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LNOT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LNOT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LNOT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
load() - +Method in class processing.app.SketchCode +
Load this piece of code from a file. +
loadBytes(String) - +Method in class processing.core.PApplet +
  +
loadBytes(InputStream) - +Static method in class processing.core.PApplet +
  +
loadBytes(File) - +Static method in class processing.core.PApplet +
  +
loadBytesRaw(File) - +Static method in class processing.app.Base +
Same as PApplet.loadBytes(), however never does gzip decoding. +
loadFile(File) - +Static method in class processing.app.Base +
Grab the contents of a file as a string. +
loadFont(String) - +Method in class processing.core.PApplet +
  +
loadFonts() - +Static method in class processing.core.PFont +
  +
loadImage(String) - +Method in class processing.core.PApplet +
Load an image from the data folder or a local directory. +
loadImage(String, String) - +Method in class processing.core.PApplet +
Identical to loadImage, but allows you to specify the type of + image by its extension. +
loadPixels() - +Method in class processing.core.PApplet +
Override the g.pixels[] function to set the pixels[] array + that's part of the PApplet object. +
loadPixels() - +Method in class processing.core.PGraphicsJava2D +
  +
loadPixels() - +Method in class processing.core.PImage +
Call this when you want to mess with the pixels[] array. +
loadPixels() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
loadPixels() - +Method in class processing.pdf.PGraphicsPDF +
  +
loadShape(String) - +Method in class processing.core.PApplet +
Load a geometry from a file as a PShape. +
loadStrings(File) - +Static method in class processing.core.PApplet +
  +
loadStrings(String) - +Method in class processing.core.PApplet +
Load data from a file and shove it into a String array. +
loadStrings(InputStream) - +Static method in class processing.core.PApplet +
  +
log(float) - +Static method in class processing.core.PApplet +
  +
logicalAndExpression() - +Method in class antlr.java.JavaRecognizer +
  +
logicalAndExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
logicalOrExpression() - +Method in class antlr.java.JavaRecognizer +
  +
logicalOrExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
lookup(Segment, int, int) - +Method in class processing.app.syntax.KeywordMap +
Looks up a key. +
lookup(String) - +Method in class processing.app.tools.AutoFormat +
  +
lookup_com(String) - +Method in class processing.app.tools.AutoFormat +
  +
LookupAccountName(String, String, byte[], IntByReference, char[], IntByReference, PointerByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
LookupAccountSid(String, byte[], char[], IntByReference, char[], IntByReference, PointerByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
loop() - +Method in class processing.core.PApplet +
  +
loop() - +Method in class processing.video.Movie +
Begin playing the movie, with repeat. +
LOR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LOR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LOR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
LOSSLESS - +Static variable in class processing.video.MovieMaker +
  +
LOW - +Static variable in class processing.video.MovieMaker +
  +
LPAREN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LPAREN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LPAREN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
lpDescription - +Variable in class processing.app.windows.Advapi32.SERVICE_DESCRIPTION +
  +
lpSecurityDescriptor - +Variable in class processing.app.windows.WINBASE.SECURITY_ATTRIBUTES +
  +
lpServiceName - +Variable in class processing.app.windows.Advapi32.SERVICE_TABLE_ENTRY +
  +
lpServiceProc - +Variable in class processing.app.windows.Advapi32.SERVICE_TABLE_ENTRY +
  +
LT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
LT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
LT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
+
+

+M

+
+
m00 - +Variable in class processing.core.PMatrix2D +
  +
m00 - +Variable in class processing.core.PMatrix3D +
  +
m01 - +Variable in class processing.core.PMatrix2D +
  +
m01 - +Variable in class processing.core.PMatrix3D +
  +
m02 - +Variable in class processing.core.PMatrix2D +
  +
m02 - +Variable in class processing.core.PMatrix3D +
  +
m03 - +Variable in class processing.core.PMatrix3D +
  +
m10 - +Variable in class processing.core.PMatrix2D +
  +
m10 - +Variable in class processing.core.PMatrix3D +
  +
m11 - +Variable in class processing.core.PMatrix2D +
  +
m11 - +Variable in class processing.core.PMatrix3D +
  +
m12 - +Variable in class processing.core.PMatrix2D +
  +
m12 - +Variable in class processing.core.PMatrix3D +
  +
m13 - +Variable in class processing.core.PMatrix3D +
  +
m20 - +Variable in class processing.core.PMatrix3D +
  +
m21 - +Variable in class processing.core.PMatrix3D +
  +
m22 - +Variable in class processing.core.PMatrix3D +
  +
m23 - +Variable in class processing.core.PMatrix3D +
  +
m30 - +Variable in class processing.core.PMatrix3D +
  +
m31 - +Variable in class processing.core.PMatrix3D +
  +
m32 - +Variable in class processing.core.PMatrix3D +
  +
m33 - +Variable in class processing.core.PMatrix3D +
  +
m_drawFlags - +Variable in class processing.core.PLine +
  +
m_drawFlags - +Variable in class processing.core.PTriangle +
  +
MACOSX - +Static variable in interface processing.core.PConstants +
  +
mag(float, float) - +Static method in class processing.core.PApplet +
  +
mag(float, float, float) - +Static method in class processing.core.PApplet +
  +
mag() - +Method in class processing.core.PVector +
Calculate the magnitude (length) of the vector +
main(String[]) - +Static method in class processing.app.Base +
  +
main(String[]) - +Static method in class processing.app.Commander +
  +
main(String[]) - +Static method in class processing.app.windows.Registry +
Testing. +
main(String[]) - +Static method in class processing.core.PApplet +
main() method for running this class from the command line. +
map(float, float, float, float, float) - +Static method in class processing.core.PApplet +
Convenience function to map a variable from one coordinate space + to another. +
markTokens(Segment, int) - +Method in class processing.app.syntax.TokenMarker +
A wrapper for the lower-level markTokensImpl method + that is called to split a line up into tokens. +
markTokensImpl(byte, Segment, int) - +Method in class processing.app.syntax.CTokenMarker +
  +
mask(int[]) - +Method in class processing.core.PApplet +
  +
mask(PImage) - +Method in class processing.core.PApplet +
  +
mask(int[]) - +Method in class processing.core.PGraphicsJava2D +
  +
mask(PImage) - +Method in class processing.core.PGraphicsJava2D +
  +
mask(int[]) - +Method in class processing.core.PImage +
Set alpha channel for an image. +
mask(PImage) - +Method in class processing.core.PImage +
Set alpha channel for an image using another image as the source. +
mask(int[]) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
mask(PImage) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
mask(int[]) - +Method in class processing.pdf.PGraphicsPDF +
  +
mask(PImage) - +Method in class processing.pdf.PGraphicsPDF +
  +
mASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
match(String, String) - +Static method in class processing.core.PApplet +
Match a string with a regular expression, and returns the match as an + array. +
matchAll(String, String) - +Static method in class processing.core.PApplet +
Identical to match(), except that it returns an array of all matches in + the specified String, rather than just the first. +
max(int, int) - +Static method in class processing.core.PApplet +
  +
max(float, float) - +Static method in class processing.core.PApplet +
  +
max(int, int, int) - +Static method in class processing.core.PApplet +
  +
max(float, float, float) - +Static method in class processing.core.PApplet +
  +
max(int[]) - +Static method in class processing.core.PApplet +
Find the maximum value in an array. +
max(float[]) - +Static method in class processing.core.PApplet +
Find the maximum value in an array. +
MAX_FLOAT - +Static variable in interface processing.core.PConstants +
Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + and to avoid teaching static methods on the first day. +
MAX_INT - +Static variable in interface processing.core.PConstants +
Largest possible (positive) integer value +
MAX_LIGHTS - +Static variable in class processing.core.PGraphics3D +
Maximum lights by default is 8, which is arbitrary for this renderer, + but is the minimum defined by OpenGL +
mBAND(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBAND(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBAND_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBAND_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBNOT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBNOT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBOR(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBOR(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBOR_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBOR_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mbox2 - +Variable in class processing.core.PFont +
next power of 2 over the max image size (usually 64) +
mBSR(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBSR(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBSR_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBSR_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBXOR(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBXOR(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mBXOR_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mBXOR_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mCHAR_LITERAL(boolean) - +Method in class antlr.java.JavaLexer +
  +
mCHAR_LITERAL(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mCOLON(boolean) - +Method in class antlr.java.JavaLexer +
  +
mCOLON(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mCOMMA(boolean) - +Method in class antlr.java.JavaLexer +
  +
mCOMMA(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mDEC(boolean) - +Method in class antlr.java.JavaLexer +
  +
mDEC(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mDIV(boolean) - +Method in class antlr.java.JavaLexer +
  +
mDIV(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mDIV_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mDIV_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
MEDIUM - +Static variable in class processing.video.MovieMaker +
  +
MENU_SHORTCUT - +Static variable in class processing.core.PApplet +
Modifier flags for the shortcut key used to trigger menus. +
mEQUAL(boolean) - +Method in class antlr.java.JavaLexer +
  +
mEQUAL(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
message(String) - +Method in interface processing.app.debug.MessageConsumer +
  +
message(String) - +Method in class processing.app.debug.Runner +
  +
message(String, boolean, boolean) - +Method in class processing.app.EditorConsole +
  +
message(String) - +Method in class processing.app.EditorToolbar +
Clear all the state of all buttons. +
messageClear(String) - +Method in class processing.app.EditorToolbar +
  +
MessageConsumer - Interface in processing.app.debug
Interface for dealing with parser/compiler output.
METHOD_CALL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
METHOD_CALL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
METHOD_CALL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
METHOD_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
METHOD_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
METHOD_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
mGE(boolean) - +Method in class antlr.java.JavaLexer +
  +
mGE(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mGT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mGT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mIDENT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mIDENT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
millis() - +Method in class processing.core.PApplet +
Get the number of milliseconds since the applet started. +
min(int, int) - +Static method in class processing.core.PApplet +
  +
min(float, float) - +Static method in class processing.core.PApplet +
  +
min(int, int, int) - +Static method in class processing.core.PApplet +
  +
min(float, float, float) - +Static method in class processing.core.PApplet +
  +
min(int[]) - +Static method in class processing.core.PApplet +
Find the minimum value in an array. +
min(float[]) - +Static method in class processing.core.PApplet +
Find the minimum value in an array. +
MIN_FLOAT - +Static variable in interface processing.core.PConstants +
Note that Float.MIN_VALUE is the smallest positive value + for a floating point number, not actually the minimum (negative) value + for a float. +
MIN_INT - +Static variable in interface processing.core.PConstants +
Smallest possible (negative) integer value +
MIN_WINDOW_HEIGHT - +Static variable in class processing.core.PApplet +
  +
MIN_WINDOW_WIDTH - +Static variable in class processing.core.PApplet +
Minimum dimensions for the window holding an applet. +
mINC(boolean) - +Method in class antlr.java.JavaLexer +
  +
mINC(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
MINUS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
MINUS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
MINUS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
MINUS_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
MINUS_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
MINUS_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
minute() - +Static method in class processing.core.PApplet +
Minutes position of the current time. +
MISC_ERROR - +Static variable in exception processing.xml.XMLValidationException +
Another error than those specified in this class was encountered. +
MISSING_ATTRIBUTE - +Static variable in exception processing.xml.XMLValidationException +
An attribute was missing. +
MISSING_ELEMENT - +Static variable in exception processing.xml.XMLValidationException +
An element was missing. +
MISSING_PCDATA - +Static variable in exception processing.xml.XMLValidationException +
A PCDATA element was missing. +
MITER - +Static variable in interface processing.core.PConstants +
  +
ML_COMMENT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
ML_COMMENT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
ML_COMMENT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
mLAND(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLAND(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLBRACK(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLBRACK(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLCURLY(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLCURLY(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLE(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLE(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLNOT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLNOT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLOR(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLOR(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLPAREN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLPAREN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mLT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mLT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mMINUS(boolean) - +Method in class antlr.java.JavaLexer +
  +
mMINUS(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mMINUS_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mMINUS_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mML_COMMENT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mML_COMMENT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mMOD(boolean) - +Method in class antlr.java.JavaLexer +
  +
mMOD(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mMOD_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mMOD_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mNOT_EQUAL(boolean) - +Method in class antlr.java.JavaLexer +
  +
mNOT_EQUAL(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mNUM_INT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mNUM_INT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
MOD - +Static variable in interface antlr.java.JavaTokenTypes +
  +
MOD - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
MOD - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
MOD_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
MOD_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
MOD_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
MODEL - +Static variable in interface processing.core.PConstants +
textMode(MODEL) is the default, meaning that characters + will be affected by transformations like any other shapes. +
modelview - +Variable in class processing.core.PGraphics3D +
The modelview matrix. +
modelviewInv - +Variable in class processing.core.PGraphics3D +
Inverse modelview matrix, used for lighting. +
modelX(float, float, float) - +Method in class processing.core.PApplet +
  +
modelX(float, float, float) - +Method in class processing.core.PGraphics +
Returns the model space x value for an x, y, z coordinate. +
modelX(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
modelY(float, float, float) - +Method in class processing.core.PApplet +
  +
modelY(float, float, float) - +Method in class processing.core.PGraphics +
Returns the model space y value for an x, y, z coordinate. +
modelY(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
modelZ(float, float, float) - +Method in class processing.core.PApplet +
  +
modelZ(float, float, float) - +Method in class processing.core.PGraphics +
Returns the model space z value for an x, y, z coordinate. +
modelZ(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
modifier() - +Method in class antlr.java.JavaRecognizer +
  +
modifier() - +Method in class processing.app.preproc.PdeRecognizer +
  +
modifiers() - +Method in class antlr.java.JavaRecognizer +
  +
MODIFIERS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
MODIFIERS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
modifiers() - +Method in class processing.app.preproc.PdeRecognizer +
  +
MODIFIERS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
month() - +Static method in class processing.core.PApplet +
Get the current month in range 1 through 12. +
MOTION_JPEG_A - +Static variable in class processing.video.MovieMaker +
  +
MOTION_JPEG_B - +Static variable in class processing.video.MovieMaker +
  +
mouseButton - +Variable in class processing.core.PApplet +
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. +
mouseClicked(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mouseClicked(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseClicked() - +Method in class processing.core.PApplet +
When the mouse is clicked, mousePressed() will be called, + then mouseReleased(), then mouseClicked(). +
mouseDragged(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mouseDragged() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
mouseDragged() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
mouseDragged(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseDragged() - +Method in class processing.core.PApplet +
Mouse button is pressed and the mouse has been dragged. +
mouseEntered(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mouseEntered(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseEvent - +Variable in class processing.core.PApplet +
  +
mouseExited(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mouseExited(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseMoved(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mouseMoved(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseMoved() - +Method in class processing.core.PApplet +
Mouse button is not pressed but the mouse has changed locations. +
mousePressed(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mousePressed() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
mousePressed() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
mousePressed - +Variable in class processing.core.PApplet +
  +
mousePressed(MouseEvent) - +Method in class processing.core.PApplet +
If you override this or any function that takes a "MouseEvent e" + without calling its super.mouseXxxx() then mouseX, mouseY, + mousePressed, and mouseEvent will no longer be set. +
mousePressed() - +Method in class processing.core.PApplet +
Mouse has been pressed, and should be considered "down" + until mouseReleased() is called. +
mouseReleased(MouseEvent) - +Method in class processing.app.EditorToolbar +
  +
mouseReleased(MouseEvent) - +Method in class processing.core.PApplet +
  +
mouseReleased() - +Method in class processing.core.PApplet +
Mouse button has been released. +
mouseX - +Variable in class processing.core.PApplet +
current x position of the mouse +
mouseY - +Variable in class processing.core.PApplet +
current y position of the mouse +
MOVE - +Static variable in interface processing.core.PConstants +
  +
Movie - Class in processing.video
 
Movie(PApplet, String) - +Constructor for class processing.video.Movie +
  +
Movie(PApplet, String, int) - +Constructor for class processing.video.Movie +
  +
movie - +Variable in class processing.video.Movie +
The QuickTime for Java "Movie" object, made public + in case anyone wants to play with it. +
MovieMaker - Class in processing.video
Library to create a QuickTime movie from a Processing pixel array.
MovieMaker(PApplet, int, int, String) - +Constructor for class processing.video.MovieMaker +
Create a movie with the specified width, height, and filename. +
MovieMaker(PApplet, int, int, String, int) - +Constructor for class processing.video.MovieMaker +
Create a movie with the specified width, height, filename, and frame rate. +
MovieMaker(PApplet, int, int, String, int, int, int) - +Constructor for class processing.video.MovieMaker +
Create a movie with the specified width, height, filename, frame rate, + and codec type and quality. +
MovieMaker(PApplet, int, int, String, int, int, int, int) - +Constructor for class processing.video.MovieMaker +
Create a movie with the specified width, height, filename, frame rate, + codec type and quality, and key frame rate. +
mPLUS(boolean) - +Method in class antlr.java.JavaLexer +
  +
mPLUS(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mPLUS_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mPLUS_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mQUESTION(boolean) - +Method in class antlr.java.JavaLexer +
  +
mQUESTION(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mRBRACK(boolean) - +Method in class antlr.java.JavaLexer +
  +
mRBRACK(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mRCURLY(boolean) - +Method in class antlr.java.JavaLexer +
  +
mRCURLY(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mRPAREN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mRPAREN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
MS_VIDEO - +Static variable in class processing.video.MovieMaker +
  +
mSEMI(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSEMI(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSL(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSL(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSL_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSL_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSL_COMMENT(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSL_COMMENT(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSR(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSR(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSR_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSR_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSTAR(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSTAR(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSTAR_ASSIGN(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSTAR_ASSIGN(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mSTRING_LITERAL(boolean) - +Method in class antlr.java.JavaLexer +
  +
mSTRING_LITERAL(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mult(PVector, PVector) - +Method in interface processing.core.PMatrix +
Multiply a PVector by this matrix. +
mult(float[], float[]) - +Method in interface processing.core.PMatrix +
Multiply a multi-element vector against this matrix. +
mult(PVector, PVector) - +Method in class processing.core.PMatrix2D +
Multiply the x and y coordinates of a PVector against this matrix. +
mult(float[], float[]) - +Method in class processing.core.PMatrix2D +
Multiply a two element vector against this matrix. +
mult(PVector, PVector) - +Method in class processing.core.PMatrix3D +
  +
mult(float[], float[]) - +Method in class processing.core.PMatrix3D +
Multiply a three or four element vector against this matrix. +
mult(float) - +Method in class processing.core.PVector +
Multiply this vector by a scalar +
mult(PVector, float) - +Static method in class processing.core.PVector +
Multiply a vector by a scalar +
mult(PVector, float, PVector) - +Static method in class processing.core.PVector +
Multiply a vector by a scalar, and write the result into a target PVector. +
mult(PVector) - +Method in class processing.core.PVector +
Multiply each element of one vector by the elements of another vector. +
mult(PVector, PVector) - +Static method in class processing.core.PVector +
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +
mult(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
Multiply each element of one vector by the individual elements of another + vector, and write the result into a target vector. +
multiplicativeExpression() - +Method in class antlr.java.JavaRecognizer +
  +
multiplicativeExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
MULTIPLY - +Static variable in interface processing.core.PConstants +
  +
multW(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multW(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multX(float, float) - +Method in class processing.core.PMatrix2D +
  +
multX(float, float) - +Method in class processing.core.PMatrix3D +
  +
multX(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multX(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multY(float, float) - +Method in class processing.core.PMatrix2D +
  +
multY(float, float) - +Method in class processing.core.PMatrix3D +
  +
multY(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multY(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multZ(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
multZ(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
mWEBCOLOR_LITERAL(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
mWS(boolean) - +Method in class antlr.java.JavaLexer +
  +
mWS(boolean) - +Method in class processing.app.preproc.PdeLexer +
  +
+
+

+N

+
+
name - +Variable in class processing.core.PFont +
Name of the font as seen by Java when it was created. +
newArrayDeclarator() - +Method in class antlr.java.JavaRecognizer +
  +
newArrayDeclarator() - +Method in class processing.app.preproc.PdeRecognizer +
  +
newExpression() - +Method in class antlr.java.JavaRecognizer +
object instantiation. +
newExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
newJMenuItem(String, int) - +Static method in class processing.app.Editor +
A software engineer, somewhere, needs to have his abstraction + taken away. +
newJMenuItemAlt(String, int) - +Static method in class processing.app.Editor +
Same as newJMenuItem(), but adds the ALT (on Linux and Windows) + or OPTION (on Mac OS X) key as a modifier. +
newJMenuItemShift(String, int) - +Static method in class processing.app.Editor +
Like newJMenuItem() but adds shift as a modifier for the key command. +
newProcessingInstruction(String, Reader) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a processing instruction is encountered. +
next - +Variable in class processing.app.syntax.Token +
The next token in the linked list. +
NEXT_CHAR - +Static variable in class processing.app.syntax.InputHandler +
  +
NEXT_LINE - +Static variable in class processing.app.syntax.InputHandler +
  +
NEXT_PAGE - +Static variable in class processing.app.syntax.InputHandler +
  +
NEXT_WORD - +Static variable in class processing.app.syntax.InputHandler +
  +
nextPage() - +Method in class processing.pdf.PGraphicsPDF +
Call to explicitly go to the next page from within a single draw(). +
nextTabStop(float, int) - +Method in class processing.app.syntax.TextAreaPainter +
Implementation of TabExpander interface. +
nextToken() - +Method in class antlr.java.JavaLexer +
  +
nextToken() - +Method in class antlr.TokenStreamCopyingHiddenTokenFilter +
Return the next monitored token. +
nextToken() - +Method in class processing.app.preproc.PdeLexer +
  +
nextVertex() - +Method in class processing.core.PSmoothTriangle +
  +
nf(int[], int) - +Static method in class processing.core.PApplet +
  +
nf(int, int) - +Static method in class processing.core.PApplet +
  +
nf(float[], int, int) - +Static method in class processing.core.PApplet +
  +
nf(float, int, int) - +Static method in class processing.core.PApplet +
  +
nfc(int[]) - +Static method in class processing.core.PApplet +
  +
nfc(int) - +Static method in class processing.core.PApplet +
  +
nfc(float[], int) - +Static method in class processing.core.PApplet +
  +
nfc(float, int) - +Static method in class processing.core.PApplet +
  +
nfp(int, int) - +Static method in class processing.core.PApplet +
number format positive (or plus) + Formats a number, always placing a - or + sign + in the front when it's negative or positive. +
nfp(int[], int) - +Static method in class processing.core.PApplet +
  +
nfp(float[], int, int) - +Static method in class processing.core.PApplet +
  +
nfp(float, int, int) - +Static method in class processing.core.PApplet +
  +
nfs(int, int) - +Static method in class processing.core.PApplet +
number format signed (or space) + Formats a number but leaves a blank space in the front + when it's positive so that it can be properly aligned with + numbers that have a negative sign in front of them. +
nfs(int[], int) - +Static method in class processing.core.PApplet +
  +
nfs(float[], int, int) - +Static method in class processing.core.PApplet +
Number formatter that takes into account whether the number + has a sign (positive, negative, etc) in front of it. +
nfs(float, int, int) - +Static method in class processing.core.PApplet +
  +
nLength - +Variable in class processing.app.windows.WINBASE.SECURITY_ATTRIBUTES +
  +
NO_ERROR - +Static variable in interface processing.app.windows.WINERROR +
  +
NO_LINE - +Static variable in class processing.xml.XMLElement +
No line number defined. +
noCrop() - +Method in class processing.video.Capture +
Remove the cropping (if any) of the image. +
noCursor() - +Method in class processing.core.PApplet +
Hide the cursor by creating a transparent image + and using it as a custom cursor. +
noFill() - +Method in class processing.core.PApplet +
  +
noFill() - +Method in class processing.core.PGraphics +
  +
noise(float) - +Method in class processing.core.PApplet +
Computes the Perlin noise function value at point x. +
noise(float, float) - +Method in class processing.core.PApplet +
Computes the Perlin noise function value at the point x, y. +
noise(float, float, float) - +Method in class processing.core.PApplet +
Computes the Perlin noise function value at x, y, z. +
noiseDetail(int) - +Method in class processing.core.PApplet +
  +
noiseDetail(int, float) - +Method in class processing.core.PApplet +
  +
noiseSeed(long) - +Method in class processing.core.PApplet +
  +
noLights() - +Method in class processing.core.PApplet +
  +
noLights() - +Method in class processing.core.PGraphics +
  +
noLights() - +Method in class processing.core.PGraphics3D +
Turn off all lights. +
noLoop() - +Method in class processing.core.PApplet +
  +
noLoop() - +Method in class processing.video.Movie +
Shut off the repeating loop. +
norm(float, float, float) - +Static method in class processing.core.PApplet +
Normalize a value to exist between 0 and 1 (inclusive). +
normal(float, float, float) - +Method in class processing.core.PApplet +
  +
NORMAL - +Static variable in interface processing.core.PConstants +
texture coordinates in 0..1 range +
normal(float, float, float) - +Method in class processing.core.PGraphics +
Sets the current normal vector. +
normalize() - +Method in class processing.core.PVector +
Normalize the vector to length 1 (make it a unit vector) +
normalize(PVector) - +Method in class processing.core.PVector +
Normalize this vector, storing the result in another vector. +
NORMALIZED - +Static variable in interface processing.core.PConstants +
Deprecated. use NORMAL instead +
normalX - +Variable in class processing.core.PGraphics +
Current normal vector. +
normalY - +Variable in class processing.core.PGraphics +
Current normal vector. +
normalZ - +Variable in class processing.core.PGraphics +
Current normal vector. +
noSmooth() - +Method in class processing.core.PApplet +
  +
noSmooth() - +Method in class processing.core.PGraphics +
Disable smoothing. +
noSmooth() - +Method in class processing.core.PGraphics3D +
  +
noSmooth() - +Method in class processing.core.PGraphicsJava2D +
  +
noSmooth() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
noStroke() - +Method in class processing.core.PApplet +
  +
noStroke() - +Method in class processing.core.PGraphics +
  +
NOT_EQUAL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
NOT_EQUAL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
NOT_EQUAL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
notice(String) - +Method in class processing.app.EditorStatus +
  +
noTint() - +Method in class processing.core.PApplet +
  +
noTint() - +Method in class processing.core.PGraphics +
  +
NTSC - +Static variable in class processing.video.Capture +
  +
NULL - +Static variable in class processing.app.syntax.Token +
Normal text token id. +
NULL_TREE_LOOKAHEAD - +Static variable in interface antlr.java.JavaTokenTypes +
  +
NULL_TREE_LOOKAHEAD - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
NULL_TREE_LOOKAHEAD - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
NUM_DOUBLE - +Static variable in interface antlr.java.JavaTokenTypes +
  +
NUM_DOUBLE - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
NUM_DOUBLE - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
NUM_FLOAT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
NUM_FLOAT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
NUM_FLOAT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
NUM_INT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
NUM_INT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
NUM_INT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
NUM_LONG - +Static variable in interface antlr.java.JavaTokenTypes +
  +
NUM_LONG - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
NUM_LONG - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
NX - +Static variable in interface processing.core.PConstants +
  +
NY - +Static variable in interface processing.core.PConstants +
  +
NZ - +Static variable in interface processing.core.PConstants +
  +
+
+

+O

+
+
obj - +Variable in class processing.app.syntax.TokenMarker.LineInfo +
This is for use by the token marker implementations + themselves. +
OBJBLOCK - +Static variable in interface antlr.java.JavaTokenTypes +
  +
OBJBLOCK - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
OBJBLOCK - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
offsetToX(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Converts an offset in a line into an x co-ordinate. +
online - +Variable in class processing.core.PApplet +
true if the applet is online. +
OPAQUE - +Static variable in interface processing.core.PConstants +
  +
open(String) - +Static method in class processing.core.PApplet +
Attempt to open a file using the platform's shell. +
open(String[]) - +Static method in class processing.core.PApplet +
Launch a process using a platforms shell. +
OPEN - +Static variable in interface processing.core.PConstants +
  +
openFolder(File) - +Static method in class processing.app.Base +
Implements the other cross-platform headache of opening + a folder in the machine's native file browser. +
openFolder(File) - +Method in class processing.app.linux.Platform +
  +
openFolder(File) - +Method in class processing.app.macosx.Platform +
  +
openFolder(File) - +Method in class processing.app.Platform +
  +
openFolder(File) - +Method in class processing.app.windows.Platform +
  +
openFolderAvailable() - +Method in class processing.app.linux.Platform +
  +
openFolderAvailable() - +Method in class processing.app.macosx.Platform +
  +
openFolderAvailable() - +Method in class processing.app.Platform +
  +
openFolderAvailable() - +Method in class processing.app.windows.Platform +
  +
OPENGL - +Static variable in interface processing.core.PConstants +
  +
OpenSCManager(String, WString, int) - +Method in interface processing.app.windows.Advapi32 +
  +
OpenService(Pointer, String, int) - +Method in interface processing.app.windows.Advapi32 +
  +
openStream(String) - +Method in class processing.core.PApplet +
Deprecated. As of release 0136, use createInput() instead. +
openStream(String, String) - +Method in class processing.xml.StdXMLReader +
Opens a stream from a public and system ID. +
openURL(String) - +Static method in class processing.app.Base +
Implements the cross-platform headache of opening URLs + TODO This code should be replaced by PApplet.link(), + however that's not a static method (because it requires + an AppletContext when used as an applet), so it's mildly + trickier than just removing this method. +
openURL(String) - +Method in class processing.app.linux.Platform +
  +
openURL(String) - +Method in class processing.app.macosx.Platform +
  +
openURL(String) - +Method in class processing.app.Platform +
  +
openURL(String) - +Method in class processing.app.windows.Platform +
  +
OPERATOR - +Static variable in class processing.app.syntax.Token +
Operator token id. +
Options - Interface in processing.app.windows
 
ortho() - +Method in class processing.core.PApplet +
  +
ortho(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
ortho() - +Method in class processing.core.PGraphics +
  +
ortho(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
ortho() - +Method in class processing.core.PGraphics3D +
Calls ortho() with the proper parameters for Processing's + standard orthographic projection. +
ortho(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
Similar to gluOrtho(), but wipes out the current projection matrix. +
ORTHOGRAPHIC - +Static variable in interface processing.core.PConstants +
  +
OTHER - +Static variable in interface processing.core.PConstants +
  +
output - +Variable in class processing.net.Client +
  +
output - +Variable in class processing.serial.Serial +
  +
OVERLAY - +Static variable in interface processing.core.PConstants +
  +
OVERWRITE - +Static variable in class processing.app.syntax.InputHandler +
  +
overwriteSetSelectedText(String) - +Method in class processing.app.syntax.JEditTextArea +
Similar to setSelectedText(), but overstrikes the + appropriate number of characters if overwrite mode is enabled. +
+
+

+P

+
+
P2D - +Static variable in interface processing.core.PConstants +
  +
P3D - +Static variable in interface processing.core.PConstants +
  +
p_tabs() - +Method in class processing.app.tools.AutoFormat +
  +
PACKAGE_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
PACKAGE_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
PACKAGE_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
packageDefinition() - +Method in class antlr.java.JavaRecognizer +
  +
packageDefinition() - +Method in class processing.app.preproc.PdeRecognizer +
  +
packageListFromClassPath(String) - +Static method in class processing.app.debug.Compiler +
A classpath, separated by the path separator, will contain + a series of .jar/.zip files or directories containing .class + files, or containing subdirectories that have .class files. +
paint(Graphics) - +Method in class processing.app.syntax.TextAreaPainter +
Repaints the text. +
paint(Graphics) - +Method in class processing.core.PApplet +
  +
paintComponent(Graphics) - +Method in class processing.app.EditorHeader +
  +
paintComponent(Graphics) - +Method in class processing.app.EditorLineStatus +
  +
paintComponent(Graphics) - +Method in class processing.app.EditorStatus +
  +
paintComponent(Graphics) - +Method in class processing.app.EditorToolbar +
  +
paintHighlight(Graphics, int, int) - +Method in interface processing.app.syntax.TextAreaPainter.Highlight +
This should paint the highlight and delgate to the + next highlight painter. +
paintInvalid - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
paintSyntaxLine(Segment, Token, SyntaxStyle[], TabExpander, Graphics, int, int) - +Static method in class processing.app.syntax.SyntaxUtilities +
Paints the specified line onto the graphics context. +
PAL - +Static variable in class processing.video.Capture +
  +
PApplet - Class in processing.core
Base class for all sketches that use processing.core.
PApplet() - +Constructor for class processing.core.PApplet +
  +
PApplet.RegisteredMethods - Class in processing.core
This returns the last width and height specified by the user + via the size() command.
PApplet.RegisteredMethods() - +Constructor for class processing.core.PApplet.RegisteredMethods +
  +
PApplet.RendererChangeException - Exception in processing.core
Exception thrown when size() is called the first time.
PApplet.RendererChangeException() - +Constructor for exception processing.core.PApplet.RendererChangeException +
  +
param(String) - +Method in class processing.core.PApplet +
Get a param from the web page, or (eventually) + from a properties file. +
PARAMETER_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
PARAMETER_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
PARAMETER_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
parameterDeclaration() - +Method in class antlr.java.JavaRecognizer +
  +
parameterDeclaration() - +Method in class processing.app.preproc.PdeRecognizer +
  +
parameterDeclarationList() - +Method in class antlr.java.JavaRecognizer +
  +
parameterDeclarationList() - +Method in class processing.app.preproc.PdeRecognizer +
  +
parameterModifier() - +Method in class antlr.java.JavaRecognizer +
  +
parameterModifier() - +Method in class processing.app.preproc.PdeRecognizer +
  +
PARAMETERS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
PARAMETERS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
PARAMETERS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
parent - +Variable in class processing.core.PImage +
Path to parent object that will be used with save(). +
parity - +Variable in class processing.serial.Serial +
  +
parse() - +Method in class processing.xml.StdXMLParser +
Parses the data and lets the builder create the logical data structure. +
parseBoolean(int) - +Static method in class processing.core.PApplet +
Convert an integer to a boolean. +
parseBoolean(String) - +Static method in class processing.core.PApplet +
Convert the string "true" or "false" to a boolean. +
parseBoolean(byte[]) - +Static method in class processing.core.PApplet +
Convert a byte array to a boolean array. +
parseBoolean(int[]) - +Static method in class processing.core.PApplet +
Convert an int array to a boolean array. +
parseBoolean(String[]) - +Static method in class processing.core.PApplet +
  +
parseByte(boolean) - +Static method in class processing.core.PApplet +
  +
parseByte(char) - +Static method in class processing.core.PApplet +
  +
parseByte(int) - +Static method in class processing.core.PApplet +
  +
parseByte(float) - +Static method in class processing.core.PApplet +
  +
parseByte(boolean[]) - +Static method in class processing.core.PApplet +
  +
parseByte(char[]) - +Static method in class processing.core.PApplet +
  +
parseByte(int[]) - +Static method in class processing.core.PApplet +
  +
parseByte(float[]) - +Static method in class processing.core.PApplet +
  +
parseByte(byte[]) - +Static method in class processing.core.PApplet +
  +
parseChar(byte) - +Static method in class processing.core.PApplet +
  +
parseChar(int) - +Static method in class processing.core.PApplet +
  +
parseChar(byte[]) - +Static method in class processing.core.PApplet +
  +
parseChar(int[]) - +Static method in class processing.core.PApplet +
  +
parseDTD(String, StdXMLReader, XMLEntityResolver, boolean) - +Method in class processing.xml.XMLValidator +
Parses the DTD. +
parseFloat(int) - +Static method in class processing.core.PApplet +
Convert an int to a float value. +
parseFloat(String) - +Static method in class processing.core.PApplet +
  +
parseFloat(String, float) - +Static method in class processing.core.PApplet +
  +
parseFloat(int[]) - +Static method in class processing.core.PApplet +
  +
parseFloat(String[]) - +Static method in class processing.core.PApplet +
  +
parseFloat(String[], float) - +Static method in class processing.core.PApplet +
  +
parseInt(boolean) - +Static method in class processing.core.PApplet +
  +
parseInt(byte) - +Static method in class processing.core.PApplet +
Note that parseInt() will un-sign a signed byte value. +
parseInt(char) - +Static method in class processing.core.PApplet +
Note that parseInt('5') is unlike String in the sense that it + won't return 5, but the ascii value. +
parseInt(float) - +Static method in class processing.core.PApplet +
Same as floor(), or an (int) cast. +
parseInt(String) - +Static method in class processing.core.PApplet +
Parse a String into an int value. +
parseInt(String, int) - +Static method in class processing.core.PApplet +
Parse a String to an int, and provide an alternate value that + should be used when the number is invalid. +
parseInt(boolean[]) - +Static method in class processing.core.PApplet +
  +
parseInt(byte[]) - +Static method in class processing.core.PApplet +
  +
parseInt(char[]) - +Static method in class processing.core.PApplet +
  +
parseInt(float[]) - +Static method in class processing.core.PApplet +
  +
parseInt(String[]) - +Static method in class processing.core.PApplet +
Make an array of int elements from an array of String objects. +
parseInt(String[], int) - +Static method in class processing.core.PApplet +
Make an array of int elements from an array of String objects. +
parseKeyStroke(String) - +Static method in class processing.app.syntax.DefaultInputHandler +
Converts a string to a keystroke. +
partialCloneToken(CommonHiddenStreamToken) - +Method in class antlr.TokenStreamCopyingHiddenTokenFilter +
Create a clone of the important parts of the given token. +
paste() - +Method in class processing.app.syntax.JEditTextArea +
Inserts the clipboard contents into the text. +
PATH - +Static variable in interface processing.core.PConstants +
  +
PATH - +Static variable in class processing.core.PShape +
A series of vertex, curveVertex, and bezierVertex calls. +
pause() - +Method in class processing.video.Movie +
Pause the movie at its current time. +
PCDataAdded(String, int) - +Method in class processing.xml.XMLValidator +
Indicates that a new #PCDATA element has been encountered. +
PConstants - Interface in processing.core
Numbers shared throughout processing.core.
PdeEmitter - Class in processing.app.preproc
PDEEmitter: A class that can take an ANTLR Java AST and produce + reasonably formatted Java code from it.
PdeEmitter() - +Constructor for class processing.app.preproc.PdeEmitter +
  +
PdeKeywords - Class in processing.app.syntax
 
PdeKeywords() - +Constructor for class processing.app.syntax.PdeKeywords +
  +
PdeLexer - Class in processing.app.preproc
 
PdeLexer(InputStream) - +Constructor for class processing.app.preproc.PdeLexer +
  +
PdeLexer(Reader) - +Constructor for class processing.app.preproc.PdeLexer +
  +
PdeLexer(InputBuffer) - +Constructor for class processing.app.preproc.PdeLexer +
  +
PdeLexer(LexerSharedInputState) - +Constructor for class processing.app.preproc.PdeLexer +
  +
PdePartialTokenTypes - Interface in processing.app.preproc
 
PdePreprocessor - Class in processing.app.preproc
Class that orchestrates preprocessing p5 syntax into straight Java.
PdePreprocessor() - +Constructor for class processing.app.preproc.PdePreprocessor +
Setup a new preprocessor. +
pdeProgram() - +Method in class processing.app.preproc.PdeRecognizer +
  +
PdeRecognizer - Class in processing.app.preproc
 
PdeRecognizer(TokenBuffer) - +Constructor for class processing.app.preproc.PdeRecognizer +
  +
PdeRecognizer(TokenStream) - +Constructor for class processing.app.preproc.PdeRecognizer +
  +
PdeRecognizer(ParserSharedInputState) - +Constructor for class processing.app.preproc.PdeRecognizer +
  +
PdeTextAreaDefaults - Class in processing.app.syntax
 
PdeTextAreaDefaults() - +Constructor for class processing.app.syntax.PdeTextAreaDefaults +
  +
PdeTokenTypes - Interface in processing.app.preproc
 
PDF - +Static variable in interface processing.core.PConstants +
  +
perspective() - +Method in class processing.core.PApplet +
  +
perspective(float, float, float, float) - +Method in class processing.core.PApplet +
  +
PERSPECTIVE - +Static variable in interface processing.core.PConstants +
  +
perspective() - +Method in class processing.core.PGraphics +
  +
perspective(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
perspective() - +Method in class processing.core.PGraphics3D +
Calls perspective() with Processing's standard coordinate projection. +
perspective(float, float, float, float) - +Method in class processing.core.PGraphics3D +
Similar to gluPerspective(). +
PFont - Class in processing.core
Grayscale bitmap font class used by Processing.
PFont() - +Constructor for class processing.core.PFont +
  +
PFont(InputStream) - +Constructor for class processing.core.PFont +
  +
PFont(Font, boolean, char[]) - +Constructor for class processing.core.PFont +
Create a new image-based font on the fly. +
PGraphics - Class in processing.core
Main graphics and rendering context, as well as the base API implementation.
PGraphics() - +Constructor for class processing.core.PGraphics +
Constructor for the PGraphics object. +
PGraphics2D - Class in processing.core
Subclass of PGraphics that handles fast 2D rendering using a + MemoryImageSource.
PGraphics2D() - +Constructor for class processing.core.PGraphics2D +
  +
PGraphics3D - Class in processing.core
Subclass of PGraphics that handles 3D rendering.
PGraphics3D() - +Constructor for class processing.core.PGraphics3D +
  +
PGraphicsJava2D - Class in processing.core
Subclass for PGraphics that implements the graphics API using Java2D.
PGraphicsJava2D() - +Constructor for class processing.core.PGraphicsJava2D +
  +
PGraphicsOpenGL - Class in processing.opengl
Implementation of the PGraphics API that employs OpenGL rendering via JOGL.
PGraphicsOpenGL() - +Constructor for class processing.opengl.PGraphicsOpenGL +
  +
PGraphicsOpenGL.TessCallback - Class in processing.opengl
There must be a better way to do this, but I'm having a brain fart + with all the inner class crap.
PGraphicsOpenGL.TessCallback() - +Constructor for class processing.opengl.PGraphicsOpenGL.TessCallback +
  +
PGraphicsPDF - Class in processing.pdf
 
PGraphicsPDF() - +Constructor for class processing.pdf.PGraphicsPDF +
  +
PI - +Static variable in interface processing.core.PConstants +
  +
PImage - Class in processing.core
Storage class for pixel data.
PImage() - +Constructor for class processing.core.PImage +
Create an empty image object, set its format to RGB. +
PImage(int, int) - +Constructor for class processing.core.PImage +
Create a new RGB (alpha ignored) image of a specific size. +
PImage(int, int, int) - +Constructor for class processing.core.PImage +
  +
PImage(Image) - +Constructor for class processing.core.PImage +
Construct a new PImage from a java.awt.Image. +
pixelCount - +Variable in class processing.core.PGraphics +
  +
pixels - +Variable in class processing.core.PApplet +
Pixel buffer from this applet's PGraphics. +
pixels - +Variable in class processing.core.PImage +
  +
Platform - Class in processing.app.linux
Used by Base for platform-specific tweaking, for instance finding the + sketchbook location using the Windows registry, or OS X event handling.
Platform() - +Constructor for class processing.app.linux.Platform +
  +
Platform - Class in processing.app.macosx
Platform handler for Mac OS X.
Platform() - +Constructor for class processing.app.macosx.Platform +
  +
Platform - Class in processing.app
Used by Base for platform-specific tweaking, for instance finding the + sketchbook location using the Windows registry, or OS X event handling.
Platform() - +Constructor for class processing.app.Platform +
  +
Platform - Class in processing.app.windows
 
Platform() - +Constructor for class processing.app.windows.Platform +
  +
platform - +Static variable in class processing.core.PApplet +
Current platform in use, one of the + PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER. +
platformNames - +Static variable in interface processing.core.PConstants +
  +
play() - +Method in class processing.video.Movie +
Begin playing the movie, with no repeat. +
PLine - Class in processing.core
Code for rendering lines with P2D and P3D.
PLine(PGraphics) - +Constructor for class processing.core.PLine +
  +
PLUS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
PLUS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
PLUS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
PLUS_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
PLUS_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
PLUS_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
PMatrix - Interface in processing.core
 
PMatrix2D - Class in processing.core
3x2 affine matrix implementation.
PMatrix2D() - +Constructor for class processing.core.PMatrix2D +
  +
PMatrix2D(float, float, float, float, float, float) - +Constructor for class processing.core.PMatrix2D +
  +
PMatrix2D(PMatrix) - +Constructor for class processing.core.PMatrix2D +
  +
PMatrix3D - Class in processing.core
4x4 matrix implementation.
PMatrix3D() - +Constructor for class processing.core.PMatrix3D +
  +
PMatrix3D(float, float, float, float, float, float) - +Constructor for class processing.core.PMatrix3D +
  +
PMatrix3D(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Constructor for class processing.core.PMatrix3D +
  +
PMatrix3D(PMatrix) - +Constructor for class processing.core.PMatrix3D +
  +
pmouseX - +Variable in class processing.core.PApplet +
Previous x/y position of the mouse. +
pmouseY - +Variable in class processing.core.PApplet +
Previous x/y position of the mouse. +
point(float, float) - +Method in class processing.core.PApplet +
  +
point(float, float, float) - +Method in class processing.core.PApplet +
  +
POINT - +Static variable in interface processing.core.PConstants +
  +
point(float, float) - +Method in class processing.core.PGraphics +
  +
point(float, float, float) - +Method in class processing.core.PGraphics +
  +
point(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
point(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
pointLight(float, float, float, float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
POINTS - +Static variable in interface processing.core.PConstants +
  +
POLYGON - +Static variable in interface processing.core.PConstants +
  +
popMatrix() - +Method in class processing.core.PApplet +
  +
popMatrix() - +Method in class processing.core.PGraphics +
Replace the current transformation matrix with the top of the stack. +
popMatrix() - +Method in class processing.core.PGraphics2D +
  +
popMatrix() - +Method in class processing.core.PGraphics3D +
  +
popMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
popStyle() - +Method in class processing.core.PApplet +
  +
popStyle() - +Method in class processing.core.PGraphics +
  +
port - +Variable in class processing.serial.Serial +
  +
possiblyEmptyField() - +Method in class processing.app.preproc.PdeRecognizer +
  +
post(PGraphics) - +Method in class processing.core.PShape +
  +
POST_DEC - +Static variable in interface antlr.java.JavaTokenTypes +
  +
POST_DEC - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
POST_DEC - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
POST_INC - +Static variable in interface antlr.java.JavaTokenTypes +
  +
POST_INC - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
POST_INC - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
POSTERIZE - +Static variable in interface processing.core.PConstants +
  +
postfixExpression() - +Method in class antlr.java.JavaRecognizer +
  +
postfixExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
pow(float, float) - +Static method in class processing.core.PApplet +
  +
PPolygon - Class in processing.core
Z-buffer polygon rendering object used by PGraphics2D.
PPolygon(PGraphics) - +Constructor for class processing.core.PPolygon +
  +
preApply(PMatrix2D) - +Method in interface processing.core.PMatrix +
Apply another matrix to the left of this one. +
preApply(PMatrix3D) - +Method in interface processing.core.PMatrix +
  +
preApply(float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
preApply(PMatrix2D) - +Method in class processing.core.PMatrix2D +
Apply another matrix to the left of this one. +
preApply(PMatrix3D) - +Method in class processing.core.PMatrix2D +
  +
preApply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
preApply(PMatrix2D) - +Method in class processing.core.PMatrix3D +
  +
preApply(PMatrix3D) - +Method in class processing.core.PMatrix3D +
Apply another matrix to the left of this one. +
preApply(float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
preApply(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
Preferences - Class in processing.app
Storage class for user preferences and environment settings.
Preferences() - +Constructor for class processing.app.Preferences +
  +
prepareCodeFolder() - +Method in class processing.app.Sketch +
Create the code folder if it does not exist already. +
prepareDataFolder() - +Method in class processing.app.Sketch +
Create the data folder if it does not exist already. +
preprocess(String) - +Method in class processing.app.Sketch +
Build all the code for this sketch. +
PresentMode - Class in processing.app
Helper class for full-screen presentation mode.
PresentMode() - +Constructor for class processing.app.PresentMode +
  +
PREV_CHAR - +Static variable in class processing.app.syntax.InputHandler +
  +
PREV_LINE - +Static variable in class processing.app.syntax.InputHandler +
  +
PREV_PAGE - +Static variable in class processing.app.syntax.InputHandler +
  +
PREV_WORD - +Static variable in class processing.app.syntax.InputHandler +
  +
primaryExpression() - +Method in class antlr.java.JavaRecognizer +
  +
primaryExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
PRIMITIVE - +Static variable in class processing.core.PShape +
A line, ellipse, arc, image, etc. +
print(AST) - +Method in class processing.app.preproc.PdeEmitter +
Print the given AST. +
print(Graphics, PageFormat, int) - +Method in class processing.app.syntax.TextAreaPainter +
  +
print(byte) - +Static method in class processing.core.PApplet +
  +
print(boolean) - +Static method in class processing.core.PApplet +
  +
print(char) - +Static method in class processing.core.PApplet +
  +
print(int) - +Static method in class processing.core.PApplet +
  +
print(float) - +Static method in class processing.core.PApplet +
  +
print(String) - +Static method in class processing.core.PApplet +
  +
print(Object) - +Static method in class processing.core.PApplet +
  +
print() - +Method in class processing.core.PMatrix2D +
  +
print() - +Method in class processing.core.PMatrix3D +
  +
print() - +Method in class processing.core.PShapeSVG +
Prints out the SVG document. +
printCamera() - +Method in class processing.core.PApplet +
  +
printCamera() - +Method in class processing.core.PGraphics +
  +
printCamera() - +Method in class processing.core.PGraphics3D +
Print the current camera matrix. +
println() - +Static method in class processing.core.PApplet +
  +
println(byte) - +Static method in class processing.core.PApplet +
  +
println(boolean) - +Static method in class processing.core.PApplet +
  +
println(char) - +Static method in class processing.core.PApplet +
  +
println(int) - +Static method in class processing.core.PApplet +
  +
println(float) - +Static method in class processing.core.PApplet +
  +
println(String) - +Static method in class processing.core.PApplet +
  +
println(Object) - +Static method in class processing.core.PApplet +
  +
println(String) - +Method in class processing.dxf.RawDXF +
Write a line to the dxf file. +
printMatrix() - +Method in class processing.core.PApplet +
  +
printMatrix() - +Method in class processing.core.PGraphics +
Print the current model (or "transformation") matrix. +
printMatrix() - +Method in class processing.core.PGraphics2D +
Print the current model (or "transformation") matrix. +
printMatrix() - +Method in class processing.core.PGraphics3D +
Print the current model (or "transformation") matrix. +
printMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
printProjection() - +Method in class processing.core.PApplet +
  +
printProjection() - +Method in class processing.core.PGraphics +
  +
printProjection() - +Method in class processing.core.PGraphics3D +
Print the current projection matrix. +
printStackTrace() - +Method in exception processing.app.debug.RunnerException +
Nix the java.lang crap out of an exception message + because it scares the children. +
printStackTrace(PrintWriter) - +Method in exception processing.xml.XMLException +
Dumps the exception stack to a print writer. +
printStackTrace(PrintStream) - +Method in exception processing.xml.XMLException +
Dumps the exception stack to an output stream. +
printStackTrace() - +Method in exception processing.xml.XMLException +
Dumps the exception stack to System.err. +
PROBLEM - +Static variable in interface processing.core.PConstants +
  +
processing.app - package processing.app
 
processing.app.debug - package processing.app.debug
 
processing.app.linux - package processing.app.linux
 
processing.app.macosx - package processing.app.macosx
 
processing.app.preproc - package processing.app.preproc
 
processing.app.syntax - package processing.app.syntax
 
processing.app.tools - package processing.app.tools
 
processing.app.windows - package processing.app.windows
 
processing.core - package processing.core
 
processing.dxf - package processing.dxf
 
processing.net - package processing.net
 
processing.opengl - package processing.opengl
 
processing.pdf - package processing.pdf
 
processing.serial - package processing.serial
 
processing.video - package processing.video
 
processing.xml - package processing.xml
 
processKeyEvent(KeyEvent) - +Method in class processing.app.syntax.JEditTextArea +
  +
programType - +Static variable in class processing.app.preproc.PdePreprocessor +
  +
PROJECT - +Static variable in interface processing.core.PConstants +
  +
projection - +Variable in class processing.core.PGraphics3D +
Current projection matrix. +
PShape - Class in processing.core
In-progress class to handle shape data, currently to be considered of + alpha or beta quality.
PShape() - +Constructor for class processing.core.PShape +
  +
PShape(int) - +Constructor for class processing.core.PShape +
  +
PShapeSVG - Class in processing.core
SVG stands for Scalable Vector Graphics, a portable graphics format.
PShapeSVG(PApplet, String) - +Constructor for class processing.core.PShapeSVG +
Initializes a new SVG Object with the given filename. +
PShapeSVG(XMLElement) - +Constructor for class processing.core.PShapeSVG +
Initializes a new SVG Object from the given XMLElement. +
PShapeSVG(PShapeSVG, XMLElement) - +Constructor for class processing.core.PShapeSVG +
  +
PSmoothTriangle - Class in processing.core
Smoothed triangle renderer for P3D.
PSmoothTriangle(PGraphics3D) - +Constructor for class processing.core.PSmoothTriangle +
  +
psname - +Variable in class processing.core.PFont +
Postscript name of the font that this bitmap was created from. +
PStyle - Class in processing.core
 
PStyle() - +Constructor for class processing.core.PStyle +
  +
PTriangle - Class in processing.core
Handles rendering of single (tesselated) triangles in 3D.
PTriangle(PGraphics3D) - +Constructor for class processing.core.PTriangle +
  +
pushMatrix() - +Method in class processing.core.PApplet +
  +
pushMatrix() - +Method in class processing.core.PGraphics +
Push a copy of the current transformation matrix onto the stack. +
pushMatrix() - +Method in class processing.core.PGraphics2D +
  +
pushMatrix() - +Method in class processing.core.PGraphics3D +
  +
pushMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
pushStyle() - +Method in class processing.core.PApplet +
  +
pushStyle() - +Method in class processing.core.PGraphics +
  +
putcoms() - +Method in class processing.app.tools.AutoFormat +
  +
PVector - Class in processing.core
A class to describe a two or three dimensional vector.
PVector() - +Constructor for class processing.core.PVector +
Constructor for an empty vector: x, y, and z are set to 0. +
PVector(float, float, float) - +Constructor for class processing.core.PVector +
Constructor for a 3D vector. +
PVector(float, float) - +Constructor for class processing.core.PVector +
Constructor for a 2D vector: z coordinate is set to 0. +
+
+

+Q

+
+
quad(float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
QUAD - +Static variable in interface processing.core.PConstants +
  +
quad(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
quad(float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
QUAD_STRIP - +Static variable in interface processing.core.PConstants +
  +
QUADS - +Static variable in interface processing.core.PConstants +
  +
QUARTER_PI - +Static variable in interface processing.core.PConstants +
  +
QUESTION - +Static variable in interface antlr.java.JavaTokenTypes +
  +
QUESTION - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
QUESTION - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
+
+

+R

+
+
R - +Static variable in interface processing.core.PConstants +
  +
RAD_TO_DEG - +Static variable in interface processing.core.PConstants +
  +
radians(float) - +Static method in class processing.core.PApplet +
  +
RADIUS - +Static variable in interface processing.core.PConstants +
Draw mode from the center, and using the radius +
random(float) - +Method in class processing.core.PApplet +
Return a random number in the range [0, howbig). +
random(float, float) - +Method in class processing.core.PApplet +
Return a random number in the range [howsmall, howbig). +
randomSeed(long) - +Method in class processing.core.PApplet +
  +
rate - +Variable in class processing.serial.Serial +
  +
raw - +Variable in class processing.video.Capture +
  +
RAW - +Static variable in class processing.video.MovieMaker +
  +
RawDXF - Class in processing.dxf
A simple library to write DXF files with Processing.
RawDXF() - +Constructor for class processing.dxf.RawDXF +
  +
RBRACK - +Static variable in interface antlr.java.JavaTokenTypes +
  +
RBRACK - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
RBRACK - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
RCURLY - +Static variable in interface antlr.java.JavaTokenTypes +
  +
RCURLY - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
RCURLY - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
read() - +Method in class processing.net.Client +
Returns a number between 0 and 255 for the next byte that's + waiting in the buffer. +
read() - +Method in class processing.serial.Serial +
Returns a number between 0 and 255 for the next byte that's + waiting in the buffer. +
read() - +Method in class processing.video.Capture +
  +
read() - +Method in class processing.video.Movie +
  +
read() - +Method in class processing.xml.StdXMLReader +
Reads a character. +
READ_CONTROL - +Static variable in interface processing.app.windows.WINNT +
  +
readBytes() - +Method in class processing.net.Client +
Return a byte array of anything that's in the serial buffer. +
readBytes(byte[]) - +Method in class processing.net.Client +
Grab whatever is in the serial buffer, and stuff it into a + byte buffer passed in by the user. +
readBytes() - +Method in class processing.serial.Serial +
Return a byte array of anything that's in the serial buffer. +
readBytes(byte[]) - +Method in class processing.serial.Serial +
Grab whatever is in the serial buffer, and stuff it into a + byte buffer passed in by the user. +
readBytesUntil(int) - +Method in class processing.net.Client +
Reads from the serial port into a buffer of bytes up to and + including a particular character. +
readBytesUntil(int, byte[]) - +Method in class processing.net.Client +
Reads from the serial port into a buffer of bytes until a + particular character. +
readBytesUntil(int) - +Method in class processing.serial.Serial +
Reads from the serial port into a buffer of bytes up to and + including a particular character. +
readBytesUntil(int, byte[]) - +Method in class processing.serial.Serial +
Reads from the serial port into a buffer of bytes until a + particular character. +
readChar() - +Method in class processing.net.Client +
Returns the next byte in the buffer as a char. +
readChar() - +Method in class processing.serial.Serial +
Returns the next byte in the buffer as a char. +
readString() - +Method in class processing.net.Client +
Return whatever has been read from the serial port so far + as a String. +
readString() - +Method in class processing.serial.Serial +
Return whatever has been read from the serial port so far + as a String. +
readStringUntil(int) - +Method in class processing.net.Client +
Combination of readBytesUntil and readString. +
readStringUntil(int) - +Method in class processing.serial.Serial +
Combination of readBytesUntil and readString. +
rebuild() - +Method in class processing.app.EditorHeader +
Called when a new sketch is opened. +
rebuildExamplesMenu(JMenu) - +Method in class processing.app.Base +
  +
rebuildImportMenu(JMenu) - +Method in class processing.app.Base +
  +
rebuildMenu() - +Method in class processing.app.EditorHeader +
  +
recalculateVisibleLines() - +Method in class processing.app.syntax.JEditTextArea +
Recalculates the number of visible lines. +
recorder - +Variable in class processing.core.PApplet +
A leech graphics object that is echoing all events. +
rect(float, float, float, float) - +Method in class processing.core.PApplet +
  +
RECT - +Static variable in interface processing.core.PConstants +
  +
rect(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
rectMode(int) - +Method in class processing.core.PApplet +
  +
rectMode - +Variable in class processing.core.PGraphics +
The current rect mode (read-only) +
rectMode(int) - +Method in class processing.core.PGraphics +
  +
rectMode - +Variable in class processing.core.PStyle +
  +
red(int) - +Method in class processing.core.PApplet +
  +
red(int) - +Method in class processing.core.PGraphics +
  +
RED_MASK - +Static variable in interface processing.core.PConstants +
  +
redraw() - +Method in class processing.core.PApplet +
  +
REG_BINARY - +Static variable in interface processing.app.windows.WINNT +
  +
REG_DWORD - +Static variable in interface processing.app.windows.WINNT +
  +
REG_DWORD_BIG_ENDIAN - +Static variable in interface processing.app.windows.WINNT +
  +
REG_DWORD_LITTLE_ENDIAN - +Static variable in interface processing.app.windows.WINNT +
  +
REG_EXPAND_SZ - +Static variable in interface processing.app.windows.WINNT +
  +
REG_FULL_RESOURCE_DESCRIPTOR - +Static variable in interface processing.app.windows.WINNT +
  +
REG_LINK - +Static variable in interface processing.app.windows.WINNT +
  +
REG_MULTI_SZ - +Static variable in interface processing.app.windows.WINNT +
  +
REG_NONE - +Static variable in interface processing.app.windows.WINNT +
  +
REG_OPTION_BACKUP_RESTORE - +Static variable in interface processing.app.windows.WINNT +
  +
REG_OPTION_CREATE_LINK - +Static variable in interface processing.app.windows.WINNT +
  +
REG_OPTION_NON_VOLATILE - +Static variable in interface processing.app.windows.WINNT +
  +
REG_OPTION_OPEN_LINK - +Static variable in interface processing.app.windows.WINNT +
  +
REG_OPTION_RESERVED - +Static variable in interface processing.app.windows.WINNT +
  +
REG_OPTION_VOLATILE - +Static variable in interface processing.app.windows.WINNT +
  +
REG_RESOURCE_LIST - +Static variable in interface processing.app.windows.WINNT +
  +
REG_RESOURCE_REQUIREMENTS_LIST - +Static variable in interface processing.app.windows.WINNT +
  +
REG_SZ - +Static variable in interface processing.app.windows.WINNT +
  +
RegCloseKey(int) - +Method in interface processing.app.windows.Advapi32 +
  +
RegCreateKeyEx(int, String, int, String, int, int, WINBASE.SECURITY_ATTRIBUTES, IntByReference, IntByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
RegDeleteKey(int, String) - +Method in interface processing.app.windows.Advapi32 +
  +
RegDeleteValue(int, String) - +Method in interface processing.app.windows.Advapi32 +
  +
RegEnumKeyEx(int, int, char[], IntByReference, IntByReference, char[], IntByReference, WINBASE.FILETIME) - +Method in interface processing.app.windows.Advapi32 +
  +
RegEnumValue(int, int, char[], IntByReference, IntByReference, IntByReference, byte[], IntByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
regionMatches(boolean, Segment, int, String) - +Static method in class processing.app.syntax.SyntaxUtilities +
Checks if a subregion of a Segment is equal to a + string. +
regionMatches(boolean, Segment, int, char[]) - +Static method in class processing.app.syntax.SyntaxUtilities +
Checks if a subregion of a Segment is equal to a + character array. +
registerDispose(Object) - +Method in class processing.core.PApplet +
  +
registerDraw(Object) - +Method in class processing.core.PApplet +
  +
registerKeyEvent(Object) - +Method in class processing.core.PApplet +
  +
registerMouseEvent(Object) - +Method in class processing.core.PApplet +
  +
registerPost(Object) - +Method in class processing.core.PApplet +
  +
registerPre(Object) - +Method in class processing.core.PApplet +
  +
RegisterServiceCtrlHandler(String, Advapi32.Handler) - +Method in interface processing.app.windows.Advapi32 +
  +
RegisterServiceCtrlHandlerEx(String, Advapi32.HandlerEx, Pointer) - +Method in interface processing.app.windows.Advapi32 +
  +
registerSize(Object) - +Method in class processing.core.PApplet +
  +
registerWindowCloseKeys(JRootPane, ActionListener) - +Static method in class processing.app.Base +
Registers key events for a Ctrl-W and ESC with an ActionListener + that will take care of disposing the window. +
Registry - Class in processing.app.windows
Methods for accessing the Windows Registry.
Registry() - +Constructor for class processing.app.windows.Registry +
  +
Registry.REGISTRY_ROOT_KEY - Enum in processing.app.windows
 
RegOpenKeyEx(int, String, int, int, IntByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
RegQueryValueEx(int, String, IntByReference, IntByReference, byte[], IntByReference) - +Method in interface processing.app.windows.Advapi32 +
  +
RegSetValueEx(int, String, int, int, byte[], int) - +Method in interface processing.app.windows.Advapi32 +
  +
relationalExpression() - +Method in class antlr.java.JavaRecognizer +
  +
relationalExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
remove(Object, Method) - +Method in class processing.core.PApplet.RegisteredMethods +
Removes first object/method pair matched (and only the first, + must be called multiple times if object is registered multiple times). +
removeAllKeyBindings() - +Method in class processing.app.syntax.DefaultInputHandler +
Removes all key bindings from this input handler. +
removeAllKeyBindings() - +Method in class processing.app.syntax.InputHandler +
Removes all key bindings from this input handler. +
removeAttribute(String) - +Method in class processing.xml.XMLElement +
Removes an attribute. +
removeAttribute(String, String) - +Method in class processing.xml.XMLElement +
Removes an attribute. +
removeCache(Object) - +Method in class processing.core.PApplet +
  +
removeCache(Object) - +Method in class processing.core.PImage +
Remove information associated with this renderer from the cache, if any. +
removeCaretListener(CaretListener) - +Method in class processing.app.syntax.JEditTextArea +
Removes a caret change listener from this text area. +
removeChild(XMLElement) - +Method in class processing.xml.XMLElement +
Removes a child element. +
removeChildAtIndex(int) - +Method in class processing.xml.XMLElement +
Removes the child located at a certain index. +
removeDescendants(File) - +Static method in class processing.app.Base +
Recursively remove all files within a directory, + used with removeDir(), or when the contents of a dir + should be removed, but not the directory itself. +
removeDir(File) - +Static method in class processing.app.Base +
Remove all files in a directory and the directory itself. +
removeKeyBinding(String) - +Method in class processing.app.syntax.DefaultInputHandler +
Removes a key binding from this input handler. +
removeKeyBinding(String) - +Method in class processing.app.syntax.InputHandler +
Removes a key binding from this input handler. +
removeNotify() - +Method in class processing.app.syntax.JEditTextArea +
Called by the AWT when this component is removed from it's parent. +
removeUpdate(DocumentEvent) - +Method in class processing.app.tools.ColorSelector +
  +
render() - +Method in class processing.core.PSmoothTriangle +
  +
render() - +Method in class processing.core.PTriangle +
Renders the polygon +
REPEAT - +Static variable in class processing.app.syntax.InputHandler +
  +
replace() - +Method in class processing.app.FindReplace +
Replace the current selection with whatever's in the + replacement text field. +
REPLACE - +Static variable in interface processing.core.PConstants +
  +
replaceAll() - +Method in class processing.app.FindReplace +
Replace everything that matches by doing find and replace + alternately until nothing more found. +
report(String) - +Method in class processing.opengl.PGraphicsOpenGL +
Report on anything from glError(). +
requestImage(String) - +Method in class processing.core.PApplet +
  +
requestImage(String, String) - +Method in class processing.core.PApplet +
  +
requestImageMax - +Variable in class processing.core.PApplet +
By trial and error, four image loading threads seem to work best when + loading images from online. +
reset() - +Method in class processing.core.PLine +
  +
reset() - +Method in interface processing.core.PMatrix +
  +
reset() - +Method in class processing.core.PMatrix2D +
  +
reset() - +Method in class processing.core.PMatrix3D +
  +
reset(int) - +Method in class processing.core.PSmoothTriangle +
  +
reset() - +Method in class processing.core.PTriangle +
Resets polygon attributes +
resetMatrix() - +Method in class processing.core.PApplet +
  +
resetMatrix() - +Method in class processing.core.PGraphics +
Set the current transformation matrix to identity. +
resetMatrix() - +Method in class processing.core.PGraphics2D +
Load identity as the transform/model matrix. +
resetMatrix() - +Method in class processing.core.PGraphics3D +
  +
resetMatrix() - +Method in class processing.core.PGraphicsJava2D +
  +
resetMatrix() - +Method in class processing.core.PShape +
  +
resize(int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
resize(int, int) - +Method in class processing.core.PImage +
Resize this image to a new width and height. +
resize(int, int) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
RETURN - +Static variable in interface processing.core.PConstants +
  +
reverse(boolean[]) - +Static method in class processing.core.PApplet +
  +
reverse(byte[]) - +Static method in class processing.core.PApplet +
  +
reverse(char[]) - +Static method in class processing.core.PApplet +
  +
reverse(int[]) - +Static method in class processing.core.PApplet +
  +
reverse(float[]) - +Static method in class processing.core.PApplet +
  +
reverse(String[]) - +Static method in class processing.core.PApplet +
  +
reverse(Object) - +Static method in class processing.core.PApplet +
  +
RGB - +Static variable in interface processing.core.PConstants +
  +
RIGHT - +Static variable in interface processing.core.PConstants +
  +
rotate(float) - +Method in class processing.core.PApplet +
  +
rotate(float, float, float, float) - +Method in class processing.core.PApplet +
  +
rotate(float) - +Method in class processing.core.PGraphics +
Two dimensional rotation. +
rotate(float, float, float, float) - +Method in class processing.core.PGraphics +
Rotate about a vector in space. +
rotate(float) - +Method in class processing.core.PGraphics2D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
rotate(float) - +Method in class processing.core.PGraphics3D +
Two dimensional rotation. +
rotate(float, float, float, float) - +Method in class processing.core.PGraphics3D +
Rotate around an arbitrary vector, similar to glRotate(), + except that it takes radians (instead of degrees). +
rotate(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotate(float) - +Method in interface processing.core.PMatrix +
  +
rotate(float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
rotate(float) - +Method in class processing.core.PMatrix2D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
rotate(float) - +Method in class processing.core.PMatrix3D +
  +
rotate(float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
rotate(float) - +Method in class processing.core.PShape +
  +
rotate(float, float, float, float) - +Method in class processing.core.PShape +
  +
rotateX(float) - +Method in class processing.core.PApplet +
  +
rotateX(float) - +Method in class processing.core.PGraphics +
Rotate around the X axis. +
rotateX(float) - +Method in class processing.core.PGraphics2D +
  +
rotateX(float) - +Method in class processing.core.PGraphics3D +
  +
rotateX(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotateX(float) - +Method in interface processing.core.PMatrix +
  +
rotateX(float) - +Method in class processing.core.PMatrix2D +
  +
rotateX(float) - +Method in class processing.core.PMatrix3D +
  +
rotateX(float) - +Method in class processing.core.PShape +
  +
rotateY(float) - +Method in class processing.core.PApplet +
  +
rotateY(float) - +Method in class processing.core.PGraphics +
Rotate around the Y axis. +
rotateY(float) - +Method in class processing.core.PGraphics2D +
  +
rotateY(float) - +Method in class processing.core.PGraphics3D +
  +
rotateY(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotateY(float) - +Method in interface processing.core.PMatrix +
  +
rotateY(float) - +Method in class processing.core.PMatrix2D +
  +
rotateY(float) - +Method in class processing.core.PMatrix3D +
  +
rotateY(float) - +Method in class processing.core.PShape +
  +
rotateZ(float) - +Method in class processing.core.PApplet +
  +
rotateZ(float) - +Method in class processing.core.PGraphics +
Rotate around the Z axis. +
rotateZ(float) - +Method in class processing.core.PGraphics2D +
  +
rotateZ(float) - +Method in class processing.core.PGraphics3D +
  +
rotateZ(float) - +Method in class processing.core.PGraphicsJava2D +
  +
rotateZ(float) - +Method in interface processing.core.PMatrix +
  +
rotateZ(float) - +Method in class processing.core.PMatrix2D +
  +
rotateZ(float) - +Method in class processing.core.PMatrix3D +
  +
rotateZ(float) - +Method in class processing.core.PShape +
  +
round(float) - +Static method in class processing.core.PApplet +
  +
ROUND - +Static variable in interface processing.core.PConstants +
  +
rows - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
RPAREN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
RPAREN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
RPAREN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
run() - +Method in class processing.app.debug.EventThread +
Run the event handling thread. +
run() - +Method in class processing.app.debug.StreamRedirectThread +
Copy. +
run() - +Method in class processing.app.tools.Archiver +
  +
run() - +Method in class processing.app.tools.AutoFormat +
  +
run() - +Method in class processing.app.tools.ColorSelector +
  +
run() - +Method in class processing.app.tools.CreateFont +
  +
run() - +Method in class processing.app.tools.FixEncoding +
  +
run() - +Method in interface processing.app.tools.Tool +
  +
run() - +Method in class processing.app.UpdateCheck +
  +
run() - +Method in class processing.core.PApplet +
Main method for the primary animation thread. +
run() - +Method in class processing.net.Client +
  +
run() - +Method in class processing.net.Server +
  +
run() - +Method in class processing.video.Capture +
  +
run() - +Method in class processing.video.Movie +
  +
Runner - Class in processing.app.debug
Runs a compiled sketch.
Runner(Sketch, String, boolean, RunnerListener) - +Constructor for class processing.app.debug.Runner +
  +
RunnerException - Exception in processing.app.debug
An exception with a line number attached that occurs + during either compile time or run time.
RunnerException(String) - +Constructor for exception processing.app.debug.RunnerException +
  +
RunnerException(String, int, int, int) - +Constructor for exception processing.app.debug.RunnerException +
  +
RunnerException(String, int, int, int, boolean) - +Constructor for exception processing.app.debug.RunnerException +
  +
RunnerListener - Interface in processing.app.debug
 
+
+

+S

+
+
SA - +Static variable in interface processing.core.PConstants +
  +
sanitizeName(String) - +Static method in class processing.app.Sketch +
Produce a sanitized name that fits our standards for likely to work. +
saturation(int) - +Method in class processing.core.PApplet +
  +
saturation(int) - +Method in class processing.core.PGraphics +
  +
save() - +Method in class processing.app.Sketch +
Save all code in the current sketch. +
save() - +Method in class processing.app.SketchCode +
Save this piece of code, regardless of whether the modified + flag is set or not. +
save(String) - +Method in class processing.core.PApplet +
Intercepts any relative paths to make them absolute (relative + to the sketch folder) before passing to save() in PImage. +
save(OutputStream) - +Method in class processing.core.PFont +
Write this PFont to an OutputStream. +
save(String) - +Method in class processing.core.PImage +
Save this image to disk. +
save(String) - +Method in class processing.pdf.PGraphicsPDF +
  +
saveAs(File) - +Method in class processing.app.SketchCode +
Save this file to another location, used by Sketch.saveAs() +
saveBytes(String, byte[]) - +Method in class processing.core.PApplet +
Saves bytes to a file to inside the sketch folder. +
saveBytes(File, byte[]) - +Static method in class processing.core.PApplet +
Saves bytes to a specific File location specified by the user. +
saveBytes(OutputStream, byte[]) - +Static method in class processing.core.PApplet +
Spews a buffer of bytes to an OutputStream. +
saveFile(String, File) - +Static method in class processing.app.Base +
Spew the contents of a String object out to a file. +
saveFile(String) - +Method in class processing.core.PApplet +
Identical to savePath(), but returns a File object. +
saveFrame() - +Method in class processing.core.PApplet +
Grab an image of what's currently in the drawing area and save it + as a .tif or .tga file. +
saveFrame(String) - +Method in class processing.core.PApplet +
Save the current frame as a .tif or .tga image. +
savePath(String) - +Method in class processing.core.PApplet +
Returns a path inside the applet folder to save to. +
saveStream(String, String) - +Method in class processing.core.PApplet +
Save the contents of a stream to a file in the sketch folder. +
saveStream(File, String) - +Method in class processing.core.PApplet +
Identical to the other saveStream(), but writes to a File + object, for greater control over the file location. +
saveStream(File, InputStream) - +Static method in class processing.core.PApplet +
  +
saveStrings(String, String[]) - +Method in class processing.core.PApplet +
  +
saveStrings(File, String[]) - +Static method in class processing.core.PApplet +
  +
saveStrings(OutputStream, String[]) - +Static method in class processing.core.PApplet +
  +
SB - +Static variable in interface processing.core.PConstants +
  +
scale(float) - +Method in class processing.core.PApplet +
  +
scale(float, float) - +Method in class processing.core.PApplet +
  +
scale(float, float, float) - +Method in class processing.core.PApplet +
  +
scale(float) - +Method in class processing.core.PGraphics +
Scale in all dimensions. +
scale(float, float) - +Method in class processing.core.PGraphics +
Scale in X and Y. +
scale(float, float, float) - +Method in class processing.core.PGraphics +
Scale in X, Y, and Z. +
scale(float) - +Method in class processing.core.PGraphics2D +
  +
scale(float, float) - +Method in class processing.core.PGraphics2D +
  +
scale(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
scale(float) - +Method in class processing.core.PGraphics3D +
Same as scale(s, s, s). +
scale(float, float) - +Method in class processing.core.PGraphics3D +
Same as scale(sx, sy, 1). +
scale(float, float, float) - +Method in class processing.core.PGraphics3D +
Scale in three dimensions. +
scale(float) - +Method in class processing.core.PGraphicsJava2D +
  +
scale(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
scale(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
scale(float) - +Method in interface processing.core.PMatrix +
  +
scale(float, float) - +Method in interface processing.core.PMatrix +
  +
scale(float, float, float) - +Method in interface processing.core.PMatrix +
  +
scale(float) - +Method in class processing.core.PMatrix2D +
  +
scale(float, float) - +Method in class processing.core.PMatrix2D +
  +
scale(float, float, float) - +Method in class processing.core.PMatrix2D +
  +
scale(float) - +Method in class processing.core.PMatrix3D +
  +
scale(float, float) - +Method in class processing.core.PMatrix3D +
  +
scale(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
scale(float) - +Method in class processing.core.PShape +
  +
scale(float, float) - +Method in class processing.core.PShape +
  +
scale(float, float, float) - +Method in class processing.core.PShape +
  +
screen - +Variable in class processing.core.PApplet +
The screen size when the applet was started. +
SCREEN - +Static variable in interface processing.core.PConstants +
  +
screenX(float, float) - +Method in class processing.core.PApplet +
  +
screenX(float, float, float) - +Method in class processing.core.PApplet +
  +
screenX(float, float) - +Method in class processing.core.PGraphics +
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +
screenX(float, float, float) - +Method in class processing.core.PGraphics +
Maps a three dimensional point to its placement on-screen. +
screenX(float, float) - +Method in class processing.core.PGraphics2D +
  +
screenX(float, float) - +Method in class processing.core.PGraphics3D +
  +
screenX(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
screenX(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenX(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenY(float, float) - +Method in class processing.core.PApplet +
  +
screenY(float, float, float) - +Method in class processing.core.PApplet +
  +
screenY(float, float) - +Method in class processing.core.PGraphics +
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +
screenY(float, float, float) - +Method in class processing.core.PGraphics +
Maps a three dimensional point to its placement on-screen. +
screenY(float, float) - +Method in class processing.core.PGraphics2D +
  +
screenY(float, float) - +Method in class processing.core.PGraphics3D +
  +
screenY(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
screenY(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenY(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
screenZ(float, float, float) - +Method in class processing.core.PApplet +
  +
screenZ(float, float, float) - +Method in class processing.core.PGraphics +
Maps a three dimensional point to its placement on-screen. +
screenZ(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
screenZ(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
scrollTo(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Ensures that the specified line and offset is visible by scrolling + the text area if necessary. +
scrollToCaret() - +Method in class processing.app.syntax.JEditTextArea +
Ensures that the caret is visible by scrolling the text area if + necessary. +
scrubComments(String) - +Static method in class processing.app.Sketch +
Replace all commented portions of a given String as spaces. +
SECAM - +Static variable in class processing.video.Capture +
  +
second() - +Static method in class processing.core.PApplet +
Seconds position of the current time. +
select(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Selects from the start offset to the end offset. +
SELECT_DOC_END - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_DOC_HOME - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_END - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_HOME - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_NEXT_CHAR - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_NEXT_LINE - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_NEXT_PAGE - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_NEXT_WORD - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_PREV_CHAR - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_PREV_LINE - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_PREV_PAGE - +Static variable in class processing.app.syntax.InputHandler +
  +
SELECT_PREV_WORD - +Static variable in class processing.app.syntax.InputHandler +
  +
selectAll() - +Method in class processing.app.syntax.JEditTextArea +
Selects all text in the document. +
selectedFile - +Variable in class processing.core.PApplet +
  +
selectFolder(String, File, Frame) - +Static method in class processing.app.Base +
Prompt for a fodler and return it as a File object (or null). +
selectFolder() - +Method in class processing.core.PApplet +
Open a platform-specific folder chooser dialog. +
selectFolder(String) - +Method in class processing.core.PApplet +
Open a platform-specific folder chooser dialog. +
selectInput() - +Method in class processing.core.PApplet +
Open a platform-specific file chooser dialog to select a file for input. +
selectInput(String) - +Method in class processing.core.PApplet +
Open a platform-specific file chooser dialog to select a file for input. +
selectionColor - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
selectNone() - +Method in class processing.app.syntax.JEditTextArea +
Moves the mark to the caret position. +
selectOutput() - +Method in class processing.core.PApplet +
Open a platform-specific file save dialog to select a file for output. +
selectOutput(String) - +Method in class processing.core.PApplet +
Open a platform-specific file save dialog to select a file for output. +
SEMI - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SEMI - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SEMI - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
Serial - Class in processing.serial
 
Serial(PApplet) - +Constructor for class processing.serial.Serial +
  +
Serial(PApplet, int) - +Constructor for class processing.serial.Serial +
  +
Serial(PApplet, String, int) - +Constructor for class processing.serial.Serial +
  +
Serial(PApplet, String) - +Constructor for class processing.serial.Serial +
  +
Serial(PApplet, String, int, char, int, float) - +Constructor for class processing.serial.Serial +
  +
serialEvent(SerialPortEvent) - +Method in class processing.serial.Serial +
  +
Server - Class in processing.net
 
Server(PApplet, int) - +Constructor for class processing.net.Server +
  +
SERVICE_WIN32_OWN_PROCESS - +Static variable in interface processing.app.windows.WINNT +
  +
set(int, int) - +Method in class processing.app.EditorLineStatus +
  +
set(String, String) - +Static method in class processing.app.Preferences +
  +
set(String, String) - +Static method in class processing.app.Theme +
  +
set(int, int, int) - +Method in class processing.core.PApplet +
  +
set(int, int, PImage) - +Method in class processing.core.PApplet +
  +
set(int, int, int) - +Method in class processing.core.PGraphicsJava2D +
  +
set(int, int, int) - +Method in class processing.core.PImage +
Set a single pixel to the specified color. +
set(int, int, PImage) - +Method in class processing.core.PImage +
Efficient method of drawing an image's pixels directly to this surface. +
set(PMatrix) - +Method in interface processing.core.PMatrix +
  +
set(float[]) - +Method in interface processing.core.PMatrix +
  +
set(float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in interface processing.core.PMatrix +
  +
set(PMatrix) - +Method in class processing.core.PMatrix2D +
  +
set(PMatrix3D) - +Method in class processing.core.PMatrix2D +
  +
set(float[]) - +Method in class processing.core.PMatrix2D +
  +
set(float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix2D +
  +
set(PMatrix) - +Method in class processing.core.PMatrix3D +
  +
set(float[]) - +Method in class processing.core.PMatrix3D +
  +
set(float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
set(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PMatrix3D +
  +
set(float, float, float) - +Method in class processing.core.PVector +
Set x, y, and z coordinates. +
set(PVector) - +Method in class processing.core.PVector +
Set x, y, and z coordinates from a Vector3D object. +
set(float[]) - +Method in class processing.core.PVector +
Set the x, y (and maybe z) coordinates using a float[] array as the source. +
set(int, int, int) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
set(int, int, PImage) - +Method in class processing.opengl.PGraphicsOpenGL +
Set an image directly to the screen. +
set(int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
set(int, int, PImage) - +Method in class processing.pdf.PGraphicsPDF +
  +
setAttribute(String, String) - +Method in class processing.xml.XMLElement +
Sets an attribute. +
setAttribute(String, String, String) - +Method in class processing.xml.XMLElement +
Sets an attribute. +
setBlockCaretEnabled(boolean) - +Method in class processing.app.syntax.TextAreaPainter +
Sets if the caret should be drawn as a block, false otherwise. +
setBoolean(String, boolean) - +Static method in class processing.app.Preferences +
  +
setBoolean(String, boolean) - +Static method in class processing.app.Theme +
  +
setBracketHighlightColor(Color) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the bracket highlight color. +
setBracketHighlightEnabled(boolean) - +Method in class processing.app.syntax.TextAreaPainter +
Enables or disables bracket highlighting. +
setBuilder(StdXMLBuilder) - +Method in class processing.xml.StdXMLParser +
Sets the builder which creates the logical structure of the XML data. +
setCache(Object, Object) - +Method in class processing.core.PApplet +
  +
setCache(Object, Object) - +Method in class processing.core.PImage +
Store data of some kind for a renderer that requires extra metadata of + some kind. +
setCamVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PSmoothTriangle +
Pass camera-space coordinates for the triangle. +
setCamVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Pass camera-space coordinates for the triangle. +
setCaretBlinkEnabled(boolean) - +Method in class processing.app.syntax.JEditTextArea +
Toggles caret blinking. +
setCaretColor(Color) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the caret color. +
setCaretPosition(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the caret position. +
setCaretVisible(boolean) - +Method in class processing.app.syntax.JEditTextArea +
Sets if the caret should be visible. +
setCodeColumn(int) - +Method in exception processing.app.debug.RunnerException +
  +
setCodeIndex(int) - +Method in exception processing.app.debug.RunnerException +
  +
setCodeLine(int) - +Method in exception processing.app.debug.RunnerException +
  +
setColor(String, Color) - +Static method in class processing.app.Preferences +
  +
setColor(String, Color) - +Static method in class processing.app.Theme +
  +
setContent(String) - +Method in class processing.xml.XMLElement +
Sets the #PCDATA content. +
setCulling(boolean) - +Method in class processing.core.PTriangle +
Sets backface culling on/off +
setCurrentCode(int) - +Method in class processing.app.Sketch +
Change what file is currently being edited. +
setCurrentLineIndex(int) - +Method in class processing.app.syntax.TextAreaPainter +
Accessor used by tools that want to hook in and grab the formatting. +
setCurrentLineTokens(Token) - +Method in class processing.app.syntax.TextAreaPainter +
Accessor used by tools that want to hook in and grab the formatting. +
setDocument(Document) - +Method in class processing.app.SketchCode +
  +
setDocument(SyntaxDocument) - +Method in class processing.app.syntax.JEditTextArea +
Sets the document this text area is editing. +
setDocument(SyntaxDocument, int, int, int) - +Method in class processing.app.syntax.JEditTextArea +
Set document with a twist, includes the old caret + and scroll positions, added for p5. +
setDTR(boolean) - +Method in class processing.serial.Serial +
Set the DTR line. +
setEditable(boolean) - +Method in class processing.app.syntax.JEditTextArea +
Sets if this component is editable. +
setEditor(Editor) - +Static method in class processing.app.EditorConsole +
  +
setElectricScroll(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the number of lines from the top and bottom of the text + area that are always visible +
setEOLMarkerColor(Color) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the EOL marker color. +
setEOLMarkersPainted(boolean) - +Method in class processing.app.syntax.TextAreaPainter +
Sets if EOL markers are to be drawn. +
setFirstLine(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the line displayed at the text area's origin without + updating the scroll bars. +
setFont(Font) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the font for this component. +
setFont(Font) - +Method in class processing.core.PFont +
Set the native complement of this font. +
setGraphicsFlags(Graphics, Font) - +Method in class processing.app.syntax.SyntaxStyle +
Sets the foreground color and font of the specified graphics + context to that specified in this style. +
setHorizontalOffset(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the horizontal offset of drawn lines. +
setIcon(Frame) - +Static method in class processing.app.Base +
Give this Frame a Processing icon. +
setIgnoreCase(boolean) - +Method in class processing.app.syntax.KeywordMap +
Sets if the keyword map should be case insensitive. +
setIndex(int) - +Method in class processing.core.PLine +
  +
setInputHandler(InputHandler) - +Method in class processing.app.syntax.JEditTextArea +
Sets the input handler. +
setInteger(String, int) - +Static method in class processing.app.Preferences +
  +
setInteger(String, int) - +Static method in class processing.app.Theme +
  +
setIntensities(float, float, float, float, float, float, float, float) - +Method in class processing.core.PLine +
  +
setIntensities(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PSmoothTriangle +
  +
setIntensities(float, float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Sets vertex intensities in 0xRRGGBBAA format +
setInterpPower(int) - +Static method in class processing.core.PTriangle +
Set the power of two used for linear interpolation of texture coordinates. +
setIntValue(Registry.REGISTRY_ROOT_KEY, String, String, int) - +Static method in class processing.app.windows.Registry +
Writes an int value. +
setInvalidLinesPainted(boolean) - +Method in class processing.app.syntax.TextAreaPainter +
Sets if invalid lines are to be painted as red tildes. +
setLayer(int) - +Method in class processing.dxf.RawDXF +
Set the current layer being used in the DXF file. +
setLineHighlightColor(Color) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the line highlight color. +
setLineHighlightEnabled(boolean) - +Method in class processing.app.syntax.TextAreaPainter +
Enables or disables current line highlighting. +
setLineText(int, String) - +Method in class processing.app.Editor +
Replace the text on a specified line. +
setLookAndFeel() - +Method in class processing.app.linux.Platform +
  +
setLookAndFeel() - +Method in class processing.app.macosx.Platform +
  +
setLookAndFeel() - +Method in class processing.app.Platform +
Set the default L & F. +
setMacroRecorder(InputHandler.MacroRecorder) - +Method in class processing.app.syntax.InputHandler +
Sets the macro recorder. +
setMagicCaretPosition(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the `magic' caret position. +
setMatrix(PMatrix) - +Method in class processing.core.PApplet +
  +
setMatrix(PMatrix2D) - +Method in class processing.core.PApplet +
  +
setMatrix(PMatrix3D) - +Method in class processing.core.PApplet +
  +
setMatrix(PMatrix) - +Method in class processing.core.PGraphics +
Set the current transformation matrix to the contents of another. +
setMatrix(PMatrix2D) - +Method in class processing.core.PGraphics +
Set the current transformation to the contents of the specified source. +
setMatrix(PMatrix3D) - +Method in class processing.core.PGraphics +
Set the current transformation to the contents of the specified source. +
setMatrix(PMatrix2D) - +Method in class processing.core.PGraphics3D +
  +
setMatrix(PMatrix3D) - +Method in class processing.core.PGraphics3D +
Set the current transformation to the contents of the specified source. +
setMatrix(PMatrix2D) - +Method in class processing.core.PGraphicsJava2D +
  +
setMatrix(PMatrix3D) - +Method in class processing.core.PGraphicsJava2D +
  +
setMessage(String) - +Method in exception processing.app.debug.RunnerException +
  +
setModified(boolean) - +Method in class processing.app.Sketch +
Sets the modified value for the code in the frontmost tab. +
setModified(boolean) - +Method in class processing.app.SketchCode +
  +
setModified() - +Method in class processing.core.PImage +
  +
setModified(boolean) - +Method in class processing.core.PImage +
  +
setName(String) - +Method in class processing.core.PShape +
  +
setName(String) - +Method in class processing.xml.XMLElement +
Sets the full name. +
setName(String, String) - +Method in class processing.xml.XMLElement +
Sets the name. +
setOrigin(int, int) - +Method in class processing.app.syntax.JEditTextArea +
A fast way of changing both the first line and horizontal + offset. +
setOut(PrintStream) - +Method in class processing.app.preproc.PdeEmitter +
Specify a PrintStream to print to. +
setOverwriteEnabled(boolean) - +Method in class processing.app.syntax.JEditTextArea +
Sets if overwrite mode should be enabled. +
setParameterEntityResolver(XMLEntityResolver) - +Method in class processing.xml.XMLValidator +
Sets the parameter entity resolver. +
setParent(PApplet) - +Method in class processing.core.PGraphics +
  +
setPath(String) - +Method in class processing.core.PGraphics +
  +
setPath(String) - +Method in class processing.dxf.RawDXF +
  +
setPath(String) - +Method in class processing.pdf.PGraphicsPDF +
  +
setPreprocOffset(int) - +Method in class processing.app.SketchCode +
  +
setPrimary(boolean) - +Method in class processing.core.PGraphics +
Set (or unset) this as the main drawing surface. +
setProgram(String) - +Method in class processing.app.SketchCode +
  +
setProperties(Properties) - +Method in class processing.serial.Serial +
  +
setPublicID(String) - +Method in class processing.xml.StdXMLReader +
Sets the public ID of the current stream. +
setReader(StdXMLReader) - +Method in class processing.xml.StdXMLParser +
Sets the reader from which the parser retrieves its data. +
setRepeatCount(int) - +Method in class processing.app.syntax.InputHandler +
Sets the number of times the next action will be repeated. +
setRepeatEnabled(boolean) - +Method in class processing.app.syntax.InputHandler +
Enables repeating. +
setResolver(XMLEntityResolver) - +Method in class processing.xml.StdXMLParser +
Sets the entity resolver. +
setRightClickPopup(JPopupMenu) - +Method in class processing.app.syntax.JEditTextArea +
Sets the right click popup menu. +
setScrollPosition(int) - +Method in class processing.app.syntax.JEditTextArea +
Set position of the vertical scroll bar. +
setSelectedText(String) - +Method in class processing.app.Editor +
  +
setSelectedText(String) - +Method in class processing.app.syntax.JEditTextArea +
Replaces the selection with the specified text. +
setSelection(int, int) - +Method in class processing.app.Editor +
  +
setSelectionColor(Color) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the selection color. +
setSelectionEnd(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the selection end. +
setSelectionRectangular(boolean) - +Method in class processing.app.syntax.JEditTextArea +
Sets if the selection should be rectangular. +
setSelectionStart(int) - +Method in class processing.app.syntax.JEditTextArea +
Sets the selection start. +
SetServiceStatus(Pointer, Advapi32.SERVICE_STATUS) - +Method in interface processing.app.windows.Advapi32 +
  +
setSize(int, int) - +Method in class processing.core.PGraphics +
The final step in setting up a renderer, set its size of this renderer. +
setSize(int, int) - +Method in class processing.core.PGraphics3D +
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. +
setSize(int, int) - +Method in class processing.core.PGraphicsJava2D +
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. +
setSketchLocation(Point) - +Method in class processing.app.Editor +
Set the location of the sketch run window. +
setStringValue(Registry.REGISTRY_ROOT_KEY, String, String, String) - +Static method in class processing.app.windows.Registry +
Writes a String value. +
setStyles(SyntaxStyle[]) - +Method in class processing.app.syntax.TextAreaPainter +
Sets the syntax styles used to paint colorized text. +
setSystemID(String) - +Method in class processing.xml.StdXMLReader +
Sets the system ID of the current stream. +
setText(String) - +Method in class processing.app.Editor +
Replace the entire contents of the front-most tab. +
setText(String) - +Method in class processing.app.syntax.JEditTextArea +
Sets the entire text of this text area. +
setTexture(PImage) - +Method in class processing.core.PTriangle +
Sets texture image used for the polygon +
settings() - +Method in class processing.video.Capture +
Show the settings dialog for this input device. +
setTokenMarker(TokenMarker) - +Method in class processing.app.syntax.JEditTextArea +
Sets the document's token marker. +
setTokenMarker(TokenMarker) - +Method in class processing.app.syntax.SyntaxDocument +
Sets the token marker that is to be used to split lines of + this document up into tokens. +
setUntitled(boolean) - +Method in class processing.app.Sketch +
  +
setup() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
setup() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
setup() - +Method in class processing.core.PApplet +
  +
setupExternalMessages() - +Method in class processing.core.PApplet +
Set this sketch to communicate its state back to the PDE. +
setupFrameResizeListener() - +Method in class processing.core.PApplet +
Set up a listener that will fire proper component resize events + in cases where frame.setResizable(true) is called. +
setUV(float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Sets the UV coordinates of the texture +
setUV(float[], float[]) - +Method in class processing.core.PTriangle +
  +
setValidator(XMLValidator) - +Method in class processing.xml.StdXMLParser +
Sets the validator that validates the XML data. +
setVertices(float, float, float, float, float, float) - +Method in class processing.core.PLine +
  +
setVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PSmoothTriangle +
  +
setVertices(float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PTriangle +
Sets vertex coordinates for the triangle +
setVisible(boolean) - +Method in class processing.core.PShape +
  +
setWidth - +Variable in class processing.core.PFont +
  +
SG - +Static variable in interface processing.core.PConstants +
  +
shape(PShape) - +Method in class processing.core.PApplet +
  +
shape(PShape, float, float) - +Method in class processing.core.PApplet +
  +
shape(PShape, float, float, float, float) - +Method in class processing.core.PApplet +
  +
SHAPE - +Static variable in interface processing.core.PConstants +
textMode(SHAPE) draws text using the the glyph outlines of + individual characters rather than as textures. +
shape(PShape) - +Method in class processing.core.PGraphics +
  +
shape(PShape, float, float) - +Method in class processing.core.PGraphics +
Convenience method to draw at a particular location. +
shape(PShape, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
shapeMode(int) - +Method in class processing.core.PApplet +
  +
shapeMode - +Variable in class processing.core.PGraphics +
The current shape alignment mode (read-only) +
shapeMode(int) - +Method in class processing.core.PGraphics +
Set the orientation for the shape() command (like imageMode() or rectMode()). +
shapeMode - +Variable in class processing.core.PStyle +
  +
SHIFT - +Static variable in interface processing.core.PConstants +
  +
shiftExpression() - +Method in class antlr.java.JavaRecognizer +
  +
shiftExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
SHINE - +Static variable in interface processing.core.PConstants +
  +
shininess(float) - +Method in class processing.core.PApplet +
  +
shininess - +Variable in class processing.core.PGraphics +
  +
shininess(float) - +Method in class processing.core.PGraphics +
  +
shininess - +Variable in class processing.core.PStyle +
  +
shininess(float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
shorten(boolean[]) - +Static method in class processing.core.PApplet +
  +
shorten(byte[]) - +Static method in class processing.core.PApplet +
  +
shorten(char[]) - +Static method in class processing.core.PApplet +
  +
shorten(int[]) - +Static method in class processing.core.PApplet +
  +
shorten(float[]) - +Static method in class processing.core.PApplet +
  +
shorten(String[]) - +Static method in class processing.core.PApplet +
  +
shorten(Object) - +Static method in class processing.core.PApplet +
  +
show() - +Method in class processing.app.tools.DiscourseFormat +
Format and render sketch code. +
showEnvironment() - +Static method in class processing.app.Base +
  +
showError(String, String, Throwable) - +Static method in class processing.app.Base +
Show an error message that's actually fatal to the program. +
showException(String) - +Static method in class processing.core.PGraphics +
Show an renderer-related exception that halts the program. +
showMessage(String, String) - +Static method in class processing.app.Base +
"No cookie for you" type messages. +
showPlatforms() - +Static method in class processing.app.Base +
  +
showReference(String) - +Static method in class processing.app.Base +
  +
showReference() - +Static method in class processing.app.Base +
  +
showStackTrace() - +Method in exception processing.app.debug.RunnerException +
  +
showTroubleshooting() - +Static method in class processing.app.Base +
  +
showWarning(String, String, Exception) - +Static method in class processing.app.Base +
Non-fatal error message with optional stack trace side dish. +
showWarning(String) - +Static method in class processing.core.PGraphics +
Show a renderer error, and keep track of it so that it's only shown once. +
sin(float) - +Static method in class processing.core.PApplet +
  +
size(int, int) - +Method in class processing.core.PApplet +
Starts up and creates a two-dimensional drawing surface, + or resizes the current drawing surface. +
size(int, int, String) - +Method in class processing.core.PApplet +
  +
size(int, int, String, String) - +Method in class processing.core.PApplet +
Creates a new PGraphics object and sets it to the specified size. +
size - +Variable in class processing.core.PFont +
"natural" size of the font (most often 48) +
Sketch - Class in processing.app
Stores information about files in the current sketch
Sketch(Editor, String) - +Constructor for class processing.app.Sketch +
path is location of the main .pde file, because this is also + simplest to use when opening the file from the finder/explorer. +
SketchCode - Class in processing.app
Represents a single tab of a sketch.
SketchCode(File, String) - +Constructor for class processing.app.SketchCode +
  +
sketchFile(String) - +Method in class processing.core.PApplet +
  +
sketchPath - +Variable in class processing.core.PApplet +
Path to sketch folder +
sketchPath(String) - +Method in class processing.core.PApplet +
Prepend the sketch folder path to the filename (or path) that is + passed in. +
skewX(float) - +Method in interface processing.core.PMatrix +
  +
skewX(float) - +Method in class processing.core.PMatrix2D +
  +
skewX(float) - +Method in class processing.core.PMatrix3D +
  +
skewY(float) - +Method in interface processing.core.PMatrix +
  +
skewY(float) - +Method in class processing.core.PMatrix2D +
  +
skewY(float) - +Method in class processing.core.PMatrix3D +
  +
SL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
SL_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SL_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SL_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
SL_COMMENT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SL_COMMENT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SL_COMMENT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
SLIST - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SLIST - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SLIST - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
SMART_HOME_END_PROPERTY - +Static variable in class processing.app.syntax.InputHandler +
If this client property is set to Boolean.TRUE on the text area, + the home/end keys will support 'smart' BRIEF-like behaviour + (one press = start/end of line, two presses = start/end of + viewscreen, three presses = start/end of document). +
smooth() - +Method in class processing.core.PApplet +
  +
smooth - +Variable in class processing.core.PFont +
true if smoothing was enabled for this font, used for native impl +
smooth - +Variable in class processing.core.PGraphics +
  +
smooth() - +Method in class processing.core.PGraphics +
If true in PImage, use bilinear interpolation for copy() + operations. +
smooth() - +Method in class processing.core.PGraphics3D +
  +
smooth() - +Method in class processing.core.PGraphicsJava2D +
  +
smooth() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
smoothTriangle - +Variable in class processing.core.PGraphics3D +
Used for anti-aliased and perspective corrected rendering. +
SOFT_LIGHT - +Static variable in interface processing.core.PConstants +
  +
SORENSON - +Static variable in class processing.video.MovieMaker +
  +
sort(byte[]) - +Static method in class processing.core.PApplet +
  +
sort(byte[], int) - +Static method in class processing.core.PApplet +
  +
sort(char[]) - +Static method in class processing.core.PApplet +
  +
sort(char[], int) - +Static method in class processing.core.PApplet +
  +
sort(int[]) - +Static method in class processing.core.PApplet +
  +
sort(int[], int) - +Static method in class processing.core.PApplet +
  +
sort(float[]) - +Static method in class processing.core.PApplet +
  +
sort(float[], int) - +Static method in class processing.core.PApplet +
  +
sort(String[]) - +Static method in class processing.core.PApplet +
  +
sort(String[], int) - +Static method in class processing.core.PApplet +
  +
source(int) - +Method in class processing.video.Capture +
Set the format to ask for from the video digitizer: + TUNER, COMPOSITE, SVIDEO, or COMPONENT. +
SPB - +Static variable in interface processing.core.PConstants +
  +
SPECIFIC_RIGHTS_ALL - +Static variable in interface processing.app.windows.WINNT +
  +
specular(int) - +Method in class processing.core.PApplet +
  +
specular(float) - +Method in class processing.core.PApplet +
  +
specular(float, float, float) - +Method in class processing.core.PApplet +
  +
specular(int) - +Method in class processing.core.PGraphics +
  +
specular(float) - +Method in class processing.core.PGraphics +
  +
specular(float, float, float) - +Method in class processing.core.PGraphics +
  +
specularB - +Variable in class processing.core.PGraphics +
  +
specularB - +Variable in class processing.core.PStyle +
  +
specularG - +Variable in class processing.core.PGraphics +
  +
specularG - +Variable in class processing.core.PStyle +
  +
specularR - +Variable in class processing.core.PGraphics +
  +
specularR - +Variable in class processing.core.PStyle +
  +
speed(float) - +Method in class processing.video.Movie +
Set a multiplier for how fast/slow the movie should be run. +
SPG - +Static variable in interface processing.core.PConstants +
  +
sphere(float) - +Method in class processing.core.PApplet +
  +
SPHERE - +Static variable in interface processing.core.PConstants +
  +
sphere(float) - +Method in class processing.core.PGraphics +
Draw a sphere with radius r centered at coordinate 0, 0, 0. +
sphere(float) - +Method in class processing.core.PGraphics2D +
  +
sphere(float) - +Method in class processing.core.PGraphics3D +
  +
sphere(float) - +Method in class processing.core.PGraphicsJava2D +
  +
sphereDetail(int) - +Method in class processing.core.PApplet +
  +
sphereDetail(int, int) - +Method in class processing.core.PApplet +
  +
sphereDetail(int) - +Method in class processing.core.PGraphics +
  +
sphereDetail(int, int) - +Method in class processing.core.PGraphics +
Set the detail level for approximating a sphere. +
sphereDetail(int) - +Method in class processing.core.PGraphics2D +
  +
sphereDetail(int, int) - +Method in class processing.core.PGraphics2D +
  +
sphereDetailU - +Variable in class processing.core.PGraphics +
  +
sphereDetailV - +Variable in class processing.core.PGraphics +
  +
splice(boolean[], boolean, int) - +Static method in class processing.core.PApplet +
  +
splice(boolean[], boolean[], int) - +Static method in class processing.core.PApplet +
  +
splice(byte[], byte, int) - +Static method in class processing.core.PApplet +
  +
splice(byte[], byte[], int) - +Static method in class processing.core.PApplet +
  +
splice(char[], char, int) - +Static method in class processing.core.PApplet +
  +
splice(char[], char[], int) - +Static method in class processing.core.PApplet +
  +
splice(int[], int, int) - +Static method in class processing.core.PApplet +
  +
splice(int[], int[], int) - +Static method in class processing.core.PApplet +
  +
splice(float[], float, int) - +Static method in class processing.core.PApplet +
  +
splice(float[], float[], int) - +Static method in class processing.core.PApplet +
  +
splice(String[], String, int) - +Static method in class processing.core.PApplet +
  +
splice(String[], String[], int) - +Static method in class processing.core.PApplet +
  +
splice(Object, Object, int) - +Static method in class processing.core.PApplet +
  +
split(String, char) - +Static method in class processing.core.PApplet +
Split a string into pieces along a specific character. +
split(String, String) - +Static method in class processing.core.PApplet +
Split a String on a specific delimiter. +
splitTokens(String) - +Static method in class processing.core.PApplet +
Split the provided String at wherever whitespace occurs. +
splitTokens(String, String) - +Static method in class processing.core.PApplet +
Splits a string into pieces, using any of the chars in the + String 'delim' as separator characters. +
SPOT - +Static variable in interface processing.core.PConstants +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
spotLight(float, float, float, float, float, float, float, float, float, float, float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
SPR - +Static variable in interface processing.core.PConstants +
  +
sq(float) - +Static method in class processing.core.PApplet +
  +
sqrt(float) - +Static method in class processing.core.PApplet +
  +
SQUARE - +Static variable in interface processing.core.PConstants +
  +
SR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
SR - +Static variable in interface processing.core.PConstants +
stroke argb values +
SR_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SR_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SR_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
STANDARD_RIGHTS_ALL - +Static variable in interface processing.app.windows.WINNT +
  +
STANDARD_RIGHTS_EXECUTE - +Static variable in interface processing.app.windows.WINNT +
  +
STANDARD_RIGHTS_READ - +Static variable in interface processing.app.windows.WINNT +
  +
STANDARD_RIGHTS_REQUIRED - +Static variable in interface processing.app.windows.WINNT +
  +
STANDARD_RIGHTS_WRITE - +Static variable in interface processing.app.windows.WINNT +
  +
STAR - +Static variable in interface antlr.java.JavaTokenTypes +
  +
STAR - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
STAR - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
STAR_ASSIGN - +Static variable in interface antlr.java.JavaTokenTypes +
  +
STAR_ASSIGN - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
STAR_ASSIGN - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
start() - +Method in class processing.core.PApplet +
Called by the browser or applet viewer to inform this applet that it + should start its execution. +
startBuilding(String, int) - +Method in class processing.xml.StdXMLBuilder +
This method is called before the parser starts processing its input. +
startCompoundEdit() - +Method in class processing.app.Editor +
Use before a manipulating text to group editing operations together as a + single undo. +
startElement(String, String, String, String, int) - +Method in class processing.xml.StdXMLBuilder +
This method is called when a new XML element is encountered. +
startNewStream(Reader) - +Method in class processing.xml.StdXMLReader +
Starts a new stream from a Java reader. +
startNewStream(Reader, boolean) - +Method in class processing.xml.StdXMLReader +
Starts a new stream from a Java reader. +
StartService(Pointer, int, char[]) - +Method in interface processing.app.windows.Advapi32 +
  +
StartServiceCtrlDispatcher(Structure[]) - +Method in interface processing.app.windows.Advapi32 +
  +
statement() - +Method in class antlr.java.JavaRecognizer +
  +
statement() - +Method in class processing.app.preproc.PdeRecognizer +
  +
STATIC - +Static variable in class processing.app.preproc.PdePreprocessor +
  +
STATIC_INIT - +Static variable in interface antlr.java.JavaTokenTypes +
  +
STATIC_INIT - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
STATIC_INIT - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
staticProgram() - +Method in class processing.app.preproc.PdeRecognizer +
  +
status(String) - +Method in class processing.core.PApplet +
Show status in the status bar of a web browser, or in the + System.out console. +
statusEmpty() - +Method in class processing.app.Editor +
Clear the status area. +
statusError(String) - +Method in class processing.app.Commander +
  +
statusError(Exception) - +Method in class processing.app.Commander +
  +
statusError(String) - +Method in interface processing.app.debug.RunnerListener +
  +
statusError(Exception) - +Method in interface processing.app.debug.RunnerListener +
  +
statusError(String) - +Method in class processing.app.Editor +
Show an error int the status bar. +
statusError(Exception) - +Method in class processing.app.Editor +
Show an exception in the editor status bar. +
statusNotice(String) - +Method in class processing.app.Editor +
Show a notice message in the editor status bar. +
StdXMLBuilder - Class in processing.xml
StdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + tree of IXMLElement from an XML data source.
StdXMLBuilder() - +Constructor for class processing.xml.StdXMLBuilder +
Creates the builder. +
StdXMLBuilder(XMLElement) - +Constructor for class processing.xml.StdXMLBuilder +
  +
StdXMLParser - Class in processing.xml
StdXMLParser is the core parser of NanoXML.
StdXMLParser() - +Constructor for class processing.xml.StdXMLParser +
Creates a new parser. +
StdXMLReader - Class in processing.xml
StdXMLReader reads the data to be parsed.
StdXMLReader(String, String) - +Constructor for class processing.xml.StdXMLReader +
Initializes the reader from a system and public ID. +
StdXMLReader(Reader) - +Constructor for class processing.xml.StdXMLReader +
Initializes the XML reader. +
StdXMLReader(InputStream) - +Constructor for class processing.xml.StdXMLReader +
Initializes the XML reader. +
stop() - +Method in class processing.core.PApplet +
Called by the browser or applet viewer to inform + this applet that it should stop its execution. +
stop() - +Method in class processing.net.Client +
Disconnect from the server and calls disconnectEvent(Client c) + in the host PApplet. +
stop() - +Method in class processing.net.Server +
Disconnect all clients and stop the server. +
stop() - +Method in class processing.serial.Serial +
Stop talking to serial and shut things down. +
stop() - +Method in class processing.video.Capture +
Called by applets to stop capturing video. +
stop() - +Method in class processing.video.Movie +
Stop the movie, and rewind. +
stopbits - +Variable in class processing.serial.Serial +
  +
stopCompoundEdit() - +Method in class processing.app.Editor +
Use with startCompoundEdit() to group edit operations in a single undo. +
str(boolean) - +Static method in class processing.core.PApplet +
  +
str(byte) - +Static method in class processing.core.PApplet +
  +
str(char) - +Static method in class processing.core.PApplet +
  +
str(int) - +Static method in class processing.core.PApplet +
  +
str(float) - +Static method in class processing.core.PApplet +
  +
str(boolean[]) - +Static method in class processing.core.PApplet +
  +
str(byte[]) - +Static method in class processing.core.PApplet +
  +
str(char[]) - +Static method in class processing.core.PApplet +
  +
str(int[]) - +Static method in class processing.core.PApplet +
  +
str(float[]) - +Static method in class processing.core.PApplet +
  +
StreamRedirectThread - Class in processing.app.debug
StreamRedirectThread is a thread which copies it's input to + it's output and terminates when it completes.
StreamRedirectThread(String, InputStream, OutputStream) - +Constructor for class processing.app.debug.StreamRedirectThread +
Set up for copy. +
STRICTFP - +Static variable in interface antlr.java.JavaTokenTypes +
  +
STRICTFP - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
STRICTFP - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
STRING_LITERAL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
STRING_LITERAL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
STRING_LITERAL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
stringReader(String) - +Static method in class processing.xml.StdXMLReader +
Creates a new reader using a string as input. +
stroke(int) - +Method in class processing.core.PApplet +
  +
stroke(int, float) - +Method in class processing.core.PApplet +
  +
stroke(float) - +Method in class processing.core.PApplet +
  +
stroke(float, float) - +Method in class processing.core.PApplet +
  +
stroke(float, float, float) - +Method in class processing.core.PApplet +
  +
stroke(float, float, float, float) - +Method in class processing.core.PApplet +
  +
stroke - +Variable in class processing.core.PGraphics +
true if stroke() is enabled, (read-only) +
stroke(int) - +Method in class processing.core.PGraphics +
Set the tint to either a grayscale or ARGB value. +
stroke(int, float) - +Method in class processing.core.PGraphics +
  +
stroke(float) - +Method in class processing.core.PGraphics +
  +
stroke(float, float) - +Method in class processing.core.PGraphics +
  +
stroke(float, float, float) - +Method in class processing.core.PGraphics +
  +
stroke(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
stroke - +Variable in class processing.core.PStyle +
  +
strokeCap(int) - +Method in class processing.core.PApplet +
  +
strokeCap - +Variable in class processing.core.PGraphics +
Set by strokeCap() (read-only). +
strokeCap(int) - +Method in class processing.core.PGraphics +
  +
strokeCap(int) - +Method in class processing.core.PGraphics3D +
  +
strokeCap(int) - +Method in class processing.core.PGraphicsJava2D +
  +
strokeCap - +Variable in class processing.core.PStyle +
  +
strokeCap(int) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
strokeColor - +Variable in class processing.core.PGraphics +
stroke that was last set (read-only) +
strokeColor - +Variable in class processing.core.PStyle +
  +
strokeGradient - +Variable in class processing.core.PGraphicsJava2D +
  +
strokeGradientObject - +Variable in class processing.core.PGraphicsJava2D +
  +
strokeJoin(int) - +Method in class processing.core.PApplet +
  +
strokeJoin - +Variable in class processing.core.PGraphics +
Set by strokeJoin() (read-only). +
strokeJoin(int) - +Method in class processing.core.PGraphics +
  +
strokeJoin(int) - +Method in class processing.core.PGraphics3D +
  +
strokeJoin(int) - +Method in class processing.core.PGraphicsJava2D +
  +
strokeJoin - +Variable in class processing.core.PStyle +
  +
strokeJoin(int) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
strokeWeight(float) - +Method in class processing.core.PApplet +
  +
strokeWeight - +Variable in class processing.core.PGraphics +
Last value set by strokeWeight() (read-only). +
strokeWeight(float) - +Method in class processing.core.PGraphics +
  +
strokeWeight(float) - +Method in class processing.core.PGraphicsJava2D +
  +
strokeWeight - +Variable in class processing.core.PStyle +
  +
strokeWeight(float) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
style(PStyle) - +Method in class processing.core.PApplet +
  +
style(PStyle) - +Method in class processing.core.PGraphics +
  +
styles - +Variable in class processing.app.syntax.TextAreaDefaults +
  +
sub(PVector) - +Method in class processing.core.PVector +
Subtract a vector from this vector +
sub(float, float, float) - +Method in class processing.core.PVector +
  +
sub(PVector, PVector) - +Static method in class processing.core.PVector +
Subtract one vector from another +
sub(PVector, PVector, PVector) - +Static method in class processing.core.PVector +
  +
subset(boolean[], int) - +Static method in class processing.core.PApplet +
  +
subset(boolean[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(byte[], int) - +Static method in class processing.core.PApplet +
  +
subset(byte[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(char[], int) - +Static method in class processing.core.PApplet +
  +
subset(char[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(int[], int) - +Static method in class processing.core.PApplet +
  +
subset(int[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(float[], int) - +Static method in class processing.core.PApplet +
  +
subset(float[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(String[], int) - +Static method in class processing.core.PApplet +
  +
subset(String[], int, int) - +Static method in class processing.core.PApplet +
  +
subset(Object, int) - +Static method in class processing.core.PApplet +
  +
subset(Object, int, int) - +Static method in class processing.core.PApplet +
  +
SUBTRACT - +Static variable in interface processing.core.PConstants +
  +
SUPER_CTOR_CALL - +Static variable in interface antlr.java.JavaTokenTypes +
  +
SUPER_CTOR_CALL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
SUPER_CTOR_CALL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
superClassClause() - +Method in class antlr.java.JavaRecognizer +
  +
superClassClause() - +Method in class processing.app.preproc.PdeRecognizer +
  +
supportsMultilineTokens() - +Method in class processing.app.syntax.TokenMarker +
Returns if the token marker supports tokens that span multiple + lines. +
SVIDEO - +Static variable in class processing.video.Capture +
  +
SW - +Static variable in interface processing.core.PConstants +
stroke weight +
SYNCHRONIZE - +Static variable in interface processing.app.windows.WINNT +
  +
SyntaxDocument - Class in processing.app.syntax
A document implementation that can be tokenized by the syntax highlighting + system.
SyntaxDocument() - +Constructor for class processing.app.syntax.SyntaxDocument +
  +
SyntaxStyle - Class in processing.app.syntax
A simple text style class.
SyntaxStyle(Color, boolean, boolean) - +Constructor for class processing.app.syntax.SyntaxStyle +
Creates a new SyntaxStyle. +
SyntaxUtilities - Class in processing.app.syntax
Class with several utility functions used by jEdit's syntax colorizing + subsystem.
systemErr - +Static variable in class processing.app.EditorConsole +
  +
systemOut - +Static variable in class processing.app.EditorConsole +
  +
+
+

+T

+
+
TAB - +Static variable in interface processing.core.PConstants +
  +
tan(float) - +Static method in class processing.core.PApplet +
  +
TARGA - +Static variable in interface processing.core.PConstants +
  +
text(char) - +Method in class processing.core.PApplet +
  +
text(char, float, float) - +Method in class processing.core.PApplet +
  +
text(char, float, float, float) - +Method in class processing.core.PApplet +
  +
text(String) - +Method in class processing.core.PApplet +
  +
text(String, float, float) - +Method in class processing.core.PApplet +
  +
text(char[], int, int, float, float) - +Method in class processing.core.PApplet +
  +
text(String, float, float, float) - +Method in class processing.core.PApplet +
  +
text(char[], int, int, float, float, float) - +Method in class processing.core.PApplet +
  +
text(String, float, float, float, float) - +Method in class processing.core.PApplet +
  +
text(String, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
text(int, float, float) - +Method in class processing.core.PApplet +
  +
text(int, float, float, float) - +Method in class processing.core.PApplet +
  +
text(float, float, float) - +Method in class processing.core.PApplet +
  +
text(float, float, float, float) - +Method in class processing.core.PApplet +
  +
TEXT - +Static variable in interface processing.core.PConstants +
  +
text(char) - +Method in class processing.core.PGraphics +
Write text where we just left off. +
text(char, float, float) - +Method in class processing.core.PGraphics +
Draw a single character on screen. +
text(char, float, float, float) - +Method in class processing.core.PGraphics +
Draw a single character on screen (with a z coordinate) +
text(String) - +Method in class processing.core.PGraphics +
Write text where we just left off. +
text(String, float, float) - +Method in class processing.core.PGraphics +
Draw a chunk of text. +
text(char[], int, int, float, float) - +Method in class processing.core.PGraphics +
Method to draw text from an array of chars. +
text(String, float, float, float) - +Method in class processing.core.PGraphics +
Same as above but with a z coordinate. +
text(char[], int, int, float, float, float) - +Method in class processing.core.PGraphics +
  +
text(String, float, float, float, float) - +Method in class processing.core.PGraphics +
Draw text in a box that is constrained to a particular size. +
text(String, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
text(int, float, float) - +Method in class processing.core.PGraphics +
  +
text(int, float, float, float) - +Method in class processing.core.PGraphics +
  +
text(float, float, float) - +Method in class processing.core.PGraphics +
This does a basic number formatting, to avoid the + generally ugly appearance of printing floats. +
text(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
textAlign(int) - +Method in class processing.core.PApplet +
  +
textAlign(int, int) - +Method in class processing.core.PApplet +
  +
textAlign - +Variable in class processing.core.PGraphics +
The current text align (read-only) +
textAlign(int) - +Method in class processing.core.PGraphics +
Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. +
textAlign(int, int) - +Method in class processing.core.PGraphics +
Sets the horizontal and vertical alignment of the text. +
textAlign - +Variable in class processing.core.PStyle +
  +
textAlignY - +Variable in class processing.core.PGraphics +
The current vertical text alignment (read-only) +
textAlignY - +Variable in class processing.core.PStyle +
  +
TextAreaDefaults - Class in processing.app.syntax
Encapsulates default settings for a text area.
TextAreaDefaults() - +Constructor for class processing.app.syntax.TextAreaDefaults +
  +
TextAreaPainter - Class in processing.app.syntax
The text area repaint manager.
TextAreaPainter(JEditTextArea, TextAreaDefaults) - +Constructor for class processing.app.syntax.TextAreaPainter +
Creates a new repaint manager. +
TextAreaPainter.Highlight - Interface in processing.app.syntax
Highlight interface.
textAscent() - +Method in class processing.core.PApplet +
  +
textAscent() - +Method in class processing.core.PGraphics +
Returns the ascent of the current font at the current size. +
textAscent() - +Method in class processing.core.PGraphicsJava2D +
  +
textAscent() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
textDescent() - +Method in class processing.core.PApplet +
  +
textDescent() - +Method in class processing.core.PGraphics +
Returns the descent of the current font at the current size. +
textDescent() - +Method in class processing.core.PGraphicsJava2D +
  +
textDescent() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
textFont(PFont) - +Method in class processing.core.PApplet +
  +
textFont(PFont, float) - +Method in class processing.core.PApplet +
  +
textFont - +Variable in class processing.core.PGraphics +
The current text font (read-only) +
textFont(PFont) - +Method in class processing.core.PGraphics +
Sets the current font. +
textFont(PFont, float) - +Method in class processing.core.PGraphics +
Useful function to set the font and size at the same time. +
textFont - +Variable in class processing.core.PStyle +
  +
textFont(PFont) - +Method in class processing.opengl.PGraphicsOpenGL +
  +
textLeading(float) - +Method in class processing.core.PApplet +
  +
textLeading - +Variable in class processing.core.PGraphics +
The current text leading (read-only) +
textLeading(float) - +Method in class processing.core.PGraphics +
Set the text leading to a specific value. +
textLeading - +Variable in class processing.core.PStyle +
  +
textMode(int) - +Method in class processing.core.PApplet +
  +
textMode - +Variable in class processing.core.PGraphics +
The current text mode (read-only) +
textMode(int) - +Method in class processing.core.PGraphics +
Sets the text rendering/placement to be either SCREEN (direct + to the screen, exact coordinates, only use the font's original size) + or MODEL (the default, where text is manipulated by translate() and + can have a textSize). +
textMode - +Variable in class processing.core.PStyle +
  +
textMode(int) - +Method in class processing.pdf.PGraphicsPDF +
Change the textMode() to either SHAPE or MODEL. +
textSize(float) - +Method in class processing.core.PApplet +
  +
textSize - +Variable in class processing.core.PGraphics +
The current text size (read-only) +
textSize(float) - +Method in class processing.core.PGraphics +
Sets the text size, also resets the value for the leading. +
textSize(float) - +Method in class processing.core.PGraphicsJava2D +
Same as parent, but override for native version of the font. +
textSize - +Variable in class processing.core.PStyle +
  +
texture(PImage) - +Method in class processing.core.PApplet +
  +
texture(PImage) - +Method in class processing.core.PGraphics +
Set texture image for current shape. +
texture(PImage) - +Method in class processing.core.PGraphics3D +
  +
texture(PImage) - +Method in class processing.core.PGraphicsJava2D +
  +
texture(PImage) - +Method in class processing.core.PSmoothTriangle +
  +
textureImage - +Variable in class processing.core.PGraphics +
Current image being used as a texture +
textureMode(int) - +Method in class processing.core.PApplet +
  +
textureMode - +Variable in class processing.core.PGraphics +
Sets whether texture coordinates passed to + vertex() calls will be based on coordinates that are + based on the IMAGE or NORMALIZED. +
textureMode(int) - +Method in class processing.core.PGraphics +
Set texture mode to either to use coordinates based on the IMAGE + (more intuitive for new users) or NORMALIZED (better for advanced chaps) +
textureU - +Variable in class processing.core.PGraphics +
Current horizontal coordinate for texture, will always + be between 0 and 1, even if using textureMode(IMAGE). +
textureV - +Variable in class processing.core.PGraphics +
Current vertical coordinate for texture, see above. +
TextUtilities - Class in processing.app.syntax
Class with several utility functions used by the text area component.
TextUtilities() - +Constructor for class processing.app.syntax.TextUtilities +
  +
textWidth(char) - +Method in class processing.core.PApplet +
  +
textWidth(String) - +Method in class processing.core.PApplet +
  +
textWidth(char) - +Method in class processing.core.PGraphics +
  +
textWidth(String) - +Method in class processing.core.PGraphics +
Return the width of a line of text. +
theight - +Variable in class processing.core.PFont +
texture height, same as mbox2, but reserved for future use +
Theme - Class in processing.app
Storage class for theme settings.
Theme() - +Constructor for class processing.app.Theme +
  +
ThinkDifferent - Class in processing.app.macosx
Deal with issues related to thinking different.
ThinkDifferent(Base) - +Constructor for class processing.app.macosx.ThinkDifferent +
  +
THIRD_PI - +Static variable in interface processing.core.PConstants +
  +
THRESHOLD - +Static variable in interface processing.core.PConstants +
  +
throwsClause() - +Method in class antlr.java.JavaRecognizer +
  +
throwsClause() - +Method in class processing.app.preproc.PdeRecognizer +
  +
TIFF - +Static variable in interface processing.core.PConstants +
  +
time() - +Method in class processing.video.Movie +
Return the current time in seconds. +
tint(int) - +Method in class processing.core.PApplet +
  +
tint(int, float) - +Method in class processing.core.PApplet +
  +
tint(float) - +Method in class processing.core.PApplet +
  +
tint(float, float) - +Method in class processing.core.PApplet +
  +
tint(float, float, float) - +Method in class processing.core.PApplet +
  +
tint(float, float, float, float) - +Method in class processing.core.PApplet +
  +
tint - +Variable in class processing.core.PGraphics +
True if tint() is enabled (read-only). +
tint(int) - +Method in class processing.core.PGraphics +
Set the tint to either a grayscale or ARGB value. +
tint(int, float) - +Method in class processing.core.PGraphics +
  +
tint(float) - +Method in class processing.core.PGraphics +
  +
tint(float, float) - +Method in class processing.core.PGraphics +
  +
tint(float, float, float) - +Method in class processing.core.PGraphics +
  +
tint(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
tint - +Variable in class processing.core.PStyle +
  +
tintColor - +Variable in class processing.core.PGraphics +
tint that was last set (read-only) +
tintColor - +Variable in class processing.core.PStyle +
  +
TOGGLE_RECT - +Static variable in class processing.app.syntax.InputHandler +
  +
Token - Class in processing.app.syntax
A linked list of tokens.
Token(int, byte) - +Constructor for class processing.app.syntax.Token +
Creates a new token. +
token - +Variable in class processing.app.syntax.TokenMarker.LineInfo +
The id of the last token of the line. +
tokenizeLines() - +Method in class processing.app.syntax.SyntaxDocument +
Reparses the document, by passing all lines to the token + marker. +
tokenizeLines(int, int) - +Method in class processing.app.syntax.SyntaxDocument +
Reparses the document, by passing the specified lines to the + token marker. +
TokenMarker - Class in processing.app.syntax
A token marker that splits lines of text into tokens.
TokenMarker.LineInfo - Class in processing.app.syntax
Inner class for storing information about tokenized lines.
TokenMarker.LineInfo() - +Constructor for class processing.app.syntax.TokenMarker.LineInfo +
Creates a new LineInfo object with token = Token.NULL + and obj = null. +
TokenMarker.LineInfo(byte, Object) - +Constructor for class processing.app.syntax.TokenMarker.LineInfo +
Creates a new LineInfo object with the specified + parameters. +
TokenStreamCopyingHiddenTokenFilter - Class in antlr
This class provides TokenStreamHiddenTokenFilters with the concept of + tokens which can be copied so that they are seen by both the hidden token + stream as well as the parser itself.
TokenStreamCopyingHiddenTokenFilter(TokenStream) - +Constructor for class antlr.TokenStreamCopyingHiddenTokenFilter +
  +
Tool - Interface in processing.app.tools
Interface for items to be shown in the Tools menu.
TOP - +Static variable in interface processing.core.PConstants +
Align text to the top +
topExtent - +Variable in class processing.core.PFont +
  +
toString() - +Method in class processing.app.syntax.SyntaxStyle +
Returns a string representation of this object. +
toString() - +Method in class processing.app.syntax.Token +
Returns a string representation of this token. +
toString() - +Method in class processing.core.PVector +
  +
toString(boolean) - +Method in class processing.xml.XMLElement +
  +
toString() - +Method in exception processing.xml.XMLException +
Returns a string representation of the exception. +
translate(float, float) - +Method in class processing.core.PApplet +
  +
translate(float, float, float) - +Method in class processing.core.PApplet +
  +
translate(float, float) - +Method in class processing.core.PGraphics +
Translate in X and Y. +
translate(float, float, float) - +Method in class processing.core.PGraphics +
Translate in X, Y, and Z. +
translate(float, float) - +Method in class processing.core.PGraphics2D +
  +
translate(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
translate(float, float) - +Method in class processing.core.PGraphics3D +
  +
translate(float, float, float) - +Method in class processing.core.PGraphics3D +
  +
translate(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
translate(float, float) - +Method in interface processing.core.PMatrix +
  +
translate(float, float, float) - +Method in interface processing.core.PMatrix +
  +
translate(float, float) - +Method in class processing.core.PMatrix2D +
  +
translate(float, float, float) - +Method in class processing.core.PMatrix2D +
  +
translate(float, float) - +Method in class processing.core.PMatrix3D +
  +
translate(float, float, float) - +Method in class processing.core.PMatrix3D +
  +
translate(float, float) - +Method in class processing.core.PShape +
  +
translate(float, float, float) - +Method in class processing.core.PShape +
  +
transpose() - +Method in interface processing.core.PMatrix +
Transpose this matrix. +
transpose() - +Method in class processing.core.PMatrix2D +
Transpose this matrix. +
transpose() - +Method in class processing.core.PMatrix3D +
Transpose this matrix. +
TRI_COLOR_COUNT - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_A - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_B - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_G - +Static variable in class processing.core.PGraphics3D +
  +
TRI_DIFFUSE_R - +Static variable in class processing.core.PGraphics3D +
  +
TRI_SPECULAR_B - +Static variable in class processing.core.PGraphics3D +
  +
TRI_SPECULAR_G - +Static variable in class processing.core.PGraphics3D +
  +
TRI_SPECULAR_R - +Static variable in class processing.core.PGraphics3D +
  +
triangle(float, float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
TRIANGLE - +Static variable in interface processing.core.PConstants +
  +
triangle(float, float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
triangle - +Variable in class processing.core.PGraphics3D +
  +
triangle(float, float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
TRIANGLE_FAN - +Static variable in interface processing.core.PConstants +
  +
TRIANGLE_STRIP - +Static variable in interface processing.core.PConstants +
  +
TRIANGLES - +Static variable in interface processing.core.PConstants +
  +
trim(String) - +Static method in class processing.core.PApplet +
Remove whitespace characters from the beginning and ending + of a String. +
trim(String[]) - +Static method in class processing.core.PApplet +
Trim the whitespace from a String array. +
tryBlock() - +Method in class antlr.java.JavaRecognizer +
  +
tryBlock() - +Method in class processing.app.preproc.PdeRecognizer +
  +
TUNER - +Static variable in class processing.video.Capture +
  +
twidth - +Variable in class processing.core.PFont +
texture width, same as mbox2, but reserved for future use +
TWO_PI - +Static variable in interface processing.core.PConstants +
  +
TX - +Static variable in interface processing.core.PConstants +
  +
TY - +Static variable in interface processing.core.PConstants +
  +
type() - +Method in class antlr.java.JavaRecognizer +
  +
TYPE - +Static variable in interface antlr.java.JavaTokenTypes +
  +
TYPE - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
type() - +Method in class processing.app.preproc.PdeRecognizer +
  +
TYPE - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
TYPECAST - +Static variable in interface antlr.java.JavaTokenTypes +
  +
TYPECAST - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
TYPECAST - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
typeDefinition() - +Method in class antlr.java.JavaRecognizer +
  +
typeDefinition() - +Method in class processing.app.preproc.PdeRecognizer +
  +
typeSpec(boolean) - +Method in class antlr.java.JavaRecognizer +
  +
typeSpec(boolean) - +Method in class processing.app.preproc.PdeRecognizer +
  +
TZ - +Static variable in interface processing.core.PConstants +
  +
+
+

+U

+
+
U - +Static variable in interface processing.core.PConstants +
  +
UNARY_MINUS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
UNARY_MINUS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
UNARY_MINUS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
UNARY_PLUS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
UNARY_PLUS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
UNARY_PLUS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
unaryExpression() - +Method in class antlr.java.JavaRecognizer +
  +
unaryExpression() - +Method in class processing.app.preproc.PdeRecognizer +
  +
unaryExpressionNotPlusMinus() - +Method in class antlr.java.JavaRecognizer +
  +
unaryExpressionNotPlusMinus() - +Method in class processing.app.preproc.PdeRecognizer +
  +
unbinary(String) - +Static method in class processing.core.PApplet +
Unpack a binary String into an int. +
unedit() - +Method in class processing.app.EditorStatus +
  +
unexpand() - +Method in class processing.core.PSmoothTriangle +
  +
UNEXPECTED_ATTRIBUTE - +Static variable in exception processing.xml.XMLValidationException +
An unexpected attribute was encountered. +
UNEXPECTED_ELEMENT - +Static variable in exception processing.xml.XMLValidationException +
An unexpected element was encountered. +
UNEXPECTED_PCDATA - +Static variable in exception processing.xml.XMLValidationException +
An unexpected PCDATA element was encountered. +
unhex(String) - +Static method in class processing.core.PApplet +
  +
UNICODE_OPTIONS - +Static variable in interface processing.app.windows.Options +
  +
unnotice(String) - +Method in class processing.app.EditorStatus +
  +
unread(char) - +Method in class processing.xml.StdXMLReader +
Pushes the last character read back to the stream. +
unregisterDispose(Object) - +Method in class processing.core.PApplet +
  +
unregisterDraw(Object) - +Method in class processing.core.PApplet +
  +
unregisterKeyEvent(Object) - +Method in class processing.core.PApplet +
  +
unregisterMouseEvent(Object) - +Method in class processing.core.PApplet +
  +
unregisterPost(Object) - +Method in class processing.core.PApplet +
  +
unregisterPre(Object) - +Method in class processing.core.PApplet +
  +
unregisterSize(Object) - +Method in class processing.core.PApplet +
  +
UP - +Static variable in interface processing.core.PConstants +
  +
update() - +Method in class processing.app.tools.CreateFont +
  +
update(Graphics) - +Method in class processing.core.PApplet +
  +
UpdateCheck - Class in processing.app
Threaded class to check for updates in the background.
UpdateCheck(Base) - +Constructor for class processing.app.UpdateCheck +
  +
updateMouse() - +Method in class processing.app.tools.ColorSelector.ColorRange +
  +
updateMouse() - +Method in class processing.app.tools.ColorSelector.ColorSlider +
  +
updatePixels() - +Method in class processing.core.PApplet +
  +
updatePixels(int, int, int, int) - +Method in class processing.core.PApplet +
  +
updatePixels() - +Method in class processing.core.PGraphicsJava2D +
Update the pixels[] buffer to the PGraphics image. +
updatePixels(int, int, int, int) - +Method in class processing.core.PGraphicsJava2D +
Update the pixels[] buffer to the PGraphics image. +
updatePixels() - +Method in class processing.core.PImage +
Call this when finished messing with the pixels[] array. +
updatePixels(int, int, int, int) - +Method in class processing.core.PImage +
Mark the pixels in this region as needing an update. +
updatePixels() - +Method in class processing.opengl.PGraphicsOpenGL +
  +
updatePixels() - +Method in class processing.pdf.PGraphicsPDF +
  +
updatePixels(int, int, int, int) - +Method in class processing.pdf.PGraphicsPDF +
  +
updateScrollBars() - +Method in class processing.app.syntax.JEditTextArea +
Updates the state of the scroll bars. +
+
+

+V

+
+
V - +Static variable in interface processing.core.PConstants +
  +
validExtension(String) - +Method in class processing.app.Sketch +
Check this extension (no dots, please) against the list of valid + extensions. +
value - +Variable in class processing.core.PFont +
  +
valueExists(Registry.REGISTRY_ROOT_KEY, String, String) - +Static method in class processing.app.windows.Registry +
Check for existence of a value. +
valueOf(String) - +Static method in enum processing.app.windows.Registry.REGISTRY_ROOT_KEY +
Returns the enum constant of this type with the specified name. +
values() - +Static method in enum processing.app.windows.Registry.REGISTRY_ROOT_KEY +
Returns an array containing the constants of this enum type, in +the order they're declared. +
VARIABLE_DEF - +Static variable in interface antlr.java.JavaTokenTypes +
  +
VARIABLE_DEF - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
VARIABLE_DEF - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
variableDeclarator(AST, AST) - +Method in class antlr.java.JavaRecognizer +
Declaration of a variable. +
variableDeclarator(AST, AST) - +Method in class processing.app.preproc.PdeRecognizer +
  +
variableDefinitions(AST, AST) - +Method in class antlr.java.JavaRecognizer +
  +
variableDefinitions(AST, AST) - +Method in class processing.app.preproc.PdeRecognizer +
  +
varInitializer() - +Method in class antlr.java.JavaRecognizer +
  +
varInitializer() - +Method in class processing.app.preproc.PdeRecognizer +
  +
vertex(float, float) - +Method in class processing.core.PApplet +
  +
vertex(float, float, float) - +Method in class processing.core.PApplet +
  +
vertex(float[]) - +Method in class processing.core.PApplet +
  +
vertex(float, float, float, float) - +Method in class processing.core.PApplet +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PApplet +
  +
vertex(float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float, float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float[]) - +Method in class processing.core.PGraphics +
Used by renderer subclasses or PShape to efficiently pass in already + formatted vertex information. +
vertex(float, float, float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PGraphics +
  +
vertex(float, float, float) - +Method in class processing.core.PGraphics2D +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PGraphics2D +
  +
vertex(float, float) - +Method in class processing.core.PGraphics3D +
  +
vertex(float, float, float, float) - +Method in class processing.core.PGraphics3D +
  +
vertex(float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
vertex(float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
vertex(float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
vertex(float, float, float, float, float) - +Method in class processing.core.PGraphicsJava2D +
  +
VERTEX - +Static variable in class processing.core.PShape +
  +
vertex(float, float) - +Method in class processing.dxf.RawDXF +
  +
vertex(float, float, float) - +Method in class processing.dxf.RawDXF +
  +
vertex(Object) - +Method in class processing.opengl.PGraphicsOpenGL.TessCallback +
  +
VERTEX_FIELD_COUNT - +Static variable in interface processing.core.PConstants +
  +
VIDEO - +Static variable in class processing.video.MovieMaker +
  +
vmDeathEvent(VMDeathEvent) - +Method in class processing.app.debug.EventThread +
  +
vmDisconnectEvent(VMDisconnectEvent) - +Method in class processing.app.debug.EventThread +
  +
VOCAB - +Static variable in interface antlr.java.JavaTokenTypes +
  +
VOCAB - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
VOCAB - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
VW - +Static variable in interface processing.core.PConstants +
  +
VX - +Static variable in interface processing.core.PConstants +
  +
VY - +Static variable in interface processing.core.PConstants +
  +
VZ - +Static variable in interface processing.core.PConstants +
  +
+
+

+W

+
+
WAIT - +Static variable in interface processing.core.PConstants +
  +
WEBCOLOR_LITERAL - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
webcolor_literal() - +Method in class processing.app.preproc.PdeRecognizer +
  +
WEBCOLOR_LITERAL - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
WebServer - Class in processing.app
An example of a very simple, multi-threaded HTTP server.
WebServer() - +Constructor for class processing.app.WebServer +
  +
WHITESPACE - +Static variable in interface processing.core.PConstants +
  +
width - +Variable in class processing.core.PApplet +
width of this applet's associated PGraphics +
width - +Variable in class processing.core.PFont +
  +
width(char) - +Method in class processing.core.PFont +
Width of this character for a font of size 1. +
width - +Variable in class processing.core.PImage +
  +
width - +Variable in class processing.core.PShape +
  +
WINBASE - Interface in processing.app.windows
 
WINBASE.FILETIME - Class in processing.app.windows
 
WINBASE.FILETIME() - +Constructor for class processing.app.windows.WINBASE.FILETIME +
  +
WINBASE.SECURITY_ATTRIBUTES - Class in processing.app.windows
 
WINBASE.SECURITY_ATTRIBUTES() - +Constructor for class processing.app.windows.WINBASE.SECURITY_ATTRIBUTES +
  +
WINDOWS - +Static variable in interface processing.core.PConstants +
  +
WINERROR - Interface in processing.app.windows
 
WINNT - Interface in processing.app.windows
 
WINREG - Interface in processing.app.windows
 
WORST - +Static variable in class processing.video.MovieMaker +
  +
write(byte[], int, int, boolean) - +Method in class processing.app.EditorConsole +
  +
write() - +Method in class processing.app.preproc.PdePreprocessor +
preprocesses a pde file and write out a java file +
write(String, float) - +Method in class processing.dxf.RawDXF +
Write a command on one line (as a String), then start a new line + and write out a formatted float. +
write(int) - +Method in class processing.net.Client +
This will handle ints, bytes and chars transparently. +
write(byte[]) - +Method in class processing.net.Client +
  +
write(String) - +Method in class processing.net.Client +
Write a String to the output. +
write(int) - +Method in class processing.net.Server +
Write a value to all the connected clients. +
write(byte[]) - +Method in class processing.net.Server +
Write a byte array to all the connected clients. +
write(String) - +Method in class processing.net.Server +
Write a String to all the connected clients. +
write(int) - +Method in class processing.serial.Serial +
This will handle both ints, bytes and chars transparently. +
write(byte[]) - +Method in class processing.serial.Serial +
  +
write(String) - +Method in class processing.serial.Serial +
Write a String to the output. +
write(XMLElement) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
write(XMLElement, boolean) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
write(XMLElement, boolean, int) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
write(XMLElement, boolean, int, boolean) - +Method in class processing.xml.XMLWriter +
Writes an XML element. +
WRITE_DAC - +Static variable in interface processing.app.windows.WINNT +
  +
WRITE_OWNER - +Static variable in interface processing.app.windows.WINNT +
  +
writePrefix(String, String, String, String[]) - +Method in class processing.app.preproc.PdePreprocessor +
  +
WS - +Static variable in interface antlr.java.JavaTokenTypes +
  +
WS - +Static variable in interface processing.app.preproc.PdePartialTokenTypes +
  +
WS - +Static variable in interface processing.app.preproc.PdeTokenTypes +
  +
+
+

+X

+
+
X - +Static variable in interface processing.core.PConstants +
  +
x - +Variable in class processing.core.PVector +
The x component of the vector. +
XMLElement - Class in processing.xml
XMLElement is an XML element.
XMLElement() - +Constructor for class processing.xml.XMLElement +
Creates an empty element to be used for #PCDATA content. +
XMLElement(String, String, String, int) - +Constructor for class processing.xml.XMLElement +
Creates an empty element. +
XMLElement(PApplet, String) - +Constructor for class processing.xml.XMLElement +
Begin parsing XML data passed in from a PApplet. +
XMLElement(Reader) - +Constructor for class processing.xml.XMLElement +
  +
XMLElement(String) - +Constructor for class processing.xml.XMLElement +
  +
XMLEntityResolver - Class in processing.xml
An XMLEntityResolver resolves entities.
XMLEntityResolver() - +Constructor for class processing.xml.XMLEntityResolver +
Initializes the resolver. +
XMLException - Exception in processing.xml
An XMLException is thrown when an exception occurred while processing the + XML data.
XMLException(String) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(Exception) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(String, int, Exception) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(String, int, String) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLException(String, int, Exception, String, boolean) - +Constructor for exception processing.xml.XMLException +
Creates a new exception. +
XMLParseException - Exception in processing.xml
An XMLParseException is thrown when the XML passed to the XML parser is not + well-formed.
XMLParseException(String) - +Constructor for exception processing.xml.XMLParseException +
Creates a new exception. +
XMLParseException(String, int, String) - +Constructor for exception processing.xml.XMLParseException +
Creates a new exception. +
xmlSerialize(Writer) - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
xmlSerializeNode(Writer) - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
xmlSerializeRootClose(Writer) - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
xmlSerializeRootOpen(Writer) - +Method in class antlr.ExtendedCommonASTWithHiddenTokens +
  +
XMLValidationException - Exception in processing.xml
An XMLValidationException is thrown when the XML passed to the XML parser is + well-formed but not valid.
XMLValidationException(int, String, int, String, String, String, String) - +Constructor for exception processing.xml.XMLValidationException +
Creates a new exception. +
XMLValidator - Class in processing.xml
XMLValidator implementation based on NonValidator (which implemented + IXMLValidator in the original NanoXML).
XMLValidator() - +Constructor for class processing.xml.XMLValidator +
Creates the "validator". +
XMLWriter - Class in processing.xml
An XMLWriter writes XML data to a stream.
XMLWriter(Writer) - +Constructor for class processing.xml.XMLWriter +
Creates a new XML writer. +
XMLWriter(OutputStream) - +Constructor for class processing.xml.XMLWriter +
Creates a new XML writer. +
xToOffset(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Converts an x co-ordinate to an offset within a line. +
xyToOffset(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Converts a point to an offset, from the start of the text. +
+
+

+Y

+
+
Y - +Static variable in interface processing.core.PConstants +
  +
y - +Variable in class processing.core.PVector +
The y component of the vector. +
year() - +Static method in class processing.core.PApplet +
Get the current year. +
yToLine(int) - +Method in class processing.app.syntax.JEditTextArea +
Converts a y co-ordinate to a line index. +
+
+

+Z

+
+
Z - +Static variable in interface processing.core.PConstants +
  +
z - +Variable in class processing.core.PVector +
The z component of the vector. +
zbuffer - +Variable in class processing.core.PGraphics3D +
The depth buffer. +
+
+

+_

+
+
_offsetToX(int, int) - +Method in class processing.app.syntax.JEditTextArea +
Converts an offset in a line into an x co-ordinate. +
_tokenNames - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenNames - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_0 - +Static variable in class antlr.java.JavaLexer +
  +
_tokenSet_0 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_0 - +Static variable in class processing.app.preproc.PdeLexer +
  +
_tokenSet_0 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_1 - +Static variable in class antlr.java.JavaLexer +
  +
_tokenSet_1 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_1 - +Static variable in class processing.app.preproc.PdeLexer +
  +
_tokenSet_1 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_10 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_10 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_11 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_11 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_12 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_12 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_13 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_13 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_14 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_14 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_15 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_15 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_16 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_16 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_17 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_17 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_18 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_18 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_19 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_19 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_2 - +Static variable in class antlr.java.JavaLexer +
  +
_tokenSet_2 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_2 - +Static variable in class processing.app.preproc.PdeLexer +
  +
_tokenSet_2 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_20 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_20 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_21 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_21 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_22 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_22 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_23 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_23 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_24 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_24 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_25 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_25 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_26 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_26 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_27 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_27 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_28 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_29 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_3 - +Static variable in class antlr.java.JavaLexer +
  +
_tokenSet_3 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_3 - +Static variable in class processing.app.preproc.PdeLexer +
  +
_tokenSet_3 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_30 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_31 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_32 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_33 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_34 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_35 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_36 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_37 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_38 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_39 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_4 - +Static variable in class antlr.java.JavaLexer +
  +
_tokenSet_4 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_4 - +Static variable in class processing.app.preproc.PdeLexer +
  +
_tokenSet_4 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_40 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_41 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_5 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_5 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_6 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_6 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_7 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_7 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_8 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_8 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
_tokenSet_9 - +Static variable in class antlr.java.JavaRecognizer +
  +
_tokenSet_9 - +Static variable in class processing.app.preproc.PdeRecognizer +
  +
+
+A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/index.html b/build/javadoc/everything/index.html new file mode 100644 index 000000000..556db6944 --- /dev/null +++ b/build/javadoc/everything/index.html @@ -0,0 +1,38 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="overview-summary.html">Non-frame version.</A> + + + diff --git a/build/javadoc/everything/overview-frame.html b/build/javadoc/everything/overview-frame.html new file mode 100644 index 000000000..4dd92c7c8 --- /dev/null +++ b/build/javadoc/everything/overview-frame.html @@ -0,0 +1,75 @@ + + + + + +Overview + + + + + + + + + + + + + + + +
+
+ + + + + +
All Classes +

+ +Packages +
+antlr +
+antlr.java +
+processing.app +
+processing.app.debug +
+processing.app.linux +
+processing.app.macosx +
+processing.app.preproc +
+processing.app.syntax +
+processing.app.tools +
+processing.app.windows +
+processing.core +
+processing.dxf +
+processing.net +
+processing.opengl +
+processing.pdf +
+processing.serial +
+processing.video +
+processing.xml +
+

+ +

+  + + diff --git a/build/javadoc/everything/overview-summary.html b/build/javadoc/everything/overview-summary.html new file mode 100644 index 000000000..e00e9e862 --- /dev/null +++ b/build/javadoc/everything/overview-summary.html @@ -0,0 +1,213 @@ + + + + + +Overview + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages
antlr 
antlr.java 
processing.app 
processing.app.debug 
processing.app.linux 
processing.app.macosx 
processing.app.preproc 
processing.app.syntax 
processing.app.tools 
processing.app.windows 
processing.core 
processing.dxf 
processing.net 
processing.opengl 
processing.pdf 
processing.serial 
processing.video 
processing.xml 
+ +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/overview-tree.html b/build/javadoc/everything/overview-tree.html new file mode 100644 index 000000000..9825aa25e --- /dev/null +++ b/build/javadoc/everything/overview-tree.html @@ -0,0 +1,338 @@ + + + + + +Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
antlr, antlr.java, processing.app, processing.app.debug, processing.app.linux, processing.app.macosx, processing.app.preproc, processing.app.syntax, processing.app.tools, processing.app.windows, processing.core, processing.dxf, processing.net, processing.opengl, processing.pdf, processing.serial, processing.video, processing.xml
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +

+Enum Hierarchy +

+
    +
  • java.lang.Object
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/package-list b/build/javadoc/everything/package-list new file mode 100644 index 000000000..d1f5b4557 --- /dev/null +++ b/build/javadoc/everything/package-list @@ -0,0 +1,18 @@ +antlr +antlr.java +processing.app +processing.app.debug +processing.app.linux +processing.app.macosx +processing.app.preproc +processing.app.syntax +processing.app.tools +processing.app.windows +processing.core +processing.dxf +processing.net +processing.opengl +processing.pdf +processing.serial +processing.video +processing.xml diff --git a/build/javadoc/everything/processing/app/Base.html b/build/javadoc/everything/processing/app/Base.html new file mode 100644 index 000000000..b6f0e779a --- /dev/null +++ b/build/javadoc/everything/processing/app/Base.html @@ -0,0 +1,1505 @@ + + + + + +Base + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Base

+
+java.lang.Object
+  extended by processing.app.Base
+
+
+
+
public class Base
extends java.lang.Object
+ + +

+The base class for the main processing application. + Primary role of this class is for platform identification and + general interaction with the system (launching URLs, loading + files and images, etc) that comes from that. +

+ +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+static java.lang.StringlibrariesClassPath + +
+           
+  + + + + + + + + + + +
+Constructor Summary
Base(java.lang.String[] args) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static intcalcFolderSize(java.io.File folder) + +
+          Calculate the size of the contents of a folder.
+static voidcopyDir(java.io.File sourceDir, + java.io.File targetDir) + +
+          Copy a folder from one place to another.
+static voidcopyFile(java.io.File sourceFile, + java.io.File targetFile) + +
+           
+static intcountLines(java.lang.String what) + +
+          Get the number of lines in a file by counting the number of newline + characters inside a String (and adding 1).
+static java.io.FilecreateTempFolder(java.lang.String name) + +
+          Get the path to the platform's temporary folder, by creating + a temporary temporary file and getting its parent folder.
+static java.io.FilegetBuildFolder() + +
+           
+static java.io.FilegetContentFile(java.lang.String name) + +
+          Get a path for something in the Processing lib folder.
+static java.lang.StringgetExamplesPath() + +
+           
+static java.awt.ImagegetLibImage(java.lang.String name, + java.awt.Component who) + +
+          Return an Image object from inside the Processing lib folder.
+static java.lang.StringgetLibrariesPath() + +
+           
+static java.io.InputStreamgetLibStream(java.lang.String filename) + +
+          Return an InputStream for a file inside the Processing lib folder.
+static intgetPlatformIndex(java.lang.String what) + +
+           
+static java.lang.StringgetPlatformName() + +
+          Get list of platform constants.
+static java.lang.StringgetPlatformName(int which) + +
+          Map a platform constant to its name.
+static java.io.FilegetSettingsFile(java.lang.String filename) + +
+          Convenience method to get a File object for the specified filename inside + the settings folder.
+static java.io.FilegetSettingsFolder() + +
+           
+static java.io.FilegetSketchbookFolder() + +
+           
+static java.io.FilegetSketchbookLibrariesFolder() + +
+           
+static java.awt.ImagegetThemeImage(java.lang.String name, + java.awt.Component who) + +
+          Get an image associated with the current color theme.
+static java.io.FilegetToolsFolder() + +
+           
+static java.lang.StringgetToolsPath() + +
+           
+ voidhandleAbout() + +
+          Show the About box.
+ booleanhandleClose(Editor editor) + +
+          Close a sketch as specified by its editor window.
+ voidhandleNew() + +
+          Create a new untitled document in a new sketch window.
+ voidhandleNewReplace() + +
+          Replace the sketch in the current window with a new untitled document.
+ EditorhandleOpen(java.lang.String path) + +
+          Open a sketch in a new window.
+ voidhandleOpenPrompt() + +
+          Prompt for a sketch to open, and open it in a new window.
+ voidhandleOpenReplace(java.lang.String path) + +
+          Open a sketch, replacing the sketch in the current window.
+ voidhandlePrefs() + +
+          Show the Preferences window.
+ booleanhandleQuit() + +
+          Handler for File → Quit.
+static booleanisLinux() + +
+          true if running on linux.
+static booleanisMacOS() + +
+          returns true if Processing is running on a Mac OS X machine.
+static booleanisWindows() + +
+          returns true if running on windows.
+static java.lang.String[]listFiles(java.io.File folder, + boolean relative) + +
+           
+static java.lang.String[]listFiles(java.lang.String path, + boolean relative) + +
+          Recursively creates a list of all files within the specified folder, + and returns a list of their relative paths.
+static byte[]loadBytesRaw(java.io.File file) + +
+          Same as PApplet.loadBytes(), however never does gzip decoding.
+static java.lang.StringloadFile(java.io.File file) + +
+          Grab the contents of a file as a string.
+static voidmain(java.lang.String[] args) + +
+           
+static voidopenFolder(java.io.File file) + +
+          Implements the other cross-platform headache of opening + a folder in the machine's native file browser.
+static voidopenURL(java.lang.String url) + +
+          Implements the cross-platform headache of opening URLs + TODO This code should be replaced by PApplet.link(), + however that's not a static method (because it requires + an AppletContext when used as an applet), so it's mildly + trickier than just removing this method.
+ voidrebuildExamplesMenu(javax.swing.JMenu menu) + +
+           
+ voidrebuildImportMenu(javax.swing.JMenu importMenu) + +
+           
+static voidregisterWindowCloseKeys(javax.swing.JRootPane root, + java.awt.event.ActionListener disposer) + +
+          Registers key events for a Ctrl-W and ESC with an ActionListener + that will take care of disposing the window.
+static voidremoveDescendants(java.io.File dir) + +
+          Recursively remove all files within a directory, + used with removeDir(), or when the contents of a dir + should be removed, but not the directory itself.
+static voidremoveDir(java.io.File dir) + +
+          Remove all files in a directory and the directory itself.
+static voidsaveFile(java.lang.String str, + java.io.File file) + +
+          Spew the contents of a String object out to a file.
+static java.io.FileselectFolder(java.lang.String prompt, + java.io.File folder, + java.awt.Frame frame) + +
+          Prompt for a fodler and return it as a File object (or null).
+static voidsetIcon(java.awt.Frame frame) + +
+          Give this Frame a Processing icon.
+static voidshowEnvironment() + +
+           
+static voidshowError(java.lang.String title, + java.lang.String message, + java.lang.Throwable e) + +
+          Show an error message that's actually fatal to the program.
+static voidshowMessage(java.lang.String title, + java.lang.String message) + +
+          "No cookie for you" type messages.
+static voidshowPlatforms() + +
+           
+static voidshowReference() + +
+           
+static voidshowReference(java.lang.String filename) + +
+           
+static voidshowTroubleshooting() + +
+           
+static voidshowWarning(java.lang.String title, + java.lang.String message, + java.lang.Exception e) + +
+          Non-fatal error message with optional stack trace side dish.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+librariesClassPath

+
+public static java.lang.String librariesClassPath
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Base

+
+public Base(java.lang.String[] args)
+
+
+ + + + + + + + +
+Method Detail
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
+
+
+
+
+ +

+handleNew

+
+public void handleNew()
+
+
Create a new untitled document in a new sketch window. +

+

+
+
+
+
+ +

+handleNewReplace

+
+public void handleNewReplace()
+
+
Replace the sketch in the current window with a new untitled document. +

+

+
+
+
+
+ +

+handleOpenReplace

+
+public void handleOpenReplace(java.lang.String path)
+
+
Open a sketch, replacing the sketch in the current window. +

+

+
Parameters:
path - Location of the primary pde file for the sketch.
+
+
+
+ +

+handleOpenPrompt

+
+public void handleOpenPrompt()
+
+
Prompt for a sketch to open, and open it in a new window. +

+

+
+
+
+
+ +

+handleOpen

+
+public Editor handleOpen(java.lang.String path)
+
+
Open a sketch in a new window. +

+

+
Parameters:
path - Path to the pde file for the sketch in question +
Returns:
the Editor object, so that properties (like 'untitled') + can be set by the caller
+
+
+
+ +

+handleClose

+
+public boolean handleClose(Editor editor)
+
+
Close a sketch as specified by its editor window. +

+

+
Parameters:
editor - Editor object of the sketch to be closed. +
Returns:
true if succeeded in closing, false if canceled.
+
+
+
+ +

+handleQuit

+
+public boolean handleQuit()
+
+
Handler for File → Quit. +

+

+ +
Returns:
false if canceled, true otherwise.
+
+
+
+ +

+rebuildImportMenu

+
+public void rebuildImportMenu(javax.swing.JMenu importMenu)
+
+
+
+
+
+
+ +

+rebuildExamplesMenu

+
+public void rebuildExamplesMenu(javax.swing.JMenu menu)
+
+
+
+
+
+
+ +

+handleAbout

+
+public void handleAbout()
+
+
Show the About box. +

+

+
+
+
+
+ +

+handlePrefs

+
+public void handlePrefs()
+
+
Show the Preferences window. +

+

+
+
+
+
+ +

+getPlatformName

+
+public static java.lang.String getPlatformName()
+
+
Get list of platform constants. +

+

+
+
+
+
+ +

+getPlatformName

+
+public static java.lang.String getPlatformName(int which)
+
+
Map a platform constant to its name. +

+

+
Parameters:
which - PConstants.WINDOWS, PConstants.MACOSX, PConstants.LINUX +
Returns:
one of "windows", "macosx", or "linux"
+
+
+
+ +

+getPlatformIndex

+
+public static int getPlatformIndex(java.lang.String what)
+
+
+
+
+
+
+ +

+isMacOS

+
+public static boolean isMacOS()
+
+
returns true if Processing is running on a Mac OS X machine. +

+

+
+
+
+
+ +

+isWindows

+
+public static boolean isWindows()
+
+
returns true if running on windows. +

+

+
+
+
+
+ +

+isLinux

+
+public static boolean isLinux()
+
+
true if running on linux. +

+

+
+
+
+
+ +

+getSettingsFolder

+
+public static java.io.File getSettingsFolder()
+
+
+
+
+
+
+ +

+getSettingsFile

+
+public static java.io.File getSettingsFile(java.lang.String filename)
+
+
Convenience method to get a File object for the specified filename inside + the settings folder. + For now, only used by Preferences to get the preferences.txt file. +

+

+
Parameters:
filename - A file inside the settings folder. +
Returns:
filename wrapped as a File object inside the settings folder
+
+
+
+ +

+getBuildFolder

+
+public static java.io.File getBuildFolder()
+
+
+
+
+
+
+ +

+createTempFolder

+
+public static java.io.File createTempFolder(java.lang.String name)
+
+
Get the path to the platform's temporary folder, by creating + a temporary temporary file and getting its parent folder. +
+ Modified for revision 0094 to actually make the folder randomized + to avoid conflicts in multi-user environments. (Bug 177) +

+

+
+
+
+
+ +

+getExamplesPath

+
+public static java.lang.String getExamplesPath()
+
+
+
+
+
+
+ +

+getLibrariesPath

+
+public static java.lang.String getLibrariesPath()
+
+
+
+
+
+
+ +

+getToolsFolder

+
+public static java.io.File getToolsFolder()
+
+
+
+
+
+
+ +

+getToolsPath

+
+public static java.lang.String getToolsPath()
+
+
+
+
+
+
+ +

+getSketchbookFolder

+
+public static java.io.File getSketchbookFolder()
+
+
+
+
+
+
+ +

+getSketchbookLibrariesFolder

+
+public static java.io.File getSketchbookLibrariesFolder()
+
+
+
+
+
+
+ +

+openURL

+
+public static void openURL(java.lang.String url)
+
+
Implements the cross-platform headache of opening URLs + TODO This code should be replaced by PApplet.link(), + however that's not a static method (because it requires + an AppletContext when used as an applet), so it's mildly + trickier than just removing this method. +

+

+
+
+
+
+ +

+openFolder

+
+public static void openFolder(java.io.File file)
+
+
Implements the other cross-platform headache of opening + a folder in the machine's native file browser. +

+

+
+
+
+
+ +

+selectFolder

+
+public static java.io.File selectFolder(java.lang.String prompt,
+                                        java.io.File folder,
+                                        java.awt.Frame frame)
+
+
Prompt for a fodler and return it as a File object (or null). + Implementation for choosing directories that handles both the + Mac OS X hack to allow the native AWT file dialog, or uses + the JFileChooser on other platforms. Mac AWT trick obtained from + this post + on the OS X Java dev archive which explains the cryptic note in + Apple's Java 1.4 release docs about the special System property. +

+

+
+
+
+
+ +

+setIcon

+
+public static void setIcon(java.awt.Frame frame)
+
+
Give this Frame a Processing icon. +

+

+
+
+
+
+ +

+registerWindowCloseKeys

+
+public static void registerWindowCloseKeys(javax.swing.JRootPane root,
+                                           java.awt.event.ActionListener disposer)
+
+
Registers key events for a Ctrl-W and ESC with an ActionListener + that will take care of disposing the window. +

+

+
+
+
+
+ +

+showReference

+
+public static void showReference(java.lang.String filename)
+
+
+
+
+
+
+ +

+showReference

+
+public static void showReference()
+
+
+
+
+
+
+ +

+showEnvironment

+
+public static void showEnvironment()
+
+
+
+
+
+
+ +

+showPlatforms

+
+public static void showPlatforms()
+
+
+
+
+
+
+ +

+showTroubleshooting

+
+public static void showTroubleshooting()
+
+
+
+
+
+
+ +

+showMessage

+
+public static void showMessage(java.lang.String title,
+                               java.lang.String message)
+
+
"No cookie for you" type messages. Nothing fatal or all that + much of a bummer, but something to notify the user about. +

+

+
+
+
+
+ +

+showWarning

+
+public static void showWarning(java.lang.String title,
+                               java.lang.String message,
+                               java.lang.Exception e)
+
+
Non-fatal error message with optional stack trace side dish. +

+

+
+
+
+
+ +

+showError

+
+public static void showError(java.lang.String title,
+                             java.lang.String message,
+                             java.lang.Throwable e)
+
+
Show an error message that's actually fatal to the program. + This is an error that can't be recovered. Use showWarning() + for errors that allow P5 to continue running. +

+

+
+
+
+
+ +

+getContentFile

+
+public static java.io.File getContentFile(java.lang.String name)
+
+
Get a path for something in the Processing lib folder. +

+

+
+
+
+
+ +

+getThemeImage

+
+public static java.awt.Image getThemeImage(java.lang.String name,
+                                           java.awt.Component who)
+
+
Get an image associated with the current color theme. +

+

+
+
+
+
+ +

+getLibImage

+
+public static java.awt.Image getLibImage(java.lang.String name,
+                                         java.awt.Component who)
+
+
Return an Image object from inside the Processing lib folder. +

+

+
+
+
+
+ +

+getLibStream

+
+public static java.io.InputStream getLibStream(java.lang.String filename)
+                                        throws java.io.IOException
+
+
Return an InputStream for a file inside the Processing lib folder. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+countLines

+
+public static int countLines(java.lang.String what)
+
+
Get the number of lines in a file by counting the number of newline + characters inside a String (and adding 1). +

+

+
+
+
+
+ +

+loadBytesRaw

+
+public static byte[] loadBytesRaw(java.io.File file)
+                           throws java.io.IOException
+
+
Same as PApplet.loadBytes(), however never does gzip decoding. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+copyFile

+
+public static void copyFile(java.io.File sourceFile,
+                            java.io.File targetFile)
+                     throws java.io.IOException
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+loadFile

+
+public static java.lang.String loadFile(java.io.File file)
+                                 throws java.io.IOException
+
+
Grab the contents of a file as a string. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+saveFile

+
+public static void saveFile(java.lang.String str,
+                            java.io.File file)
+                     throws java.io.IOException
+
+
Spew the contents of a String object out to a file. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+copyDir

+
+public static void copyDir(java.io.File sourceDir,
+                           java.io.File targetDir)
+                    throws java.io.IOException
+
+
Copy a folder from one place to another. This ignores all dot files and + folders found in the source directory, to avoid copying silly .DS_Store + files and potentially troublesome .svn folders. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+removeDir

+
+public static void removeDir(java.io.File dir)
+
+
Remove all files in a directory and the directory itself. +

+

+
+
+
+
+ +

+removeDescendants

+
+public static void removeDescendants(java.io.File dir)
+
+
Recursively remove all files within a directory, + used with removeDir(), or when the contents of a dir + should be removed, but not the directory itself. + (i.e. when cleaning temp files from lib/build) +

+

+
+
+
+
+ +

+calcFolderSize

+
+public static int calcFolderSize(java.io.File folder)
+
+
Calculate the size of the contents of a folder. + Used to determine whether sketches are empty or not. + Note that the function calls itself recursively. +

+

+
+
+
+
+ +

+listFiles

+
+public static java.lang.String[] listFiles(java.lang.String path,
+                                           boolean relative)
+
+
Recursively creates a list of all files within the specified folder, + and returns a list of their relative paths. + Ignores any files/folders prefixed with a dot. +

+

+
+
+
+
+ +

+listFiles

+
+public static java.lang.String[] listFiles(java.io.File folder,
+                                           boolean relative)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/Commander.html b/build/javadoc/everything/processing/app/Commander.html new file mode 100644 index 000000000..12f1f01a2 --- /dev/null +++ b/build/javadoc/everything/processing/app/Commander.html @@ -0,0 +1,323 @@ + + + + + +Commander + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Commander

+
+java.lang.Object
+  extended by processing.app.Commander
+
+
+
All Implemented Interfaces:
RunnerListener
+
+
+
+
public class Commander
extends java.lang.Object
implements RunnerListener
+ + +

+Class to handle running Processing from the command line. +

+ --help               Show the help text.
+ 
+ --sketch=<name&rt;      Specify the sketch folder (required)
+ --output=<name&rt;      Specify the output folder (required and
+                      cannot be the same as the sketch folder.)
+ 
+ --preprocess         Preprocess a sketch into .java files.
+ --build              Preprocess and compile a sketch into .class files.
+ --run                Preprocess, compile, and run a sketch.
+ --present            Preprocess, compile, and run a sketch full screen.
+ 
+ --export-applet      Export an applet.
+ --export-application Export an application.
+ --platform           Specify the platform (export to application only).
+                      Should be one of 'windows', 'macosx', or 'linux'.
+ 
+ --preferences=<file&rt; Specify a preferences file to use (optional).
+ 
+ + To build the command line version, first build for your platform, + then cd to processing/build/cmd and type 'dist.sh'. This will create a + usable installation plus a zip file of the same. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Commander(java.lang.String[] args) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static voidmain(java.lang.String[] args) + +
+           
+ voidstatusError(java.lang.Exception exception) + +
+           
+ voidstatusError(java.lang.String message) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Commander

+
+public Commander(java.lang.String[] args)
+
+
+ + + + + + + + +
+Method Detail
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
+
+
+
+
+
+
+
+ +

+statusError

+
+public void statusError(java.lang.String message)
+
+
+
Specified by:
statusError in interface RunnerListener
+
+
+
+
+
+
+ +

+statusError

+
+public void statusError(java.lang.Exception exception)
+
+
+
Specified by:
statusError in interface RunnerListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/Editor.html b/build/javadoc/everything/processing/app/Editor.html new file mode 100644 index 000000000..2867c3a3e --- /dev/null +++ b/build/javadoc/everything/processing/app/Editor.html @@ -0,0 +1,1469 @@ + + + + + +Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Editor

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Window
+              extended by java.awt.Frame
+                  extended by javax.swing.JFrame
+                      extended by processing.app.Editor
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, RunnerListener
+
+
+
+
public class Editor
extends javax.swing.JFrame
implements RunnerListener
+ + +

+Main editor panel for the Processing Development Environment. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
+ + + + + + + +
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
Editor(Base ibase, + java.lang.String path, + int[] location) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ intgetCaretOffset() + +
+          Get the position (character offset) of the caret.
+ intgetLineCount() + +
+          Get the number of lines in the currently displayed buffer.
+ intgetLineStartOffset(int line) + +
+          Get character offset for the start of a given line of text.
+ intgetLineStopOffset(int line) + +
+          Get character offset for end of a given line of text.
+ java.lang.StringgetLineText(int line) + +
+          Get text for a specified line.
+ java.awt.DimensiongetMinimumSize() + +
+          Hack for #@#)$(* Mac OS X 10.2.
+ intgetScrollPosition() + +
+           
+ java.lang.StringgetSelectedText() + +
+          Called to update the text but not switch to a different set of code + (which would affect the undo manager).
+ intgetSelectionStart() + +
+          Get the beginning point of the current selection.
+ intgetSelectionStop() + +
+          Get the end point of the current selection.
+ SketchgetSketch() + +
+          Gets the current sketch object.
+ java.awt.PointgetSketchLocation() + +
+          Get the last location of the sketch's run window.
+ java.lang.StringgetText() + +
+          Get the contents of the current buffer.
+ java.lang.StringgetText(int start, + int stop) + +
+          Get a range of text from the current buffer.
+ JEditTextAreagetTextArea() + +
+          Get the JEditTextArea object for use (not recommended).
+ voidhandleCopy() + +
+          Implements Edit → Copy.
+ voidhandleCut() + +
+          Implements Edit → Cut.
+ voidhandleExport() + +
+          Called by Sketch → Export.
+ voidhandleExportApplication() + +
+          Handler for Sketch → Export Application
+ voidhandlePageSetup() + +
+          Handler for File → Page Setup.
+ voidhandlePaste() + +
+          Implements Edit → Paste.
+ voidhandlePrint() + +
+          Handler for File → Print.
+ voidhandleRun(boolean present) + +
+          Implements Sketch → Run.
+ booleanhandleSave(boolean immediately) + +
+          Actually handle the save command.
+ booleanhandleSaveAs() + +
+           
+ voidhandleSelectAll() + +
+          Implements Edit → Select All.
+ voidhandleStop() + +
+          Implements Sketch → Stop, or pressing Stop on the toolbar.
+ voidinsertText(java.lang.String what) + +
+           
+ voidinternalCloseRunner() + +
+          Handle internal shutdown of the runner.
+ voidinternalRunnerClosed() + +
+          Called by Runner to notify that the sketch has stopped running.
+ booleanisSelectionActive() + +
+          True if some text is currently selected.
+static javax.swing.JMenuItemnewJMenuItem(java.lang.String title, + int what) + +
+          A software engineer, somewhere, needs to have his abstraction + taken away.
+static javax.swing.JMenuItemnewJMenuItemAlt(java.lang.String title, + int what) + +
+          Same as newJMenuItem(), but adds the ALT (on Linux and Windows) + or OPTION (on Mac OS X) key as a modifier.
+static javax.swing.JMenuItemnewJMenuItemShift(java.lang.String title, + int what) + +
+          Like newJMenuItem() but adds shift as a modifier for the key command.
+ voidsetLineText(int line, + java.lang.String what) + +
+          Replace the text on a specified line.
+ voidsetSelectedText(java.lang.String what) + +
+           
+ voidsetSelection(int start, + int stop) + +
+           
+ voidsetSketchLocation(java.awt.Point p) + +
+          Set the location of the sketch run window.
+ voidsetText(java.lang.String what) + +
+          Replace the entire contents of the front-most tab.
+ voidstartCompoundEdit() + +
+          Use before a manipulating text to group editing operations together as a + single undo.
+ voidstatusEmpty() + +
+          Clear the status area.
+ voidstatusError(java.lang.Exception e) + +
+          Show an exception in the editor status bar.
+ voidstatusError(java.lang.String what) + +
+          Show an error int the status bar.
+ voidstatusNotice(java.lang.String msg) + +
+          Show a notice message in the editor status bar.
+ voidstopCompoundEdit() + +
+          Use with startCompoundEdit() to group edit operations in a single undo.
+ + + + + + + +
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
+ + + + + + + +
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
+ + + + + + + +
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Editor

+
+public Editor(Base ibase,
+              java.lang.String path,
+              int[] location)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
Hack for #@#)$(* Mac OS X 10.2. +

+ This appears to only be required on OS X 10.2, and is not + even being called on later versions of OS X or Windows. +

+

+
Overrides:
getMinimumSize in class java.awt.Container
+
+
+
+
+
+
+ +

+newJMenuItem

+
+public static javax.swing.JMenuItem newJMenuItem(java.lang.String title,
+                                                 int what)
+
+
A software engineer, somewhere, needs to have his abstraction + taken away. In some countries they jail or beat people for writing + the sort of API that would require a five line helper function + just to set the command key for a menu item. +

+

+
+
+
+
+
+
+
+ +

+newJMenuItemShift

+
+public static javax.swing.JMenuItem newJMenuItemShift(java.lang.String title,
+                                                      int what)
+
+
Like newJMenuItem() but adds shift as a modifier for the key command. +

+

+
+
+
+
+
+
+
+ +

+newJMenuItemAlt

+
+public static javax.swing.JMenuItem newJMenuItemAlt(java.lang.String title,
+                                                    int what)
+
+
Same as newJMenuItem(), but adds the ALT (on Linux and Windows) + or OPTION (on Mac OS X) key as a modifier. +

+

+
+
+
+
+
+
+
+ +

+getSketch

+
+public Sketch getSketch()
+
+
Gets the current sketch object. +

+

+
+
+
+
+
+
+
+ +

+getTextArea

+
+public JEditTextArea getTextArea()
+
+
Get the JEditTextArea object for use (not recommended). This should only + be used in obscure cases that really need to hack the internals of the + JEditTextArea. Most tools should only interface via the get/set functions + found in this class. This will maintain compatibility with future releases, + which will not use JEditTextArea. +

+

+
+
+
+
+
+
+
+ +

+getText

+
+public java.lang.String getText()
+
+
Get the contents of the current buffer. Used by the Sketch class. +

+

+
+
+
+
+
+
+
+ +

+getText

+
+public java.lang.String getText(int start,
+                                int stop)
+
+
Get a range of text from the current buffer. +

+

+
+
+
+
+
+
+
+ +

+setText

+
+public void setText(java.lang.String what)
+
+
Replace the entire contents of the front-most tab. +

+

+
+
+
+
+
+
+
+ +

+insertText

+
+public void insertText(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+getSelectedText

+
+public java.lang.String getSelectedText()
+
+
Called to update the text but not switch to a different set of code + (which would affect the undo manager). +

+

+
+
+
+
+
+
+
+ +

+setSelectedText

+
+public void setSelectedText(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+setSelection

+
+public void setSelection(int start,
+                         int stop)
+
+
+
+
+
+
+
+
+
+ +

+getCaretOffset

+
+public int getCaretOffset()
+
+
Get the position (character offset) of the caret. With text selected, + this will be the last character actually selected, no matter the direction + of the selection. That is, if the user clicks and drags to select lines + 7 up to 4, then the caret position will be somewhere on line four. +

+

+
+
+
+
+
+
+
+ +

+isSelectionActive

+
+public boolean isSelectionActive()
+
+
True if some text is currently selected. +

+

+
+
+
+
+
+
+
+ +

+getSelectionStart

+
+public int getSelectionStart()
+
+
Get the beginning point of the current selection. +

+

+
+
+
+
+
+
+
+ +

+getSelectionStop

+
+public int getSelectionStop()
+
+
Get the end point of the current selection. +

+

+
+
+
+
+
+
+
+ +

+getLineText

+
+public java.lang.String getLineText(int line)
+
+
Get text for a specified line. +

+

+
+
+
+
+
+
+
+ +

+setLineText

+
+public void setLineText(int line,
+                        java.lang.String what)
+
+
Replace the text on a specified line. +

+

+
+
+
+
+
+
+
+ +

+getLineStartOffset

+
+public int getLineStartOffset(int line)
+
+
Get character offset for the start of a given line of text. +

+

+
+
+
+
+
+
+
+ +

+getLineStopOffset

+
+public int getLineStopOffset(int line)
+
+
Get character offset for end of a given line of text. +

+

+
+
+
+
+
+
+
+ +

+getLineCount

+
+public int getLineCount()
+
+
Get the number of lines in the currently displayed buffer. +

+

+
+
+
+
+
+
+
+ +

+startCompoundEdit

+
+public void startCompoundEdit()
+
+
Use before a manipulating text to group editing operations together as a + single undo. Use stopCompoundEdit() once finished. +

+

+
+
+
+
+
+
+
+ +

+stopCompoundEdit

+
+public void stopCompoundEdit()
+
+
Use with startCompoundEdit() to group edit operations in a single undo. +

+

+
+
+
+
+
+
+
+ +

+getScrollPosition

+
+public int getScrollPosition()
+
+
+
+
+
+
+
+
+
+ +

+handleCut

+
+public void handleCut()
+
+
Implements Edit → Cut. +

+

+
+
+
+
+
+
+
+ +

+handleCopy

+
+public void handleCopy()
+
+
Implements Edit → Copy. +

+

+
+
+
+
+
+
+
+ +

+handlePaste

+
+public void handlePaste()
+
+
Implements Edit → Paste. +

+

+
+
+
+
+
+
+
+ +

+handleSelectAll

+
+public void handleSelectAll()
+
+
Implements Edit → Select All. +

+

+
+
+
+
+
+
+
+ +

+handleRun

+
+public void handleRun(boolean present)
+
+
Implements Sketch → Run. +

+

+
+
+
+
Parameters:
present - Set true to run in full screen (present mode).
+
+
+
+ +

+setSketchLocation

+
+public void setSketchLocation(java.awt.Point p)
+
+
Set the location of the sketch run window. Used by Runner to update the + Editor about window drag events while the sketch is running. +

+

+
+
+
+
+
+
+
+ +

+getSketchLocation

+
+public java.awt.Point getSketchLocation()
+
+
Get the last location of the sketch's run window. Used by Runner to make + the window show up in the same location as when it was last closed. +

+

+
+
+
+
+
+
+
+ +

+handleStop

+
+public void handleStop()
+
+
Implements Sketch → Stop, or pressing Stop on the toolbar. +

+

+
+
+
+
+
+
+
+ +

+internalRunnerClosed

+
+public void internalRunnerClosed()
+
+
Called by Runner to notify that the sketch has stopped running. + Tools should not call this function, use handleStop() instead. +

+

+
+
+
+
+
+
+
+ +

+internalCloseRunner

+
+public void internalCloseRunner()
+
+
Handle internal shutdown of the runner. +

+

+
+
+
+
+
+
+
+ +

+handleSave

+
+public boolean handleSave(boolean immediately)
+
+
Actually handle the save command. If 'immediately' is set to false, + this will happen in another thread so that the message area + will update and the save button will stay highlighted while the + save is happening. If 'immediately' is true, then it will happen + immediately. This is used during a quit, because invokeLater() + won't run properly while a quit is happening. This fixes + Bug 276. +

+

+
+
+
+
+
+
+
+ +

+handleSaveAs

+
+public boolean handleSaveAs()
+
+
+
+
+
+
+
+
+
+ +

+handleExport

+
+public void handleExport()
+
+
Called by Sketch → Export. + Handles calling the export() function on sketch, and + queues all the gui status stuff that comes along with it. +

+ Made synchronized to (hopefully) avoid problems of people + hitting export twice, quickly, and horking things up. +

+

+
+
+
+
+
+
+
+ +

+handleExportApplication

+
+public void handleExportApplication()
+
+
Handler for Sketch → Export Application +

+

+
+
+
+
+
+
+
+ +

+handlePageSetup

+
+public void handlePageSetup()
+
+
Handler for File → Page Setup. +

+

+
+
+
+
+
+
+
+ +

+handlePrint

+
+public void handlePrint()
+
+
Handler for File → Print. +

+

+
+
+
+
+
+
+
+ +

+statusError

+
+public void statusError(java.lang.String what)
+
+
Show an error int the status bar. +

+

+
Specified by:
statusError in interface RunnerListener
+
+
+
+
+
+
+ +

+statusError

+
+public void statusError(java.lang.Exception e)
+
+
Show an exception in the editor status bar. +

+

+
Specified by:
statusError in interface RunnerListener
+
+
+
+
+
+
+ +

+statusNotice

+
+public void statusNotice(java.lang.String msg)
+
+
Show a notice message in the editor status bar. +

+

+
+
+
+
+
+
+
+ +

+statusEmpty

+
+public void statusEmpty()
+
+
Clear the status area. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/EditorConsole.html b/build/javadoc/everything/processing/app/EditorConsole.html new file mode 100644 index 000000000..a6c088123 --- /dev/null +++ b/build/javadoc/everything/processing/app/EditorConsole.html @@ -0,0 +1,501 @@ + + + + + +EditorConsole + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class EditorConsole

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by javax.swing.JScrollPane
+                  extended by processing.app.EditorConsole
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.ScrollPaneConstants
+
+
+
+
public class EditorConsole
extends javax.swing.JScrollPane
+ + +

+Message console that sits below the editing area. +

+ Debugging this class is tricky... If it's throwing exceptions, + don't take over System.err, and debug while watching just System.out + or just write println() or whatever directly to systemOut or systemErr. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + + + + + + + + + +
+Field Summary
+static java.io.PrintStreamsystemErr + +
+           
+static java.io.PrintStreamsystemOut + +
+           
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
EditorConsole(Editor editor) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidclear() + +
+           
+ voidhandleQuit() + +
+          Close the streams so that the temporary files can be deleted.
+ voidmessage(java.lang.String what, + boolean err, + boolean advance) + +
+           
+static voidsetEditor(Editor editor) + +
+           
+ voidwrite(byte[] b, + int offset, + int length, + boolean err) + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+systemOut

+
+public static java.io.PrintStream systemOut
+
+
+
+
+
+ +

+systemErr

+
+public static java.io.PrintStream systemErr
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+EditorConsole

+
+public EditorConsole(Editor editor)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setEditor

+
+public static void setEditor(Editor editor)
+
+
+
+
+
+
+ +

+handleQuit

+
+public void handleQuit()
+
+
Close the streams so that the temporary files can be deleted. +

+ File.deleteOnExit() cannot be used because the stdout and stderr + files are inside a folder, and have to be deleted before the + folder itself is deleted, which can't be guaranteed when using + the deleteOnExit() method. +

+

+
+
+
+
+ +

+write

+
+public void write(byte[] b,
+                  int offset,
+                  int length,
+                  boolean err)
+
+
+
+
+
+
+ +

+message

+
+public void message(java.lang.String what,
+                    boolean err,
+                    boolean advance)
+
+
+
+
+
+
+ +

+clear

+
+public void clear()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/EditorHeader.html b/build/javadoc/everything/processing/app/EditorHeader.html new file mode 100644 index 000000000..4c98cc6f1 --- /dev/null +++ b/build/javadoc/everything/processing/app/EditorHeader.html @@ -0,0 +1,468 @@ + + + + + +EditorHeader + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class EditorHeader

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by processing.app.EditorHeader
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
+
+
+
+
public class EditorHeader
extends javax.swing.JComponent
+ + +

+Sketch tabs at the top of the editor window. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
EditorHeader(Editor eddie) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddeselectMenu() + +
+           
+ java.awt.DimensiongetMaximumSize() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+ voidpaintComponent(java.awt.Graphics screen) + +
+           
+ voidrebuild() + +
+          Called when a new sketch is opened.
+ voidrebuildMenu() + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EditorHeader

+
+public EditorHeader(Editor eddie)
+
+
+ + + + + + + + +
+Method Detail
+ +

+paintComponent

+
+public void paintComponent(java.awt.Graphics screen)
+
+
+
Overrides:
paintComponent in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+rebuild

+
+public void rebuild()
+
+
Called when a new sketch is opened. +

+

+
+
+
+
+ +

+rebuildMenu

+
+public void rebuildMenu()
+
+
+
+
+
+
+ +

+deselectMenu

+
+public void deselectMenu()
+
+
+
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
Overrides:
getPreferredSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
+
Overrides:
getMaximumSize in class javax.swing.JComponent
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/EditorLineStatus.html b/build/javadoc/everything/processing/app/EditorLineStatus.html new file mode 100644 index 000000000..871e884b0 --- /dev/null +++ b/build/javadoc/everything/processing/app/EditorLineStatus.html @@ -0,0 +1,430 @@ + + + + + +EditorLineStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class EditorLineStatus

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by processing.app.EditorLineStatus
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
+
+
+
+
public class EditorLineStatus
extends javax.swing.JComponent
+ + +

+Li'l status bar fella that shows the line number. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
EditorLineStatus(JEditTextArea textarea) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.awt.DimensiongetMaximumSize() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+ voidpaintComponent(java.awt.Graphics g) + +
+           
+ voidset(int newStart, + int newStop) + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EditorLineStatus

+
+public EditorLineStatus(JEditTextArea textarea)
+
+
+ + + + + + + + +
+Method Detail
+ +

+set

+
+public void set(int newStart,
+                int newStop)
+
+
+
+
+
+
+ +

+paintComponent

+
+public void paintComponent(java.awt.Graphics g)
+
+
+
Overrides:
paintComponent in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
Overrides:
getPreferredSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
+
Overrides:
getMaximumSize in class javax.swing.JComponent
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/EditorListener.html b/build/javadoc/everything/processing/app/EditorListener.html new file mode 100644 index 000000000..17e3bb9f1 --- /dev/null +++ b/build/javadoc/everything/processing/app/EditorListener.html @@ -0,0 +1,307 @@ + + + + + +EditorListener + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class EditorListener

+
+java.lang.Object
+  extended by processing.app.EditorListener
+
+
+
+
public class EditorListener
extends java.lang.Object
+ + +

+Filters key events for tab expansion/indent/etc. +

+ For version 0099, some changes have been made to make the indents + smarter. There are still issues though: + + indent happens when it picks up a curly brace on the previous line, + but not if there's a blank line between them. + + It also doesn't handle single indent situations where a brace + isn't used (i.e. an if statement or for loop that's a single line). + It shouldn't actually be using braces. + Solving these issues, however, would probably best be done by a + smarter parser/formatter, rather than continuing to hack this class. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
EditorListener(Editor editor, + JEditTextArea textarea) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapplyPreferences() + +
+           
+ booleankeyPressed(java.awt.event.KeyEvent event) + +
+          Intercepts key pressed events for JEditTextArea.
+ booleankeyTyped(java.awt.event.KeyEvent event) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EditorListener

+
+public EditorListener(Editor editor,
+                      JEditTextArea textarea)
+
+
+ + + + + + + + +
+Method Detail
+ +

+applyPreferences

+
+public void applyPreferences()
+
+
+
+
+
+
+ +

+keyPressed

+
+public boolean keyPressed(java.awt.event.KeyEvent event)
+
+
Intercepts key pressed events for JEditTextArea. +

+ Called by JEditTextArea inside processKeyEvent(). Note that this + won't intercept actual characters, because those are fired on + keyTyped(). +

+

+ +
Returns:
true if the event has been handled (to remove it from the queue)
+
+
+
+ +

+keyTyped

+
+public boolean keyTyped(java.awt.event.KeyEvent event)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/EditorStatus.html b/build/javadoc/everything/processing/app/EditorStatus.html new file mode 100644 index 000000000..cf75ca12d --- /dev/null +++ b/build/javadoc/everything/processing/app/EditorStatus.html @@ -0,0 +1,554 @@ + + + + + +EditorStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class EditorStatus

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by javax.swing.JPanel
+                  extended by processing.app.EditorStatus
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
+
+
+
+
public class EditorStatus
extends javax.swing.JPanel
+ + +

+Panel just below the editing area that contains status messages. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
EditorStatus(Editor editor) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent e) + +
+           
+ voidedit(java.lang.String message, + java.lang.String dflt) + +
+           
+ voidempty() + +
+           
+ voiderror(java.lang.String message) + +
+           
+ java.awt.DimensiongetMaximumSize() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+ voidnotice(java.lang.String message) + +
+           
+ voidpaintComponent(java.awt.Graphics screen) + +
+           
+ voidunedit() + +
+           
+ voidunnotice(java.lang.String unmessage) + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EditorStatus

+
+public EditorStatus(Editor editor)
+
+
+ + + + + + + + +
+Method Detail
+ +

+empty

+
+public void empty()
+
+
+
+
+
+
+ +

+notice

+
+public void notice(java.lang.String message)
+
+
+
+
+
+
+ +

+unnotice

+
+public void unnotice(java.lang.String unmessage)
+
+
+
+
+
+
+ +

+error

+
+public void error(java.lang.String message)
+
+
+
+
+
+
+ +

+edit

+
+public void edit(java.lang.String message,
+                 java.lang.String dflt)
+
+
+
+
+
+
+ +

+unedit

+
+public void unedit()
+
+
+
+
+
+
+ +

+paintComponent

+
+public void paintComponent(java.awt.Graphics screen)
+
+
+
Overrides:
paintComponent in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
Overrides:
getPreferredSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
+
Overrides:
getMaximumSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent e)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/EditorToolbar.html b/build/javadoc/everything/processing/app/EditorToolbar.html new file mode 100644 index 000000000..4c0d955ca --- /dev/null +++ b/build/javadoc/everything/processing/app/EditorToolbar.html @@ -0,0 +1,683 @@ + + + + + +EditorToolbar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class EditorToolbar

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by processing.app.EditorToolbar
+
+
+
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.swing.event.MouseInputListener
+
+
+
+
public class EditorToolbar
extends javax.swing.JComponent
implements javax.swing.event.MouseInputListener
+ + +

+run/stop/etc buttons for the ide +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
EditorToolbar(Editor editor, + javax.swing.JMenu menu) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidactivate(int what) + +
+          Set a particular button to be active.
+ voiddeactivate(int what) + +
+          Set a particular button to be active.
+ java.awt.DimensiongetMaximumSize() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+ voidhandleMouse(int x, + int y) + +
+           
+ voidmessage(java.lang.String msg) + +
+          Clear all the state of all buttons.
+ voidmessageClear(java.lang.String msg) + +
+           
+ voidmouseClicked(java.awt.event.MouseEvent e) + +
+           
+ voidmouseDragged(java.awt.event.MouseEvent e) + +
+           
+ voidmouseEntered(java.awt.event.MouseEvent e) + +
+           
+ voidmouseExited(java.awt.event.MouseEvent e) + +
+           
+ voidmouseMoved(java.awt.event.MouseEvent e) + +
+           
+ voidmousePressed(java.awt.event.MouseEvent e) + +
+           
+ voidmouseReleased(java.awt.event.MouseEvent e) + +
+           
+ voidpaintComponent(java.awt.Graphics screen) + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EditorToolbar

+
+public EditorToolbar(Editor editor,
+                     javax.swing.JMenu menu)
+
+
+ + + + + + + + +
+Method Detail
+ +

+paintComponent

+
+public void paintComponent(java.awt.Graphics screen)
+
+
+
Overrides:
paintComponent in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+mouseMoved

+
+public void mouseMoved(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
+
+
+
+
+
+
+ +

+handleMouse

+
+public void handleMouse(int x,
+                        int y)
+
+
+
+
+
+
+
+
+
+ +

+mouseEntered

+
+public void mouseEntered(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseEntered in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseExited

+
+public void mouseExited(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseExited in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mousePressed in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseClicked

+
+public void mouseClicked(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseClicked in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseReleased

+
+public void mouseReleased(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseReleased in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+activate

+
+public void activate(int what)
+
+
Set a particular button to be active. +

+

+
+
+
+
+
+
+
+ +

+deactivate

+
+public void deactivate(int what)
+
+
Set a particular button to be active. +

+

+
+
+
+
+
+
+
+ +

+message

+
+public void message(java.lang.String msg)
+
+
Clear all the state of all buttons. +

+

+
+
+
+
+
+
+
+ +

+messageClear

+
+public void messageClear(java.lang.String msg)
+
+
+
+
+
+
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
Overrides:
getPreferredSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
+
Overrides:
getMaximumSize in class javax.swing.JComponent
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/FindReplace.html b/build/javadoc/everything/processing/app/FindReplace.html new file mode 100644 index 000000000..790f753f6 --- /dev/null +++ b/build/javadoc/everything/processing/app/FindReplace.html @@ -0,0 +1,479 @@ + + + + + +FindReplace + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class FindReplace

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Window
+              extended by java.awt.Frame
+                  extended by javax.swing.JFrame
+                      extended by processing.app.FindReplace
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
+
+
+
+
public class FindReplace
extends javax.swing.JFrame
implements java.awt.event.ActionListener
+ + +

+Find & Replace window for the Processing editor. +

+ One major annoyance in this is that the window is re-created each time + that "Find" is called. This is because Mac OS X has a strange focus + issue with windows that are re-shown with setVisible() or show(). + requestFocusInWindow() properly sets the focus to the find field, + however, just a short moment later, the focus is set to null. Even + trying to catch this scenario and request it again doesn't seem to work. + Most likely this is some annoyance buried deep in one of Apple's docs, + or in the doc for the focus stuff (I tend to think the former because + Windows doesn't seem to be quite so beligerent). Filed as + Bug 244 + should anyone have clues about how to fix. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
+ + + + + + + +
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
FindReplace(Editor editor) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent e) + +
+           
+ voidfind(boolean wrap) + +
+           
+ voidhandleClose() + +
+           
+ voidreplace() + +
+          Replace the current selection with whatever's in the + replacement text field.
+ voidreplaceAll() + +
+          Replace everything that matches by doing find and replace + alternately until nothing more found.
+ + + + + + + +
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
+ + + + + + + +
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
+ + + + + + + +
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+FindReplace

+
+public FindReplace(Editor editor)
+
+
+ + + + + + + + +
+Method Detail
+ +

+handleClose

+
+public void handleClose()
+
+
+
+
+
+
+
+
+
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent e)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+
+ +

+find

+
+public void find(boolean wrap)
+
+
+
+
+
+
+
+
+
+ +

+replace

+
+public void replace()
+
+
Replace the current selection with whatever's in the + replacement text field. +

+

+
+
+
+
+
+
+
+ +

+replaceAll

+
+public void replaceAll()
+
+
Replace everything that matches by doing find and replace + alternately until nothing more found. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/Platform.html b/build/javadoc/everything/processing/app/Platform.html new file mode 100644 index 000000000..a955ca898 --- /dev/null +++ b/build/javadoc/everything/processing/app/Platform.html @@ -0,0 +1,404 @@ + + + + + +Platform + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Platform

+
+java.lang.Object
+  extended by processing.app.Platform
+
+
+
Direct Known Subclasses:
Platform, Platform, Platform
+
+
+
+
public class Platform
extends java.lang.Object
+ + +

+Used by Base for platform-specific tweaking, for instance finding the + sketchbook location using the Windows registry, or OS X event handling. + + The methods in this implementation are used by default, and can be + overridden by a subclass, if loaded by Base.main(). + + These methods throw vanilla-flavored Exceptions, so that error handling + occurs inside Base. + + There is currently no mechanism for adding new platforms, as the setup is + not automated. We could use getProperty("os.arch") perhaps, but that's + debatable (could be upper/lowercase, have spaces, etc.. basically we don't + know if name is proper Java package syntax.) +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Platform() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.io.FilegetDefaultSketchbookFolder() + +
+           
+ java.io.FilegetSettingsFolder() + +
+           
+ voidinit(Base base) + +
+           
+ voidopenFolder(java.io.File file) + +
+           
+ booleanopenFolderAvailable() + +
+           
+ voidopenURL(java.lang.String url) + +
+           
+ voidsetLookAndFeel() + +
+          Set the default L & F.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Platform

+
+public Platform()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setLookAndFeel

+
+public void setLookAndFeel()
+                    throws java.lang.Exception
+
+
Set the default L & F. While I enjoy the bounty of the sixteen possible + exception types that this UIManager method might throw, I feel that in + just this one particular case, I'm being spoiled by those engineers + at Sun, those Masters of the Abstractionverse. It leaves me feeling sad + and overweight. So instead, I'll pretend that I'm not offered eleven dozen + ways to report to the user exactly what went wrong, and I'll bundle them + all into a single catch-all "Exception". Because in the end, all I really + care about is whether things worked or not. And even then, I don't care. +

+

+ +
Throws: +
java.lang.Exception - Just like I said.
+
+
+
+ +

+init

+
+public void init(Base base)
+
+
+
+
+
+
+ +

+getSettingsFolder

+
+public java.io.File getSettingsFolder()
+                               throws java.lang.Exception
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+getDefaultSketchbookFolder

+
+public java.io.File getDefaultSketchbookFolder()
+                                        throws java.lang.Exception
+
+
+ +
Returns:
null if not overridden, which will cause a prompt to show instead. +
Throws: +
java.lang.Exception
+
+
+
+ +

+openURL

+
+public void openURL(java.lang.String url)
+             throws java.lang.Exception
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+openFolderAvailable

+
+public boolean openFolderAvailable()
+
+
+
+
+
+
+ +

+openFolder

+
+public void openFolder(java.io.File file)
+                throws java.lang.Exception
+
+
+ +
Throws: +
java.lang.Exception
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/Preferences.html b/build/javadoc/everything/processing/app/Preferences.html new file mode 100644 index 000000000..d78ec64d1 --- /dev/null +++ b/build/javadoc/everything/processing/app/Preferences.html @@ -0,0 +1,554 @@ + + + + + +Preferences + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Preferences

+
+java.lang.Object
+  extended by processing.app.Preferences
+
+
+
+
public class Preferences
extends java.lang.Object
+ + +

+Storage class for user preferences and environment settings. +

+ This class no longer uses the Properties class, since + properties files are iso8859-1, which is highly likely to + be a problem when trying to save sketch folders and locations. +

+ The GUI portion in here is really ugly, as it uses exact layout. This was + done in frustration one evening (and pre-Swing), but that's long since past, + and it should all be moved to a proper swing layout like BoxLayout. +

+ This is very poorly put together, that the preferences panel and the actual + preferences i/o is part of the same code. But there hasn't yet been a + compelling reason to bother with the separation aside from concern about + being lectured by strangers who feel that it doesn't look like what they + learned in CS class. +

+ Would also be possible to change this to use the Java Preferences API. + Some useful articles + here and + here. + However, haven't implemented this yet for lack of time, but more + importantly, because it would entail writing to the registry (on Windows), + or an obscure file location (on Mac OS X) and make it far more difficult to + find the preferences to tweak them by hand (no! stay out of regedit!) + or to reset the preferences by simply deleting the preferences.txt file. +

+ +

+


+ +

+ + + + + + + + + + + + + + + +
+Field Summary
+static intBUTTON_HEIGHT + +
+          Standardized button height.
+static intBUTTON_WIDTH + +
+          Standardized width for buttons.
+  + + + + + + + + + + +
+Constructor Summary
Preferences() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static java.lang.Stringget(java.lang.String attribute) + +
+           
+static booleangetBoolean(java.lang.String attribute) + +
+           
+static java.awt.ColorgetColor(java.lang.String name) + +
+           
+static java.lang.StringgetDefault(java.lang.String attribute) + +
+           
+static java.awt.FontgetFont(java.lang.String attr) + +
+           
+static intgetInteger(java.lang.String attribute) + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+static SyntaxStylegetStyle(java.lang.String what) + +
+           
+static voidset(java.lang.String attribute, + java.lang.String value) + +
+           
+static voidsetBoolean(java.lang.String attribute, + boolean value) + +
+           
+static voidsetColor(java.lang.String attr, + java.awt.Color what) + +
+           
+static voidsetInteger(java.lang.String key, + int value) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+BUTTON_WIDTH

+
+public static int BUTTON_WIDTH
+
+
Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, + Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper. +

+

+
+
+
+ +

+BUTTON_HEIGHT

+
+public static int BUTTON_HEIGHT
+
+
Standardized button height. Mac OS X 10.3 (Java 1.4) wants 29, + presumably because it now includes the blue border, where it didn't + in Java 1.3. Windows XP only wants 23 (not sure what default Linux + would be). Because of the disparity, on Mac OS X, it will be set + inside a static block. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Preferences

+
+public Preferences()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
+
+
+
+ +

+get

+
+public static java.lang.String get(java.lang.String attribute)
+
+
+
+
+
+
+ +

+getDefault

+
+public static java.lang.String getDefault(java.lang.String attribute)
+
+
+
+
+
+
+ +

+set

+
+public static void set(java.lang.String attribute,
+                       java.lang.String value)
+
+
+
+
+
+
+ +

+getBoolean

+
+public static boolean getBoolean(java.lang.String attribute)
+
+
+
+
+
+
+ +

+setBoolean

+
+public static void setBoolean(java.lang.String attribute,
+                              boolean value)
+
+
+
+
+
+
+ +

+getInteger

+
+public static int getInteger(java.lang.String attribute)
+
+
+
+
+
+
+ +

+setInteger

+
+public static void setInteger(java.lang.String key,
+                              int value)
+
+
+
+
+
+
+ +

+getColor

+
+public static java.awt.Color getColor(java.lang.String name)
+
+
+
+
+
+
+ +

+setColor

+
+public static void setColor(java.lang.String attr,
+                            java.awt.Color what)
+
+
+
+
+
+
+ +

+getFont

+
+public static java.awt.Font getFont(java.lang.String attr)
+
+
+
+
+
+
+ +

+getStyle

+
+public static SyntaxStyle getStyle(java.lang.String what)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/PresentMode.html b/build/javadoc/everything/processing/app/PresentMode.html new file mode 100644 index 000000000..ae5e6acfe --- /dev/null +++ b/build/javadoc/everything/processing/app/PresentMode.html @@ -0,0 +1,250 @@ + + + + + +PresentMode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class PresentMode

+
+java.lang.Object
+  extended by processing.app.PresentMode
+
+
+
+
public class PresentMode
extends java.lang.Object
+ + +

+Helper class for full-screen presentation mode. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
PresentMode() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static javax.swing.JComboBoxgetSelector() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PresentMode

+
+public PresentMode()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getSelector

+
+public static javax.swing.JComboBox getSelector()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/Sketch.html b/build/javadoc/everything/processing/app/Sketch.html new file mode 100644 index 000000000..0f04f374b --- /dev/null +++ b/build/javadoc/everything/processing/app/Sketch.html @@ -0,0 +1,1264 @@ + + + + + +Sketch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Sketch

+
+java.lang.Object
+  extended by processing.app.Sketch
+
+
+
+
public class Sketch
extends java.lang.Object
+ + +

+Stores information about files in the current sketch +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Sketch(Editor editor, + java.lang.String path) + +
+          path is location of the main .pde file, because this is also + simplest to use when opening the file from the finder/explorer.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanaddFile(java.io.File sourceFile) + +
+          Add a file to the sketch.
+ java.lang.Stringbuild(java.lang.String buildPath) + +
+          Preprocess and compile all the code for this sketch.
+static java.lang.StringcheckName(java.lang.String origName) + +
+          Convert to sanitized name and alert the user + if changes were made.
+ booleanexportApplet(java.lang.String appletPath) + +
+          Handle export to applet.
+ booleanexportApplication(java.lang.String destPath, + int exportPlatform) + +
+          Export to application without GUI.
+ booleanexportApplicationPrompt() + +
+           
+ java.lang.StringgetAppletClassName2() + +
+           
+ java.lang.StringgetClassPath() + +
+           
+ SketchCode[]getCode() + +
+           
+ SketchCodegetCode(int index) + +
+           
+ intgetCodeCount() + +
+           
+ java.io.FilegetCodeFolder() + +
+          Returns the location of the sketch's code folder.
+ intgetCodeIndex(SketchCode who) + +
+           
+ SketchCodegetCurrentCode() + +
+           
+ java.io.FilegetDataFolder() + +
+          Returns the location of the sketch's data folder.
+ java.lang.StringgetDefaultExtension() + +
+          Returns the default extension for this editor setup.
+ java.lang.String[]getExtensions() + +
+          Returns a String[] array of proper extensions.
+ java.io.FilegetFolder() + +
+          Returns the sketch folder.
+ java.lang.StringgetLibraryPath() + +
+           
+ java.lang.StringgetMainFilePath() + +
+          Returns path to the main .pde file for this sketch.
+ java.lang.StringgetName() + +
+          Returns the name of this sketch.
+ java.io.FilegetPrimaryFile() + +
+          Returns a file object for the primary .pde of this sketch.
+ voidhandleAddFile() + +
+          Prompt the user for a new file to the sketch, then call the + other addFile() function to actually add it.
+ voidhandleDeleteCode() + +
+          Remove a piece of code from the sketch and from the disk.
+ voidhandleNewCode() + +
+          Handler for the New Code menu option.
+ voidhandleNextCode() + +
+          Move to the next tab.
+ voidhandlePrevCode() + +
+          Move to the previous tab.
+ voidhandleRenameCode() + +
+          Handler for the Rename Code menu option.
+ booleanhasDefaultExtension(SketchCode code) + +
+          True if the specified code has the default file extension.
+ booleanhideExtension(java.lang.String what) + +
+          True if the specified extension should be hidden when shown on a tab.
+ voidimportLibrary(java.lang.String jarPath) + +
+          Add import statements to the current tab for all of packages inside + the specified jar file.
+ booleanisDefaultExtension(java.lang.String what) + +
+          True if the specified extension is the default file extension.
+ booleanisModified() + +
+           
+ booleanisReadOnly() + +
+          Returns true if this is a read-only sketch.
+static booleanisSanitaryName(java.lang.String name) + +
+          Return true if the name is valid for a Processing sketch.
+ booleanisUntitled() + +
+           
+ java.io.FileprepareCodeFolder() + +
+          Create the code folder if it does not exist already.
+ java.io.FileprepareDataFolder() + +
+          Create the data folder if it does not exist already.
+ java.lang.Stringpreprocess(java.lang.String buildPath) + +
+          Build all the code for this sketch.
+static java.lang.StringsanitizeName(java.lang.String origName) + +
+          Produce a sanitized name that fits our standards for likely to work.
+ booleansave() + +
+          Save all code in the current sketch.
+static java.lang.StringscrubComments(java.lang.String what) + +
+          Replace all commented portions of a given String as spaces.
+ voidsetCurrentCode(int which) + +
+          Change what file is currently being edited.
+ voidsetModified(boolean state) + +
+          Sets the modified value for the code in the frontmost tab.
+ voidsetUntitled(boolean u) + +
+           
+ booleanvalidExtension(java.lang.String what) + +
+          Check this extension (no dots, please) against the list of valid + extensions.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Sketch

+
+public Sketch(Editor editor,
+              java.lang.String path)
+       throws java.io.IOException
+
+
path is location of the main .pde file, because this is also + simplest to use when opening the file from the finder/explorer. +

+

+ +
Throws: +
java.io.IOException
+
+ + + + + + + + +
+Method Detail
+ +

+handleNewCode

+
+public void handleNewCode()
+
+
Handler for the New Code menu option. +

+

+
+
+
+
+ +

+handleRenameCode

+
+public void handleRenameCode()
+
+
Handler for the Rename Code menu option. +

+

+
+
+
+
+ +

+handleDeleteCode

+
+public void handleDeleteCode()
+
+
Remove a piece of code from the sketch and from the disk. +

+

+
+
+
+
+ +

+handlePrevCode

+
+public void handlePrevCode()
+
+
Move to the previous tab. +

+

+
+
+
+
+ +

+handleNextCode

+
+public void handleNextCode()
+
+
Move to the next tab. +

+

+
+
+
+
+ +

+setModified

+
+public void setModified(boolean state)
+
+
Sets the modified value for the code in the frontmost tab. +

+

+
+
+
+
+ +

+isModified

+
+public boolean isModified()
+
+
+
+
+
+
+ +

+save

+
+public boolean save()
+             throws java.io.IOException
+
+
Save all code in the current sketch. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+handleAddFile

+
+public void handleAddFile()
+
+
Prompt the user for a new file to the sketch, then call the + other addFile() function to actually add it. +

+

+
+
+
+
+ +

+addFile

+
+public boolean addFile(java.io.File sourceFile)
+
+
Add a file to the sketch. +

+ .pde or .java files will be added to the sketch folder.
+ .jar, .class, .dll, .jnilib, and .so files will all + be added to the "code" folder.
+ All other files will be added to the "data" folder. +

+ If they don't exist already, the "code" or "data" folder + will be created. +

+

+

+ +
Returns:
true if successful.
+
+
+
+ +

+importLibrary

+
+public void importLibrary(java.lang.String jarPath)
+
+
Add import statements to the current tab for all of packages inside + the specified jar file. +

+

+
+
+
+
+ +

+setCurrentCode

+
+public void setCurrentCode(int which)
+
+
Change what file is currently being edited. Changes the current tab index. +
    +
  1. store the String for the text of the current file. +
  2. retrieve the String for the text of the new file. +
  3. change the text that's visible in the text area +
+

+

+
+
+
+
+ +

+preprocess

+
+public java.lang.String preprocess(java.lang.String buildPath)
+                            throws RunnerException
+
+
Build all the code for this sketch. + + In an advanced program, the returned class name could be different, + which is why the className is set based on the return value. + A compilation error will burp up a RunnerException. + + Setting purty to 'true' will cause exception line numbers to be incorrect. + Unless you know the code compiles, you should first run the preprocessor + with purty set to false to make sure there are no errors, then once + successful, re-export with purty set to true. +

+

+
Parameters:
buildPath - Location to copy all the .java files +
Returns:
null if compilation failed, main class name if not +
Throws: +
RunnerException
+
+
+
+ +

+build

+
+public java.lang.String build(java.lang.String buildPath)
+                       throws RunnerException
+
+
Preprocess and compile all the code for this sketch. + + In an advanced program, the returned class name could be different, + which is why the className is set based on the return value. + A compilation error will burp up a RunnerException. +

+

+ +
Returns:
null if compilation failed, main class name if not +
Throws: +
RunnerException
+
+
+
+ +

+exportApplet

+
+public boolean exportApplet(java.lang.String appletPath)
+                     throws RunnerException,
+                            java.io.IOException
+
+
Handle export to applet. +

+

+ +
Throws: +
RunnerException +
java.io.IOException
+
+
+
+ +

+scrubComments

+
+public static java.lang.String scrubComments(java.lang.String what)
+
+
Replace all commented portions of a given String as spaces. + Utility function used here and in the preprocessor. +

+

+
+
+
+
+ +

+exportApplicationPrompt

+
+public boolean exportApplicationPrompt()
+                                throws java.io.IOException,
+                                       RunnerException
+
+
+ +
Throws: +
java.io.IOException +
RunnerException
+
+
+
+ +

+exportApplication

+
+public boolean exportApplication(java.lang.String destPath,
+                                 int exportPlatform)
+                          throws java.io.IOException,
+                                 RunnerException
+
+
Export to application without GUI. +

+

+ +
Throws: +
java.io.IOException +
RunnerException
+
+
+
+ +

+isReadOnly

+
+public boolean isReadOnly()
+
+
Returns true if this is a read-only sketch. Used for the + examples directory, or when sketches are loaded from read-only + volumes or folders without appropriate permissions. +

+

+
+
+
+
+ +

+hideExtension

+
+public boolean hideExtension(java.lang.String what)
+
+
True if the specified extension should be hidden when shown on a tab. + For Processing, this is true for .pde files. (Broken out for subclasses.) +

+

+
+
+
+
+ +

+hasDefaultExtension

+
+public boolean hasDefaultExtension(SketchCode code)
+
+
True if the specified code has the default file extension. +

+

+
+
+
+
+ +

+isDefaultExtension

+
+public boolean isDefaultExtension(java.lang.String what)
+
+
True if the specified extension is the default file extension. +

+

+
+
+
+
+ +

+validExtension

+
+public boolean validExtension(java.lang.String what)
+
+
Check this extension (no dots, please) against the list of valid + extensions. +

+

+
+
+
+
+ +

+getDefaultExtension

+
+public java.lang.String getDefaultExtension()
+
+
Returns the default extension for this editor setup. +

+

+
+
+
+
+ +

+getExtensions

+
+public java.lang.String[] getExtensions()
+
+
Returns a String[] array of proper extensions. +

+

+
+
+
+
+ +

+getName

+
+public java.lang.String getName()
+
+
Returns the name of this sketch. (The pretty name of the main tab.) +

+

+
+
+
+
+ +

+getPrimaryFile

+
+public java.io.File getPrimaryFile()
+
+
Returns a file object for the primary .pde of this sketch. +

+

+
+
+
+
+ +

+getMainFilePath

+
+public java.lang.String getMainFilePath()
+
+
Returns path to the main .pde file for this sketch. +

+

+
+
+
+
+ +

+getFolder

+
+public java.io.File getFolder()
+
+
Returns the sketch folder. +

+

+
+
+
+
+ +

+getDataFolder

+
+public java.io.File getDataFolder()
+
+
Returns the location of the sketch's data folder. (It may not exist yet.) +

+

+
+
+
+
+ +

+prepareDataFolder

+
+public java.io.File prepareDataFolder()
+
+
Create the data folder if it does not exist already. As a convenience, + it also returns the data folder, since it's likely about to be used. +

+

+
+
+
+
+ +

+getCodeFolder

+
+public java.io.File getCodeFolder()
+
+
Returns the location of the sketch's code folder. (It may not exist yet.) +

+

+
+
+
+
+ +

+prepareCodeFolder

+
+public java.io.File prepareCodeFolder()
+
+
Create the code folder if it does not exist already. As a convenience, + it also returns the code folder, since it's likely about to be used. +

+

+
+
+
+
+ +

+getClassPath

+
+public java.lang.String getClassPath()
+
+
+
+
+
+
+ +

+getLibraryPath

+
+public java.lang.String getLibraryPath()
+
+
+
+
+
+
+ +

+getCode

+
+public SketchCode[] getCode()
+
+
+
+
+
+
+ +

+getCodeCount

+
+public int getCodeCount()
+
+
+
+
+
+
+ +

+getCode

+
+public SketchCode getCode(int index)
+
+
+
+
+
+
+ +

+getCodeIndex

+
+public int getCodeIndex(SketchCode who)
+
+
+
+
+
+
+ +

+getCurrentCode

+
+public SketchCode getCurrentCode()
+
+
+
+
+
+
+ +

+setUntitled

+
+public void setUntitled(boolean u)
+
+
+
+
+
+
+ +

+isUntitled

+
+public boolean isUntitled()
+
+
+
+
+
+
+ +

+getAppletClassName2

+
+public java.lang.String getAppletClassName2()
+
+
+
+
+
+
+ +

+checkName

+
+public static java.lang.String checkName(java.lang.String origName)
+
+
Convert to sanitized name and alert the user + if changes were made. +

+

+
+
+
+
+ +

+isSanitaryName

+
+public static boolean isSanitaryName(java.lang.String name)
+
+
Return true if the name is valid for a Processing sketch. +

+

+
+
+
+
+ +

+sanitizeName

+
+public static java.lang.String sanitizeName(java.lang.String origName)
+
+
Produce a sanitized name that fits our standards for likely to work. +

+ Java classes have a wider range of names that are technically allowed + (supposedly any Unicode name) than what we support. The reason for + going more narrow is to avoid situations with text encodings and + converting during the process of moving files between operating + systems, i.e. uploading from a Windows machine to a Linux server, + or reading a FAT32 partition in OS X and using a thumb drive. +

+ This helper function replaces everything but A-Z, a-z, and 0-9 with + underscores. Also disallows starting the sketch name with a digit. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/SketchCode.html b/build/javadoc/everything/processing/app/SketchCode.html new file mode 100644 index 000000000..6fdee3726 --- /dev/null +++ b/build/javadoc/everything/processing/app/SketchCode.html @@ -0,0 +1,668 @@ + + + + + +SketchCode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class SketchCode

+
+java.lang.Object
+  extended by processing.app.SketchCode
+
+
+
+
public class SketchCode
extends java.lang.Object
+ + +

+Represents a single tab of a sketch. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
SketchCode(java.io.File file, + java.lang.String extension) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddPreprocOffset(int extra) + +
+           
+ javax.swing.text.DocumentgetDocument() + +
+           
+ java.lang.StringgetExtension() + +
+           
+ java.io.FilegetFile() + +
+           
+ java.lang.StringgetFileName() + +
+           
+ intgetLineCount() + +
+           
+ intgetPreprocOffset() + +
+           
+ java.lang.StringgetPrettyName() + +
+           
+ java.lang.StringgetProgram() + +
+           
+ intgetScrollPosition() + +
+           
+ intgetSelectionStart() + +
+           
+ intgetSelectionStop() + +
+           
+ javax.swing.undo.UndoManagergetUndo() + +
+           
+ booleanisExtension(java.lang.String what) + +
+           
+ booleanisModified() + +
+           
+ voidload() + +
+          Load this piece of code from a file.
+ voidsave() + +
+          Save this piece of code, regardless of whether the modified + flag is set or not.
+ voidsaveAs(java.io.File newFile) + +
+          Save this file to another location, used by Sketch.saveAs()
+ voidsetDocument(javax.swing.text.Document d) + +
+           
+ voidsetModified(boolean modified) + +
+           
+ voidsetPreprocOffset(int preprocOffset) + +
+           
+ voidsetProgram(java.lang.String replacement) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SketchCode

+
+public SketchCode(java.io.File file,
+                  java.lang.String extension)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getFile

+
+public java.io.File getFile()
+
+
+
+
+
+
+ +

+getFileName

+
+public java.lang.String getFileName()
+
+
+
+
+
+
+ +

+getPrettyName

+
+public java.lang.String getPrettyName()
+
+
+
+
+
+
+ +

+getExtension

+
+public java.lang.String getExtension()
+
+
+
+
+
+
+ +

+isExtension

+
+public boolean isExtension(java.lang.String what)
+
+
+
+
+
+
+ +

+getProgram

+
+public java.lang.String getProgram()
+
+
+
+
+
+
+ +

+setProgram

+
+public void setProgram(java.lang.String replacement)
+
+
+
+
+
+
+ +

+getLineCount

+
+public int getLineCount()
+
+
+
+
+
+
+ +

+setModified

+
+public void setModified(boolean modified)
+
+
+
+
+
+
+ +

+isModified

+
+public boolean isModified()
+
+
+
+
+
+
+ +

+setPreprocOffset

+
+public void setPreprocOffset(int preprocOffset)
+
+
+
+
+
+
+ +

+getPreprocOffset

+
+public int getPreprocOffset()
+
+
+
+
+
+
+ +

+addPreprocOffset

+
+public void addPreprocOffset(int extra)
+
+
+
+
+
+
+ +

+getDocument

+
+public javax.swing.text.Document getDocument()
+
+
+
+
+
+
+ +

+setDocument

+
+public void setDocument(javax.swing.text.Document d)
+
+
+
+
+
+
+ +

+getUndo

+
+public javax.swing.undo.UndoManager getUndo()
+
+
+
+
+
+
+ +

+getSelectionStart

+
+public int getSelectionStart()
+
+
+
+
+
+
+ +

+getSelectionStop

+
+public int getSelectionStop()
+
+
+
+
+
+
+ +

+getScrollPosition

+
+public int getScrollPosition()
+
+
+
+
+
+
+ +

+load

+
+public void load()
+          throws java.io.IOException
+
+
Load this piece of code from a file. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+save

+
+public void save()
+          throws java.io.IOException
+
+
Save this piece of code, regardless of whether the modified + flag is set or not. +

+

+ +
Throws: +
java.io.IOException
+
+
+
+ +

+saveAs

+
+public void saveAs(java.io.File newFile)
+            throws java.io.IOException
+
+
Save this file to another location, used by Sketch.saveAs() +

+

+ +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/Theme.html b/build/javadoc/everything/processing/app/Theme.html new file mode 100644 index 000000000..459504f68 --- /dev/null +++ b/build/javadoc/everything/processing/app/Theme.html @@ -0,0 +1,450 @@ + + + + + +Theme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class Theme

+
+java.lang.Object
+  extended by processing.app.Theme
+
+
+
+
public class Theme
extends java.lang.Object
+ + +

+Storage class for theme settings. This was separated from the Preferences + class for 1.0 so that the coloring wouldn't conflict with previous releases + and to make way for future ability to customize. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Theme() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static java.lang.Stringget(java.lang.String attribute) + +
+           
+static booleangetBoolean(java.lang.String attribute) + +
+           
+static java.awt.ColorgetColor(java.lang.String name) + +
+           
+static java.lang.StringgetDefault(java.lang.String attribute) + +
+           
+static java.awt.FontgetFont(java.lang.String attr) + +
+           
+static intgetInteger(java.lang.String attribute) + +
+           
+static SyntaxStylegetStyle(java.lang.String what) + +
+           
+static voidset(java.lang.String attribute, + java.lang.String value) + +
+           
+static voidsetBoolean(java.lang.String attribute, + boolean value) + +
+           
+static voidsetColor(java.lang.String attr, + java.awt.Color what) + +
+           
+static voidsetInteger(java.lang.String key, + int value) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Theme

+
+public Theme()
+
+
+ + + + + + + + +
+Method Detail
+ +

+get

+
+public static java.lang.String get(java.lang.String attribute)
+
+
+
+
+
+
+ +

+getDefault

+
+public static java.lang.String getDefault(java.lang.String attribute)
+
+
+
+
+
+
+ +

+set

+
+public static void set(java.lang.String attribute,
+                       java.lang.String value)
+
+
+
+
+
+
+ +

+getBoolean

+
+public static boolean getBoolean(java.lang.String attribute)
+
+
+
+
+
+
+ +

+setBoolean

+
+public static void setBoolean(java.lang.String attribute,
+                              boolean value)
+
+
+
+
+
+
+ +

+getInteger

+
+public static int getInteger(java.lang.String attribute)
+
+
+
+
+
+
+ +

+setInteger

+
+public static void setInteger(java.lang.String key,
+                              int value)
+
+
+
+
+
+
+ +

+getColor

+
+public static java.awt.Color getColor(java.lang.String name)
+
+
+
+
+
+
+ +

+setColor

+
+public static void setColor(java.lang.String attr,
+                            java.awt.Color what)
+
+
+
+
+
+
+ +

+getFont

+
+public static java.awt.Font getFont(java.lang.String attr)
+
+
+
+
+
+
+ +

+getStyle

+
+public static SyntaxStyle getStyle(java.lang.String what)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/UpdateCheck.html b/build/javadoc/everything/processing/app/UpdateCheck.html new file mode 100644 index 000000000..0e1d5e7cf --- /dev/null +++ b/build/javadoc/everything/processing/app/UpdateCheck.html @@ -0,0 +1,266 @@ + + + + + +UpdateCheck + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class UpdateCheck

+
+java.lang.Object
+  extended by processing.app.UpdateCheck
+
+
+
All Implemented Interfaces:
java.lang.Runnable
+
+
+
+
public class UpdateCheck
extends java.lang.Object
implements java.lang.Runnable
+ + +

+Threaded class to check for updates in the background. +

+ This is the class that handles the mind control and stuff for + spying on our users and stealing their personal information. + A random ID number is generated for each user, and hits the server + to check for updates. Also included is the operating system and + its version and the version of Java being used to run Processing. +

+ The ID number also helps provide us a general idea of how many + people are using Processing, which helps us when writing grant + proposals and that kind of thing so that we can keep Processing free. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
UpdateCheck(Base base) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidrun() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+UpdateCheck

+
+public UpdateCheck(Base base)
+
+
+ + + + + + + + +
+Method Detail
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/WebServer.html b/build/javadoc/everything/processing/app/WebServer.html new file mode 100644 index 000000000..b5613793d --- /dev/null +++ b/build/javadoc/everything/processing/app/WebServer.html @@ -0,0 +1,913 @@ + + + + + +WebServer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app +
+Class WebServer

+
+java.lang.Object
+  extended by processing.app.WebServer
+
+
+
+
public class WebServer
extends java.lang.Object
+ + +

+An example of a very simple, multi-threaded HTTP server. + Taken from this article on java.sun.com. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intHTTP_ACCEPTED + +
+           
+static intHTTP_BAD_GATEWAY + +
+           
+static intHTTP_BAD_METHOD + +
+           
+static intHTTP_BAD_REQUEST + +
+          4XX: client error
+static intHTTP_CLIENT_TIMEOUT + +
+           
+static intHTTP_CONFLICT + +
+           
+static intHTTP_CREATED + +
+           
+static intHTTP_ENTITY_TOO_LARGE + +
+           
+static intHTTP_FORBIDDEN + +
+           
+static intHTTP_GATEWAY_TIMEOUT + +
+           
+static intHTTP_GONE + +
+           
+static intHTTP_INTERNAL_ERROR + +
+           
+static intHTTP_LENGTH_REQUIRED + +
+           
+static intHTTP_MOVED_PERM + +
+           
+static intHTTP_MOVED_TEMP + +
+           
+static intHTTP_MULT_CHOICE + +
+          3XX: relocation/redirect
+static intHTTP_NO_CONTENT + +
+           
+static intHTTP_NOT_ACCEPTABLE + +
+           
+static intHTTP_NOT_AUTHORITATIVE + +
+           
+static intHTTP_NOT_FOUND + +
+           
+static intHTTP_NOT_MODIFIED + +
+           
+static intHTTP_OK + +
+          2XX: generally "OK"
+static intHTTP_PARTIAL + +
+           
+static intHTTP_PAYMENT_REQUIRED + +
+           
+static intHTTP_PRECON_FAILED + +
+           
+static intHTTP_PROXY_AUTH + +
+           
+static intHTTP_REQ_TOO_LONG + +
+           
+static intHTTP_RESET + +
+           
+static intHTTP_SEE_OTHER + +
+           
+static intHTTP_SERVER_ERROR + +
+          5XX: server error
+static intHTTP_UNAUTHORIZED + +
+           
+static intHTTP_UNAVAILABLE + +
+           
+static intHTTP_UNSUPPORTED_TYPE + +
+           
+static intHTTP_USE_PROXY + +
+           
+static intHTTP_VERSION + +
+           
+  + + + + + + + + + + +
+Constructor Summary
WebServer() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static intlaunch(java.lang.String zipPath) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+HTTP_OK

+
+public static final int HTTP_OK
+
+
2XX: generally "OK" +

+

+
See Also:
Constant Field Values
+
+
+ +

+HTTP_CREATED

+
+public static final int HTTP_CREATED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_ACCEPTED

+
+public static final int HTTP_ACCEPTED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_NOT_AUTHORITATIVE

+
+public static final int HTTP_NOT_AUTHORITATIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_NO_CONTENT

+
+public static final int HTTP_NO_CONTENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_RESET

+
+public static final int HTTP_RESET
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_PARTIAL

+
+public static final int HTTP_PARTIAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_MULT_CHOICE

+
+public static final int HTTP_MULT_CHOICE
+
+
3XX: relocation/redirect +

+

+
See Also:
Constant Field Values
+
+
+ +

+HTTP_MOVED_PERM

+
+public static final int HTTP_MOVED_PERM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_MOVED_TEMP

+
+public static final int HTTP_MOVED_TEMP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_SEE_OTHER

+
+public static final int HTTP_SEE_OTHER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_NOT_MODIFIED

+
+public static final int HTTP_NOT_MODIFIED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_USE_PROXY

+
+public static final int HTTP_USE_PROXY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_BAD_REQUEST

+
+public static final int HTTP_BAD_REQUEST
+
+
4XX: client error +

+

+
See Also:
Constant Field Values
+
+
+ +

+HTTP_UNAUTHORIZED

+
+public static final int HTTP_UNAUTHORIZED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_PAYMENT_REQUIRED

+
+public static final int HTTP_PAYMENT_REQUIRED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_FORBIDDEN

+
+public static final int HTTP_FORBIDDEN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_NOT_FOUND

+
+public static final int HTTP_NOT_FOUND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_BAD_METHOD

+
+public static final int HTTP_BAD_METHOD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_NOT_ACCEPTABLE

+
+public static final int HTTP_NOT_ACCEPTABLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_PROXY_AUTH

+
+public static final int HTTP_PROXY_AUTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_CLIENT_TIMEOUT

+
+public static final int HTTP_CLIENT_TIMEOUT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_CONFLICT

+
+public static final int HTTP_CONFLICT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_GONE

+
+public static final int HTTP_GONE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_LENGTH_REQUIRED

+
+public static final int HTTP_LENGTH_REQUIRED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_PRECON_FAILED

+
+public static final int HTTP_PRECON_FAILED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_ENTITY_TOO_LARGE

+
+public static final int HTTP_ENTITY_TOO_LARGE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_REQ_TOO_LONG

+
+public static final int HTTP_REQ_TOO_LONG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_UNSUPPORTED_TYPE

+
+public static final int HTTP_UNSUPPORTED_TYPE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_SERVER_ERROR

+
+public static final int HTTP_SERVER_ERROR
+
+
5XX: server error +

+

+
See Also:
Constant Field Values
+
+
+ +

+HTTP_INTERNAL_ERROR

+
+public static final int HTTP_INTERNAL_ERROR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_BAD_GATEWAY

+
+public static final int HTTP_BAD_GATEWAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_UNAVAILABLE

+
+public static final int HTTP_UNAVAILABLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_GATEWAY_TIMEOUT

+
+public static final int HTTP_GATEWAY_TIMEOUT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_VERSION

+
+public static final int HTTP_VERSION
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+WebServer

+
+public WebServer()
+
+
+ + + + + + + + +
+Method Detail
+ +

+launch

+
+public static int launch(java.lang.String zipPath)
+                  throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/Compiler.html b/build/javadoc/everything/processing/app/debug/Compiler.html new file mode 100644 index 000000000..7ae5ddc6e --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/Compiler.html @@ -0,0 +1,313 @@ + + + + + +Compiler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Class Compiler

+
+java.lang.Object
+  extended by processing.app.debug.Compiler
+
+
+
+
public class Compiler
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Compiler() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleancompile(Sketch sketch, + java.lang.String buildPath, + java.lang.String primaryClassName) + +
+          Compile with ECJ.
+static java.lang.StringcontentsToClassPath(java.io.File folder) + +
+          Given a folder, return a list of absolute paths to all jar or zip files + inside that folder, separated by pathSeparatorChar.
+static java.lang.String[]packageListFromClassPath(java.lang.String path) + +
+          A classpath, separated by the path separator, will contain + a series of .jar/.zip files or directories containing .class + files, or containing subdirectories that have .class files.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Compiler

+
+public Compiler()
+
+
+ + + + + + + + +
+Method Detail
+ +

+compile

+
+public boolean compile(Sketch sketch,
+                       java.lang.String buildPath,
+                       java.lang.String primaryClassName)
+                throws RunnerException
+
+
Compile with ECJ. +

+

+
Parameters:
sketch - Sketch object to be compiled.
buildPath - Where the temporary files live and will be built from. +
Returns:
true if successful. +
Throws: +
RunnerException - Only if there's a problem. Only then.
+
+
+
+ +

+contentsToClassPath

+
+public static java.lang.String contentsToClassPath(java.io.File folder)
+
+
Given a folder, return a list of absolute paths to all jar or zip files + inside that folder, separated by pathSeparatorChar. + + This will prepend a colon (or whatever the path separator is) + so that it can be directly appended to another path string. + + As of 0136, this will no longer add the root folder as well. + + This function doesn't bother checking to see if there are any .class + files in the folder or within a subfolder. +

+

+
+
+
+
+ +

+packageListFromClassPath

+
+public static java.lang.String[] packageListFromClassPath(java.lang.String path)
+
+
A classpath, separated by the path separator, will contain + a series of .jar/.zip files or directories containing .class + files, or containing subdirectories that have .class files. +

+

+
Parameters:
path - the input classpath +
Returns:
array of possible package names
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/EventThread.html b/build/javadoc/everything/processing/app/debug/EventThread.html new file mode 100644 index 000000000..4cf586c81 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/EventThread.html @@ -0,0 +1,312 @@ + + + + + +EventThread + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Class EventThread

+
+java.lang.Object
+  extended by java.lang.Thread
+      extended by processing.app.debug.EventThread
+
+
+
All Implemented Interfaces:
java.lang.Runnable
+
+
+
+
public class EventThread
extends java.lang.Thread
+ + +

+This class processes incoming JDI events and displays them +

+ +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidrun() + +
+          Run the event handling thread.
+ voidvmDeathEvent(com.sun.jdi.event.VMDeathEvent event) + +
+           
+ voidvmDisconnectEvent(com.sun.jdi.event.VMDisconnectEvent event) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+run

+
+public void run()
+
+
Run the event handling thread. + As long as we are connected, get event sets off + the queue and dispatch the events within them. +

+

+
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
+
+
+
+
+
+
+ +

+vmDeathEvent

+
+public void vmDeathEvent(com.sun.jdi.event.VMDeathEvent event)
+
+
+
+
+
+
+ +

+vmDisconnectEvent

+
+public void vmDisconnectEvent(com.sun.jdi.event.VMDisconnectEvent event)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/MessageConsumer.html b/build/javadoc/everything/processing/app/debug/MessageConsumer.html new file mode 100644 index 000000000..4e670ad33 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/MessageConsumer.html @@ -0,0 +1,215 @@ + + + + + +MessageConsumer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Interface MessageConsumer

+
+
All Known Implementing Classes:
Runner
+
+
+
+
public interface MessageConsumer
+ + +

+Interface for dealing with parser/compiler output. +

+ Different instances of MessageStream need to do different things with + messages. In particular, a stream instance used for parsing output from + the compiler compiler has to interpret its messages differently than one + parsing output from the runtime. +

+ Classes which consume messages and do something with them + should implement this interface. +

+ +

+


+ +

+ + + + + + + + + + + + +
+Method Summary
+ voidmessage(java.lang.String s) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+message

+
+void message(java.lang.String s)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/Runner.html b/build/javadoc/everything/processing/app/debug/Runner.html new file mode 100644 index 000000000..9e3cd01d3 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/Runner.html @@ -0,0 +1,334 @@ + + + + + +Runner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Class Runner

+
+java.lang.Object
+  extended by processing.app.debug.Runner
+
+
+
All Implemented Interfaces:
MessageConsumer
+
+
+
+
public class Runner
extends java.lang.Object
implements MessageConsumer
+ + +

+Runs a compiled sketch. As of release 0136, all sketches are run externally + to the environment so that a debugging interface can be used. This opens up + future options for a decent debugger, but in the meantime fixes several + problems with output and error streams, messages getting lost on Mac OS X, + the run/stop buttons not working, libraries not shutting down, exceptions + not coming through, exceptions being printed twice, having to force quit + if you make a bad while() loop, and so on. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Runner(Sketch sketch, + java.lang.String appletClassName, + boolean presenting, + RunnerListener listener) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidclose() + +
+           
+ voidexception(com.sun.jdi.event.ExceptionEvent event) + +
+           
+ voidlaunch() + +
+           
+ voidmessage(java.lang.String s) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Runner

+
+public Runner(Sketch sketch,
+              java.lang.String appletClassName,
+              boolean presenting,
+              RunnerListener listener)
+
+
+ + + + + + + + +
+Method Detail
+ +

+launch

+
+public void launch()
+
+
+
+
+
+
+
+
+
+ +

+exception

+
+public void exception(com.sun.jdi.event.ExceptionEvent event)
+
+
+
+
+
+
+
+
+
+ +

+close

+
+public void close()
+
+
+
+
+
+
+
+
+
+ +

+message

+
+public void message(java.lang.String s)
+
+
+
Specified by:
message in interface MessageConsumer
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/RunnerException.html b/build/javadoc/everything/processing/app/debug/RunnerException.html new file mode 100644 index 000000000..e323d4c02 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/RunnerException.html @@ -0,0 +1,554 @@ + + + + + +RunnerException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Class RunnerException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.app.debug.RunnerException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class RunnerException
extends java.lang.Exception
+ + +

+An exception with a line number attached that occurs + during either compile time or run time. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
RunnerException(java.lang.String message) + +
+           
RunnerException(java.lang.String message, + int file, + int line, + int column) + +
+           
RunnerException(java.lang.String message, + int file, + int line, + int column, + boolean showStackTrace) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ intgetCodeColumn() + +
+           
+ intgetCodeIndex() + +
+           
+ intgetCodeLine() + +
+           
+ java.lang.StringgetMessage() + +
+          Override getMessage() in Throwable, so that I can set + the message text outside the constructor.
+ booleanhasCodeIndex() + +
+           
+ booleanhasCodeLine() + +
+           
+ voidhideStackTrace() + +
+           
+ voidprintStackTrace() + +
+          Nix the java.lang crap out of an exception message + because it scares the children.
+ voidsetCodeColumn(int column) + +
+           
+ voidsetCodeIndex(int index) + +
+           
+ voidsetCodeLine(int line) + +
+           
+ voidsetMessage(java.lang.String message) + +
+           
+ voidshowStackTrace() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+RunnerException

+
+public RunnerException(java.lang.String message)
+
+
+
+ +

+RunnerException

+
+public RunnerException(java.lang.String message,
+                       int file,
+                       int line,
+                       int column)
+
+
+
+ +

+RunnerException

+
+public RunnerException(java.lang.String message,
+                       int file,
+                       int line,
+                       int column,
+                       boolean showStackTrace)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getMessage

+
+public java.lang.String getMessage()
+
+
Override getMessage() in Throwable, so that I can set + the message text outside the constructor. +

+

+
Overrides:
getMessage in class java.lang.Throwable
+
+
+
+
+
+
+ +

+setMessage

+
+public void setMessage(java.lang.String message)
+
+
+
+
+
+
+ +

+getCodeIndex

+
+public int getCodeIndex()
+
+
+
+
+
+
+ +

+setCodeIndex

+
+public void setCodeIndex(int index)
+
+
+
+
+
+
+ +

+hasCodeIndex

+
+public boolean hasCodeIndex()
+
+
+
+
+
+
+ +

+getCodeLine

+
+public int getCodeLine()
+
+
+
+
+
+
+ +

+setCodeLine

+
+public void setCodeLine(int line)
+
+
+
+
+
+
+ +

+hasCodeLine

+
+public boolean hasCodeLine()
+
+
+
+
+
+
+ +

+setCodeColumn

+
+public void setCodeColumn(int column)
+
+
+
+
+
+
+ +

+getCodeColumn

+
+public int getCodeColumn()
+
+
+
+
+
+
+ +

+showStackTrace

+
+public void showStackTrace()
+
+
+
+
+
+
+ +

+hideStackTrace

+
+public void hideStackTrace()
+
+
+
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace()
+
+
Nix the java.lang crap out of an exception message + because it scares the children. +

+ This function must be static to be used with super() + in each of the constructors above. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/RunnerListener.html b/build/javadoc/everything/processing/app/debug/RunnerListener.html new file mode 100644 index 000000000..af755cc1f --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/RunnerListener.html @@ -0,0 +1,222 @@ + + + + + +RunnerListener + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Interface RunnerListener

+
+
All Known Implementing Classes:
Commander, Editor
+
+
+
+
public interface RunnerListener
+ + +

+


+ +

+ + + + + + + + + + + + + + + + +
+Method Summary
+ voidstatusError(java.lang.Exception exception) + +
+           
+ voidstatusError(java.lang.String message) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+statusError

+
+void statusError(java.lang.String message)
+
+
+
+
+
+
+ +

+statusError

+
+void statusError(java.lang.Exception exception)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/StreamRedirectThread.html b/build/javadoc/everything/processing/app/debug/StreamRedirectThread.html new file mode 100644 index 000000000..aa7b615b7 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/StreamRedirectThread.html @@ -0,0 +1,314 @@ + + + + + +StreamRedirectThread + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.debug +
+Class StreamRedirectThread

+
+java.lang.Object
+  extended by java.lang.Thread
+      extended by processing.app.debug.StreamRedirectThread
+
+
+
All Implemented Interfaces:
java.lang.Runnable
+
+
+
+
public class StreamRedirectThread
extends java.lang.Thread
+ + +

+StreamRedirectThread is a thread which copies it's input to + it's output and terminates when it completes. +

+ +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
+  + + + + + + + + + + +
+Constructor Summary
StreamRedirectThread(java.lang.String name, + java.io.InputStream in, + java.io.OutputStream out) + +
+          Set up for copy.
+  + + + + + + + + + + + +
+Method Summary
+ voidrun() + +
+          Copy.
+ + + + + + + +
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StreamRedirectThread

+
+public StreamRedirectThread(java.lang.String name,
+                            java.io.InputStream in,
+                            java.io.OutputStream out)
+
+
Set up for copy. +

+

+
Parameters:
name - Name of the thread
in - Stream to copy from
out - Stream to copy to
+
+ + + + + + + + +
+Method Detail
+ +

+run

+
+public void run()
+
+
Copy. +

+

+
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/package-frame.html b/build/javadoc/everything/processing/app/debug/package-frame.html new file mode 100644 index 000000000..9ce5a56b4 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/package-frame.html @@ -0,0 +1,61 @@ + + + + + +processing.app.debug + + + + + + + + + + + +processing.app.debug + + + + +
+Interfaces  + +
+MessageConsumer +
+RunnerListener
+ + + + + + +
+Classes  + +
+Compiler +
+EventThread +
+Runner +
+StreamRedirectThread
+ + + + + + +
+Exceptions  + +
+RunnerException
+ + + + diff --git a/build/javadoc/everything/processing/app/debug/package-summary.html b/build/javadoc/everything/processing/app/debug/package-summary.html new file mode 100644 index 000000000..0d0ce2c87 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/package-summary.html @@ -0,0 +1,197 @@ + + + + + +processing.app.debug + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.debug +

+ + + + + + + + + + + + + +
+Interface Summary
MessageConsumerInterface for dealing with parser/compiler output.
RunnerListener 
+  + +

+ + + + + + + + + + + + + + + + + + + + + +
+Class Summary
Compiler 
EventThreadThis class processes incoming JDI events and displays them
RunnerRuns a compiled sketch.
StreamRedirectThreadStreamRedirectThread is a thread which copies it's input to + it's output and terminates when it completes.
+  + +

+ + + + + + + + + +
+Exception Summary
RunnerExceptionAn exception with a line number attached that occurs + during either compile time or run time.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/debug/package-tree.html b/build/javadoc/everything/processing/app/debug/package-tree.html new file mode 100644 index 000000000..b12819737 --- /dev/null +++ b/build/javadoc/everything/processing/app/debug/package-tree.html @@ -0,0 +1,160 @@ + + + + + +processing.app.debug Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.debug +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object +
+

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/linux/Platform.html b/build/javadoc/everything/processing/app/linux/Platform.html new file mode 100644 index 000000000..4f2da2a38 --- /dev/null +++ b/build/javadoc/everything/processing/app/linux/Platform.html @@ -0,0 +1,349 @@ + + + + + +Platform + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.linux +
+Class Platform

+
+java.lang.Object
+  extended by processing.app.Platform
+      extended by processing.app.linux.Platform
+
+
+
+
public class Platform
extends Platform
+ + +

+Used by Base for platform-specific tweaking, for instance finding the + sketchbook location using the Windows registry, or OS X event handling. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Platform() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidopenFolder(java.io.File file) + +
+           
+ booleanopenFolderAvailable() + +
+           
+ voidopenURL(java.lang.String url) + +
+           
+ voidsetLookAndFeel() + +
+          Set the default L & F.
+ + + + + + + +
Methods inherited from class processing.app.Platform
getDefaultSketchbookFolder, getSettingsFolder, init
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Platform

+
+public Platform()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setLookAndFeel

+
+public void setLookAndFeel()
+                    throws java.lang.Exception
+
+
Description copied from class: Platform
+
Set the default L & F. While I enjoy the bounty of the sixteen possible + exception types that this UIManager method might throw, I feel that in + just this one particular case, I'm being spoiled by those engineers + at Sun, those Masters of the Abstractionverse. It leaves me feeling sad + and overweight. So instead, I'll pretend that I'm not offered eleven dozen + ways to report to the user exactly what went wrong, and I'll bundle them + all into a single catch-all "Exception". Because in the end, all I really + care about is whether things worked or not. And even then, I don't care. +

+

+
Overrides:
setLookAndFeel in class Platform
+
+
+ +
Throws: +
java.lang.Exception - Just like I said.
+
+
+
+ +

+openURL

+
+public void openURL(java.lang.String url)
+             throws java.lang.Exception
+
+
+
Overrides:
openURL in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+openFolderAvailable

+
+public boolean openFolderAvailable()
+
+
+
Overrides:
openFolderAvailable in class Platform
+
+
+
+
+
+
+ +

+openFolder

+
+public void openFolder(java.io.File file)
+                throws java.lang.Exception
+
+
+
Overrides:
openFolder in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/linux/package-frame.html b/build/javadoc/everything/processing/app/linux/package-frame.html new file mode 100644 index 000000000..b42e0b8d3 --- /dev/null +++ b/build/javadoc/everything/processing/app/linux/package-frame.html @@ -0,0 +1,31 @@ + + + + + +processing.app.linux + + + + + + + + + + + +processing.app.linux + + + + +
+Classes  + +
+Platform
+ + + + diff --git a/build/javadoc/everything/processing/app/linux/package-summary.html b/build/javadoc/everything/processing/app/linux/package-summary.html new file mode 100644 index 000000000..02598a2ae --- /dev/null +++ b/build/javadoc/everything/processing/app/linux/package-summary.html @@ -0,0 +1,152 @@ + + + + + +processing.app.linux + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.linux +

+ + + + + + + + + +
+Class Summary
PlatformUsed by Base for platform-specific tweaking, for instance finding the + sketchbook location using the Windows registry, or OS X event handling.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/linux/package-tree.html b/build/javadoc/everything/processing/app/linux/package-tree.html new file mode 100644 index 000000000..26c00985a --- /dev/null +++ b/build/javadoc/everything/processing/app/linux/package-tree.html @@ -0,0 +1,148 @@ + + + + + +processing.app.linux Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.linux +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/macosx/Platform.html b/build/javadoc/everything/processing/app/macosx/Platform.html new file mode 100644 index 000000000..de5c12633 --- /dev/null +++ b/build/javadoc/everything/processing/app/macosx/Platform.html @@ -0,0 +1,412 @@ + + + + + +Platform + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.macosx +
+Class Platform

+
+java.lang.Object
+  extended by processing.app.Platform
+      extended by processing.app.macosx.Platform
+
+
+
+
public class Platform
extends Platform
+ + +

+Platform handler for Mac OS X. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Platform() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.io.FilegetDefaultSketchbookFolder() + +
+           
+ java.io.FilegetSettingsFolder() + +
+           
+ voidinit(Base base) + +
+           
+ voidopenFolder(java.io.File file) + +
+           
+ booleanopenFolderAvailable() + +
+           
+ voidopenURL(java.lang.String url) + +
+           
+ voidsetLookAndFeel() + +
+          Set the default L & F.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Platform

+
+public Platform()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setLookAndFeel

+
+public void setLookAndFeel()
+                    throws java.lang.Exception
+
+
Description copied from class: Platform
+
Set the default L & F. While I enjoy the bounty of the sixteen possible + exception types that this UIManager method might throw, I feel that in + just this one particular case, I'm being spoiled by those engineers + at Sun, those Masters of the Abstractionverse. It leaves me feeling sad + and overweight. So instead, I'll pretend that I'm not offered eleven dozen + ways to report to the user exactly what went wrong, and I'll bundle them + all into a single catch-all "Exception". Because in the end, all I really + care about is whether things worked or not. And even then, I don't care. +

+

+
Overrides:
setLookAndFeel in class Platform
+
+
+ +
Throws: +
java.lang.Exception - Just like I said.
+
+
+
+ +

+init

+
+public void init(Base base)
+
+
+
Overrides:
init in class Platform
+
+
+
+
+
+
+ +

+getSettingsFolder

+
+public java.io.File getSettingsFolder()
+                               throws java.lang.Exception
+
+
+
Overrides:
getSettingsFolder in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+getDefaultSketchbookFolder

+
+public java.io.File getDefaultSketchbookFolder()
+                                        throws java.lang.Exception
+
+
+
Overrides:
getDefaultSketchbookFolder in class Platform
+
+
+ +
Returns:
null if not overridden, which will cause a prompt to show instead. +
Throws: +
java.lang.Exception
+
+
+
+ +

+openURL

+
+public void openURL(java.lang.String url)
+             throws java.lang.Exception
+
+
+
Overrides:
openURL in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+openFolderAvailable

+
+public boolean openFolderAvailable()
+
+
+
Overrides:
openFolderAvailable in class Platform
+
+
+
+
+
+
+ +

+openFolder

+
+public void openFolder(java.io.File file)
+                throws java.lang.Exception
+
+
+
Overrides:
openFolder in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/macosx/ThinkDifferent.html b/build/javadoc/everything/processing/app/macosx/ThinkDifferent.html new file mode 100644 index 000000000..43601c920 --- /dev/null +++ b/build/javadoc/everything/processing/app/macosx/ThinkDifferent.html @@ -0,0 +1,394 @@ + + + + + +ThinkDifferent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.macosx +
+Class ThinkDifferent

+
+java.lang.Object
+  extended by processing.app.macosx.ThinkDifferent
+
+
+
All Implemented Interfaces:
com.apple.eawt.ApplicationListener, java.util.EventListener
+
+
+
+
public class ThinkDifferent
extends java.lang.Object
implements com.apple.eawt.ApplicationListener
+ + +

+Deal with issues related to thinking different. This handles the basic + Mac OS X menu commands (and apple events) for open, about, prefs, etc. + + Based on OSXAdapter.java from Apple DTS. + + As of 0140, this code need not be built on platforms other than OS X, + because of the new platform structure which isolates through reflection. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
ThinkDifferent(Base base) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidhandleAbout(com.apple.eawt.ApplicationEvent ae) + +
+           
+ voidhandleOpenApplication(com.apple.eawt.ApplicationEvent ae) + +
+           
+ voidhandleOpenFile(com.apple.eawt.ApplicationEvent ae) + +
+           
+ voidhandlePreferences(com.apple.eawt.ApplicationEvent ae) + +
+           
+ voidhandlePrintFile(com.apple.eawt.ApplicationEvent ae) + +
+           
+ voidhandleQuit(com.apple.eawt.ApplicationEvent ae) + +
+           
+ voidhandleReOpenApplication(com.apple.eawt.ApplicationEvent arg0) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ThinkDifferent

+
+public ThinkDifferent(Base base)
+
+
+ + + + + + + + +
+Method Detail
+ +

+handleAbout

+
+public void handleAbout(com.apple.eawt.ApplicationEvent ae)
+
+
+
Specified by:
handleAbout in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+
+ +

+handlePreferences

+
+public void handlePreferences(com.apple.eawt.ApplicationEvent ae)
+
+
+
Specified by:
handlePreferences in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+
+ +

+handleOpenApplication

+
+public void handleOpenApplication(com.apple.eawt.ApplicationEvent ae)
+
+
+
Specified by:
handleOpenApplication in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+
+ +

+handleOpenFile

+
+public void handleOpenFile(com.apple.eawt.ApplicationEvent ae)
+
+
+
Specified by:
handleOpenFile in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+
+ +

+handlePrintFile

+
+public void handlePrintFile(com.apple.eawt.ApplicationEvent ae)
+
+
+
Specified by:
handlePrintFile in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+
+ +

+handleQuit

+
+public void handleQuit(com.apple.eawt.ApplicationEvent ae)
+
+
+
Specified by:
handleQuit in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+
+ +

+handleReOpenApplication

+
+public void handleReOpenApplication(com.apple.eawt.ApplicationEvent arg0)
+
+
+
Specified by:
handleReOpenApplication in interface com.apple.eawt.ApplicationListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/macosx/package-frame.html b/build/javadoc/everything/processing/app/macosx/package-frame.html new file mode 100644 index 000000000..c266a14e5 --- /dev/null +++ b/build/javadoc/everything/processing/app/macosx/package-frame.html @@ -0,0 +1,33 @@ + + + + + +processing.app.macosx + + + + + + + + + + + +processing.app.macosx + + + + +
+Classes  + +
+Platform +
+ThinkDifferent
+ + + + diff --git a/build/javadoc/everything/processing/app/macosx/package-summary.html b/build/javadoc/everything/processing/app/macosx/package-summary.html new file mode 100644 index 000000000..73bb1db96 --- /dev/null +++ b/build/javadoc/everything/processing/app/macosx/package-summary.html @@ -0,0 +1,155 @@ + + + + + +processing.app.macosx + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.macosx +

+ + + + + + + + + + + + + +
+Class Summary
PlatformPlatform handler for Mac OS X.
ThinkDifferentDeal with issues related to thinking different.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/macosx/package-tree.html b/build/javadoc/everything/processing/app/macosx/package-tree.html new file mode 100644 index 000000000..7bc8a5b3a --- /dev/null +++ b/build/javadoc/everything/processing/app/macosx/package-tree.html @@ -0,0 +1,149 @@ + + + + + +processing.app.macosx Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.macosx +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/package-frame.html b/build/javadoc/everything/processing/app/package-frame.html new file mode 100644 index 000000000..b900fd13f --- /dev/null +++ b/build/javadoc/everything/processing/app/package-frame.html @@ -0,0 +1,65 @@ + + + + + +processing.app + + + + + + + + + + + +processing.app + + + + +
+Classes  + +
+Base +
+Commander +
+Editor +
+EditorConsole +
+EditorHeader +
+EditorLineStatus +
+EditorListener +
+EditorStatus +
+EditorToolbar +
+FindReplace +
+Platform +
+Preferences +
+PresentMode +
+Sketch +
+SketchCode +
+Theme +
+UpdateCheck +
+WebServer
+ + + + diff --git a/build/javadoc/everything/processing/app/package-summary.html b/build/javadoc/everything/processing/app/package-summary.html new file mode 100644 index 000000000..41874391f --- /dev/null +++ b/build/javadoc/everything/processing/app/package-summary.html @@ -0,0 +1,220 @@ + + + + + +processing.app + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
BaseThe base class for the main processing application.
CommanderClass to handle running Processing from the command line.
EditorMain editor panel for the Processing Development Environment.
EditorConsoleMessage console that sits below the editing area.
EditorHeaderSketch tabs at the top of the editor window.
EditorLineStatusLi'l status bar fella that shows the line number.
EditorListenerFilters key events for tab expansion/indent/etc.
EditorStatusPanel just below the editing area that contains status messages.
EditorToolbarrun/stop/etc buttons for the ide
FindReplaceFind & Replace window for the Processing editor.
PlatformUsed by Base for platform-specific tweaking, for instance finding the + sketchbook location using the Windows registry, or OS X event handling.
PreferencesStorage class for user preferences and environment settings.
PresentModeHelper class for full-screen presentation mode.
SketchStores information about files in the current sketch
SketchCodeRepresents a single tab of a sketch.
ThemeStorage class for theme settings.
UpdateCheckThreaded class to check for updates in the background.
WebServerAn example of a very simple, multi-threaded HTTP server.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/package-tree.html b/build/javadoc/everything/processing/app/package-tree.html new file mode 100644 index 000000000..0c7998560 --- /dev/null +++ b/build/javadoc/everything/processing/app/package-tree.html @@ -0,0 +1,174 @@ + + + + + +processing.app Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • processing.app.Base
    • processing.app.Commander (implements processing.app.debug.RunnerListener) +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • processing.app.EditorHeader
          • processing.app.EditorLineStatus
          • processing.app.EditorToolbar (implements javax.swing.event.MouseInputListener) +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) + +
          • javax.swing.JScrollPane (implements javax.accessibility.Accessible, javax.swing.ScrollPaneConstants) + +
          +
        • java.awt.Window (implements javax.accessibility.Accessible) +
            +
          • java.awt.Frame (implements java.awt.MenuContainer) +
              +
            • javax.swing.JFrame (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants) + +
            +
          +
        +
      +
    • processing.app.EditorListener
    • processing.app.Platform
    • processing.app.Preferences
    • processing.app.PresentMode
    • processing.app.Sketch
    • processing.app.SketchCode
    • processing.app.Theme
    • processing.app.UpdateCheck (implements java.lang.Runnable) +
    • processing.app.WebServer
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/PdeEmitter.html b/build/javadoc/everything/processing/app/preproc/PdeEmitter.html new file mode 100644 index 000000000..fa0b8904e --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/PdeEmitter.html @@ -0,0 +1,311 @@ + + + + + +PdeEmitter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.preproc +
+Class PdeEmitter

+
+java.lang.Object
+  extended by processing.app.preproc.PdeEmitter
+
+
+
All Implemented Interfaces:
PdeTokenTypes
+
+
+
+
public class PdeEmitter
extends java.lang.Object
implements PdeTokenTypes
+ + +

+PDEEmitter: A class that can take an ANTLR Java AST and produce + reasonably formatted Java code from it. To use it, create a + PDEEmitter object, call setOut() if you want to print to something + other than System.out, and then call print(), passing the + AST. Typically, the AST node that you pass would be the root of a + tree - the ROOT_ID node that represents a Java file. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.app.preproc.PdeTokenTypes
ABSTRACT, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CONSTRUCTOR_CAST, CTOR_CALL, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, ELIST, EMPTY_FIELD, EMPTY_STAT, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_color, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RPAREN, SEMI, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRICTFP, STRING_LITERAL, SUPER_CTOR_CALL, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WEBCOLOR_LITERAL, WS
+  + + + + + + + + + + +
+Constructor Summary
PdeEmitter() + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+ voidprint(antlr.collections.AST ast) + +
+          Print the given AST.
+ voidsetOut(java.io.PrintStream out) + +
+          Specify a PrintStream to print to.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PdeEmitter

+
+public PdeEmitter()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setOut

+
+public void setOut(java.io.PrintStream out)
+
+
Specify a PrintStream to print to. System.out is the default. +

+

+
+
+
+
Parameters:
out - the PrintStream to print to
+
+
+
+ +

+print

+
+public void print(antlr.collections.AST ast)
+           throws RunnerException
+
+
Print the given AST. Call this function to print your PDE code. + + It works by making recursive calls to print children. + So the code below is one big "switch" statement on the passed AST type. +

+

+
+
+
+ +
Throws: +
RunnerException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/PdeLexer.html b/build/javadoc/everything/processing/app/preproc/PdeLexer.html new file mode 100644 index 000000000..36c5afd38 --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/PdeLexer.html @@ -0,0 +1,1970 @@ + + + + + +PdeLexer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.preproc +
+Class PdeLexer

+
+java.lang.Object
+  extended by antlr.CharScanner
+      extended by processing.app.preproc.PdeLexer
+
+
+
All Implemented Interfaces:
antlr.TokenStream, PdeTokenTypes
+
+
+
+
public class PdeLexer
extends antlr.CharScanner
implements PdeTokenTypes, antlr.TokenStream
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static antlr.collections.impl.BitSet_tokenSet_0 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_1 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_2 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_3 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_4 + +
+           
+ + + + + + + +
Fields inherited from class antlr.CharScanner
EOF_CHAR
+ + + + + + + +
Fields inherited from interface processing.app.preproc.PdeTokenTypes
ABSTRACT, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CONSTRUCTOR_CAST, CTOR_CALL, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, ELIST, EMPTY_FIELD, EMPTY_STAT, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_color, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RPAREN, SEMI, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRICTFP, STRING_LITERAL, SUPER_CTOR_CALL, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WEBCOLOR_LITERAL, WS
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
PdeLexer(antlr.InputBuffer ib) + +
+           
PdeLexer(java.io.InputStream in) + +
+           
PdeLexer(antlr.LexerSharedInputState state) + +
+           
PdeLexer(java.io.Reader in) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidmASSIGN(boolean _createToken) + +
+           
+ voidmBAND_ASSIGN(boolean _createToken) + +
+           
+ voidmBAND(boolean _createToken) + +
+           
+ voidmBNOT(boolean _createToken) + +
+           
+ voidmBOR_ASSIGN(boolean _createToken) + +
+           
+ voidmBOR(boolean _createToken) + +
+           
+ voidmBSR_ASSIGN(boolean _createToken) + +
+           
+ voidmBSR(boolean _createToken) + +
+           
+ voidmBXOR_ASSIGN(boolean _createToken) + +
+           
+ voidmBXOR(boolean _createToken) + +
+           
+ voidmCHAR_LITERAL(boolean _createToken) + +
+           
+ voidmCOLON(boolean _createToken) + +
+           
+ voidmCOMMA(boolean _createToken) + +
+           
+ voidmDEC(boolean _createToken) + +
+           
+ voidmDIV_ASSIGN(boolean _createToken) + +
+           
+ voidmDIV(boolean _createToken) + +
+           
+ voidmEQUAL(boolean _createToken) + +
+           
+ voidmGE(boolean _createToken) + +
+           
+ voidmGT(boolean _createToken) + +
+           
+ voidmIDENT(boolean _createToken) + +
+           
+ voidmINC(boolean _createToken) + +
+           
+ voidmLAND(boolean _createToken) + +
+           
+ voidmLBRACK(boolean _createToken) + +
+           
+ voidmLCURLY(boolean _createToken) + +
+           
+ voidmLE(boolean _createToken) + +
+           
+ voidmLNOT(boolean _createToken) + +
+           
+ voidmLOR(boolean _createToken) + +
+           
+ voidmLPAREN(boolean _createToken) + +
+           
+ voidmLT(boolean _createToken) + +
+           
+ voidmMINUS_ASSIGN(boolean _createToken) + +
+           
+ voidmMINUS(boolean _createToken) + +
+           
+ voidmML_COMMENT(boolean _createToken) + +
+           
+ voidmMOD_ASSIGN(boolean _createToken) + +
+           
+ voidmMOD(boolean _createToken) + +
+           
+ voidmNOT_EQUAL(boolean _createToken) + +
+           
+ voidmNUM_INT(boolean _createToken) + +
+           
+ voidmPLUS_ASSIGN(boolean _createToken) + +
+           
+ voidmPLUS(boolean _createToken) + +
+           
+ voidmQUESTION(boolean _createToken) + +
+           
+ voidmRBRACK(boolean _createToken) + +
+           
+ voidmRCURLY(boolean _createToken) + +
+           
+ voidmRPAREN(boolean _createToken) + +
+           
+ voidmSEMI(boolean _createToken) + +
+           
+ voidmSL_ASSIGN(boolean _createToken) + +
+           
+ voidmSL_COMMENT(boolean _createToken) + +
+           
+ voidmSL(boolean _createToken) + +
+           
+ voidmSR_ASSIGN(boolean _createToken) + +
+           
+ voidmSR(boolean _createToken) + +
+           
+ voidmSTAR_ASSIGN(boolean _createToken) + +
+           
+ voidmSTAR(boolean _createToken) + +
+           
+ voidmSTRING_LITERAL(boolean _createToken) + +
+           
+ voidmWEBCOLOR_LITERAL(boolean _createToken) + +
+           
+ voidmWS(boolean _createToken) + +
+           
+ antlr.TokennextToken() + +
+           
+ + + + + + + +
Methods inherited from class antlr.CharScanner
append, append, commit, consume, consumeUntil, consumeUntil, getCaseSensitive, getCaseSensitiveLiterals, getColumn, getCommitToPath, getFilename, getInputBuffer, getInputState, getLine, getTabSize, getText, getTokenObject, LA, mark, match, match, match, matchNot, matchRange, newline, panic, panic, reportError, reportError, reportWarning, resetText, rewind, setCaseSensitive, setColumn, setCommitToPath, setFilename, setInputState, setLine, setTabSize, setText, setTokenObjectClass, tab, testLiteralsTable, testLiteralsTable, toLower, traceIn, traceIndent, traceOut, uponEOF
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+_tokenSet_0

+
+public static final antlr.collections.impl.BitSet _tokenSet_0
+
+
+
+
+
+ +

+_tokenSet_1

+
+public static final antlr.collections.impl.BitSet _tokenSet_1
+
+
+
+
+
+ +

+_tokenSet_2

+
+public static final antlr.collections.impl.BitSet _tokenSet_2
+
+
+
+
+
+ +

+_tokenSet_3

+
+public static final antlr.collections.impl.BitSet _tokenSet_3
+
+
+
+
+
+ +

+_tokenSet_4

+
+public static final antlr.collections.impl.BitSet _tokenSet_4
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PdeLexer

+
+public PdeLexer(java.io.InputStream in)
+
+
+
+ +

+PdeLexer

+
+public PdeLexer(java.io.Reader in)
+
+
+
+ +

+PdeLexer

+
+public PdeLexer(antlr.InputBuffer ib)
+
+
+
+ +

+PdeLexer

+
+public PdeLexer(antlr.LexerSharedInputState state)
+
+
+ + + + + + + + +
+Method Detail
+ +

+nextToken

+
+public antlr.Token nextToken()
+                      throws antlr.TokenStreamException
+
+
+
Specified by:
nextToken in interface antlr.TokenStream
+
+
+ +
Throws: +
antlr.TokenStreamException
+
+
+
+ +

+mWS

+
+public final void mWS(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSL_COMMENT

+
+public final void mSL_COMMENT(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mML_COMMENT

+
+public final void mML_COMMENT(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mWEBCOLOR_LITERAL

+
+public final void mWEBCOLOR_LITERAL(boolean _createToken)
+                             throws antlr.RecognitionException,
+                                    antlr.CharStreamException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mQUESTION

+
+public final void mQUESTION(boolean _createToken)
+                     throws antlr.RecognitionException,
+                            antlr.CharStreamException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLPAREN

+
+public final void mLPAREN(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mRPAREN

+
+public final void mRPAREN(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLBRACK

+
+public final void mLBRACK(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mRBRACK

+
+public final void mRBRACK(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLCURLY

+
+public final void mLCURLY(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mRCURLY

+
+public final void mRCURLY(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mCOLON

+
+public final void mCOLON(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mCOMMA

+
+public final void mCOMMA(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mASSIGN

+
+public final void mASSIGN(boolean _createToken)
+                   throws antlr.RecognitionException,
+                          antlr.CharStreamException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mEQUAL

+
+public final void mEQUAL(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLNOT

+
+public final void mLNOT(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBNOT

+
+public final void mBNOT(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mNOT_EQUAL

+
+public final void mNOT_EQUAL(boolean _createToken)
+                      throws antlr.RecognitionException,
+                             antlr.CharStreamException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mDIV

+
+public final void mDIV(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mDIV_ASSIGN

+
+public final void mDIV_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mPLUS

+
+public final void mPLUS(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mPLUS_ASSIGN

+
+public final void mPLUS_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mINC

+
+public final void mINC(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMINUS

+
+public final void mMINUS(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMINUS_ASSIGN

+
+public final void mMINUS_ASSIGN(boolean _createToken)
+                         throws antlr.RecognitionException,
+                                antlr.CharStreamException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mDEC

+
+public final void mDEC(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSTAR

+
+public final void mSTAR(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSTAR_ASSIGN

+
+public final void mSTAR_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMOD

+
+public final void mMOD(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mMOD_ASSIGN

+
+public final void mMOD_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSR

+
+public final void mSR(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSR_ASSIGN

+
+public final void mSR_ASSIGN(boolean _createToken)
+                      throws antlr.RecognitionException,
+                             antlr.CharStreamException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBSR

+
+public final void mBSR(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBSR_ASSIGN

+
+public final void mBSR_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mGE

+
+public final void mGE(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mGT

+
+public final void mGT(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSL

+
+public final void mSL(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSL_ASSIGN

+
+public final void mSL_ASSIGN(boolean _createToken)
+                      throws antlr.RecognitionException,
+                             antlr.CharStreamException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLE

+
+public final void mLE(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLT

+
+public final void mLT(boolean _createToken)
+               throws antlr.RecognitionException,
+                      antlr.CharStreamException,
+                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBXOR

+
+public final void mBXOR(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBXOR_ASSIGN

+
+public final void mBXOR_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBOR

+
+public final void mBOR(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBOR_ASSIGN

+
+public final void mBOR_ASSIGN(boolean _createToken)
+                       throws antlr.RecognitionException,
+                              antlr.CharStreamException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLOR

+
+public final void mLOR(boolean _createToken)
+                throws antlr.RecognitionException,
+                       antlr.CharStreamException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBAND

+
+public final void mBAND(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mBAND_ASSIGN

+
+public final void mBAND_ASSIGN(boolean _createToken)
+                        throws antlr.RecognitionException,
+                               antlr.CharStreamException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mLAND

+
+public final void mLAND(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSEMI

+
+public final void mSEMI(boolean _createToken)
+                 throws antlr.RecognitionException,
+                        antlr.CharStreamException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mCHAR_LITERAL

+
+public final void mCHAR_LITERAL(boolean _createToken)
+                         throws antlr.RecognitionException,
+                                antlr.CharStreamException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mSTRING_LITERAL

+
+public final void mSTRING_LITERAL(boolean _createToken)
+                           throws antlr.RecognitionException,
+                                  antlr.CharStreamException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mIDENT

+
+public final void mIDENT(boolean _createToken)
+                  throws antlr.RecognitionException,
+                         antlr.CharStreamException,
+                         antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+
+ +

+mNUM_INT

+
+public final void mNUM_INT(boolean _createToken)
+                    throws antlr.RecognitionException,
+                           antlr.CharStreamException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.CharStreamException +
antlr.TokenStreamException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/PdePartialTokenTypes.html b/build/javadoc/everything/processing/app/preproc/PdePartialTokenTypes.html new file mode 100644 index 000000000..6787f250a --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/PdePartialTokenTypes.html @@ -0,0 +1,2973 @@ + + + + + +PdePartialTokenTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.preproc +
+Interface PdePartialTokenTypes

+
+
All Known Implementing Classes:
PdeRecognizer
+
+
+
+
public interface PdePartialTokenTypes
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intABSTRACT + +
+           
+static intARRAY_DECLARATOR + +
+           
+static intARRAY_INIT + +
+           
+static intASSIGN + +
+           
+static intBAND + +
+           
+static intBAND_ASSIGN + +
+           
+static intBLOCK + +
+           
+static intBNOT + +
+           
+static intBOR + +
+           
+static intBOR_ASSIGN + +
+           
+static intBSR + +
+           
+static intBSR_ASSIGN + +
+           
+static intBXOR + +
+           
+static intBXOR_ASSIGN + +
+           
+static intCASE_GROUP + +
+           
+static intCHAR_LITERAL + +
+           
+static intCLASS_DEF + +
+           
+static intCOLON + +
+           
+static intCOMMA + +
+           
+static intCONSTRUCTOR_CAST + +
+           
+static intCTOR_CALL + +
+           
+static intCTOR_DEF + +
+           
+static intDEC + +
+           
+static intDIV + +
+           
+static intDIV_ASSIGN + +
+           
+static intDOT + +
+           
+static intELIST + +
+           
+static intEMPTY_FIELD + +
+           
+static intEMPTY_STAT + +
+           
+static intEOF + +
+           
+static intEQUAL + +
+           
+static intESC + +
+           
+static intEXPONENT + +
+           
+static intEXPR + +
+           
+static intEXTENDS_CLAUSE + +
+           
+static intFINAL + +
+           
+static intFLOAT_SUFFIX + +
+           
+static intFOR_CONDITION + +
+           
+static intFOR_INIT + +
+           
+static intFOR_ITERATOR + +
+           
+static intGE + +
+           
+static intGT + +
+           
+static intHEX_DIGIT + +
+           
+static intIDENT + +
+           
+static intIMPLEMENTS_CLAUSE + +
+           
+static intIMPORT + +
+           
+static intINC + +
+           
+static intINDEX_OP + +
+           
+static intINSTANCE_INIT + +
+           
+static intINTERFACE_DEF + +
+           
+static intLABELED_STAT + +
+           
+static intLAND + +
+           
+static intLBRACK + +
+           
+static intLCURLY + +
+           
+static intLE + +
+           
+static intLITERAL_assert + +
+           
+static intLITERAL_boolean + +
+           
+static intLITERAL_break + +
+           
+static intLITERAL_byte + +
+           
+static intLITERAL_case + +
+           
+static intLITERAL_catch + +
+           
+static intLITERAL_char + +
+           
+static intLITERAL_class + +
+           
+static intLITERAL_color + +
+           
+static intLITERAL_continue + +
+           
+static intLITERAL_default + +
+           
+static intLITERAL_do + +
+           
+static intLITERAL_double + +
+           
+static intLITERAL_else + +
+           
+static intLITERAL_extends + +
+           
+static intLITERAL_false + +
+           
+static intLITERAL_finally + +
+           
+static intLITERAL_float + +
+           
+static intLITERAL_for + +
+           
+static intLITERAL_if + +
+           
+static intLITERAL_implements + +
+           
+static intLITERAL_import + +
+           
+static intLITERAL_instanceof + +
+           
+static intLITERAL_int + +
+           
+static intLITERAL_interface + +
+           
+static intLITERAL_long + +
+           
+static intLITERAL_native + +
+           
+static intLITERAL_new + +
+           
+static intLITERAL_null + +
+           
+static intLITERAL_package + +
+           
+static intLITERAL_private + +
+           
+static intLITERAL_protected + +
+           
+static intLITERAL_public + +
+           
+static intLITERAL_return + +
+           
+static intLITERAL_short + +
+           
+static intLITERAL_static + +
+           
+static intLITERAL_super + +
+           
+static intLITERAL_switch + +
+           
+static intLITERAL_synchronized + +
+           
+static intLITERAL_this + +
+           
+static intLITERAL_threadsafe + +
+           
+static intLITERAL_throw + +
+           
+static intLITERAL_throws + +
+           
+static intLITERAL_transient + +
+           
+static intLITERAL_true + +
+           
+static intLITERAL_try + +
+           
+static intLITERAL_void + +
+           
+static intLITERAL_volatile + +
+           
+static intLITERAL_while + +
+           
+static intLNOT + +
+           
+static intLOR + +
+           
+static intLPAREN + +
+           
+static intLT + +
+           
+static intMETHOD_CALL + +
+           
+static intMETHOD_DEF + +
+           
+static intMINUS + +
+           
+static intMINUS_ASSIGN + +
+           
+static intML_COMMENT + +
+           
+static intMOD + +
+           
+static intMOD_ASSIGN + +
+           
+static intMODIFIERS + +
+           
+static intNOT_EQUAL + +
+           
+static intNULL_TREE_LOOKAHEAD + +
+           
+static intNUM_DOUBLE + +
+           
+static intNUM_FLOAT + +
+           
+static intNUM_INT + +
+           
+static intNUM_LONG + +
+           
+static intOBJBLOCK + +
+           
+static intPACKAGE_DEF + +
+           
+static intPARAMETER_DEF + +
+           
+static intPARAMETERS + +
+           
+static intPLUS + +
+           
+static intPLUS_ASSIGN + +
+           
+static intPOST_DEC + +
+           
+static intPOST_INC + +
+           
+static intQUESTION + +
+           
+static intRBRACK + +
+           
+static intRCURLY + +
+           
+static intRPAREN + +
+           
+static intSEMI + +
+           
+static intSL + +
+           
+static intSL_ASSIGN + +
+           
+static intSL_COMMENT + +
+           
+static intSLIST + +
+           
+static intSR + +
+           
+static intSR_ASSIGN + +
+           
+static intSTAR + +
+           
+static intSTAR_ASSIGN + +
+           
+static intSTATIC_INIT + +
+           
+static intSTRICTFP + +
+           
+static intSTRING_LITERAL + +
+           
+static intSUPER_CTOR_CALL + +
+           
+static intTYPE + +
+           
+static intTYPECAST + +
+           
+static intUNARY_MINUS + +
+           
+static intUNARY_PLUS + +
+           
+static intVARIABLE_DEF + +
+           
+static intVOCAB + +
+           
+static intWEBCOLOR_LITERAL + +
+           
+static intWS + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+EOF

+
+static final int EOF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NULL_TREE_LOOKAHEAD

+
+static final int NULL_TREE_LOOKAHEAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLOCK

+
+static final int BLOCK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MODIFIERS

+
+static final int MODIFIERS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OBJBLOCK

+
+static final int OBJBLOCK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SLIST

+
+static final int SLIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CTOR_DEF

+
+static final int CTOR_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHOD_DEF

+
+static final int METHOD_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VARIABLE_DEF

+
+static final int VARIABLE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INSTANCE_INIT

+
+static final int INSTANCE_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STATIC_INIT

+
+static final int STATIC_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TYPE

+
+static final int TYPE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CLASS_DEF

+
+static final int CLASS_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INTERFACE_DEF

+
+static final int INTERFACE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PACKAGE_DEF

+
+static final int PACKAGE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARRAY_DECLARATOR

+
+static final int ARRAY_DECLARATOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXTENDS_CLAUSE

+
+static final int EXTENDS_CLAUSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IMPLEMENTS_CLAUSE

+
+static final int IMPLEMENTS_CLAUSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PARAMETERS

+
+static final int PARAMETERS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PARAMETER_DEF

+
+static final int PARAMETER_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LABELED_STAT

+
+static final int LABELED_STAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TYPECAST

+
+static final int TYPECAST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INDEX_OP

+
+static final int INDEX_OP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POST_INC

+
+static final int POST_INC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POST_DEC

+
+static final int POST_DEC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHOD_CALL

+
+static final int METHOD_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXPR

+
+static final int EXPR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARRAY_INIT

+
+static final int ARRAY_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IMPORT

+
+static final int IMPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNARY_MINUS

+
+static final int UNARY_MINUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNARY_PLUS

+
+static final int UNARY_PLUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CASE_GROUP

+
+static final int CASE_GROUP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ELIST

+
+static final int ELIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_INIT

+
+static final int FOR_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_CONDITION

+
+static final int FOR_CONDITION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_ITERATOR

+
+static final int FOR_ITERATOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EMPTY_STAT

+
+static final int EMPTY_STAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FINAL

+
+static final int FINAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ABSTRACT

+
+static final int ABSTRACT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRICTFP

+
+static final int STRICTFP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SUPER_CTOR_CALL

+
+static final int SUPER_CTOR_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CTOR_CALL

+
+static final int CTOR_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_package

+
+static final int LITERAL_package
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SEMI

+
+static final int SEMI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_import

+
+static final int LITERAL_import
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LBRACK

+
+static final int LBRACK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RBRACK

+
+static final int RBRACK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_void

+
+static final int LITERAL_void
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_boolean

+
+static final int LITERAL_boolean
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_byte

+
+static final int LITERAL_byte
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_char

+
+static final int LITERAL_char
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_short

+
+static final int LITERAL_short
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_int

+
+static final int LITERAL_int
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_float

+
+static final int LITERAL_float
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_long

+
+static final int LITERAL_long
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_double

+
+static final int LITERAL_double
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IDENT

+
+static final int IDENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DOT

+
+static final int DOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STAR

+
+static final int STAR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_private

+
+static final int LITERAL_private
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_public

+
+static final int LITERAL_public
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_protected

+
+static final int LITERAL_protected
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_static

+
+static final int LITERAL_static
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_transient

+
+static final int LITERAL_transient
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_native

+
+static final int LITERAL_native
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_threadsafe

+
+static final int LITERAL_threadsafe
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_synchronized

+
+static final int LITERAL_synchronized
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_volatile

+
+static final int LITERAL_volatile
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_class

+
+static final int LITERAL_class
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_extends

+
+static final int LITERAL_extends
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_interface

+
+static final int LITERAL_interface
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LCURLY

+
+static final int LCURLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RCURLY

+
+static final int RCURLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMMA

+
+static final int COMMA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_implements

+
+static final int LITERAL_implements
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LPAREN

+
+static final int LPAREN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RPAREN

+
+static final int RPAREN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_this

+
+static final int LITERAL_this
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_super

+
+static final int LITERAL_super
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ASSIGN

+
+static final int ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_throws

+
+static final int LITERAL_throws
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COLON

+
+static final int COLON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_if

+
+static final int LITERAL_if
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_else

+
+static final int LITERAL_else
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_for

+
+static final int LITERAL_for
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_while

+
+static final int LITERAL_while
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_do

+
+static final int LITERAL_do
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_break

+
+static final int LITERAL_break
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_continue

+
+static final int LITERAL_continue
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_return

+
+static final int LITERAL_return
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_switch

+
+static final int LITERAL_switch
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_throw

+
+static final int LITERAL_throw
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_assert

+
+static final int LITERAL_assert
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_case

+
+static final int LITERAL_case
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_default

+
+static final int LITERAL_default
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_try

+
+static final int LITERAL_try
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_finally

+
+static final int LITERAL_finally
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_catch

+
+static final int LITERAL_catch
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PLUS_ASSIGN

+
+static final int PLUS_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MINUS_ASSIGN

+
+static final int MINUS_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STAR_ASSIGN

+
+static final int STAR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIV_ASSIGN

+
+static final int DIV_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOD_ASSIGN

+
+static final int MOD_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR_ASSIGN

+
+static final int SR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BSR_ASSIGN

+
+static final int BSR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL_ASSIGN

+
+static final int SL_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BAND_ASSIGN

+
+static final int BAND_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BXOR_ASSIGN

+
+static final int BXOR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOR_ASSIGN

+
+static final int BOR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUESTION

+
+static final int QUESTION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LOR

+
+static final int LOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LAND

+
+static final int LAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOR

+
+static final int BOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BXOR

+
+static final int BXOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BAND

+
+static final int BAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NOT_EQUAL

+
+static final int NOT_EQUAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EQUAL

+
+static final int EQUAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LT

+
+static final int LT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GT

+
+static final int GT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LE

+
+static final int LE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GE

+
+static final int GE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_instanceof

+
+static final int LITERAL_instanceof
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL

+
+static final int SL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR

+
+static final int SR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BSR

+
+static final int BSR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PLUS

+
+static final int PLUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MINUS

+
+static final int MINUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIV

+
+static final int DIV
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOD

+
+static final int MOD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INC

+
+static final int INC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DEC

+
+static final int DEC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BNOT

+
+static final int BNOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LNOT

+
+static final int LNOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_true

+
+static final int LITERAL_true
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_false

+
+static final int LITERAL_false
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_null

+
+static final int LITERAL_null
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_new

+
+static final int LITERAL_new
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_INT

+
+static final int NUM_INT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CHAR_LITERAL

+
+static final int CHAR_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRING_LITERAL

+
+static final int STRING_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_FLOAT

+
+static final int NUM_FLOAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_LONG

+
+static final int NUM_LONG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_DOUBLE

+
+static final int NUM_DOUBLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WS

+
+static final int WS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL_COMMENT

+
+static final int SL_COMMENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ML_COMMENT

+
+static final int ML_COMMENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ESC

+
+static final int ESC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HEX_DIGIT

+
+static final int HEX_DIGIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VOCAB

+
+static final int VOCAB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXPONENT

+
+static final int EXPONENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FLOAT_SUFFIX

+
+static final int FLOAT_SUFFIX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CONSTRUCTOR_CAST

+
+static final int CONSTRUCTOR_CAST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EMPTY_FIELD

+
+static final int EMPTY_FIELD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WEBCOLOR_LITERAL

+
+static final int WEBCOLOR_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_color

+
+static final int LITERAL_color
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/PdePreprocessor.html b/build/javadoc/everything/processing/app/preproc/PdePreprocessor.html new file mode 100644 index 000000000..acbcf70c9 --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/PdePreprocessor.html @@ -0,0 +1,519 @@ + + + + + +PdePreprocessor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.preproc +
+Class PdePreprocessor

+
+java.lang.Object
+  extended by processing.app.preproc.PdePreprocessor
+
+
+
+
public class PdePreprocessor
extends java.lang.Object
+ + +

+Class that orchestrates preprocessing p5 syntax into straight Java. +

+ Current Preprocessor Subsitutions: +

    +
  • any function not specified as being protected or private will + be made 'public'. this means that void setup() becomes + public void setup(). This is important to note when + coding with core.jar outside of the PDE. +
  • compiler.substitute_floats (currently "substitute_f") + treat doubles as floats, i.e. 12.3 becomes 12.3f so that people + don't have to add f after their numbers all the time since it's + confusing for beginners. +
  • compiler.enhanced_casting byte(), char(), int(), float() + works for casting. this is basic in the current implementation, but + should be expanded as described above. color() works similarly to int(), + however there is also a *function* called color(r, g, b) in p5. +
  • compiler.color_datatype 'color' is aliased to 'int' + as a datatype to represent ARGB packed into a single int, commonly + used in p5 for pixels[] and other color operations. this is just a + search/replace type thing, and it can be used interchangeably with int. +
  • compiler.web_colors (currently "inline_web_colors") + color c = #cc0080; should unpack to 0xffcc0080 (the ff at the top is + so that the color is opaque), which is just an int. +
+ Other preprocessor functionality +
    +
  • detects what 'mode' the program is in: static (no function + brackets at all, just assumes everything is in draw), active + (setup plus draw or loop), and java mode (full java support). + http://processing.org/reference/environment/ +
+

+ The PDE Preprocessor is based on the Java Grammar that comes with + ANTLR 2.7.2. Moving it forward to a new version of the grammar + shouldn't be too difficult. +

+ Here's some info about the various files in this directory: +

+ java.g: this is the ANTLR grammar for Java 1.3/1.4 from the + ANTLR distribution. It is in the public domain. The only change to + this file from the original this file is the uncommenting of the + clauses required to support assert(). +

+ java.tree.g: this describes the Abstract Syntax Tree (AST) + generated by java.g. It is only here as a reference for coders hacking + on the preprocessor, it is not built or used at all. Note that pde.g + overrides some of the java.g rules so that in PDE ASTs, there are a + few minor differences. Also in the public domain. +

+ pde.g: this is the grammar and lexer for the PDE language + itself. It subclasses the java.g grammar and lexer. There are a couple + of overrides to java.g that I hope to convince the ANTLR folks to fold + back into their grammar, but most of this file is highly specific to + PDE itself. + PdeEmitter.java: this class traverses the AST generated by + the PDE Recognizer, and emits it as Java code, doing any necessary + transformations along the way. It is based on JavaEmitter.java, + available from antlr.org, written by Andy Tripp , + who has given permission for it to be distributed under the GPL. +

+ ExtendedCommonASTWithHiddenTokens.java: this adds a necessary + initialize() method, as well as a number of methods to allow for XML + serialization of the parse tree in a such a way that the hidden tokens + are visible. Much of the code is taken from the original + CommonASTWithHiddenTokens class. I hope to convince the ANTLR folks + to fold these changes back into that class so that this file will be + unnecessary. +

+ TokenStreamCopyingHiddenTokenFilter.java: this class provides + TokenStreamHiddenTokenFilters with the concept of tokens which can be + copied so that they are seen by both the hidden token stream as well + as the parser itself. This is useful when one wants to use an + existing parser (like the Java parser included with ANTLR) that throws + away some tokens to create a parse tree which can be used to spit out + a copy of the code with only minor modifications. Partially derived + from ANTLR code. I hope to convince the ANTLR folks to fold this + functionality back into ANTLR proper as well. +

+ whitespace_test.pde: a torture test to ensure that the + preprocessor is correctly preserving whitespace, comments, and other + hidden tokens correctly. See the comments in the code for details about + how to run the test. +

+ All other files in this directory are generated at build time by ANTLR + itself. The ANTLR manual goes into a fair amount of detail about the + what each type of file is for. +

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intACTIVE + +
+           
+static TokenStreamCopyingHiddenTokenFilterfilter + +
+          Used by PdeEmitter.dumpHiddenTokens()
+static booleanfoundMain + +
+           
+static intJAVA + +
+           
+static intprogramType + +
+           
+static intSTATIC + +
+           
+  + + + + + + + + + + +
+Constructor Summary
PdePreprocessor() + +
+          Setup a new preprocessor.
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.util.ArrayList<java.lang.String>getExtraImports() + +
+           
+ java.lang.Stringwrite() + +
+          preprocesses a pde file and write out a java file
+ intwritePrefix(java.lang.String program, + java.lang.String buildPath, + java.lang.String name, + java.lang.String[] codeFolderPackages) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+STATIC

+
+public static final int STATIC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ACTIVE

+
+public static final int ACTIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+JAVA

+
+public static final int JAVA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+programType

+
+public static int programType
+
+
+
+
+
+ +

+foundMain

+
+public static boolean foundMain
+
+
+
+
+
+ +

+filter

+
+public static TokenStreamCopyingHiddenTokenFilter filter
+
+
Used by PdeEmitter.dumpHiddenTokens() +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PdePreprocessor

+
+public PdePreprocessor()
+
+
Setup a new preprocessor. +

+

+ + + + + + + + +
+Method Detail
+ +

+writePrefix

+
+public int writePrefix(java.lang.String program,
+                       java.lang.String buildPath,
+                       java.lang.String name,
+                       java.lang.String[] codeFolderPackages)
+                throws java.io.FileNotFoundException
+
+
+ +
Throws: +
java.io.FileNotFoundException
+
+
+
+ +

+write

+
+public java.lang.String write()
+                       throws java.lang.Exception
+
+
preprocesses a pde file and write out a java file +

+

+ +
Returns:
the classname of the exported Java +
Throws: +
java.lang.Exception
+
+
+
+ +

+getExtraImports

+
+public java.util.ArrayList<java.lang.String> getExtraImports()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/PdeRecognizer.html b/build/javadoc/everything/processing/app/preproc/PdeRecognizer.html new file mode 100644 index 000000000..6c8ff7bcb --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/PdeRecognizer.html @@ -0,0 +1,3216 @@ + + + + + +PdeRecognizer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.preproc +
+Class PdeRecognizer

+
+java.lang.Object
+  extended by antlr.Parser
+      extended by antlr.LLkParser
+          extended by processing.app.preproc.PdeRecognizer
+
+
+
All Implemented Interfaces:
PdePartialTokenTypes
+
+
+
+
public class PdeRecognizer
extends antlr.LLkParser
implements PdePartialTokenTypes
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static java.lang.String[]_tokenNames + +
+           
+static antlr.collections.impl.BitSet_tokenSet_0 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_1 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_10 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_11 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_12 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_13 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_14 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_15 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_16 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_17 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_18 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_19 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_2 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_20 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_21 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_22 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_23 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_24 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_25 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_26 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_27 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_28 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_29 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_3 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_30 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_31 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_32 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_33 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_34 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_35 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_36 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_37 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_38 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_39 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_4 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_40 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_41 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_5 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_6 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_7 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_8 + +
+           
+static antlr.collections.impl.BitSet_tokenSet_9 + +
+           
+ + + + + + + +
Fields inherited from interface processing.app.preproc.PdePartialTokenTypes
ABSTRACT, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CASE_GROUP, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CONSTRUCTOR_CAST, CTOR_CALL, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, ELIST, EMPTY_FIELD, EMPTY_STAT, EOF, EQUAL, ESC, EXPONENT, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FOR_CONDITION, FOR_INIT, FOR_ITERATOR, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INTERFACE_DEF, LABELED_STAT, LAND, LBRACK, LCURLY, LE, LITERAL_assert, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_color, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_long, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_package, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_volatile, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RPAREN, SEMI, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRICTFP, STRING_LITERAL, SUPER_CTOR_CALL, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WEBCOLOR_LITERAL, WS
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PdeRecognizer(antlr.ParserSharedInputState state) + +
+           
PdeRecognizer(antlr.TokenBuffer tokenBuf) + +
+           
PdeRecognizer(antlr.TokenStream lexer) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaCase() + +
+           
+ voidactiveProgram() + +
+           
+ voidadditiveExpression() + +
+           
+ voidandExpression() + +
+           
+ voidargList() + +
+           
+ voidarrayInitializer() + +
+           
+ voidassignmentExpression() + +
+           
+ voidbuiltInConsCastType() + +
+           
+ voidbuiltInConsCastTypeSpec(boolean addImagNode) + +
+           
+ voidbuiltInType() + +
+           
+ voidbuiltInTypeSpec(boolean addImagNode) + +
+           
+ voidcasesGroup() + +
+           
+ voidcaseSList() + +
+           
+ voidclassBlock() + +
+           
+ voidclassDefinition(antlr.collections.AST modifiers) + +
+           
+ voidclassTypeSpec(boolean addImagNode) + +
+           
+ voidcolorMethodCall() + +
+           
+ voidcompilationUnit() + +
+           
+ voidcompoundStatement() + +
+           
+ voidconditionalExpression() + +
+           
+ voidconsCastTypeSpec(boolean addImagNode) + +
+           
+ voidconstant() + +
+           
+ voidconstructorBody() + +
+           
+ voidconstructorCast() + +
+           
+ voidctorHead() + +
+           
+ voiddeclaration() + +
+           
+ voiddeclaratorBrackets(antlr.collections.AST typ) + +
+           
+ voidequalityExpression() + +
+           
+ voidexclusiveOrExpression() + +
+           
+ voidexplicitConstructorInvocation() + +
+           
+ voidexpression() + +
+           
+ voidexpressionList() + +
+           
+ voidfield() + +
+           
+ voidfinallyClause() + +
+           
+ voidforCond() + +
+           
+ voidforInit() + +
+           
+ voidforIter() + +
+           
+ voidhandler() + +
+           
+ voididentifier() + +
+           
+ voididentifierStar() + +
+           
+ voididentPrimary() + +
+           
+ voidimplementsClause() + +
+           
+ voidimportDefinition() + +
+           
+ voidinclusiveOrExpression() + +
+           
+ voidinitializer() + +
+           
+ voidinterfaceDefinition(antlr.collections.AST modifiers) + +
+           
+ voidinterfaceExtends() + +
+           
+ voidjavaProgram() + +
+           
+ voidlogicalAndExpression() + +
+           
+ voidlogicalOrExpression() + +
+           
+ voidmodifier() + +
+           
+ voidmodifiers() + +
+           
+ voidmultiplicativeExpression() + +
+           
+ voidnewArrayDeclarator() + +
+           
+ voidnewExpression() + +
+           
+ voidpackageDefinition() + +
+           
+ voidparameterDeclaration() + +
+           
+ voidparameterDeclarationList() + +
+           
+ voidparameterModifier() + +
+           
+ voidpdeProgram() + +
+           
+ voidpossiblyEmptyField() + +
+           
+ voidpostfixExpression() + +
+           
+ voidprimaryExpression() + +
+           
+ voidrelationalExpression() + +
+           
+ voidshiftExpression() + +
+           
+ voidstatement() + +
+           
+ voidstaticProgram() + +
+           
+ voidsuperClassClause() + +
+           
+ voidthrowsClause() + +
+           
+ voidtryBlock() + +
+           
+ voidtype() + +
+           
+ voidtypeDefinition() + +
+           
+ voidtypeSpec(boolean addImagNode) + +
+           
+ voidunaryExpression() + +
+           
+ voidunaryExpressionNotPlusMinus() + +
+           
+ voidvariableDeclarator(antlr.collections.AST mods, + antlr.collections.AST t) + +
+           
+ voidvariableDefinitions(antlr.collections.AST mods, + antlr.collections.AST t) + +
+           
+ voidvarInitializer() + +
+           
+ voidwebcolor_literal() + +
+           
+ + + + + + + +
Methods inherited from class antlr.LLkParser
consume, LA, LT, traceIn, traceOut
+ + + + + + + +
Methods inherited from class antlr.Parser
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, recover, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+_tokenNames

+
+public static final java.lang.String[] _tokenNames
+
+
+
+
+
+ +

+_tokenSet_0

+
+public static final antlr.collections.impl.BitSet _tokenSet_0
+
+
+
+
+
+ +

+_tokenSet_1

+
+public static final antlr.collections.impl.BitSet _tokenSet_1
+
+
+
+
+
+ +

+_tokenSet_2

+
+public static final antlr.collections.impl.BitSet _tokenSet_2
+
+
+
+
+
+ +

+_tokenSet_3

+
+public static final antlr.collections.impl.BitSet _tokenSet_3
+
+
+
+
+
+ +

+_tokenSet_4

+
+public static final antlr.collections.impl.BitSet _tokenSet_4
+
+
+
+
+
+ +

+_tokenSet_5

+
+public static final antlr.collections.impl.BitSet _tokenSet_5
+
+
+
+
+
+ +

+_tokenSet_6

+
+public static final antlr.collections.impl.BitSet _tokenSet_6
+
+
+
+
+
+ +

+_tokenSet_7

+
+public static final antlr.collections.impl.BitSet _tokenSet_7
+
+
+
+
+
+ +

+_tokenSet_8

+
+public static final antlr.collections.impl.BitSet _tokenSet_8
+
+
+
+
+
+ +

+_tokenSet_9

+
+public static final antlr.collections.impl.BitSet _tokenSet_9
+
+
+
+
+
+ +

+_tokenSet_10

+
+public static final antlr.collections.impl.BitSet _tokenSet_10
+
+
+
+
+
+ +

+_tokenSet_11

+
+public static final antlr.collections.impl.BitSet _tokenSet_11
+
+
+
+
+
+ +

+_tokenSet_12

+
+public static final antlr.collections.impl.BitSet _tokenSet_12
+
+
+
+
+
+ +

+_tokenSet_13

+
+public static final antlr.collections.impl.BitSet _tokenSet_13
+
+
+
+
+
+ +

+_tokenSet_14

+
+public static final antlr.collections.impl.BitSet _tokenSet_14
+
+
+
+
+
+ +

+_tokenSet_15

+
+public static final antlr.collections.impl.BitSet _tokenSet_15
+
+
+
+
+
+ +

+_tokenSet_16

+
+public static final antlr.collections.impl.BitSet _tokenSet_16
+
+
+
+
+
+ +

+_tokenSet_17

+
+public static final antlr.collections.impl.BitSet _tokenSet_17
+
+
+
+
+
+ +

+_tokenSet_18

+
+public static final antlr.collections.impl.BitSet _tokenSet_18
+
+
+
+
+
+ +

+_tokenSet_19

+
+public static final antlr.collections.impl.BitSet _tokenSet_19
+
+
+
+
+
+ +

+_tokenSet_20

+
+public static final antlr.collections.impl.BitSet _tokenSet_20
+
+
+
+
+
+ +

+_tokenSet_21

+
+public static final antlr.collections.impl.BitSet _tokenSet_21
+
+
+
+
+
+ +

+_tokenSet_22

+
+public static final antlr.collections.impl.BitSet _tokenSet_22
+
+
+
+
+
+ +

+_tokenSet_23

+
+public static final antlr.collections.impl.BitSet _tokenSet_23
+
+
+
+
+
+ +

+_tokenSet_24

+
+public static final antlr.collections.impl.BitSet _tokenSet_24
+
+
+
+
+
+ +

+_tokenSet_25

+
+public static final antlr.collections.impl.BitSet _tokenSet_25
+
+
+
+
+
+ +

+_tokenSet_26

+
+public static final antlr.collections.impl.BitSet _tokenSet_26
+
+
+
+
+
+ +

+_tokenSet_27

+
+public static final antlr.collections.impl.BitSet _tokenSet_27
+
+
+
+
+
+ +

+_tokenSet_28

+
+public static final antlr.collections.impl.BitSet _tokenSet_28
+
+
+
+
+
+ +

+_tokenSet_29

+
+public static final antlr.collections.impl.BitSet _tokenSet_29
+
+
+
+
+
+ +

+_tokenSet_30

+
+public static final antlr.collections.impl.BitSet _tokenSet_30
+
+
+
+
+
+ +

+_tokenSet_31

+
+public static final antlr.collections.impl.BitSet _tokenSet_31
+
+
+
+
+
+ +

+_tokenSet_32

+
+public static final antlr.collections.impl.BitSet _tokenSet_32
+
+
+
+
+
+ +

+_tokenSet_33

+
+public static final antlr.collections.impl.BitSet _tokenSet_33
+
+
+
+
+
+ +

+_tokenSet_34

+
+public static final antlr.collections.impl.BitSet _tokenSet_34
+
+
+
+
+
+ +

+_tokenSet_35

+
+public static final antlr.collections.impl.BitSet _tokenSet_35
+
+
+
+
+
+ +

+_tokenSet_36

+
+public static final antlr.collections.impl.BitSet _tokenSet_36
+
+
+
+
+
+ +

+_tokenSet_37

+
+public static final antlr.collections.impl.BitSet _tokenSet_37
+
+
+
+
+
+ +

+_tokenSet_38

+
+public static final antlr.collections.impl.BitSet _tokenSet_38
+
+
+
+
+
+ +

+_tokenSet_39

+
+public static final antlr.collections.impl.BitSet _tokenSet_39
+
+
+
+
+
+ +

+_tokenSet_40

+
+public static final antlr.collections.impl.BitSet _tokenSet_40
+
+
+
+
+
+ +

+_tokenSet_41

+
+public static final antlr.collections.impl.BitSet _tokenSet_41
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PdeRecognizer

+
+public PdeRecognizer(antlr.TokenBuffer tokenBuf)
+
+
+
+ +

+PdeRecognizer

+
+public PdeRecognizer(antlr.TokenStream lexer)
+
+
+
+ +

+PdeRecognizer

+
+public PdeRecognizer(antlr.ParserSharedInputState state)
+
+
+ + + + + + + + +
+Method Detail
+ +

+pdeProgram

+
+public final void pdeProgram()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+javaProgram

+
+public final void javaProgram()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+possiblyEmptyField

+
+public final void possiblyEmptyField()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+activeProgram

+
+public final void activeProgram()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+staticProgram

+
+public final void staticProgram()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+compilationUnit

+
+public final void compilationUnit()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+statement

+
+public final void statement()
+                     throws antlr.RecognitionException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+constant

+
+public final void constant()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+webcolor_literal

+
+public final void webcolor_literal()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+builtInConsCastType

+
+public final void builtInConsCastType()
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+builtInType

+
+public final void builtInType()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+constructorCast

+
+public final void constructorCast()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+consCastTypeSpec

+
+public final void consCastTypeSpec(boolean addImagNode)
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+expression

+
+public final void expression()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+builtInConsCastTypeSpec

+
+public final void builtInConsCastTypeSpec(boolean addImagNode)
+                                   throws antlr.RecognitionException,
+                                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+colorMethodCall

+
+public final void colorMethodCall()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+argList

+
+public final void argList()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+primaryExpression

+
+public final void primaryExpression()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+identPrimary

+
+public final void identPrimary()
+                        throws antlr.RecognitionException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+newExpression

+
+public final void newExpression()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+assignmentExpression

+
+public final void assignmentExpression()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+variableDefinitions

+
+public final void variableDefinitions(antlr.collections.AST mods,
+                                      antlr.collections.AST t)
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+variableDeclarator

+
+public final void variableDeclarator(antlr.collections.AST mods,
+                                     antlr.collections.AST t)
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+varInitializer

+
+public final void varInitializer()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+explicitConstructorInvocation

+
+public final void explicitConstructorInvocation()
+                                         throws antlr.RecognitionException,
+                                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+classDefinition

+
+public final void classDefinition(antlr.collections.AST modifiers)
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+superClassClause

+
+public final void superClassClause()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+implementsClause

+
+public final void implementsClause()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+classBlock

+
+public final void classBlock()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+field

+
+public final void field()
+                 throws antlr.RecognitionException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+packageDefinition

+
+public final void packageDefinition()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+importDefinition

+
+public final void importDefinition()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+typeDefinition

+
+public final void typeDefinition()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+identifier

+
+public final void identifier()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+identifierStar

+
+public final void identifierStar()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+modifiers

+
+public final void modifiers()
+                     throws antlr.RecognitionException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+interfaceDefinition

+
+public final void interfaceDefinition(antlr.collections.AST modifiers)
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+declaration

+
+public final void declaration()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+typeSpec

+
+public final void typeSpec(boolean addImagNode)
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+classTypeSpec

+
+public final void classTypeSpec(boolean addImagNode)
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+builtInTypeSpec

+
+public final void builtInTypeSpec(boolean addImagNode)
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+type

+
+public final void type()
+                throws antlr.RecognitionException,
+                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+modifier

+
+public final void modifier()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+interfaceExtends

+
+public final void interfaceExtends()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+ctorHead

+
+public final void ctorHead()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+constructorBody

+
+public final void constructorBody()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+parameterDeclarationList

+
+public final void parameterDeclarationList()
+                                    throws antlr.RecognitionException,
+                                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+declaratorBrackets

+
+public final void declaratorBrackets(antlr.collections.AST typ)
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+throwsClause

+
+public final void throwsClause()
+                        throws antlr.RecognitionException,
+                               antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+compoundStatement

+
+public final void compoundStatement()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+initializer

+
+public final void initializer()
+                       throws antlr.RecognitionException,
+                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+arrayInitializer

+
+public final void arrayInitializer()
+                            throws antlr.RecognitionException,
+                                   antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+parameterDeclaration

+
+public final void parameterDeclaration()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+parameterModifier

+
+public final void parameterModifier()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+forInit

+
+public final void forInit()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+forCond

+
+public final void forCond()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+forIter

+
+public final void forIter()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+casesGroup

+
+public final void casesGroup()
+                      throws antlr.RecognitionException,
+                             antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+tryBlock

+
+public final void tryBlock()
+                    throws antlr.RecognitionException,
+                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+aCase

+
+public final void aCase()
+                 throws antlr.RecognitionException,
+                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+caseSList

+
+public final void caseSList()
+                     throws antlr.RecognitionException,
+                            antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+expressionList

+
+public final void expressionList()
+                          throws antlr.RecognitionException,
+                                 antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+handler

+
+public final void handler()
+                   throws antlr.RecognitionException,
+                          antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+finallyClause

+
+public final void finallyClause()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+conditionalExpression

+
+public final void conditionalExpression()
+                                 throws antlr.RecognitionException,
+                                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+logicalOrExpression

+
+public final void logicalOrExpression()
+                               throws antlr.RecognitionException,
+                                      antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+logicalAndExpression

+
+public final void logicalAndExpression()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+inclusiveOrExpression

+
+public final void inclusiveOrExpression()
+                                 throws antlr.RecognitionException,
+                                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+exclusiveOrExpression

+
+public final void exclusiveOrExpression()
+                                 throws antlr.RecognitionException,
+                                        antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+andExpression

+
+public final void andExpression()
+                         throws antlr.RecognitionException,
+                                antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+equalityExpression

+
+public final void equalityExpression()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+relationalExpression

+
+public final void relationalExpression()
+                                throws antlr.RecognitionException,
+                                       antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+shiftExpression

+
+public final void shiftExpression()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+additiveExpression

+
+public final void additiveExpression()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+multiplicativeExpression

+
+public final void multiplicativeExpression()
+                                    throws antlr.RecognitionException,
+                                           antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+unaryExpression

+
+public final void unaryExpression()
+                           throws antlr.RecognitionException,
+                                  antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+unaryExpressionNotPlusMinus

+
+public final void unaryExpressionNotPlusMinus()
+                                       throws antlr.RecognitionException,
+                                              antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+postfixExpression

+
+public final void postfixExpression()
+                             throws antlr.RecognitionException,
+                                    antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+
+ +

+newArrayDeclarator

+
+public final void newArrayDeclarator()
+                              throws antlr.RecognitionException,
+                                     antlr.TokenStreamException
+
+
+
+
+
+ +
Throws: +
antlr.RecognitionException +
antlr.TokenStreamException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/PdeTokenTypes.html b/build/javadoc/everything/processing/app/preproc/PdeTokenTypes.html new file mode 100644 index 000000000..8f957fc70 --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/PdeTokenTypes.html @@ -0,0 +1,2973 @@ + + + + + +PdeTokenTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.preproc +
+Interface PdeTokenTypes

+
+
All Known Implementing Classes:
PdeEmitter, PdeLexer
+
+
+
+
public interface PdeTokenTypes
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intABSTRACT + +
+           
+static intARRAY_DECLARATOR + +
+           
+static intARRAY_INIT + +
+           
+static intASSIGN + +
+           
+static intBAND + +
+           
+static intBAND_ASSIGN + +
+           
+static intBLOCK + +
+           
+static intBNOT + +
+           
+static intBOR + +
+           
+static intBOR_ASSIGN + +
+           
+static intBSR + +
+           
+static intBSR_ASSIGN + +
+           
+static intBXOR + +
+           
+static intBXOR_ASSIGN + +
+           
+static intCASE_GROUP + +
+           
+static intCHAR_LITERAL + +
+           
+static intCLASS_DEF + +
+           
+static intCOLON + +
+           
+static intCOMMA + +
+           
+static intCONSTRUCTOR_CAST + +
+           
+static intCTOR_CALL + +
+           
+static intCTOR_DEF + +
+           
+static intDEC + +
+           
+static intDIV + +
+           
+static intDIV_ASSIGN + +
+           
+static intDOT + +
+           
+static intELIST + +
+           
+static intEMPTY_FIELD + +
+           
+static intEMPTY_STAT + +
+           
+static intEOF + +
+           
+static intEQUAL + +
+           
+static intESC + +
+           
+static intEXPONENT + +
+           
+static intEXPR + +
+           
+static intEXTENDS_CLAUSE + +
+           
+static intFINAL + +
+           
+static intFLOAT_SUFFIX + +
+           
+static intFOR_CONDITION + +
+           
+static intFOR_INIT + +
+           
+static intFOR_ITERATOR + +
+           
+static intGE + +
+           
+static intGT + +
+           
+static intHEX_DIGIT + +
+           
+static intIDENT + +
+           
+static intIMPLEMENTS_CLAUSE + +
+           
+static intIMPORT + +
+           
+static intINC + +
+           
+static intINDEX_OP + +
+           
+static intINSTANCE_INIT + +
+           
+static intINTERFACE_DEF + +
+           
+static intLABELED_STAT + +
+           
+static intLAND + +
+           
+static intLBRACK + +
+           
+static intLCURLY + +
+           
+static intLE + +
+           
+static intLITERAL_assert + +
+           
+static intLITERAL_boolean + +
+           
+static intLITERAL_break + +
+           
+static intLITERAL_byte + +
+           
+static intLITERAL_case + +
+           
+static intLITERAL_catch + +
+           
+static intLITERAL_char + +
+           
+static intLITERAL_class + +
+           
+static intLITERAL_color + +
+           
+static intLITERAL_continue + +
+           
+static intLITERAL_default + +
+           
+static intLITERAL_do + +
+           
+static intLITERAL_double + +
+           
+static intLITERAL_else + +
+           
+static intLITERAL_extends + +
+           
+static intLITERAL_false + +
+           
+static intLITERAL_finally + +
+           
+static intLITERAL_float + +
+           
+static intLITERAL_for + +
+           
+static intLITERAL_if + +
+           
+static intLITERAL_implements + +
+           
+static intLITERAL_import + +
+           
+static intLITERAL_instanceof + +
+           
+static intLITERAL_int + +
+           
+static intLITERAL_interface + +
+           
+static intLITERAL_long + +
+           
+static intLITERAL_native + +
+           
+static intLITERAL_new + +
+           
+static intLITERAL_null + +
+           
+static intLITERAL_package + +
+           
+static intLITERAL_private + +
+           
+static intLITERAL_protected + +
+           
+static intLITERAL_public + +
+           
+static intLITERAL_return + +
+           
+static intLITERAL_short + +
+           
+static intLITERAL_static + +
+           
+static intLITERAL_super + +
+           
+static intLITERAL_switch + +
+           
+static intLITERAL_synchronized + +
+           
+static intLITERAL_this + +
+           
+static intLITERAL_threadsafe + +
+           
+static intLITERAL_throw + +
+           
+static intLITERAL_throws + +
+           
+static intLITERAL_transient + +
+           
+static intLITERAL_true + +
+           
+static intLITERAL_try + +
+           
+static intLITERAL_void + +
+           
+static intLITERAL_volatile + +
+           
+static intLITERAL_while + +
+           
+static intLNOT + +
+           
+static intLOR + +
+           
+static intLPAREN + +
+           
+static intLT + +
+           
+static intMETHOD_CALL + +
+           
+static intMETHOD_DEF + +
+           
+static intMINUS + +
+           
+static intMINUS_ASSIGN + +
+           
+static intML_COMMENT + +
+           
+static intMOD + +
+           
+static intMOD_ASSIGN + +
+           
+static intMODIFIERS + +
+           
+static intNOT_EQUAL + +
+           
+static intNULL_TREE_LOOKAHEAD + +
+           
+static intNUM_DOUBLE + +
+           
+static intNUM_FLOAT + +
+           
+static intNUM_INT + +
+           
+static intNUM_LONG + +
+           
+static intOBJBLOCK + +
+           
+static intPACKAGE_DEF + +
+           
+static intPARAMETER_DEF + +
+           
+static intPARAMETERS + +
+           
+static intPLUS + +
+           
+static intPLUS_ASSIGN + +
+           
+static intPOST_DEC + +
+           
+static intPOST_INC + +
+           
+static intQUESTION + +
+           
+static intRBRACK + +
+           
+static intRCURLY + +
+           
+static intRPAREN + +
+           
+static intSEMI + +
+           
+static intSL + +
+           
+static intSL_ASSIGN + +
+           
+static intSL_COMMENT + +
+           
+static intSLIST + +
+           
+static intSR + +
+           
+static intSR_ASSIGN + +
+           
+static intSTAR + +
+           
+static intSTAR_ASSIGN + +
+           
+static intSTATIC_INIT + +
+           
+static intSTRICTFP + +
+           
+static intSTRING_LITERAL + +
+           
+static intSUPER_CTOR_CALL + +
+           
+static intTYPE + +
+           
+static intTYPECAST + +
+           
+static intUNARY_MINUS + +
+           
+static intUNARY_PLUS + +
+           
+static intVARIABLE_DEF + +
+           
+static intVOCAB + +
+           
+static intWEBCOLOR_LITERAL + +
+           
+static intWS + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+EOF

+
+static final int EOF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NULL_TREE_LOOKAHEAD

+
+static final int NULL_TREE_LOOKAHEAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLOCK

+
+static final int BLOCK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MODIFIERS

+
+static final int MODIFIERS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OBJBLOCK

+
+static final int OBJBLOCK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SLIST

+
+static final int SLIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CTOR_DEF

+
+static final int CTOR_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHOD_DEF

+
+static final int METHOD_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VARIABLE_DEF

+
+static final int VARIABLE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INSTANCE_INIT

+
+static final int INSTANCE_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STATIC_INIT

+
+static final int STATIC_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TYPE

+
+static final int TYPE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CLASS_DEF

+
+static final int CLASS_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INTERFACE_DEF

+
+static final int INTERFACE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PACKAGE_DEF

+
+static final int PACKAGE_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARRAY_DECLARATOR

+
+static final int ARRAY_DECLARATOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXTENDS_CLAUSE

+
+static final int EXTENDS_CLAUSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IMPLEMENTS_CLAUSE

+
+static final int IMPLEMENTS_CLAUSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PARAMETERS

+
+static final int PARAMETERS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PARAMETER_DEF

+
+static final int PARAMETER_DEF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LABELED_STAT

+
+static final int LABELED_STAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TYPECAST

+
+static final int TYPECAST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INDEX_OP

+
+static final int INDEX_OP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POST_INC

+
+static final int POST_INC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POST_DEC

+
+static final int POST_DEC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHOD_CALL

+
+static final int METHOD_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXPR

+
+static final int EXPR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARRAY_INIT

+
+static final int ARRAY_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IMPORT

+
+static final int IMPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNARY_MINUS

+
+static final int UNARY_MINUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNARY_PLUS

+
+static final int UNARY_PLUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CASE_GROUP

+
+static final int CASE_GROUP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ELIST

+
+static final int ELIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_INIT

+
+static final int FOR_INIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_CONDITION

+
+static final int FOR_CONDITION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FOR_ITERATOR

+
+static final int FOR_ITERATOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EMPTY_STAT

+
+static final int EMPTY_STAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FINAL

+
+static final int FINAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ABSTRACT

+
+static final int ABSTRACT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRICTFP

+
+static final int STRICTFP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SUPER_CTOR_CALL

+
+static final int SUPER_CTOR_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CTOR_CALL

+
+static final int CTOR_CALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_package

+
+static final int LITERAL_package
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SEMI

+
+static final int SEMI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_import

+
+static final int LITERAL_import
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LBRACK

+
+static final int LBRACK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RBRACK

+
+static final int RBRACK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_void

+
+static final int LITERAL_void
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_boolean

+
+static final int LITERAL_boolean
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_byte

+
+static final int LITERAL_byte
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_char

+
+static final int LITERAL_char
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_short

+
+static final int LITERAL_short
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_int

+
+static final int LITERAL_int
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_float

+
+static final int LITERAL_float
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_long

+
+static final int LITERAL_long
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_double

+
+static final int LITERAL_double
+
+
+
See Also:
Constant Field Values
+
+
+ +

+IDENT

+
+static final int IDENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DOT

+
+static final int DOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STAR

+
+static final int STAR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_private

+
+static final int LITERAL_private
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_public

+
+static final int LITERAL_public
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_protected

+
+static final int LITERAL_protected
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_static

+
+static final int LITERAL_static
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_transient

+
+static final int LITERAL_transient
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_native

+
+static final int LITERAL_native
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_threadsafe

+
+static final int LITERAL_threadsafe
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_synchronized

+
+static final int LITERAL_synchronized
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_volatile

+
+static final int LITERAL_volatile
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_class

+
+static final int LITERAL_class
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_extends

+
+static final int LITERAL_extends
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_interface

+
+static final int LITERAL_interface
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LCURLY

+
+static final int LCURLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RCURLY

+
+static final int RCURLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMMA

+
+static final int COMMA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_implements

+
+static final int LITERAL_implements
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LPAREN

+
+static final int LPAREN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RPAREN

+
+static final int RPAREN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_this

+
+static final int LITERAL_this
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_super

+
+static final int LITERAL_super
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ASSIGN

+
+static final int ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_throws

+
+static final int LITERAL_throws
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COLON

+
+static final int COLON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_if

+
+static final int LITERAL_if
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_else

+
+static final int LITERAL_else
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_for

+
+static final int LITERAL_for
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_while

+
+static final int LITERAL_while
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_do

+
+static final int LITERAL_do
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_break

+
+static final int LITERAL_break
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_continue

+
+static final int LITERAL_continue
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_return

+
+static final int LITERAL_return
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_switch

+
+static final int LITERAL_switch
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_throw

+
+static final int LITERAL_throw
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_assert

+
+static final int LITERAL_assert
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_case

+
+static final int LITERAL_case
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_default

+
+static final int LITERAL_default
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_try

+
+static final int LITERAL_try
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_finally

+
+static final int LITERAL_finally
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_catch

+
+static final int LITERAL_catch
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PLUS_ASSIGN

+
+static final int PLUS_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MINUS_ASSIGN

+
+static final int MINUS_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STAR_ASSIGN

+
+static final int STAR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIV_ASSIGN

+
+static final int DIV_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOD_ASSIGN

+
+static final int MOD_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR_ASSIGN

+
+static final int SR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BSR_ASSIGN

+
+static final int BSR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL_ASSIGN

+
+static final int SL_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BAND_ASSIGN

+
+static final int BAND_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BXOR_ASSIGN

+
+static final int BXOR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOR_ASSIGN

+
+static final int BOR_ASSIGN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUESTION

+
+static final int QUESTION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LOR

+
+static final int LOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LAND

+
+static final int LAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOR

+
+static final int BOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BXOR

+
+static final int BXOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BAND

+
+static final int BAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NOT_EQUAL

+
+static final int NOT_EQUAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EQUAL

+
+static final int EQUAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LT

+
+static final int LT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GT

+
+static final int GT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LE

+
+static final int LE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GE

+
+static final int GE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_instanceof

+
+static final int LITERAL_instanceof
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL

+
+static final int SL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR

+
+static final int SR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BSR

+
+static final int BSR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PLUS

+
+static final int PLUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MINUS

+
+static final int MINUS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIV

+
+static final int DIV
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOD

+
+static final int MOD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INC

+
+static final int INC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DEC

+
+static final int DEC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BNOT

+
+static final int BNOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LNOT

+
+static final int LNOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_true

+
+static final int LITERAL_true
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_false

+
+static final int LITERAL_false
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_null

+
+static final int LITERAL_null
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_new

+
+static final int LITERAL_new
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_INT

+
+static final int NUM_INT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CHAR_LITERAL

+
+static final int CHAR_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRING_LITERAL

+
+static final int STRING_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_FLOAT

+
+static final int NUM_FLOAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_LONG

+
+static final int NUM_LONG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NUM_DOUBLE

+
+static final int NUM_DOUBLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WS

+
+static final int WS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SL_COMMENT

+
+static final int SL_COMMENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ML_COMMENT

+
+static final int ML_COMMENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ESC

+
+static final int ESC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HEX_DIGIT

+
+static final int HEX_DIGIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VOCAB

+
+static final int VOCAB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXPONENT

+
+static final int EXPONENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FLOAT_SUFFIX

+
+static final int FLOAT_SUFFIX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CONSTRUCTOR_CAST

+
+static final int CONSTRUCTOR_CAST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EMPTY_FIELD

+
+static final int EMPTY_FIELD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WEBCOLOR_LITERAL

+
+static final int WEBCOLOR_LITERAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LITERAL_color

+
+static final int LITERAL_color
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/package-frame.html b/build/javadoc/everything/processing/app/preproc/package-frame.html new file mode 100644 index 000000000..fdd98f484 --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/package-frame.html @@ -0,0 +1,50 @@ + + + + + +processing.app.preproc + + + + + + + + + + + +processing.app.preproc + + + + +
+Interfaces  + +
+PdePartialTokenTypes +
+PdeTokenTypes
+ + + + + + +
+Classes  + +
+PdeEmitter +
+PdeLexer +
+PdePreprocessor +
+PdeRecognizer
+ + + + diff --git a/build/javadoc/everything/processing/app/preproc/package-summary.html b/build/javadoc/everything/processing/app/preproc/package-summary.html new file mode 100644 index 000000000..ddc982a9d --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/package-summary.html @@ -0,0 +1,182 @@ + + + + + +processing.app.preproc + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.preproc +

+ + + + + + + + + + + + + +
+Interface Summary
PdePartialTokenTypes 
PdeTokenTypes 
+  + +

+ + + + + + + + + + + + + + + + + + + + + +
+Class Summary
PdeEmitterPDEEmitter: A class that can take an ANTLR Java AST and produce + reasonably formatted Java code from it.
PdeLexer 
PdePreprocessorClass that orchestrates preprocessing p5 syntax into straight Java.
PdeRecognizer 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/preproc/package-tree.html b/build/javadoc/everything/processing/app/preproc/package-tree.html new file mode 100644 index 000000000..be1f6befa --- /dev/null +++ b/build/javadoc/everything/processing/app/preproc/package-tree.html @@ -0,0 +1,161 @@ + + + + + +processing.app.preproc Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.preproc +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/CTokenMarker.html b/build/javadoc/everything/processing/app/syntax/CTokenMarker.html new file mode 100644 index 000000000..a4976fa36 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/CTokenMarker.html @@ -0,0 +1,337 @@ + + + + + +CTokenMarker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class CTokenMarker

+
+java.lang.Object
+  extended by processing.app.syntax.TokenMarker
+      extended by processing.app.syntax.CTokenMarker
+
+
+
Direct Known Subclasses:
PdeKeywords
+
+
+
+
public class CTokenMarker
extends TokenMarker
+ + +

+C token marker. +

+ +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class processing.app.syntax.TokenMarker
TokenMarker.LineInfo
+  + + + + + + + + + + + + + + +
+Constructor Summary
CTokenMarker() + +
+           
CTokenMarker(boolean cpp, + KeywordMap keywords) + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static KeywordMapgetKeywords() + +
+           
+ bytemarkTokensImpl(byte token, + javax.swing.text.Segment line, + int lineIndex) + +
+          An abstract method that splits a line up into tokens.
+ + + + + + + +
Methods inherited from class processing.app.syntax.TokenMarker
deleteLines, getLineCount, insertLines, isNextLineRequested, markTokens, supportsMultilineTokens
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CTokenMarker

+
+public CTokenMarker()
+
+
+
+ +

+CTokenMarker

+
+public CTokenMarker(boolean cpp,
+                    KeywordMap keywords)
+
+
+ + + + + + + + +
+Method Detail
+ +

+markTokensImpl

+
+public byte markTokensImpl(byte token,
+                           javax.swing.text.Segment line,
+                           int lineIndex)
+
+
Description copied from class: TokenMarker
+
An abstract method that splits a line up into tokens. It + should parse the line, and call addToken() to + add syntax tokens to the token list. Then, it should return + the initial token type for the next line.

+ + For example if the current line contains the start of a + multiline comment that doesn't end on that line, this method + should return the comment token type so that it continues on + the next line. +

+

+
+
+
+
Parameters:
token - The initial token type for this line
line - The line to be tokenized
lineIndex - The index of the line in the document, + starting at 0 +
Returns:
The initial token type for the next line
+
+
+
+ +

+getKeywords

+
+public static KeywordMap getKeywords()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/DefaultInputHandler.html b/build/javadoc/everything/processing/app/syntax/DefaultInputHandler.html new file mode 100644 index 000000000..f057af0d4 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/DefaultInputHandler.html @@ -0,0 +1,499 @@ + + + + + +DefaultInputHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class DefaultInputHandler

+
+java.lang.Object
+  extended by java.awt.event.KeyAdapter
+      extended by processing.app.syntax.InputHandler
+          extended by processing.app.syntax.DefaultInputHandler
+
+
+
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener
+
+
+
+
public class DefaultInputHandler
extends InputHandler
+ + +

+The default input handler. It maps sequences of keystrokes into actions + and inserts key typed events into the text area. +

+ +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class processing.app.syntax.InputHandler
InputHandler.backspace, InputHandler.backspace_word, InputHandler.delete, InputHandler.delete_word, InputHandler.document_end, InputHandler.document_home, InputHandler.end, InputHandler.home, InputHandler.insert_break, InputHandler.insert_char, InputHandler.insert_tab, InputHandler.MacroRecorder, InputHandler.next_char, InputHandler.next_line, InputHandler.next_page, InputHandler.next_word, InputHandler.NonRecordable, InputHandler.NonRepeatable, InputHandler.overwrite, InputHandler.prev_char, InputHandler.prev_line, InputHandler.prev_page, InputHandler.prev_word, InputHandler.repeat, InputHandler.toggle_rect, InputHandler.Wrapper
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.app.syntax.InputHandler
BACKSPACE, BACKSPACE_WORD, DELETE, DELETE_WORD, DOCUMENT_END, DOCUMENT_HOME, END, HOME, INSERT_BREAK, INSERT_CHAR, INSERT_TAB, NEXT_CHAR, NEXT_LINE, NEXT_PAGE, NEXT_WORD, OVERWRITE, PREV_CHAR, PREV_LINE, PREV_PAGE, PREV_WORD, REPEAT, SELECT_DOC_END, SELECT_DOC_HOME, SELECT_END, SELECT_HOME, SELECT_NEXT_CHAR, SELECT_NEXT_LINE, SELECT_NEXT_PAGE, SELECT_NEXT_WORD, SELECT_PREV_CHAR, SELECT_PREV_LINE, SELECT_PREV_PAGE, SELECT_PREV_WORD, SMART_HOME_END_PROPERTY, TOGGLE_RECT
+  + + + + + + + + + + +
+Constructor Summary
DefaultInputHandler() + +
+          Creates a new input handler with no key bindings defined.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddDefaultKeyBindings() + +
+          Sets up the default key bindings.
+ voidaddKeyBinding(java.lang.String keyBinding, + java.awt.event.ActionListener action) + +
+          Adds a key binding to this input handler.
+ InputHandlercopy() + +
+          Returns a copy of this input handler that shares the same + key bindings.
+ voidkeyPressed(java.awt.event.KeyEvent evt) + +
+          Handle a key pressed event.
+ voidkeyTyped(java.awt.event.KeyEvent evt) + +
+          Handle a key typed event.
+static javax.swing.KeyStrokeparseKeyStroke(java.lang.String keyStroke) + +
+          Converts a string to a keystroke.
+ voidremoveAllKeyBindings() + +
+          Removes all key bindings from this input handler.
+ voidremoveKeyBinding(java.lang.String keyBinding) + +
+          Removes a key binding from this input handler.
+ + + + + + + +
Methods inherited from class processing.app.syntax.InputHandler
executeAction, getAction, getActionName, getActions, getMacroRecorder, getRepeatCount, getTextArea, grabNextKeyStroke, isRepeatEnabled, setMacroRecorder, setRepeatCount, setRepeatEnabled
+ + + + + + + +
Methods inherited from class java.awt.event.KeyAdapter
keyReleased
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+DefaultInputHandler

+
+public DefaultInputHandler()
+
+
Creates a new input handler with no key bindings defined. +

+

+ + + + + + + + +
+Method Detail
+ +

+addDefaultKeyBindings

+
+public void addDefaultKeyBindings()
+
+
Sets up the default key bindings. +

+

+
Specified by:
addDefaultKeyBindings in class InputHandler
+
+
+
+
+
+
+ +

+addKeyBinding

+
+public void addKeyBinding(java.lang.String keyBinding,
+                          java.awt.event.ActionListener action)
+
+
Adds a key binding to this input handler. The key binding is + a list of white space separated key strokes of the form + [modifiers+]key where modifier is C for Control, A for Alt, + or S for Shift, and key is either a character (a-z) or a field + name in the KeyEvent class prefixed with VK_ (e.g., BACK_SPACE) +

+

+
Specified by:
addKeyBinding in class InputHandler
+
+
+
Parameters:
keyBinding - The key binding
action - The action
+
+
+
+ +

+removeKeyBinding

+
+public void removeKeyBinding(java.lang.String keyBinding)
+
+
Removes a key binding from this input handler. This is not yet + implemented. +

+

+
Specified by:
removeKeyBinding in class InputHandler
+
+
+
Parameters:
keyBinding - The key binding
+
+
+
+ +

+removeAllKeyBindings

+
+public void removeAllKeyBindings()
+
+
Removes all key bindings from this input handler. +

+

+
Specified by:
removeAllKeyBindings in class InputHandler
+
+
+
+
+
+
+ +

+copy

+
+public InputHandler copy()
+
+
Returns a copy of this input handler that shares the same + key bindings. Setting key bindings in the copy will also + set them in the original. +

+

+
Specified by:
copy in class InputHandler
+
+
+
+
+
+
+ +

+keyPressed

+
+public void keyPressed(java.awt.event.KeyEvent evt)
+
+
Handle a key pressed event. This will look up the binding for + the key stroke and execute it. +

+

+
Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class java.awt.event.KeyAdapter
+
+
+
+
+
+
+ +

+keyTyped

+
+public void keyTyped(java.awt.event.KeyEvent evt)
+
+
Handle a key typed event. This inserts the key into the text area. +

+

+
Specified by:
keyTyped in interface java.awt.event.KeyListener
Overrides:
keyTyped in class java.awt.event.KeyAdapter
+
+
+
+
+
+
+ +

+parseKeyStroke

+
+public static javax.swing.KeyStroke parseKeyStroke(java.lang.String keyStroke)
+
+
Converts a string to a keystroke. The string should be of the + form modifiers+shortcut where modifiers + is any combination of A for Alt, C for Control, S for Shift + or M for Meta, and shortcut is either a single character, + or a keycode name from the KeyEvent class, without + the VK_ prefix. +

+

+
Parameters:
keyStroke - A string description of the key stroke
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.MacroRecorder.html b/build/javadoc/everything/processing/app/syntax/InputHandler.MacroRecorder.html new file mode 100644 index 000000000..befe06aed --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.MacroRecorder.html @@ -0,0 +1,209 @@ + + + + + +InputHandler.MacroRecorder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Interface InputHandler.MacroRecorder

+
+
Enclosing class:
InputHandler
+
+
+
+
public static interface InputHandler.MacroRecorder
+ + +

+Macro recorder. +

+ +

+


+ +

+ + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionListener listener, + java.lang.String actionCommand) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+void actionPerformed(java.awt.event.ActionListener listener,
+                     java.lang.String actionCommand)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.NonRecordable.html b/build/javadoc/everything/processing/app/syntax/InputHandler.NonRecordable.html new file mode 100644 index 000000000..e9feef7c8 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.NonRecordable.html @@ -0,0 +1,173 @@ + + + + + +InputHandler.NonRecordable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Interface InputHandler.NonRecordable

+
+
All Known Implementing Classes:
InputHandler.repeat
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static interface InputHandler.NonRecordable
+ + +

+If an action implements this interface, it should not be recorded + by the macro recorder. Instead, it will do its own recording. +

+ +

+


+ +

+ +

+ +


+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.NonRepeatable.html b/build/javadoc/everything/processing/app/syntax/InputHandler.NonRepeatable.html new file mode 100644 index 000000000..972ad39cc --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.NonRepeatable.html @@ -0,0 +1,173 @@ + + + + + +InputHandler.NonRepeatable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Interface InputHandler.NonRepeatable

+
+
All Known Implementing Classes:
InputHandler.insert_char
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static interface InputHandler.NonRepeatable
+ + +

+If an action implements this interface, it should not be repeated. + Instead, it will handle the repetition itself. +

+ +

+


+ +

+ +

+ +


+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.Wrapper.html b/build/javadoc/everything/processing/app/syntax/InputHandler.Wrapper.html new file mode 100644 index 000000000..a6666e4b9 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.Wrapper.html @@ -0,0 +1,173 @@ + + + + + +InputHandler.Wrapper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Interface InputHandler.Wrapper

+
+
Enclosing class:
InputHandler
+
+
+
+
public static interface InputHandler.Wrapper
+ + +

+For use by EditAction.Wrapper only. +

+ +

+

+
Since:
+
jEdit 2.2final
+
+
+ +

+ +

+ +


+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.backspace.html b/build/javadoc/everything/processing/app/syntax/InputHandler.backspace.html new file mode 100644 index 000000000..9711eeb8c --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.backspace.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.backspace + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.backspace

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.backspace
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.backspace
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.backspace() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.backspace

+
+public InputHandler.backspace()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.backspace_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.backspace_word.html new file mode 100644 index 000000000..625f12774 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.backspace_word.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.backspace_word + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.backspace_word

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.backspace_word
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.backspace_word
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.backspace_word() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.backspace_word

+
+public InputHandler.backspace_word()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.delete.html b/build/javadoc/everything/processing/app/syntax/InputHandler.delete.html new file mode 100644 index 000000000..e9f60014b --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.delete.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.delete + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.delete

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.delete
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.delete
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.delete() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.delete

+
+public InputHandler.delete()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.delete_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.delete_word.html new file mode 100644 index 000000000..75fab8599 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.delete_word.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.delete_word + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.delete_word

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.delete_word
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.delete_word
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.delete_word() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.delete_word

+
+public InputHandler.delete_word()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.document_end.html b/build/javadoc/everything/processing/app/syntax/InputHandler.document_end.html new file mode 100644 index 000000000..1667a417f --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.document_end.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.document_end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.document_end

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.document_end
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.document_end
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.document_end(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.document_end

+
+public InputHandler.document_end(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.document_home.html b/build/javadoc/everything/processing/app/syntax/InputHandler.document_home.html new file mode 100644 index 000000000..11626173c --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.document_home.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.document_home + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.document_home

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.document_home
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.document_home
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.document_home(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.document_home

+
+public InputHandler.document_home(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.end.html b/build/javadoc/everything/processing/app/syntax/InputHandler.end.html new file mode 100644 index 000000000..f169817b5 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.end.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.end

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.end
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.end
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.end(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.end

+
+public InputHandler.end(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.home.html b/build/javadoc/everything/processing/app/syntax/InputHandler.home.html new file mode 100644 index 000000000..98aa59fea --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.home.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.home + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.home

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.home
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.home
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.home(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.home

+
+public InputHandler.home(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.html b/build/javadoc/everything/processing/app/syntax/InputHandler.html new file mode 100644 index 000000000..cfd51d8ef --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.html @@ -0,0 +1,1507 @@ + + + + + +InputHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler

+
+java.lang.Object
+  extended by java.awt.event.KeyAdapter
+      extended by processing.app.syntax.InputHandler
+
+
+
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener
+
+
+
Direct Known Subclasses:
DefaultInputHandler
+
+
+
+
public abstract class InputHandler
extends java.awt.event.KeyAdapter
+ + +

+An input handler converts the user's key strokes into concrete actions. + It also takes care of macro recording and action repetition.

+ + This class provides all the necessary support code for an input + handler, but doesn't actually do any key binding logic. It is up + to the implementations of this class to do so. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Nested Class Summary
+static classInputHandler.backspace + +
+           
+static classInputHandler.backspace_word + +
+           
+static classInputHandler.delete + +
+           
+static classInputHandler.delete_word + +
+           
+static classInputHandler.document_end + +
+           
+static classInputHandler.document_home + +
+           
+static classInputHandler.end + +
+           
+static classInputHandler.home + +
+           
+static classInputHandler.insert_break + +
+           
+static classInputHandler.insert_char + +
+           
+static classInputHandler.insert_tab + +
+           
+static interfaceInputHandler.MacroRecorder + +
+          Macro recorder.
+static classInputHandler.next_char + +
+           
+static classInputHandler.next_line + +
+           
+static classInputHandler.next_page + +
+           
+static classInputHandler.next_word + +
+           
+static interfaceInputHandler.NonRecordable + +
+          If an action implements this interface, it should not be recorded + by the macro recorder.
+static interfaceInputHandler.NonRepeatable + +
+          If an action implements this interface, it should not be repeated.
+static classInputHandler.overwrite + +
+           
+static classInputHandler.prev_char + +
+           
+static classInputHandler.prev_line + +
+           
+static classInputHandler.prev_page + +
+           
+static classInputHandler.prev_word + +
+           
+static classInputHandler.repeat + +
+           
+static classInputHandler.toggle_rect + +
+           
+static interfaceInputHandler.Wrapper + +
+          For use by EditAction.Wrapper only.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static java.awt.event.ActionListenerBACKSPACE + +
+           
+static java.awt.event.ActionListenerBACKSPACE_WORD + +
+           
+static java.awt.event.ActionListenerDELETE + +
+           
+static java.awt.event.ActionListenerDELETE_WORD + +
+           
+static java.awt.event.ActionListenerDOCUMENT_END + +
+           
+static java.awt.event.ActionListenerDOCUMENT_HOME + +
+           
+static java.awt.event.ActionListenerEND + +
+           
+static java.awt.event.ActionListenerHOME + +
+           
+static java.awt.event.ActionListenerINSERT_BREAK + +
+           
+static java.awt.event.ActionListenerINSERT_CHAR + +
+           
+static java.awt.event.ActionListenerINSERT_TAB + +
+           
+static java.awt.event.ActionListenerNEXT_CHAR + +
+           
+static java.awt.event.ActionListenerNEXT_LINE + +
+           
+static java.awt.event.ActionListenerNEXT_PAGE + +
+           
+static java.awt.event.ActionListenerNEXT_WORD + +
+           
+static java.awt.event.ActionListenerOVERWRITE + +
+           
+static java.awt.event.ActionListenerPREV_CHAR + +
+           
+static java.awt.event.ActionListenerPREV_LINE + +
+           
+static java.awt.event.ActionListenerPREV_PAGE + +
+           
+static java.awt.event.ActionListenerPREV_WORD + +
+           
+static java.awt.event.ActionListenerREPEAT + +
+           
+static java.awt.event.ActionListenerSELECT_DOC_END + +
+           
+static java.awt.event.ActionListenerSELECT_DOC_HOME + +
+           
+static java.awt.event.ActionListenerSELECT_END + +
+           
+static java.awt.event.ActionListenerSELECT_HOME + +
+           
+static java.awt.event.ActionListenerSELECT_NEXT_CHAR + +
+           
+static java.awt.event.ActionListenerSELECT_NEXT_LINE + +
+           
+static java.awt.event.ActionListenerSELECT_NEXT_PAGE + +
+           
+static java.awt.event.ActionListenerSELECT_NEXT_WORD + +
+           
+static java.awt.event.ActionListenerSELECT_PREV_CHAR + +
+           
+static java.awt.event.ActionListenerSELECT_PREV_LINE + +
+           
+static java.awt.event.ActionListenerSELECT_PREV_PAGE + +
+           
+static java.awt.event.ActionListenerSELECT_PREV_WORD + +
+           
+static java.lang.StringSMART_HOME_END_PROPERTY + +
+          If this client property is set to Boolean.TRUE on the text area, + the home/end keys will support 'smart' BRIEF-like behaviour + (one press = start/end of line, two presses = start/end of + viewscreen, three presses = start/end of document).
+static java.awt.event.ActionListenerTOGGLE_RECT + +
+           
+  + + + + + + + + + + +
+Constructor Summary
InputHandler() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+abstract  voidaddDefaultKeyBindings() + +
+          Adds the default key bindings to this input handler.
+abstract  voidaddKeyBinding(java.lang.String keyBinding, + java.awt.event.ActionListener action) + +
+          Adds a key binding to this input handler.
+abstract  InputHandlercopy() + +
+          Returns a copy of this input handler that shares the same + key bindings.
+ voidexecuteAction(java.awt.event.ActionListener listener, + java.lang.Object source, + java.lang.String actionCommand) + +
+          Executes the specified action, repeating and recording it as + necessary.
+static java.awt.event.ActionListenergetAction(java.lang.String name) + +
+          Returns a named text area action.
+static java.lang.StringgetActionName(java.awt.event.ActionListener listener) + +
+          Returns the name of the specified text area action.
+static java.util.EnumerationgetActions() + +
+          Returns an enumeration of all available actions.
+ InputHandler.MacroRecordergetMacroRecorder() + +
+          Returns the macro recorder.
+ intgetRepeatCount() + +
+          Returns the number of times the next action will be repeated.
+static JEditTextAreagetTextArea(java.util.EventObject evt) + +
+          Returns the text area that fired the specified event.
+ voidgrabNextKeyStroke(java.awt.event.ActionListener listener) + +
+          Grabs the next key typed event and invokes the specified + action with the key as a the action command.
+ booleanisRepeatEnabled() + +
+          Returns if repeating is enabled.
+abstract  voidremoveAllKeyBindings() + +
+          Removes all key bindings from this input handler.
+abstract  voidremoveKeyBinding(java.lang.String keyBinding) + +
+          Removes a key binding from this input handler.
+ voidsetMacroRecorder(InputHandler.MacroRecorder recorder) + +
+          Sets the macro recorder.
+ voidsetRepeatCount(int repeatCount) + +
+          Sets the number of times the next action will be repeated.
+ voidsetRepeatEnabled(boolean repeat) + +
+          Enables repeating.
+ + + + + + + +
Methods inherited from class java.awt.event.KeyAdapter
keyPressed, keyReleased, keyTyped
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+SMART_HOME_END_PROPERTY

+
+public static final java.lang.String SMART_HOME_END_PROPERTY
+
+
If this client property is set to Boolean.TRUE on the text area, + the home/end keys will support 'smart' BRIEF-like behaviour + (one press = start/end of line, two presses = start/end of + viewscreen, three presses = start/end of document). By default, + this property is not set. +

+

+
See Also:
Constant Field Values
+
+
+ +

+BACKSPACE

+
+public static final java.awt.event.ActionListener BACKSPACE
+
+
+
+
+
+ +

+BACKSPACE_WORD

+
+public static final java.awt.event.ActionListener BACKSPACE_WORD
+
+
+
+
+
+ +

+DELETE

+
+public static final java.awt.event.ActionListener DELETE
+
+
+
+
+
+ +

+DELETE_WORD

+
+public static final java.awt.event.ActionListener DELETE_WORD
+
+
+
+
+
+ +

+END

+
+public static final java.awt.event.ActionListener END
+
+
+
+
+
+ +

+DOCUMENT_END

+
+public static final java.awt.event.ActionListener DOCUMENT_END
+
+
+
+
+
+ +

+SELECT_END

+
+public static final java.awt.event.ActionListener SELECT_END
+
+
+
+
+
+ +

+SELECT_DOC_END

+
+public static final java.awt.event.ActionListener SELECT_DOC_END
+
+
+
+
+
+ +

+INSERT_BREAK

+
+public static final java.awt.event.ActionListener INSERT_BREAK
+
+
+
+
+
+ +

+INSERT_TAB

+
+public static final java.awt.event.ActionListener INSERT_TAB
+
+
+
+
+
+ +

+HOME

+
+public static final java.awt.event.ActionListener HOME
+
+
+
+
+
+ +

+DOCUMENT_HOME

+
+public static final java.awt.event.ActionListener DOCUMENT_HOME
+
+
+
+
+
+ +

+SELECT_HOME

+
+public static final java.awt.event.ActionListener SELECT_HOME
+
+
+
+
+
+ +

+SELECT_DOC_HOME

+
+public static final java.awt.event.ActionListener SELECT_DOC_HOME
+
+
+
+
+
+ +

+NEXT_CHAR

+
+public static final java.awt.event.ActionListener NEXT_CHAR
+
+
+
+
+
+ +

+NEXT_LINE

+
+public static final java.awt.event.ActionListener NEXT_LINE
+
+
+
+
+
+ +

+NEXT_PAGE

+
+public static final java.awt.event.ActionListener NEXT_PAGE
+
+
+
+
+
+ +

+NEXT_WORD

+
+public static final java.awt.event.ActionListener NEXT_WORD
+
+
+
+
+
+ +

+SELECT_NEXT_CHAR

+
+public static final java.awt.event.ActionListener SELECT_NEXT_CHAR
+
+
+
+
+
+ +

+SELECT_NEXT_LINE

+
+public static final java.awt.event.ActionListener SELECT_NEXT_LINE
+
+
+
+
+
+ +

+SELECT_NEXT_PAGE

+
+public static final java.awt.event.ActionListener SELECT_NEXT_PAGE
+
+
+
+
+
+ +

+SELECT_NEXT_WORD

+
+public static final java.awt.event.ActionListener SELECT_NEXT_WORD
+
+
+
+
+
+ +

+OVERWRITE

+
+public static final java.awt.event.ActionListener OVERWRITE
+
+
+
+
+
+ +

+PREV_CHAR

+
+public static final java.awt.event.ActionListener PREV_CHAR
+
+
+
+
+
+ +

+PREV_LINE

+
+public static final java.awt.event.ActionListener PREV_LINE
+
+
+
+
+
+ +

+PREV_PAGE

+
+public static final java.awt.event.ActionListener PREV_PAGE
+
+
+
+
+
+ +

+PREV_WORD

+
+public static final java.awt.event.ActionListener PREV_WORD
+
+
+
+
+
+ +

+SELECT_PREV_CHAR

+
+public static final java.awt.event.ActionListener SELECT_PREV_CHAR
+
+
+
+
+
+ +

+SELECT_PREV_LINE

+
+public static final java.awt.event.ActionListener SELECT_PREV_LINE
+
+
+
+
+
+ +

+SELECT_PREV_PAGE

+
+public static final java.awt.event.ActionListener SELECT_PREV_PAGE
+
+
+
+
+
+ +

+SELECT_PREV_WORD

+
+public static final java.awt.event.ActionListener SELECT_PREV_WORD
+
+
+
+
+
+ +

+REPEAT

+
+public static final java.awt.event.ActionListener REPEAT
+
+
+
+
+
+ +

+TOGGLE_RECT

+
+public static final java.awt.event.ActionListener TOGGLE_RECT
+
+
+
+
+
+ +

+INSERT_CHAR

+
+public static final java.awt.event.ActionListener INSERT_CHAR
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler

+
+public InputHandler()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getAction

+
+public static java.awt.event.ActionListener getAction(java.lang.String name)
+
+
Returns a named text area action. +

+

+
Parameters:
name - The action name
+
+
+
+ +

+getActionName

+
+public static java.lang.String getActionName(java.awt.event.ActionListener listener)
+
+
Returns the name of the specified text area action. +

+

+
Parameters:
listener - The action
+
+
+
+ +

+getActions

+
+public static java.util.Enumeration getActions()
+
+
Returns an enumeration of all available actions. +

+

+
+
+
+
+ +

+addDefaultKeyBindings

+
+public abstract void addDefaultKeyBindings()
+
+
Adds the default key bindings to this input handler. + This should not be called in the constructor of this + input handler, because applications might load the + key bindings from a file, etc. +

+

+
+
+
+
+ +

+addKeyBinding

+
+public abstract void addKeyBinding(java.lang.String keyBinding,
+                                   java.awt.event.ActionListener action)
+
+
Adds a key binding to this input handler. +

+

+
Parameters:
keyBinding - The key binding (the format of this is + input-handler specific)
action - The action
+
+
+
+ +

+removeKeyBinding

+
+public abstract void removeKeyBinding(java.lang.String keyBinding)
+
+
Removes a key binding from this input handler. +

+

+
Parameters:
keyBinding - The key binding
+
+
+
+ +

+removeAllKeyBindings

+
+public abstract void removeAllKeyBindings()
+
+
Removes all key bindings from this input handler. +

+

+
+
+
+
+ +

+grabNextKeyStroke

+
+public void grabNextKeyStroke(java.awt.event.ActionListener listener)
+
+
Grabs the next key typed event and invokes the specified + action with the key as a the action command. +

+

+
+
+
+
+ +

+isRepeatEnabled

+
+public boolean isRepeatEnabled()
+
+
Returns if repeating is enabled. When repeating is enabled, + actions will be executed multiple times. This is usually + invoked with a special key stroke in the input handler. +

+

+
+
+
+
+ +

+setRepeatEnabled

+
+public void setRepeatEnabled(boolean repeat)
+
+
Enables repeating. When repeating is enabled, actions will be + executed multiple times. Once repeating is enabled, the input + handler should read a number from the keyboard. +

+

+
+
+
+
+ +

+getRepeatCount

+
+public int getRepeatCount()
+
+
Returns the number of times the next action will be repeated. +

+

+
+
+
+
+ +

+setRepeatCount

+
+public void setRepeatCount(int repeatCount)
+
+
Sets the number of times the next action will be repeated. +

+

+
Parameters:
repeatCount - The repeat count
+
+
+
+ +

+getMacroRecorder

+
+public InputHandler.MacroRecorder getMacroRecorder()
+
+
Returns the macro recorder. If this is non-null, all executed + actions should be forwarded to the recorder. +

+

+
+
+
+
+ +

+setMacroRecorder

+
+public void setMacroRecorder(InputHandler.MacroRecorder recorder)
+
+
Sets the macro recorder. If this is non-null, all executed + actions should be forwarded to the recorder. +

+

+
Parameters:
recorder - The macro recorder
+
+
+
+ +

+copy

+
+public abstract InputHandler copy()
+
+
Returns a copy of this input handler that shares the same + key bindings. Setting key bindings in the copy will also + set them in the original. +

+

+
+
+
+
+ +

+executeAction

+
+public void executeAction(java.awt.event.ActionListener listener,
+                          java.lang.Object source,
+                          java.lang.String actionCommand)
+
+
Executes the specified action, repeating and recording it as + necessary. +

+

+
Parameters:
listener - The action listener
source - The event source
actionCommand - The action command
+
+
+
+ +

+getTextArea

+
+public static JEditTextArea getTextArea(java.util.EventObject evt)
+
+
Returns the text area that fired the specified event. +

+

+
Parameters:
evt - The event
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_break.html b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_break.html new file mode 100644 index 000000000..585f610d0 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_break.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.insert_break + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.insert_break

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.insert_break
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.insert_break
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.insert_break() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.insert_break

+
+public InputHandler.insert_break()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_char.html b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_char.html new file mode 100644 index 000000000..d99ef7b9e --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_char.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.insert_char + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.insert_char

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.insert_char
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, InputHandler.NonRepeatable
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.insert_char
extends java.lang.Object
implements java.awt.event.ActionListener, InputHandler.NonRepeatable
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.insert_char() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.insert_char

+
+public InputHandler.insert_char()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.insert_tab.html b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_tab.html new file mode 100644 index 000000000..0bd6d2ca4 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.insert_tab.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.insert_tab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.insert_tab

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.insert_tab
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.insert_tab
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.insert_tab() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.insert_tab

+
+public InputHandler.insert_tab()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_char.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_char.html new file mode 100644 index 000000000..cbe5c08e1 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.next_char.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.next_char + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.next_char

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.next_char
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.next_char
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.next_char(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.next_char

+
+public InputHandler.next_char(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_line.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_line.html new file mode 100644 index 000000000..d3bbe0feb --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.next_line.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.next_line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.next_line

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.next_line
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.next_line
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.next_line(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.next_line

+
+public InputHandler.next_line(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_page.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_page.html new file mode 100644 index 000000000..f9dfbff3e --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.next_page.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.next_page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.next_page

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.next_page
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.next_page
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.next_page(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.next_page

+
+public InputHandler.next_page(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.next_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.next_word.html new file mode 100644 index 000000000..b4881af6f --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.next_word.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.next_word + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.next_word

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.next_word
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.next_word
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.next_word(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.next_word

+
+public InputHandler.next_word(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.overwrite.html b/build/javadoc/everything/processing/app/syntax/InputHandler.overwrite.html new file mode 100644 index 000000000..3261f09eb --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.overwrite.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.overwrite + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.overwrite

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.overwrite
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.overwrite
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.overwrite() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.overwrite

+
+public InputHandler.overwrite()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_char.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_char.html new file mode 100644 index 000000000..6c692b242 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_char.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.prev_char + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.prev_char

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.prev_char
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.prev_char
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.prev_char(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.prev_char

+
+public InputHandler.prev_char(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_line.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_line.html new file mode 100644 index 000000000..84946d8ef --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_line.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.prev_line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.prev_line

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.prev_line
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.prev_line
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.prev_line(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.prev_line

+
+public InputHandler.prev_line(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_page.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_page.html new file mode 100644 index 000000000..bfca11c63 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_page.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.prev_page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.prev_page

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.prev_page
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.prev_page
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.prev_page(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.prev_page

+
+public InputHandler.prev_page(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.prev_word.html b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_word.html new file mode 100644 index 000000000..46adbb2f2 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.prev_word.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.prev_word + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.prev_word

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.prev_word
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.prev_word
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.prev_word(boolean select) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.prev_word

+
+public InputHandler.prev_word(boolean select)
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.repeat.html b/build/javadoc/everything/processing/app/syntax/InputHandler.repeat.html new file mode 100644 index 000000000..cd3e0e832 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.repeat.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.repeat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.repeat

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.repeat
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, InputHandler.NonRecordable
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.repeat
extends java.lang.Object
implements java.awt.event.ActionListener, InputHandler.NonRecordable
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.repeat() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.repeat

+
+public InputHandler.repeat()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/InputHandler.toggle_rect.html b/build/javadoc/everything/processing/app/syntax/InputHandler.toggle_rect.html new file mode 100644 index 000000000..60ab87ce1 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/InputHandler.toggle_rect.html @@ -0,0 +1,255 @@ + + + + + +InputHandler.toggle_rect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class InputHandler.toggle_rect

+
+java.lang.Object
+  extended by processing.app.syntax.InputHandler.toggle_rect
+
+
+
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
+
+
+
Enclosing class:
InputHandler
+
+
+
+
public static class InputHandler.toggle_rect
extends java.lang.Object
implements java.awt.event.ActionListener
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
InputHandler.toggle_rect() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(java.awt.event.ActionEvent evt) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+InputHandler.toggle_rect

+
+public InputHandler.toggle_rect()
+
+
+ + + + + + + + +
+Method Detail
+ +

+actionPerformed

+
+public void actionPerformed(java.awt.event.ActionEvent evt)
+
+
+
Specified by:
actionPerformed in interface java.awt.event.ActionListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/JEditTextArea.html b/build/javadoc/everything/processing/app/syntax/JEditTextArea.html new file mode 100644 index 000000000..7c4885220 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/JEditTextArea.html @@ -0,0 +1,2310 @@ + + + + + +JEditTextArea + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class JEditTextArea

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by processing.app.syntax.JEditTextArea
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
+
+
+
+
public class JEditTextArea
extends javax.swing.JComponent
+ + +

+jEdit's text area component. It is more suited for editing program + source code than JEditorPane, because it drops the unnecessary features + (images, variable-width lines, and so on) and adds a whole bunch of + useful goodies such as: +

    +
  • More flexible key binding scheme +
  • Supports macro recorders +
  • Rectangular selection +
  • Bracket highlighting +
  • Syntax highlighting +
  • Command repetition +
  • Block caret can be enabled +
+ It is also faster and doesn't have as many problems. It can be used + in other applications; the only other part of jEdit it depends on is + the syntax package.

+ + To use it in your app, treat it like any other component, for example: +

JEditTextArea ta = new JEditTextArea();
+ ta.setTokenMarker(new JavaTokenMarker());
+ ta.setText("public class Test {\n"
+     + "    public static void main(String[] args) {\n"
+     + "        System.out.println(\"Hello World\");\n"
+     + "    }\n"
+     + "}");
+

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ EditorLineStatuseditorLineStatus + +
+          The component that tracks the current line number.
+ EditorListenereditorListener + +
+          Forwards key events directly to the input handler.
+static java.lang.StringLEFT_OF_SCROLLBAR + +
+          Adding components with this name to the text area will place + them left of the horizontal scroll bar.
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
JEditTextArea(TextAreaDefaults defaults) + +
+          Creates a new JEditTextArea with the specified settings.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ int_offsetToX(int line, + int offset) + +
+          Converts an offset in a line into an x co-ordinate.
+ voidaddCaretListener(javax.swing.event.CaretListener listener) + +
+          Adds a caret change listener to this text area.
+ voidblinkCaret() + +
+          Blinks the caret.
+ voidcopy() + +
+          Places the selected text into the clipboard.
+ voidcut() + +
+          Deletes the selected text from the text area and places it + into the clipboard.
+ intgetBracketLine() + +
+          Returns the line of the highlighted bracket (the bracket + matching the one before the caret)
+ intgetBracketPosition() + +
+          Returns the position of the highlighted bracket (the bracket + matching the one before the caret)
+ intgetCaretLine() + +
+          Returns the caret line.
+ intgetCaretPosition() + +
+          Returns the caret position.
+ SyntaxDocumentgetDocument() + +
+          Returns the document this text area is editing.
+ intgetDocumentLength() + +
+          Returns the length of the document.
+ intgetElectricScroll() + +
+          Returns the number of lines from the top and button of the + text area that are always visible.
+ intgetFirstLine() + +
+          Returns the line displayed at the text area's origin.
+ intgetHorizontalOffset() + +
+          Returns the horizontal offset of drawn lines.
+ InputHandlergetInputHandler() + +
+          Returns the input handler.
+ intgetLineCount() + +
+          Returns the number of lines in the document.
+ intgetLineLength(int line) + +
+          Returns the length of the specified line.
+ intgetLineOfOffset(int offset) + +
+          Returns the line containing the specified offset.
+ intgetLineStartOffset(int line) + +
+          Returns the start offset of the specified line.
+ intgetLineStopOffset(int line) + +
+          Returns the end offset of the specified line.
+ java.lang.StringgetLineText(int lineIndex) + +
+          Returns the text on the specified line.
+ voidgetLineText(int lineIndex, + javax.swing.text.Segment segment) + +
+          Copies the text on the specified line into a segment.
+ intgetMagicCaretPosition() + +
+          Returns the `magic' caret position.
+ intgetMarkLine() + +
+          Returns the mark line.
+ intgetMarkPosition() + +
+          Returns the mark position.
+ TextAreaPaintergetPainter() + +
+          Returns the object responsible for painting this text area.
+ javax.swing.JPopupMenugetRightClickPopup() + +
+          Returns the right click popup menu.
+ intgetScrollPosition() + +
+          Get current position of the vertical scroll bar.
+ java.lang.StringgetSelectedText() + +
+          Returns the selected text, or null if no selection is active.
+ intgetSelectionStart() + +
+          Returns the selection start offset.
+ intgetSelectionStart(int line) + +
+          Returns the offset where the selection starts on the specified + line.
+ intgetSelectionStartLine() + +
+          Returns the selection start line.
+ intgetSelectionStop() + +
+          Returns the selection end offset.
+ intgetSelectionStop(int line) + +
+          Returns the offset where the selection ends on the specified + line.
+ intgetSelectionStopLine() + +
+          Returns the selection end line.
+ java.lang.StringgetText() + +
+          Returns the entire text of this text area.
+ java.lang.StringgetText(int start, + int len) + +
+          Returns the specified substring of the document.
+ voidgetText(int start, + int len, + javax.swing.text.Segment segment) + +
+          Copies the specified substring of the document into a segment.
+ TokenMarkergetTokenMarker() + +
+          Returns the document's token marker.
+ intgetVisibleLines() + +
+          Returns the number of lines visible in this text area.
+ booleanisCaretBlinkEnabled() + +
+          Returns true if the caret is blinking, false otherwise.
+ booleanisCaretVisible() + +
+          Returns true if the caret is visible, false otherwise.
+ booleanisEditable() + +
+          Returns true if this text area is editable, false otherwise.
+ booleanisManagingFocus() + +
+          Returns if this component can be traversed by pressing + the Tab key.
+ booleanisOverwriteEnabled() + +
+          Returns true if overwrite mode is enabled, false otherwise.
+ booleanisSelectionActive() + +
+           
+ booleanisSelectionRectangular() + +
+          Returns true if the selection is rectangular, false otherwise.
+ intlineToY(int line) + +
+          Converts a line index to a y co-ordinate.
+ intoffsetToX(int line, + int offset) + +
+          Converts an offset in a line into an x co-ordinate.
+ voidoverwriteSetSelectedText(java.lang.String str) + +
+          Similar to setSelectedText(), but overstrikes the + appropriate number of characters if overwrite mode is enabled.
+ voidpaste() + +
+          Inserts the clipboard contents into the text.
+ voidprocessKeyEvent(java.awt.event.KeyEvent evt) + +
+           
+ voidrecalculateVisibleLines() + +
+          Recalculates the number of visible lines.
+ voidremoveCaretListener(javax.swing.event.CaretListener listener) + +
+          Removes a caret change listener from this text area.
+ voidremoveNotify() + +
+          Called by the AWT when this component is removed from it's parent.
+ booleanscrollTo(int line, + int offset) + +
+          Ensures that the specified line and offset is visible by scrolling + the text area if necessary.
+ booleanscrollToCaret() + +
+          Ensures that the caret is visible by scrolling the text area if + necessary.
+ voidselect(int start, + int end) + +
+          Selects from the start offset to the end offset.
+ voidselectAll() + +
+          Selects all text in the document.
+ voidselectNone() + +
+          Moves the mark to the caret position.
+ voidsetCaretBlinkEnabled(boolean caretBlinks) + +
+          Toggles caret blinking.
+ voidsetCaretPosition(int caret) + +
+          Sets the caret position.
+ voidsetCaretVisible(boolean caretVisible) + +
+          Sets if the caret should be visible.
+ voidsetDocument(SyntaxDocument document) + +
+          Sets the document this text area is editing.
+ voidsetDocument(SyntaxDocument document, + int start, + int stop, + int scroll) + +
+          Set document with a twist, includes the old caret + and scroll positions, added for p5.
+ voidsetEditable(boolean editable) + +
+          Sets if this component is editable.
+ voidsetElectricScroll(int electricScroll) + +
+          Sets the number of lines from the top and bottom of the text + area that are always visible
+ voidsetFirstLine(int firstLine) + +
+          Sets the line displayed at the text area's origin without + updating the scroll bars.
+ voidsetHorizontalOffset(int horizontalOffset) + +
+          Sets the horizontal offset of drawn lines.
+ voidsetInputHandler(InputHandler inputHandler) + +
+          Sets the input handler.
+ voidsetMagicCaretPosition(int magicCaret) + +
+          Sets the `magic' caret position.
+ booleansetOrigin(int firstLine, + int horizontalOffset) + +
+          A fast way of changing both the first line and horizontal + offset.
+ voidsetOverwriteEnabled(boolean overwrite) + +
+          Sets if overwrite mode should be enabled.
+ voidsetRightClickPopup(javax.swing.JPopupMenu popup) + +
+          Sets the right click popup menu.
+ voidsetScrollPosition(int what) + +
+          Set position of the vertical scroll bar.
+ voidsetSelectedText(java.lang.String selectedText) + +
+          Replaces the selection with the specified text.
+ voidsetSelectionEnd(int selectionEnd) + +
+          Sets the selection end.
+ voidsetSelectionRectangular(boolean rectSelect) + +
+          Sets if the selection should be rectangular.
+ voidsetSelectionStart(int selectionStart) + +
+          Sets the selection start.
+ voidsetText(java.lang.String text) + +
+          Sets the entire text of this text area.
+ voidsetTokenMarker(TokenMarker tokenMarker) + +
+          Sets the document's token marker.
+ voidupdateScrollBars() + +
+          Updates the state of the scroll bars.
+ intxToOffset(int line, + int x) + +
+          Converts an x co-ordinate to an offset within a line.
+ intxyToOffset(int x, + int y) + +
+          Converts a point to an offset, from the start of the text.
+ intyToLine(int y) + +
+          Converts a y co-ordinate to a line index.
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+LEFT_OF_SCROLLBAR

+
+public static java.lang.String LEFT_OF_SCROLLBAR
+
+
Adding components with this name to the text area will place + them left of the horizontal scroll bar. In jEdit, the status + bar is added this way. +

+

+
+
+
+ +

+editorListener

+
+public EditorListener editorListener
+
+
Forwards key events directly to the input handler. + This is slightly faster than using a KeyListener + because some Swing overhead is avoided. +

+

+
+
+
+ +

+editorLineStatus

+
+public EditorLineStatus editorLineStatus
+
+
The component that tracks the current line number. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+JEditTextArea

+
+public JEditTextArea(TextAreaDefaults defaults)
+
+
Creates a new JEditTextArea with the specified settings. +

+

+
Parameters:
defaults - The default settings
+
+ + + + + + + + +
+Method Detail
+ +

+getScrollPosition

+
+public int getScrollPosition()
+
+
Get current position of the vertical scroll bar. [fry] +

+

+
+
+
+
+ +

+setScrollPosition

+
+public void setScrollPosition(int what)
+
+
Set position of the vertical scroll bar. [fry] +

+

+
+
+
+
+ +

+isManagingFocus

+
+public final boolean isManagingFocus()
+
+
Returns if this component can be traversed by pressing + the Tab key. This returns false. +

+

+
Overrides:
isManagingFocus in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getPainter

+
+public final TextAreaPainter getPainter()
+
+
Returns the object responsible for painting this text area. +

+

+
+
+
+
+ +

+getInputHandler

+
+public final InputHandler getInputHandler()
+
+
Returns the input handler. +

+

+
+
+
+
+ +

+setInputHandler

+
+public void setInputHandler(InputHandler inputHandler)
+
+
Sets the input handler. +

+

+
Parameters:
inputHandler - The new input handler
+
+
+
+ +

+isCaretBlinkEnabled

+
+public final boolean isCaretBlinkEnabled()
+
+
Returns true if the caret is blinking, false otherwise. +

+

+
+
+
+
+ +

+setCaretBlinkEnabled

+
+public void setCaretBlinkEnabled(boolean caretBlinks)
+
+
Toggles caret blinking. +

+

+
Parameters:
caretBlinks - True if the caret should blink, false otherwise
+
+
+
+ +

+isCaretVisible

+
+public final boolean isCaretVisible()
+
+
Returns true if the caret is visible, false otherwise. +

+

+
+
+
+
+ +

+setCaretVisible

+
+public void setCaretVisible(boolean caretVisible)
+
+
Sets if the caret should be visible. +

+

+
Parameters:
caretVisible - True if the caret should be visible, false + otherwise
+
+
+
+ +

+blinkCaret

+
+public final void blinkCaret()
+
+
Blinks the caret. +

+

+
+
+
+
+ +

+getElectricScroll

+
+public final int getElectricScroll()
+
+
Returns the number of lines from the top and button of the + text area that are always visible. +

+

+
+
+
+
+ +

+setElectricScroll

+
+public final void setElectricScroll(int electricScroll)
+
+
Sets the number of lines from the top and bottom of the text + area that are always visible +

+

+
Parameters:
electricScroll - The number of lines always visible from + the top or bottom
+
+
+
+ +

+updateScrollBars

+
+public void updateScrollBars()
+
+
Updates the state of the scroll bars. This should be called + if the number of lines in the document changes, or when the + size of the text are changes. +

+

+
+
+
+
+ +

+getFirstLine

+
+public final int getFirstLine()
+
+
Returns the line displayed at the text area's origin. +

+

+
+
+
+
+ +

+setFirstLine

+
+public void setFirstLine(int firstLine)
+
+
Sets the line displayed at the text area's origin without + updating the scroll bars. +

+

+
+
+
+
+ +

+getVisibleLines

+
+public final int getVisibleLines()
+
+
Returns the number of lines visible in this text area. +

+

+
+
+
+
+ +

+recalculateVisibleLines

+
+public final void recalculateVisibleLines()
+
+
Recalculates the number of visible lines. This should not + be called directly. +

+

+
+
+
+
+ +

+getHorizontalOffset

+
+public final int getHorizontalOffset()
+
+
Returns the horizontal offset of drawn lines. +

+

+
+
+
+
+ +

+setHorizontalOffset

+
+public void setHorizontalOffset(int horizontalOffset)
+
+
Sets the horizontal offset of drawn lines. This can be used to + implement horizontal scrolling. +

+

+
Parameters:
horizontalOffset - offset The new horizontal offset
+
+
+
+ +

+setOrigin

+
+public boolean setOrigin(int firstLine,
+                         int horizontalOffset)
+
+
A fast way of changing both the first line and horizontal + offset. +

+

+
Parameters:
firstLine - The new first line
horizontalOffset - The new horizontal offset +
Returns:
True if any of the values were changed, false otherwise
+
+
+
+ +

+scrollToCaret

+
+public boolean scrollToCaret()
+
+
Ensures that the caret is visible by scrolling the text area if + necessary. +

+

+ +
Returns:
True if scrolling was actually performed, false if the + caret was already visible
+
+
+
+ +

+scrollTo

+
+public boolean scrollTo(int line,
+                        int offset)
+
+
Ensures that the specified line and offset is visible by scrolling + the text area if necessary. +

+

+
Parameters:
line - The line to scroll to
offset - The offset in the line to scroll to +
Returns:
True if scrolling was actually performed, false if the + line and offset was already visible
+
+
+
+ +

+lineToY

+
+public int lineToY(int line)
+
+
Converts a line index to a y co-ordinate. +

+

+
Parameters:
line - The line
+
+
+
+ +

+yToLine

+
+public int yToLine(int y)
+
+
Converts a y co-ordinate to a line index. +

+

+
Parameters:
y - The y co-ordinate
+
+
+
+ +

+offsetToX

+
+public final int offsetToX(int line,
+                           int offset)
+
+
Converts an offset in a line into an x co-ordinate. This is a + slow version that can be used any time. +

+

+
Parameters:
line - The line
offset - The offset, from the start of the line
+
+
+
+ +

+_offsetToX

+
+public int _offsetToX(int line,
+                      int offset)
+
+
Converts an offset in a line into an x co-ordinate. This is a + fast version that should only be used if no changes were made + to the text since the last repaint. +

+

+
Parameters:
line - The line
offset - The offset, from the start of the line
+
+
+
+ +

+xToOffset

+
+public int xToOffset(int line,
+                     int x)
+
+
Converts an x co-ordinate to an offset within a line. +

+

+
Parameters:
line - The line
x - The x co-ordinate
+
+
+
+ +

+xyToOffset

+
+public int xyToOffset(int x,
+                      int y)
+
+
Converts a point to an offset, from the start of the text. +

+

+
Parameters:
x - The x co-ordinate of the point
y - The y co-ordinate of the point
+
+
+
+ +

+getDocument

+
+public final SyntaxDocument getDocument()
+
+
Returns the document this text area is editing. +

+

+
+
+
+
+ +

+setDocument

+
+public void setDocument(SyntaxDocument document)
+
+
Sets the document this text area is editing. +

+

+
Parameters:
document - The document
+
+
+
+ +

+setDocument

+
+public void setDocument(SyntaxDocument document,
+                        int start,
+                        int stop,
+                        int scroll)
+
+
Set document with a twist, includes the old caret + and scroll positions, added for p5. [fry] +

+

+
+
+
+
+ +

+getTokenMarker

+
+public final TokenMarker getTokenMarker()
+
+
Returns the document's token marker. Equivalent to calling + getDocument().getTokenMarker(). +

+

+
+
+
+
+ +

+setTokenMarker

+
+public final void setTokenMarker(TokenMarker tokenMarker)
+
+
Sets the document's token marker. Equivalent to caling + getDocument().setTokenMarker(). +

+

+
Parameters:
tokenMarker - The token marker
+
+
+
+ +

+getDocumentLength

+
+public final int getDocumentLength()
+
+
Returns the length of the document. Equivalent to calling + getDocument().getLength(). +

+

+
+
+
+
+ +

+getLineCount

+
+public final int getLineCount()
+
+
Returns the number of lines in the document. +

+

+
+
+
+
+ +

+getLineOfOffset

+
+public final int getLineOfOffset(int offset)
+
+
Returns the line containing the specified offset. +

+

+
Parameters:
offset - The offset
+
+
+
+ +

+getLineStartOffset

+
+public int getLineStartOffset(int line)
+
+
Returns the start offset of the specified line. +

+

+
Parameters:
line - The line +
Returns:
The start offset of the specified line, or -1 if the line is + invalid
+
+
+
+ +

+getLineStopOffset

+
+public int getLineStopOffset(int line)
+
+
Returns the end offset of the specified line. +

+

+
Parameters:
line - The line +
Returns:
The end offset of the specified line, or -1 if the line is + invalid.
+
+
+
+ +

+getLineLength

+
+public int getLineLength(int line)
+
+
Returns the length of the specified line. +

+

+
Parameters:
line - The line
+
+
+
+ +

+getText

+
+public java.lang.String getText()
+
+
Returns the entire text of this text area. +

+

+
+
+
+
+ +

+setText

+
+public void setText(java.lang.String text)
+
+
Sets the entire text of this text area. +

+

+
+
+
+
+ +

+getText

+
+public final java.lang.String getText(int start,
+                                      int len)
+
+
Returns the specified substring of the document. +

+

+
Parameters:
start - The start offset
len - The length of the substring +
Returns:
The substring, or null if the offsets are invalid
+
+
+
+ +

+getText

+
+public final void getText(int start,
+                          int len,
+                          javax.swing.text.Segment segment)
+
+
Copies the specified substring of the document into a segment. + If the offsets are invalid, the segment will contain a null string. +

+

+
Parameters:
start - The start offset
len - The length of the substring
segment - The segment
+
+
+
+ +

+getLineText

+
+public final java.lang.String getLineText(int lineIndex)
+
+
Returns the text on the specified line. +

+

+
Parameters:
lineIndex - The line +
Returns:
The text, or null if the line is invalid
+
+
+
+ +

+getLineText

+
+public final void getLineText(int lineIndex,
+                              javax.swing.text.Segment segment)
+
+
Copies the text on the specified line into a segment. If the line + is invalid, the segment will contain a null string. +

+

+
Parameters:
lineIndex - The line
+
+
+
+ +

+getSelectionStart

+
+public final int getSelectionStart()
+
+
Returns the selection start offset. +

+

+
+
+
+
+ +

+getSelectionStart

+
+public int getSelectionStart(int line)
+
+
Returns the offset where the selection starts on the specified + line. +

+

+
+
+
+
+ +

+getSelectionStartLine

+
+public final int getSelectionStartLine()
+
+
Returns the selection start line. +

+

+
+
+
+
+ +

+setSelectionStart

+
+public final void setSelectionStart(int selectionStart)
+
+
Sets the selection start. The new selection will be the new + selection start and the old selection end. +

+

+
Parameters:
selectionStart - The selection start
See Also:
select(int,int)
+
+
+
+ +

+getSelectionStop

+
+public final int getSelectionStop()
+
+
Returns the selection end offset. +

+

+
+
+
+
+ +

+getSelectionStop

+
+public int getSelectionStop(int line)
+
+
Returns the offset where the selection ends on the specified + line. +

+

+
+
+
+
+ +

+getSelectionStopLine

+
+public final int getSelectionStopLine()
+
+
Returns the selection end line. +

+

+
+
+
+
+ +

+setSelectionEnd

+
+public final void setSelectionEnd(int selectionEnd)
+
+
Sets the selection end. The new selection will be the old + selection start and the bew selection end. +

+

+
Parameters:
selectionEnd - The selection end
See Also:
select(int,int)
+
+
+
+ +

+isSelectionActive

+
+public final boolean isSelectionActive()
+
+
+
+
+
+
+ +

+getCaretPosition

+
+public final int getCaretPosition()
+
+
Returns the caret position. This will either be the selection + start or the selection end, depending on which direction the + selection was made in. +

+

+
+
+
+
+ +

+getCaretLine

+
+public final int getCaretLine()
+
+
Returns the caret line. +

+

+
+
+
+
+ +

+getMarkPosition

+
+public final int getMarkPosition()
+
+
Returns the mark position. This will be the opposite selection + bound to the caret position. +

+

+
See Also:
getCaretPosition()
+
+
+
+ +

+getMarkLine

+
+public final int getMarkLine()
+
+
Returns the mark line. +

+

+
+
+
+
+ +

+setCaretPosition

+
+public final void setCaretPosition(int caret)
+
+
Sets the caret position. The new selection will consist of the + caret position only (hence no text will be selected) +

+

+
Parameters:
caret - The caret position
See Also:
select(int,int)
+
+
+
+ +

+selectAll

+
+public final void selectAll()
+
+
Selects all text in the document. +

+

+
+
+
+
+ +

+selectNone

+
+public final void selectNone()
+
+
Moves the mark to the caret position. +

+

+
+
+
+
+ +

+select

+
+public void select(int start,
+                   int end)
+
+
Selects from the start offset to the end offset. This is the + general selection method used by all other selecting methods. + The caret position will be start if start < end, and end + if end > start. +

+

+
Parameters:
start - The start offset
end - The end offset
+
+
+
+ +

+getSelectedText

+
+public final java.lang.String getSelectedText()
+
+
Returns the selected text, or null if no selection is active. +

+

+
+
+
+
+ +

+setSelectedText

+
+public void setSelectedText(java.lang.String selectedText)
+
+
Replaces the selection with the specified text. +

+

+
Parameters:
selectedText - The replacement text for the selection
+
+
+
+ +

+isEditable

+
+public final boolean isEditable()
+
+
Returns true if this text area is editable, false otherwise. +

+

+
+
+
+
+ +

+setEditable

+
+public final void setEditable(boolean editable)
+
+
Sets if this component is editable. +

+

+
Parameters:
editable - True if this text area should be editable, + false otherwise
+
+
+
+ +

+getRightClickPopup

+
+public final javax.swing.JPopupMenu getRightClickPopup()
+
+
Returns the right click popup menu. +

+

+
+
+
+
+ +

+setRightClickPopup

+
+public final void setRightClickPopup(javax.swing.JPopupMenu popup)
+
+
Sets the right click popup menu. +

+

+
Parameters:
popup - The popup
+
+
+
+ +

+getMagicCaretPosition

+
+public final int getMagicCaretPosition()
+
+
Returns the `magic' caret position. This can be used to preserve + the column position when moving up and down lines. +

+

+
+
+
+
+ +

+setMagicCaretPosition

+
+public final void setMagicCaretPosition(int magicCaret)
+
+
Sets the `magic' caret position. This can be used to preserve + the column position when moving up and down lines. +

+

+
Parameters:
magicCaret - The magic caret position
+
+
+
+ +

+overwriteSetSelectedText

+
+public void overwriteSetSelectedText(java.lang.String str)
+
+
Similar to setSelectedText(), but overstrikes the + appropriate number of characters if overwrite mode is enabled. +

+

+
Parameters:
str - The string
See Also:
setSelectedText(String), +isOverwriteEnabled()
+
+
+
+ +

+isOverwriteEnabled

+
+public final boolean isOverwriteEnabled()
+
+
Returns true if overwrite mode is enabled, false otherwise. +

+

+
+
+
+
+ +

+setOverwriteEnabled

+
+public final void setOverwriteEnabled(boolean overwrite)
+
+
Sets if overwrite mode should be enabled. +

+

+
Parameters:
overwrite - True if overwrite mode should be enabled, + false otherwise.
+
+
+
+ +

+isSelectionRectangular

+
+public final boolean isSelectionRectangular()
+
+
Returns true if the selection is rectangular, false otherwise. +

+

+
+
+
+
+ +

+setSelectionRectangular

+
+public final void setSelectionRectangular(boolean rectSelect)
+
+
Sets if the selection should be rectangular. +

+

+
Parameters:
rectSelect - True if the selection should be rectangular, + false otherwise.
+
+
+
+ +

+getBracketPosition

+
+public final int getBracketPosition()
+
+
Returns the position of the highlighted bracket (the bracket + matching the one before the caret) +

+

+
+
+
+
+ +

+getBracketLine

+
+public final int getBracketLine()
+
+
Returns the line of the highlighted bracket (the bracket + matching the one before the caret) +

+

+
+
+
+
+ +

+addCaretListener

+
+public final void addCaretListener(javax.swing.event.CaretListener listener)
+
+
Adds a caret change listener to this text area. +

+

+
Parameters:
listener - The listener
+
+
+
+ +

+removeCaretListener

+
+public final void removeCaretListener(javax.swing.event.CaretListener listener)
+
+
Removes a caret change listener from this text area. +

+

+
Parameters:
listener - The listener
+
+
+
+ +

+cut

+
+public void cut()
+
+
Deletes the selected text from the text area and places it + into the clipboard. +

+

+
+
+
+
+ +

+copy

+
+public void copy()
+
+
Places the selected text into the clipboard. +

+

+
+
+
+
+ +

+paste

+
+public void paste()
+
+
Inserts the clipboard contents into the text. +

+

+
+
+
+
+ +

+removeNotify

+
+public void removeNotify()
+
+
Called by the AWT when this component is removed from it's parent. + This stops clears the currently focused component. +

+

+
Overrides:
removeNotify in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+processKeyEvent

+
+public void processKeyEvent(java.awt.event.KeyEvent evt)
+
+
+
Overrides:
processKeyEvent in class javax.swing.JComponent
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/KeywordMap.html b/build/javadoc/everything/processing/app/syntax/KeywordMap.html new file mode 100644 index 000000000..79b118176 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/KeywordMap.html @@ -0,0 +1,353 @@ + + + + + +KeywordMap + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class KeywordMap

+
+java.lang.Object
+  extended by processing.app.syntax.KeywordMap
+
+
+
+
public class KeywordMap
extends java.lang.Object
+ + +

+A KeywordMap is similar to a hashtable in that it maps keys + to values. However, the `keys' are Swing segments. This allows lookups of + text substrings without the overhead of creating a new string object. +

+ This class is used by CTokenMarker to map keywords to ids. +

+ +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
KeywordMap(boolean ignoreCase) + +
+          Creates a new KeywordMap.
KeywordMap(boolean ignoreCase, + int mapLength) + +
+          Creates a new KeywordMap.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(java.lang.String keyword, + byte id) + +
+          Adds a key-value mapping.
+ booleangetIgnoreCase() + +
+          Returns true if the keyword map is set to be case insensitive, + false otherwise.
+ bytelookup(javax.swing.text.Segment text, + int offset, + int length) + +
+          Looks up a key.
+ voidsetIgnoreCase(boolean ignoreCase) + +
+          Sets if the keyword map should be case insensitive.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+KeywordMap

+
+public KeywordMap(boolean ignoreCase)
+
+
Creates a new KeywordMap. +

+

+
Parameters:
ignoreCase - True if keys are case insensitive
+
+
+ +

+KeywordMap

+
+public KeywordMap(boolean ignoreCase,
+                  int mapLength)
+
+
Creates a new KeywordMap. +

+

+
Parameters:
ignoreCase - True if the keys are case insensitive
mapLength - The number of `buckets' to create. + A value of 52 will give good performance for most maps.
+
+ + + + + + + + +
+Method Detail
+ +

+lookup

+
+public byte lookup(javax.swing.text.Segment text,
+                   int offset,
+                   int length)
+
+
Looks up a key. +

+

+
Parameters:
text - The text segment
offset - The offset of the substring within the text segment
length - The length of the substring
+
+
+
+ +

+add

+
+public void add(java.lang.String keyword,
+                byte id)
+
+
Adds a key-value mapping. +

+

+
Parameters:
keyword - The key
id - The value
+
+
+
+ +

+getIgnoreCase

+
+public boolean getIgnoreCase()
+
+
Returns true if the keyword map is set to be case insensitive, + false otherwise. +

+

+
+
+
+
+ +

+setIgnoreCase

+
+public void setIgnoreCase(boolean ignoreCase)
+
+
Sets if the keyword map should be case insensitive. +

+

+
Parameters:
ignoreCase - True if the keyword map should be case + insensitive, false otherwise
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/PdeKeywords.html b/build/javadoc/everything/processing/app/syntax/PdeKeywords.html new file mode 100644 index 000000000..beba16a64 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/PdeKeywords.html @@ -0,0 +1,312 @@ + + + + + +PdeKeywords + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class PdeKeywords

+
+java.lang.Object
+  extended by processing.app.syntax.TokenMarker
+      extended by processing.app.syntax.CTokenMarker
+          extended by processing.app.syntax.PdeKeywords
+
+
+
+
public class PdeKeywords
extends CTokenMarker
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class processing.app.syntax.TokenMarker
TokenMarker.LineInfo
+  + + + + + + + + + + + +
+Constructor Summary
PdeKeywords() + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static KeywordMapgetKeywords() + +
+          Handles loading of keywords file.
+static java.lang.StringgetReference(java.lang.String keyword) + +
+           
+ + + + + + + +
Methods inherited from class processing.app.syntax.CTokenMarker
markTokensImpl
+ + + + + + + +
Methods inherited from class processing.app.syntax.TokenMarker
deleteLines, getLineCount, insertLines, isNextLineRequested, markTokens, supportsMultilineTokens
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PdeKeywords

+
+public PdeKeywords()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getKeywords

+
+public static KeywordMap getKeywords()
+
+
Handles loading of keywords file. +

+ Uses getKeywords() method because that's part of the + TokenMarker classes. +

+ It is recommended that a # sign be used for comments + inside keywords.txt. +

+

+
+
+
+
+ +

+getReference

+
+public static java.lang.String getReference(java.lang.String keyword)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/PdeTextAreaDefaults.html b/build/javadoc/everything/processing/app/syntax/PdeTextAreaDefaults.html new file mode 100644 index 000000000..c5976dae2 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/PdeTextAreaDefaults.html @@ -0,0 +1,246 @@ + + + + + +PdeTextAreaDefaults + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class PdeTextAreaDefaults

+
+java.lang.Object
+  extended by processing.app.syntax.TextAreaDefaults
+      extended by processing.app.syntax.PdeTextAreaDefaults
+
+
+
+
public class PdeTextAreaDefaults
extends TextAreaDefaults
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.app.syntax.TextAreaDefaults
bgcolor, blockCaret, bracketHighlight, bracketHighlightColor, caretBlinks, caretColor, caretVisible, cols, document, editable, electricScroll, eolMarkerColor, eolMarkers, fgcolor, font, inputHandler, lineHighlight, lineHighlightColor, paintInvalid, rows, selectionColor, styles
+  + + + + + + + + + + +
+Constructor Summary
PdeTextAreaDefaults() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class processing.app.syntax.TextAreaDefaults
getDefaults
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PdeTextAreaDefaults

+
+public PdeTextAreaDefaults()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/SyntaxDocument.html b/build/javadoc/everything/processing/app/syntax/SyntaxDocument.html new file mode 100644 index 000000000..5f1b97add --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/SyntaxDocument.html @@ -0,0 +1,482 @@ + + + + + +SyntaxDocument + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class SyntaxDocument

+
+java.lang.Object
+  extended by javax.swing.text.AbstractDocument
+      extended by javax.swing.text.PlainDocument
+          extended by processing.app.syntax.SyntaxDocument
+
+
+
All Implemented Interfaces:
java.io.Serializable, javax.swing.text.Document
+
+
+
+
public class SyntaxDocument
extends javax.swing.text.PlainDocument
+ + +

+A document implementation that can be tokenized by the syntax highlighting + system. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
+ + + + + + + +
Fields inherited from class javax.swing.text.AbstractDocument
BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName
+ + + + + + + +
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
+  + + + + + + + + + + +
+Constructor Summary
SyntaxDocument() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddUndoableEdit(javax.swing.undo.UndoableEdit edit) + +
+          Adds an undoable edit to this document's undo list.
+ voidbeginCompoundEdit() + +
+          Starts a compound edit that can be undone in one operation.
+ voidendCompoundEdit() + +
+          Ends a compound edit that can be undone in one operation.
+ TokenMarkergetTokenMarker() + +
+          Returns the token marker that is to be used to split lines + of this document up into tokens.
+ voidsetTokenMarker(TokenMarker tm) + +
+          Sets the token marker that is to be used to split lines of + this document up into tokens.
+ voidtokenizeLines() + +
+          Reparses the document, by passing all lines to the token + marker.
+ voidtokenizeLines(int start, + int len) + +
+          Reparses the document, by passing the specified lines to the + token marker.
+ + + + + + + +
Methods inherited from class javax.swing.text.PlainDocument
getDefaultRootElement, getParagraphElement, insertString
+ + + + + + + +
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SyntaxDocument

+
+public SyntaxDocument()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getTokenMarker

+
+public TokenMarker getTokenMarker()
+
+
Returns the token marker that is to be used to split lines + of this document up into tokens. May return null if this + document is not to be colorized. +

+

+
+
+
+
+ +

+setTokenMarker

+
+public void setTokenMarker(TokenMarker tm)
+
+
Sets the token marker that is to be used to split lines of + this document up into tokens. May throw an exception if + this is not supported for this type of document. +

+

+
Parameters:
tm - The new token marker
+
+
+
+ +

+tokenizeLines

+
+public void tokenizeLines()
+
+
Reparses the document, by passing all lines to the token + marker. This should be called after the document is first + loaded. +

+

+
+
+
+
+ +

+tokenizeLines

+
+public void tokenizeLines(int start,
+                          int len)
+
+
Reparses the document, by passing the specified lines to the + token marker. This should be called after a large quantity of + text is first inserted. +

+

+
Parameters:
start - The first line to parse
len - The number of lines, after the first one to parse
+
+
+
+ +

+beginCompoundEdit

+
+public void beginCompoundEdit()
+
+
Starts a compound edit that can be undone in one operation. + Subclasses that implement undo should override this method; + this class has no undo functionality so this method is + empty. +

+

+
+
+
+
+ +

+endCompoundEdit

+
+public void endCompoundEdit()
+
+
Ends a compound edit that can be undone in one operation. + Subclasses that implement undo should override this method; + this class has no undo functionality so this method is + empty. +

+

+
+
+
+
+ +

+addUndoableEdit

+
+public void addUndoableEdit(javax.swing.undo.UndoableEdit edit)
+
+
Adds an undoable edit to this document's undo list. The edit + should be ignored if something is currently being undone. +

+

+
Parameters:
edit - The undoable edit
Since:
+
jEdit 2.2pre1
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/SyntaxStyle.html b/build/javadoc/everything/processing/app/syntax/SyntaxStyle.html new file mode 100644 index 000000000..ecde3a003 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/SyntaxStyle.html @@ -0,0 +1,419 @@ + + + + + +SyntaxStyle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class SyntaxStyle

+
+java.lang.Object
+  extended by processing.app.syntax.SyntaxStyle
+
+
+
+
public class SyntaxStyle
extends java.lang.Object
+ + +

+A simple text style class. It can specify the color, italic flag, + and bold flag of a run of text. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
SyntaxStyle(java.awt.Color color, + boolean italic, + boolean bold) + +
+          Creates a new SyntaxStyle.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.awt.ColorgetColor() + +
+          Returns the color specified in this style.
+ java.awt.FontMetricsgetFontMetrics(java.awt.Font font, + javax.swing.JComponent comp) + +
+          Returns the font metrics for the styled font.
+ java.awt.FontgetStyledFont(java.awt.Font font) + +
+          Returns the specified font, but with the style's bold and + italic flags applied.
+ booleanisBold() + +
+          Returns true if boldface is enabled for this style.
+ booleanisItalic() + +
+          Returns true if italics is enabled for this style.
+ booleanisPlain() + +
+          Returns true if no font styles are enabled.
+ voidsetGraphicsFlags(java.awt.Graphics gfx, + java.awt.Font font) + +
+          Sets the foreground color and font of the specified graphics + context to that specified in this style.
+ java.lang.StringtoString() + +
+          Returns a string representation of this object.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SyntaxStyle

+
+public SyntaxStyle(java.awt.Color color,
+                   boolean italic,
+                   boolean bold)
+
+
Creates a new SyntaxStyle. +

+

+
Parameters:
color - The text color
italic - True if the text should be italics
bold - True if the text should be bold
+
+ + + + + + + + +
+Method Detail
+ +

+getColor

+
+public java.awt.Color getColor()
+
+
Returns the color specified in this style. +

+

+
+
+
+
+ +

+isPlain

+
+public boolean isPlain()
+
+
Returns true if no font styles are enabled. +

+

+
+
+
+
+ +

+isItalic

+
+public boolean isItalic()
+
+
Returns true if italics is enabled for this style. +

+

+
+
+
+
+ +

+isBold

+
+public boolean isBold()
+
+
Returns true if boldface is enabled for this style. +

+

+
+
+
+
+ +

+getStyledFont

+
+public java.awt.Font getStyledFont(java.awt.Font font)
+
+
Returns the specified font, but with the style's bold and + italic flags applied. +

+

+
+
+
+
+ +

+getFontMetrics

+
+public java.awt.FontMetrics getFontMetrics(java.awt.Font font,
+                                           javax.swing.JComponent comp)
+
+
Returns the font metrics for the styled font. +

+

+
+
+
+
+ +

+setGraphicsFlags

+
+public void setGraphicsFlags(java.awt.Graphics gfx,
+                             java.awt.Font font)
+
+
Sets the foreground color and font of the specified graphics + context to that specified in this style. +

+

+
Parameters:
gfx - The graphics context
font - The font to add the styles to
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
Returns a string representation of this object. +

+

+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/SyntaxUtilities.html b/build/javadoc/everything/processing/app/syntax/SyntaxUtilities.html new file mode 100644 index 000000000..c145bc0ec --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/SyntaxUtilities.html @@ -0,0 +1,316 @@ + + + + + +SyntaxUtilities + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class SyntaxUtilities

+
+java.lang.Object
+  extended by processing.app.syntax.SyntaxUtilities
+
+
+
+
public class SyntaxUtilities
extends java.lang.Object
+ + +

+Class with several utility functions used by jEdit's syntax colorizing + subsystem. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static SyntaxStyle[]getDefaultSyntaxStyles() + +
+          Returns the default style table.
+static intpaintSyntaxLine(javax.swing.text.Segment line, + Token tokens, + SyntaxStyle[] styles, + javax.swing.text.TabExpander expander, + java.awt.Graphics gfx, + int x, + int y) + +
+          Paints the specified line onto the graphics context.
+static booleanregionMatches(boolean ignoreCase, + javax.swing.text.Segment text, + int offset, + char[] match) + +
+          Checks if a subregion of a Segment is equal to a + character array.
+static booleanregionMatches(boolean ignoreCase, + javax.swing.text.Segment text, + int offset, + java.lang.String match) + +
+          Checks if a subregion of a Segment is equal to a + string.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+regionMatches

+
+public static boolean regionMatches(boolean ignoreCase,
+                                    javax.swing.text.Segment text,
+                                    int offset,
+                                    java.lang.String match)
+
+
Checks if a subregion of a Segment is equal to a + string. +

+

+
Parameters:
ignoreCase - True if case should be ignored, false otherwise
text - The segment
offset - The offset into the segment
match - The string to match
+
+
+
+ +

+regionMatches

+
+public static boolean regionMatches(boolean ignoreCase,
+                                    javax.swing.text.Segment text,
+                                    int offset,
+                                    char[] match)
+
+
Checks if a subregion of a Segment is equal to a + character array. +

+

+
Parameters:
ignoreCase - True if case should be ignored, false otherwise
text - The segment
offset - The offset into the segment
match - The character array to match
+
+
+
+ +

+getDefaultSyntaxStyles

+
+public static SyntaxStyle[] getDefaultSyntaxStyles()
+
+
Returns the default style table. This can be passed to the + setStyles() method of SyntaxDocument + to use the default syntax styles. +

+

+
+
+
+
+ +

+paintSyntaxLine

+
+public static int paintSyntaxLine(javax.swing.text.Segment line,
+                                  Token tokens,
+                                  SyntaxStyle[] styles,
+                                  javax.swing.text.TabExpander expander,
+                                  java.awt.Graphics gfx,
+                                  int x,
+                                  int y)
+
+
Paints the specified line onto the graphics context. Note that this + method munges the offset and count values of the segment. +

+

+
Parameters:
line - The line segment
tokens - The token list for the line
styles - The syntax style list
expander - The tab expander used to determine tab stops. May + be null
gfx - The graphics context
x - The x co-ordinate
y - The y co-ordinate +
Returns:
The x co-ordinate, plus the width of the painted string
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/TextAreaDefaults.html b/build/javadoc/everything/processing/app/syntax/TextAreaDefaults.html new file mode 100644 index 000000000..f9e5be782 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/TextAreaDefaults.html @@ -0,0 +1,674 @@ + + + + + +TextAreaDefaults + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class TextAreaDefaults

+
+java.lang.Object
+  extended by processing.app.syntax.TextAreaDefaults
+
+
+
Direct Known Subclasses:
PdeTextAreaDefaults
+
+
+
+
public class TextAreaDefaults
extends java.lang.Object
+ + +

+Encapsulates default settings for a text area. This can be passed + to the constructor once the necessary fields have been filled out. + The advantage of doing this over calling lots of set() methods after + creating the text area is that this method is faster. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ java.awt.Colorbgcolor + +
+           
+ booleanblockCaret + +
+           
+ booleanbracketHighlight + +
+           
+ java.awt.ColorbracketHighlightColor + +
+           
+ booleancaretBlinks + +
+           
+ java.awt.ColorcaretColor + +
+           
+ booleancaretVisible + +
+           
+ intcols + +
+           
+ SyntaxDocumentdocument + +
+           
+ booleaneditable + +
+           
+ intelectricScroll + +
+           
+ java.awt.ColoreolMarkerColor + +
+           
+ booleaneolMarkers + +
+           
+ java.awt.Colorfgcolor + +
+           
+ java.awt.Fontfont + +
+           
+ InputHandlerinputHandler + +
+           
+ booleanlineHighlight + +
+           
+ java.awt.ColorlineHighlightColor + +
+           
+ booleanpaintInvalid + +
+           
+ introws + +
+           
+ java.awt.ColorselectionColor + +
+           
+ SyntaxStyle[]styles + +
+           
+  + + + + + + + + + + +
+Constructor Summary
TextAreaDefaults() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static TextAreaDefaultsgetDefaults() + +
+          Returns a new TextAreaDefaults object with the default values filled + in.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+inputHandler

+
+public InputHandler inputHandler
+
+
+
+
+
+ +

+document

+
+public SyntaxDocument document
+
+
+
+
+
+ +

+editable

+
+public boolean editable
+
+
+
+
+
+ +

+caretVisible

+
+public boolean caretVisible
+
+
+
+
+
+ +

+caretBlinks

+
+public boolean caretBlinks
+
+
+
+
+
+ +

+blockCaret

+
+public boolean blockCaret
+
+
+
+
+
+ +

+electricScroll

+
+public int electricScroll
+
+
+
+
+
+ +

+cols

+
+public int cols
+
+
+
+
+
+ +

+rows

+
+public int rows
+
+
+
+
+
+ +

+styles

+
+public SyntaxStyle[] styles
+
+
+
+
+
+ +

+caretColor

+
+public java.awt.Color caretColor
+
+
+
+
+
+ +

+selectionColor

+
+public java.awt.Color selectionColor
+
+
+
+
+
+ +

+lineHighlightColor

+
+public java.awt.Color lineHighlightColor
+
+
+
+
+
+ +

+lineHighlight

+
+public boolean lineHighlight
+
+
+
+
+
+ +

+bracketHighlightColor

+
+public java.awt.Color bracketHighlightColor
+
+
+
+
+
+ +

+bracketHighlight

+
+public boolean bracketHighlight
+
+
+
+
+
+ +

+eolMarkerColor

+
+public java.awt.Color eolMarkerColor
+
+
+
+
+
+ +

+eolMarkers

+
+public boolean eolMarkers
+
+
+
+
+
+ +

+paintInvalid

+
+public boolean paintInvalid
+
+
+
+
+
+ +

+font

+
+public java.awt.Font font
+
+
+
+
+
+ +

+fgcolor

+
+public java.awt.Color fgcolor
+
+
+
+
+
+ +

+bgcolor

+
+public java.awt.Color bgcolor
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+TextAreaDefaults

+
+public TextAreaDefaults()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getDefaults

+
+public static TextAreaDefaults getDefaults()
+
+
Returns a new TextAreaDefaults object with the default values filled + in. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/TextAreaPainter.Highlight.html b/build/javadoc/everything/processing/app/syntax/TextAreaPainter.Highlight.html new file mode 100644 index 000000000..1cdcad4f5 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/TextAreaPainter.Highlight.html @@ -0,0 +1,263 @@ + + + + + +TextAreaPainter.Highlight + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Interface TextAreaPainter.Highlight

+
+
Enclosing class:
TextAreaPainter
+
+
+
+
public static interface TextAreaPainter.Highlight
+ + +

+Highlight interface. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetToolTipText(java.awt.event.MouseEvent evt) + +
+          Returns the tool tip to display at the specified + location.
+ voidinit(JEditTextArea textArea, + TextAreaPainter.Highlight next) + +
+          Called after the highlight painter has been added.
+ voidpaintHighlight(java.awt.Graphics gfx, + int line, + int y) + +
+          This should paint the highlight and delgate to the + next highlight painter.
+  +

+ + + + + + + + +
+Method Detail
+ +

+init

+
+void init(JEditTextArea textArea,
+          TextAreaPainter.Highlight next)
+
+
Called after the highlight painter has been added. +

+

+
Parameters:
textArea - The text area
next - The painter this one should delegate to
+
+
+
+ +

+paintHighlight

+
+void paintHighlight(java.awt.Graphics gfx,
+                    int line,
+                    int y)
+
+
This should paint the highlight and delgate to the + next highlight painter. +

+

+
Parameters:
gfx - The graphics context
line - The line number
y - The y co-ordinate of the line
+
+
+
+ +

+getToolTipText

+
+java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
+
+
Returns the tool tip to display at the specified + location. If this highlighter doesn't know what to + display, it should delegate to the next highlight + painter. +

+

+
Parameters:
evt - The mouse event
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/TextAreaPainter.html b/build/javadoc/everything/processing/app/syntax/TextAreaPainter.html new file mode 100644 index 000000000..5081a04a0 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/TextAreaPainter.html @@ -0,0 +1,1326 @@ + + + + + +TextAreaPainter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class TextAreaPainter

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by javax.swing.JComponent
+              extended by processing.app.syntax.TextAreaPainter
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, javax.swing.text.TabExpander
+
+
+
+
public class TextAreaPainter
extends javax.swing.JComponent
implements javax.swing.text.TabExpander, java.awt.print.Printable
+ + +

+The text area repaint manager. It performs double buffering and paints + lines of text. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Nested Class Summary
+static interfaceTextAreaPainter.Highlight + +
+          Highlight interface.
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
TextAreaPainter(JEditTextArea textArea, + TextAreaDefaults defaults) + +
+          Creates a new repaint manager.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddCustomHighlight(TextAreaPainter.Highlight highlight) + +
+          Adds a custom highlight painter.
+ java.awt.ColorgetBracketHighlightColor() + +
+          Returns the bracket highlight color.
+ java.awt.ColorgetCaretColor() + +
+          Returns the caret color.
+ javax.swing.text.SegmentgetCurrentLine() + +
+          Accessor used by tools that want to hook in and grab the formatting.
+ intgetCurrentLineIndex() + +
+          Accessor used by tools that want to hook in and grab the formatting.
+ TokengetCurrentLineTokens() + +
+          Accessor used by tools that want to hook in and grab the formatting.
+ java.awt.ColorgetEOLMarkerColor() + +
+          Returns the EOL marker color.
+ booleangetEOLMarkersPainted() + +
+          Returns true if EOL markers are drawn, false otherwise.
+ java.awt.FontMetricsgetFontMetrics() + +
+          Returns the font metrics used by this component.
+ booleangetInvalidLinesPainted() + +
+          Returns true if invalid lines are painted as red tildes (~), + false otherwise.
+ java.awt.ColorgetLineHighlightColor() + +
+          Returns the line highlight color.
+ java.awt.DimensiongetMinimumSize() + +
+          Returns the painter's minimum size.
+ java.awt.DimensiongetPreferredSize() + +
+          Returns the painter's preferred size.
+ java.awt.ColorgetSelectionColor() + +
+          Returns the selection color.
+ SyntaxStyle[]getStyles() + +
+          Returns the syntax styles used to paint colorized text.
+ java.lang.StringgetToolTipText(java.awt.event.MouseEvent evt) + +
+          Returns the tool tip to display at the specified location.
+ voidinvalidateLine(int line) + +
+          Marks a line as needing a repaint.
+ voidinvalidateLineRange(int firstLine, + int lastLine) + +
+          Marks a range of lines as needing a repaint.
+ voidinvalidateSelectedLines() + +
+          Repaints the lines containing the selection.
+ booleanisBlockCaretEnabled() + +
+          Returns true if the caret should be drawn as a block, false otherwise.
+ booleanisBracketHighlightEnabled() + +
+          Returns true if bracket highlighting is enabled, false otherwise.
+ booleanisLineHighlightEnabled() + +
+          Returns true if line highlight is enabled, false otherwise.
+ booleanisManagingFocus() + +
+          Returns if this component can be traversed by pressing the + Tab key.
+ floatnextTabStop(float x, + int tabOffset) + +
+          Implementation of TabExpander interface.
+ voidpaint(java.awt.Graphics gfx) + +
+          Repaints the text.
+ intprint(java.awt.Graphics g, + java.awt.print.PageFormat pageFormat, + int pageIndex) + +
+           
+ voidsetBlockCaretEnabled(boolean blockCaret) + +
+          Sets if the caret should be drawn as a block, false otherwise.
+ voidsetBracketHighlightColor(java.awt.Color bracketHighlightColor) + +
+          Sets the bracket highlight color.
+ voidsetBracketHighlightEnabled(boolean bracketHighlight) + +
+          Enables or disables bracket highlighting.
+ voidsetCaretColor(java.awt.Color caretColor) + +
+          Sets the caret color.
+ voidsetCurrentLineIndex(int what) + +
+          Accessor used by tools that want to hook in and grab the formatting.
+ voidsetCurrentLineTokens(Token tokens) + +
+          Accessor used by tools that want to hook in and grab the formatting.
+ voidsetEOLMarkerColor(java.awt.Color eolMarkerColor) + +
+          Sets the EOL marker color.
+ voidsetEOLMarkersPainted(boolean eolMarkers) + +
+          Sets if EOL markers are to be drawn.
+ voidsetFont(java.awt.Font font) + +
+          Sets the font for this component.
+ voidsetInvalidLinesPainted(boolean paintInvalid) + +
+          Sets if invalid lines are to be painted as red tildes.
+ voidsetLineHighlightColor(java.awt.Color lineHighlightColor) + +
+          Sets the line highlight color.
+ voidsetLineHighlightEnabled(boolean lineHighlight) + +
+          Enables or disables current line highlighting.
+ voidsetSelectionColor(java.awt.Color selectionColor) + +
+          Sets the selection color.
+ voidsetStyles(SyntaxStyle[] styles) + +
+          Sets the syntax styles used to paint colorized text.
+ + + + + + + +
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+TextAreaPainter

+
+public TextAreaPainter(JEditTextArea textArea,
+                       TextAreaDefaults defaults)
+
+
Creates a new repaint manager. This should be not be called + directly. +

+

+ + + + + + + + +
+Method Detail
+ +

+isManagingFocus

+
+public final boolean isManagingFocus()
+
+
Returns if this component can be traversed by pressing the + Tab key. This returns false. +

+

+
Overrides:
isManagingFocus in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getStyles

+
+public final SyntaxStyle[] getStyles()
+
+
Returns the syntax styles used to paint colorized text. Entry n + will be used to paint tokens with id = n. +

+

+
+
+
+
See Also:
Token
+
+
+
+ +

+setStyles

+
+public final void setStyles(SyntaxStyle[] styles)
+
+
Sets the syntax styles used to paint colorized text. Entry n + will be used to paint tokens with id = n. +

+

+
+
+
+
Parameters:
styles - The syntax styles
See Also:
Token
+
+
+
+ +

+getCaretColor

+
+public final java.awt.Color getCaretColor()
+
+
Returns the caret color. +

+

+
+
+
+
+
+
+
+ +

+setCaretColor

+
+public final void setCaretColor(java.awt.Color caretColor)
+
+
Sets the caret color. +

+

+
+
+
+
Parameters:
caretColor - The caret color
+
+
+
+ +

+getSelectionColor

+
+public final java.awt.Color getSelectionColor()
+
+
Returns the selection color. +

+

+
+
+
+
+
+
+
+ +

+setSelectionColor

+
+public final void setSelectionColor(java.awt.Color selectionColor)
+
+
Sets the selection color. +

+

+
+
+
+
Parameters:
selectionColor - The selection color
+
+
+
+ +

+getLineHighlightColor

+
+public final java.awt.Color getLineHighlightColor()
+
+
Returns the line highlight color. +

+

+
+
+
+
+
+
+
+ +

+setLineHighlightColor

+
+public final void setLineHighlightColor(java.awt.Color lineHighlightColor)
+
+
Sets the line highlight color. +

+

+
+
+
+
Parameters:
lineHighlightColor - The line highlight color
+
+
+
+ +

+isLineHighlightEnabled

+
+public final boolean isLineHighlightEnabled()
+
+
Returns true if line highlight is enabled, false otherwise. +

+

+
+
+
+
+
+
+
+ +

+setLineHighlightEnabled

+
+public final void setLineHighlightEnabled(boolean lineHighlight)
+
+
Enables or disables current line highlighting. +

+

+
+
+
+
Parameters:
lineHighlight - True if current line highlight + should be enabled, false otherwise
+
+
+
+ +

+getBracketHighlightColor

+
+public final java.awt.Color getBracketHighlightColor()
+
+
Returns the bracket highlight color. +

+

+
+
+
+
+
+
+
+ +

+setBracketHighlightColor

+
+public final void setBracketHighlightColor(java.awt.Color bracketHighlightColor)
+
+
Sets the bracket highlight color. +

+

+
+
+
+
Parameters:
bracketHighlightColor - The bracket highlight color
+
+
+
+ +

+isBracketHighlightEnabled

+
+public final boolean isBracketHighlightEnabled()
+
+
Returns true if bracket highlighting is enabled, false otherwise. + When bracket highlighting is enabled, the bracket matching the + one before the caret (if any) is highlighted. +

+

+
+
+
+
+
+
+
+ +

+setBracketHighlightEnabled

+
+public final void setBracketHighlightEnabled(boolean bracketHighlight)
+
+
Enables or disables bracket highlighting. + When bracket highlighting is enabled, the bracket matching the + one before the caret (if any) is highlighted. +

+

+
+
+
+
Parameters:
bracketHighlight - True if bracket highlighting should be + enabled, false otherwise
+
+
+
+ +

+isBlockCaretEnabled

+
+public final boolean isBlockCaretEnabled()
+
+
Returns true if the caret should be drawn as a block, false otherwise. +

+

+
+
+
+
+
+
+
+ +

+setBlockCaretEnabled

+
+public final void setBlockCaretEnabled(boolean blockCaret)
+
+
Sets if the caret should be drawn as a block, false otherwise. +

+

+
+
+
+
Parameters:
blockCaret - True if the caret should be drawn as a block, + false otherwise.
+
+
+
+ +

+getEOLMarkerColor

+
+public final java.awt.Color getEOLMarkerColor()
+
+
Returns the EOL marker color. +

+

+
+
+
+
+
+
+
+ +

+setEOLMarkerColor

+
+public final void setEOLMarkerColor(java.awt.Color eolMarkerColor)
+
+
Sets the EOL marker color. +

+

+
+
+
+
Parameters:
eolMarkerColor - The EOL marker color
+
+
+
+ +

+getEOLMarkersPainted

+
+public final boolean getEOLMarkersPainted()
+
+
Returns true if EOL markers are drawn, false otherwise. +

+

+
+
+
+
+
+
+
+ +

+setEOLMarkersPainted

+
+public final void setEOLMarkersPainted(boolean eolMarkers)
+
+
Sets if EOL markers are to be drawn. +

+

+
+
+
+
Parameters:
eolMarkers - True if EOL markers should be drawn, false otherwise
+
+
+
+ +

+getInvalidLinesPainted

+
+public boolean getInvalidLinesPainted()
+
+
Returns true if invalid lines are painted as red tildes (~), + false otherwise. +

+

+
+
+
+
+
+
+
+ +

+setInvalidLinesPainted

+
+public void setInvalidLinesPainted(boolean paintInvalid)
+
+
Sets if invalid lines are to be painted as red tildes. +

+

+
+
+
+
Parameters:
paintInvalid - True if invalid lines should be drawn, false otherwise
+
+
+
+ +

+addCustomHighlight

+
+public void addCustomHighlight(TextAreaPainter.Highlight highlight)
+
+
Adds a custom highlight painter. +

+

+
+
+
+
Parameters:
highlight - The highlight
+
+
+
+ +

+getToolTipText

+
+public java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
+
+
Returns the tool tip to display at the specified location. +

+

+
Overrides:
getToolTipText in class javax.swing.JComponent
+
+
+
Parameters:
evt - The mouse event
+
+
+
+ +

+getFontMetrics

+
+public java.awt.FontMetrics getFontMetrics()
+
+
Returns the font metrics used by this component. +

+

+
+
+
+
+
+
+
+ +

+setFont

+
+public void setFont(java.awt.Font font)
+
+
Sets the font for this component. This is overridden to update the + cached font metrics and to recalculate which lines are visible. +

+

+
Overrides:
setFont in class javax.swing.JComponent
+
+
+
Parameters:
font - The font
+
+
+
+ +

+paint

+
+public void paint(java.awt.Graphics gfx)
+
+
Repaints the text. +

+

+
Overrides:
paint in class javax.swing.JComponent
+
+
+
Parameters:
gfx - The graphics context
+
+
+
+ +

+print

+
+public int print(java.awt.Graphics g,
+                 java.awt.print.PageFormat pageFormat,
+                 int pageIndex)
+
+
+
Specified by:
print in interface java.awt.print.Printable
+
+
+
+
+
+
+ +

+invalidateLine

+
+public final void invalidateLine(int line)
+
+
Marks a line as needing a repaint. +

+

+
+
+
+
Parameters:
line - The line to invalidate
+
+
+
+ +

+invalidateLineRange

+
+public final void invalidateLineRange(int firstLine,
+                                      int lastLine)
+
+
Marks a range of lines as needing a repaint. +

+

+
+
+
+
Parameters:
firstLine - The first line to invalidate
lastLine - The last line to invalidate
+
+
+
+ +

+invalidateSelectedLines

+
+public final void invalidateSelectedLines()
+
+
Repaints the lines containing the selection. +

+

+
+
+
+
+
+
+
+ +

+nextTabStop

+
+public float nextTabStop(float x,
+                         int tabOffset)
+
+
Implementation of TabExpander interface. Returns next tab stop after + a specified point. +

+

+
Specified by:
nextTabStop in interface javax.swing.text.TabExpander
+
+
+
Parameters:
x - The x co-ordinate
tabOffset - Ignored +
Returns:
The next tab stop after x
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
Returns the painter's preferred size. +

+

+
Overrides:
getPreferredSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
Returns the painter's minimum size. +

+

+
Overrides:
getMinimumSize in class javax.swing.JComponent
+
+
+
+
+
+
+ +

+getCurrentLineIndex

+
+public int getCurrentLineIndex()
+
+
Accessor used by tools that want to hook in and grab the formatting. +

+

+
+
+
+
+
+
+
+ +

+setCurrentLineIndex

+
+public void setCurrentLineIndex(int what)
+
+
Accessor used by tools that want to hook in and grab the formatting. +

+

+
+
+
+
+
+
+
+ +

+getCurrentLineTokens

+
+public Token getCurrentLineTokens()
+
+
Accessor used by tools that want to hook in and grab the formatting. +

+

+
+
+
+
+
+
+
+ +

+setCurrentLineTokens

+
+public void setCurrentLineTokens(Token tokens)
+
+
Accessor used by tools that want to hook in and grab the formatting. +

+

+
+
+
+
+
+
+
+ +

+getCurrentLine

+
+public javax.swing.text.Segment getCurrentLine()
+
+
Accessor used by tools that want to hook in and grab the formatting. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/TextUtilities.html b/build/javadoc/everything/processing/app/syntax/TextUtilities.html new file mode 100644 index 000000000..bb439575f --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/TextUtilities.html @@ -0,0 +1,312 @@ + + + + + +TextUtilities + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class TextUtilities

+
+java.lang.Object
+  extended by processing.app.syntax.TextUtilities
+
+
+
+
public class TextUtilities
extends java.lang.Object
+ + +

+Class with several utility functions used by the text area component. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
TextUtilities() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static intfindMatchingBracket(javax.swing.text.Document doc, + int offset) + +
+          Returns the offset of the bracket matching the one at the + specified offset of the document, or -1 if the bracket is + unmatched (or if the character is not a bracket).
+static intfindWordEnd(java.lang.String line, + int pos, + java.lang.String noWordSep) + +
+          Locates the end of the word at the specified position.
+static intfindWordStart(java.lang.String line, + int pos, + java.lang.String noWordSep) + +
+          Locates the start of the word at the specified position.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+TextUtilities

+
+public TextUtilities()
+
+
+ + + + + + + + +
+Method Detail
+ +

+findMatchingBracket

+
+public static int findMatchingBracket(javax.swing.text.Document doc,
+                                      int offset)
+                               throws javax.swing.text.BadLocationException
+
+
Returns the offset of the bracket matching the one at the + specified offset of the document, or -1 if the bracket is + unmatched (or if the character is not a bracket). +

+

+
Parameters:
doc - The document
offset - The offset +
Throws: +
javax.swing.text.BadLocationException - If an out-of-bounds access + was attempted on the document text
+
+
+
+ +

+findWordStart

+
+public static int findWordStart(java.lang.String line,
+                                int pos,
+                                java.lang.String noWordSep)
+
+
Locates the start of the word at the specified position. +

+

+
Parameters:
line - The text
pos - The position
+
+
+
+ +

+findWordEnd

+
+public static int findWordEnd(java.lang.String line,
+                              int pos,
+                              java.lang.String noWordSep)
+
+
Locates the end of the word at the specified position. +

+

+
Parameters:
line - The text
pos - The position
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/Token.html b/build/javadoc/everything/processing/app/syntax/Token.html new file mode 100644 index 000000000..84c41c847 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/Token.html @@ -0,0 +1,662 @@ + + + + + +Token + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class Token

+
+java.lang.Object
+  extended by processing.app.syntax.Token
+
+
+
+
public class Token
extends java.lang.Object
+ + +

+A linked list of tokens. Each token has three fields - a token + identifier, which is a byte value that can be looked up in the + array returned by SyntaxDocument.getColors() + to get a color value, a length value which is the length of the + token in the text, and a pointer to the next token in the list. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static byteCOMMENT1 + +
+          Comment 1 token id.
+static byteCOMMENT2 + +
+          Comment 2 token id.
+static byteEND + +
+          The token type, that along with a length of 0 + marks the end of the token list.
+ byteid + +
+          The id of this token.
+static byteID_COUNT + +
+          The total number of defined token ids.
+static byteINTERNAL_FIRST + +
+          The first id that can be used for internal state + in a token marker.
+static byteINTERNAL_LAST + +
+          The last id that can be used for internal state + in a token marker.
+static byteINVALID + +
+          Invalid token id.
+static byteKEYWORD1 + +
+          Keyword 1 token id.
+static byteKEYWORD2 + +
+          Keyword 2 token id.
+static byteKEYWORD3 + +
+          Keyword 3 token id.
+static byteLABEL + +
+          Label token id.
+ intlength + +
+          The length of this token.
+static byteLITERAL1 + +
+          Literal 1 token id.
+static byteLITERAL2 + +
+          Literal 2 token id.
+ Tokennext + +
+          The next token in the linked list.
+static byteNULL + +
+          Normal text token id.
+static byteOPERATOR + +
+          Operator token id.
+  + + + + + + + + + + +
+Constructor Summary
Token(int length, + byte id) + +
+          Creates a new token.
+  + + + + + + + + + + + +
+Method Summary
+ java.lang.StringtoString() + +
+          Returns a string representation of this token.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+NULL

+
+public static final byte NULL
+
+
Normal text token id. This should be used to mark + normal text. +

+

+
See Also:
Constant Field Values
+
+
+ +

+COMMENT1

+
+public static final byte COMMENT1
+
+
Comment 1 token id. This can be used to mark a comment. +

+

+
See Also:
Constant Field Values
+
+
+ +

+COMMENT2

+
+public static final byte COMMENT2
+
+
Comment 2 token id. This can be used to mark a comment. +

+

+
See Also:
Constant Field Values
+
+
+ +

+LITERAL1

+
+public static final byte LITERAL1
+
+
Literal 1 token id. This can be used to mark a string + literal (eg, C mode uses this to mark "..." literals) +

+

+
See Also:
Constant Field Values
+
+
+ +

+LITERAL2

+
+public static final byte LITERAL2
+
+
Literal 2 token id. This can be used to mark an object + literal (eg, Java mode uses this to mark true, false, etc) +

+

+
See Also:
Constant Field Values
+
+
+ +

+LABEL

+
+public static final byte LABEL
+
+
Label token id. This can be used to mark labels + (eg, C mode uses this to mark ...: sequences) +

+

+
See Also:
Constant Field Values
+
+
+ +

+KEYWORD1

+
+public static final byte KEYWORD1
+
+
Keyword 1 token id. This can be used to mark a + keyword. This should be used for general language + constructs. +

+

+
See Also:
Constant Field Values
+
+
+ +

+KEYWORD2

+
+public static final byte KEYWORD2
+
+
Keyword 2 token id. This can be used to mark a + keyword. This should be used for preprocessor + commands, or variables. +

+

+
See Also:
Constant Field Values
+
+
+ +

+KEYWORD3

+
+public static final byte KEYWORD3
+
+
Keyword 3 token id. This can be used to mark a + keyword. This should be used for data types. +

+

+
See Also:
Constant Field Values
+
+
+ +

+OPERATOR

+
+public static final byte OPERATOR
+
+
Operator token id. This can be used to mark an + operator. (eg, SQL mode marks +, -, etc with this + token type) +

+

+
See Also:
Constant Field Values
+
+
+ +

+INVALID

+
+public static final byte INVALID
+
+
Invalid token id. This can be used to mark invalid + or incomplete tokens, so the user can easily spot + syntax errors. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ID_COUNT

+
+public static final byte ID_COUNT
+
+
The total number of defined token ids. +

+

+
See Also:
Constant Field Values
+
+
+ +

+INTERNAL_FIRST

+
+public static final byte INTERNAL_FIRST
+
+
The first id that can be used for internal state + in a token marker. +

+

+
See Also:
Constant Field Values
+
+
+ +

+INTERNAL_LAST

+
+public static final byte INTERNAL_LAST
+
+
The last id that can be used for internal state + in a token marker. +

+

+
See Also:
Constant Field Values
+
+
+ +

+END

+
+public static final byte END
+
+
The token type, that along with a length of 0 + marks the end of the token list. +

+

+
See Also:
Constant Field Values
+
+
+ +

+length

+
+public int length
+
+
The length of this token. +

+

+
+
+
+ +

+id

+
+public byte id
+
+
The id of this token. +

+

+
+
+
+ +

+next

+
+public Token next
+
+
The next token in the linked list. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Token

+
+public Token(int length,
+             byte id)
+
+
Creates a new token. +

+

+
Parameters:
length - The length of the token
id - The id of the token
+
+ + + + + + + + +
+Method Detail
+ +

+toString

+
+public java.lang.String toString()
+
+
Returns a string representation of this token. +

+

+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/TokenMarker.LineInfo.html b/build/javadoc/everything/processing/app/syntax/TokenMarker.LineInfo.html new file mode 100644 index 000000000..ca4404f5c --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/TokenMarker.LineInfo.html @@ -0,0 +1,311 @@ + + + + + +TokenMarker.LineInfo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class TokenMarker.LineInfo

+
+java.lang.Object
+  extended by processing.app.syntax.TokenMarker.LineInfo
+
+
+
Enclosing class:
TokenMarker
+
+
+
+
public class TokenMarker.LineInfo
extends java.lang.Object
+ + +

+Inner class for storing information about tokenized lines. +

+ +

+


+ +

+ + + + + + + + + + + + + + + +
+Field Summary
+ java.lang.Objectobj + +
+          This is for use by the token marker implementations + themselves.
+ bytetoken + +
+          The id of the last token of the line.
+  + + + + + + + + + + + + + +
+Constructor Summary
TokenMarker.LineInfo() + +
+          Creates a new LineInfo object with token = Token.NULL + and obj = null.
TokenMarker.LineInfo(byte token, + java.lang.Object obj) + +
+          Creates a new LineInfo object with the specified + parameters.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+token

+
+public byte token
+
+
The id of the last token of the line. +

+

+
+
+
+ +

+obj

+
+public java.lang.Object obj
+
+
This is for use by the token marker implementations + themselves. It can be used to store anything that + is an object and that needs to exist on a per-line + basis. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+TokenMarker.LineInfo

+
+public TokenMarker.LineInfo()
+
+
Creates a new LineInfo object with token = Token.NULL + and obj = null. +

+

+
+ +

+TokenMarker.LineInfo

+
+public TokenMarker.LineInfo(byte token,
+                            java.lang.Object obj)
+
+
Creates a new LineInfo object with the specified + parameters. +

+

+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/TokenMarker.html b/build/javadoc/everything/processing/app/syntax/TokenMarker.html new file mode 100644 index 000000000..8e50feb1c --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/TokenMarker.html @@ -0,0 +1,374 @@ + + + + + +TokenMarker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.syntax +
+Class TokenMarker

+
+java.lang.Object
+  extended by processing.app.syntax.TokenMarker
+
+
+
Direct Known Subclasses:
CTokenMarker
+
+
+
+
public abstract class TokenMarker
extends java.lang.Object
+ + +

+A token marker that splits lines of text into tokens. Each token carries + a length field and an indentification tag that can be mapped to a color + for painting that token.

+ + For performance reasons, the linked list of tokens is reused after each + line is tokenized. Therefore, the return value of markTokens + should only be used for immediate painting. Notably, it cannot be + cached. +

+ +

+


+ +

+ + + + + + + + + + + +
+Nested Class Summary
+ classTokenMarker.LineInfo + +
+          Inner class for storing information about tokenized lines.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddeleteLines(int index, + int lines) + +
+          Informs the token marker that line have been deleted from + the document.
+ intgetLineCount() + +
+          Returns the number of lines in this token marker.
+ voidinsertLines(int index, + int lines) + +
+          Informs the token marker that lines have been inserted into + the document.
+ booleanisNextLineRequested() + +
+          Returns true if the next line should be repainted.
+ TokenmarkTokens(javax.swing.text.Segment line, + int lineIndex) + +
+          A wrapper for the lower-level markTokensImpl method + that is called to split a line up into tokens.
+ booleansupportsMultilineTokens() + +
+          Returns if the token marker supports tokens that span multiple + lines.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+markTokens

+
+public Token markTokens(javax.swing.text.Segment line,
+                        int lineIndex)
+
+
A wrapper for the lower-level markTokensImpl method + that is called to split a line up into tokens. +

+

+
Parameters:
line - The line
lineIndex - The line number
+
+
+
+ +

+supportsMultilineTokens

+
+public boolean supportsMultilineTokens()
+
+
Returns if the token marker supports tokens that span multiple + lines. If this is true, the object using this token marker is + required to pass all lines in the document to the + markTokens() method (in turn).

+ + The default implementation returns true; it should be overridden + to return false on simpler token markers for increased speed. +

+

+
+
+
+
+ +

+insertLines

+
+public void insertLines(int index,
+                        int lines)
+
+
Informs the token marker that lines have been inserted into + the document. This inserts a gap in the lineInfo + array. +

+

+
Parameters:
index - The first line number
lines - The number of lines
+
+
+
+ +

+deleteLines

+
+public void deleteLines(int index,
+                        int lines)
+
+
Informs the token marker that line have been deleted from + the document. This removes the lines in question from the + lineInfo array. +

+

+
Parameters:
index - The first line number
lines - The number of lines
+
+
+
+ +

+getLineCount

+
+public int getLineCount()
+
+
Returns the number of lines in this token marker. +

+

+
+
+
+
+ +

+isNextLineRequested

+
+public boolean isNextLineRequested()
+
+
Returns true if the next line should be repainted. This + will return true after a line has been tokenized that starts + a multiline token that continues onto the next line. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/package-frame.html b/build/javadoc/everything/processing/app/syntax/package-frame.html new file mode 100644 index 000000000..9d71c859b --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/package-frame.html @@ -0,0 +1,122 @@ + + + + + +processing.app.syntax + + + + + + + + + + + +processing.app.syntax + + + + +
+Interfaces  + +
+InputHandler.MacroRecorder +
+InputHandler.NonRecordable +
+InputHandler.NonRepeatable +
+InputHandler.Wrapper +
+TextAreaPainter.Highlight
+ + + + + + +
+Classes  + +
+CTokenMarker +
+DefaultInputHandler +
+InputHandler +
+InputHandler.backspace +
+InputHandler.backspace_word +
+InputHandler.delete +
+InputHandler.delete_word +
+InputHandler.document_end +
+InputHandler.document_home +
+InputHandler.end +
+InputHandler.home +
+InputHandler.insert_break +
+InputHandler.insert_char +
+InputHandler.insert_tab +
+InputHandler.next_char +
+InputHandler.next_line +
+InputHandler.next_page +
+InputHandler.next_word +
+InputHandler.overwrite +
+InputHandler.prev_char +
+InputHandler.prev_line +
+InputHandler.prev_page +
+InputHandler.prev_word +
+InputHandler.repeat +
+InputHandler.toggle_rect +
+JEditTextArea +
+KeywordMap +
+PdeKeywords +
+PdeTextAreaDefaults +
+SyntaxDocument +
+SyntaxStyle +
+SyntaxUtilities +
+TextAreaDefaults +
+TextAreaPainter +
+TextUtilities +
+Token +
+TokenMarker
+ + + + diff --git a/build/javadoc/everything/processing/app/syntax/package-summary.html b/build/javadoc/everything/processing/app/syntax/package-summary.html new file mode 100644 index 000000000..ef4d04069 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/package-summary.html @@ -0,0 +1,329 @@ + + + + + +processing.app.syntax + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.syntax +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+Interface Summary
InputHandler.MacroRecorderMacro recorder.
InputHandler.NonRecordableIf an action implements this interface, it should not be recorded + by the macro recorder.
InputHandler.NonRepeatableIf an action implements this interface, it should not be repeated.
InputHandler.WrapperFor use by EditAction.Wrapper only.
TextAreaPainter.HighlightHighlight interface.
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
CTokenMarkerC token marker.
DefaultInputHandlerThe default input handler.
InputHandlerAn input handler converts the user's key strokes into concrete actions.
InputHandler.backspace 
InputHandler.backspace_word 
InputHandler.delete 
InputHandler.delete_word 
InputHandler.document_end 
InputHandler.document_home 
InputHandler.end 
InputHandler.home 
InputHandler.insert_break 
InputHandler.insert_char 
InputHandler.insert_tab 
InputHandler.next_char 
InputHandler.next_line 
InputHandler.next_page 
InputHandler.next_word 
InputHandler.overwrite 
InputHandler.prev_char 
InputHandler.prev_line 
InputHandler.prev_page 
InputHandler.prev_word 
InputHandler.repeat 
InputHandler.toggle_rect 
JEditTextAreajEdit's text area component.
KeywordMapA KeywordMap is similar to a hashtable in that it maps keys + to values.
PdeKeywords 
PdeTextAreaDefaults 
SyntaxDocumentA document implementation that can be tokenized by the syntax highlighting + system.
SyntaxStyleA simple text style class.
SyntaxUtilitiesClass with several utility functions used by jEdit's syntax colorizing + subsystem.
TextAreaDefaultsEncapsulates default settings for a text area.
TextAreaPainterThe text area repaint manager.
TextUtilitiesClass with several utility functions used by the text area component.
TokenA linked list of tokens.
TokenMarkerA token marker that splits lines of text into tokens.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/syntax/package-tree.html b/build/javadoc/everything/processing/app/syntax/package-tree.html new file mode 100644 index 000000000..c64c62d29 --- /dev/null +++ b/build/javadoc/everything/processing/app/syntax/package-tree.html @@ -0,0 +1,198 @@ + + + + + +processing.app.syntax Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.syntax +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/Archiver.html b/build/javadoc/everything/processing/app/tools/Archiver.html new file mode 100644 index 000000000..b7642c444 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/Archiver.html @@ -0,0 +1,325 @@ + + + + + +Archiver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class Archiver

+
+java.lang.Object
+  extended by processing.app.tools.Archiver
+
+
+
All Implemented Interfaces:
java.lang.Runnable, Tool
+
+
+
+
public class Archiver
extends java.lang.Object
implements Tool
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Archiver() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidbuildZip(java.io.File dir, + java.lang.String sofar, + java.util.zip.ZipOutputStream zos) + +
+           
+ java.lang.StringgetMenuTitle() + +
+           
+ voidinit(Editor editor) + +
+           
+ voidrun() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Archiver

+
+public Archiver()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getMenuTitle

+
+public java.lang.String getMenuTitle()
+
+
+
Specified by:
getMenuTitle in interface Tool
+
+
+
+
+
+
+ +

+init

+
+public void init(Editor editor)
+
+
+
Specified by:
init in interface Tool
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
Specified by:
run in interface Tool
+
+
+
+
+
+
+ +

+buildZip

+
+public void buildZip(java.io.File dir,
+                     java.lang.String sofar,
+                     java.util.zip.ZipOutputStream zos)
+              throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/AutoFormat.html b/build/javadoc/everything/processing/app/tools/AutoFormat.html new file mode 100644 index 000000000..642abcaec --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/AutoFormat.html @@ -0,0 +1,602 @@ + + + + + +AutoFormat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class AutoFormat

+
+java.lang.Object
+  extended by processing.app.tools.AutoFormat
+
+
+
All Implemented Interfaces:
java.lang.Runnable, Tool
+
+
+
+
public class AutoFormat
extends java.lang.Object
implements Tool
+ + +

+Alternate handler for dealing with auto format. + Contributed by Martin Gomez, additional bug fixes by Ben Fry. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
AutoFormat() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidcomment() + +
+           
+ voidcpp_comment() + +
+           
+ voidfprintf(java.lang.String out_string) + +
+           
+ charget_string() + +
+           
+ chargetchr() + +
+           
+ java.lang.StringgetMenuTitle() + +
+           
+ intgetnl() + +
+           
+ voidgotelse() + +
+           
+ intgrabLines() + +
+           
+ voidindent_puts() + +
+           
+ voidinit(Editor editor) + +
+           
+ intlookup_com(java.lang.String keyword) + +
+           
+ intlookup(java.lang.String keyword) + +
+           
+ voidp_tabs() + +
+           
+ voidputcoms() + +
+           
+ voidrun() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+AutoFormat

+
+public AutoFormat()
+
+
+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init(Editor editor)
+
+
+
Specified by:
init in interface Tool
+
+
+
+
+
+
+ +

+getMenuTitle

+
+public java.lang.String getMenuTitle()
+
+
+
Specified by:
getMenuTitle in interface Tool
+
+
+
+
+
+
+ +

+comment

+
+public void comment()
+             throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+get_string

+
+public char get_string()
+                throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+indent_puts

+
+public void indent_puts()
+
+
+
+
+
+
+
+
+
+ +

+fprintf

+
+public void fprintf(java.lang.String out_string)
+
+
+
+
+
+
+
+
+
+ +

+grabLines

+
+public int grabLines()
+
+
+
+
+
+
+
+
+
+ +

+putcoms

+
+public void putcoms()
+
+
+
+
+
+
+
+
+
+ +

+cpp_comment

+
+public void cpp_comment()
+                 throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+p_tabs

+
+public void p_tabs()
+
+
+
+
+
+
+
+
+
+ +

+getchr

+
+public char getchr()
+            throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+gotelse

+
+public void gotelse()
+
+
+
+
+
+
+
+
+
+ +

+getnl

+
+public int getnl()
+          throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+lookup

+
+public int lookup(java.lang.String keyword)
+
+
+
+
+
+
+
+
+
+ +

+lookup_com

+
+public int lookup_com(java.lang.String keyword)
+
+
+
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
Specified by:
run in interface Tool
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/ColorSelector.ColorRange.html b/build/javadoc/everything/processing/app/tools/ColorSelector.ColorRange.html new file mode 100644 index 000000000..dc066e7b2 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/ColorSelector.ColorRange.html @@ -0,0 +1,535 @@ + + + + + +ColorSelector.ColorRange + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class ColorSelector.ColorRange

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Panel
+              extended by java.applet.Applet
+                  extended by processing.core.PApplet
+                      extended by processing.app.tools.ColorSelector.ColorRange
+
+
+
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, PConstants
+
+
+
Enclosing class:
ColorSelector
+
+
+
+
public class ColorSelector.ColorRange
extends PApplet
+ + +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class processing.core.PApplet
PApplet.RegisteredMethods, PApplet.RendererChangeException
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PApplet
args, ARGS_BGCOLOR, ARGS_DISPLAY, ARGS_EDITOR_LOCATION, ARGS_EXCLUSIVE, ARGS_EXTERNAL, ARGS_HIDE_STOP, ARGS_LOCATION, ARGS_PRESENT, ARGS_SKETCH_FOLDER, ARGS_STOP_COLOR, DEFAULT_HEIGHT, DEFAULT_WIDTH, defaultSize, EXTERNAL_MOVE, EXTERNAL_STOP, finished, firstMouse, focused, frame, frameCount, frameRate, g, height, ICON_IMAGE, javaVersion, javaVersionName, key, keyCode, keyEvent, keyPressed, MENU_SHORTCUT, MIN_WINDOW_HEIGHT, MIN_WINDOW_WIDTH, mouseButton, mouseEvent, mousePressed, mouseX, mouseY, online, pixels, platform, pmouseX, pmouseY, recorder, requestImageMax, screen, selectedFile, sketchPath, width
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
ColorSelector.ColorRange() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddraw() + +
+           
+ java.awt.DimensiongetMaximumSize() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+ voidmouseDragged() + +
+          Mouse button is pressed and the mouse has been dragged.
+ voidmousePressed() + +
+          Mouse has been pressed, and should be considered "down" + until mouseReleased() is called.
+ voidsetup() + +
+           
+ voidupdateMouse() + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PApplet
abs, abs, acos, addListeners, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, arc, arraycopy, arrayCopy, arraycopy, arrayCopy, arraycopy, arrayCopy, asin, atan, atan2, background, background, background, background, background, background, background, beginCamera, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blue, box, box, breakShape, brightness, camera, camera, ceil, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createImage, createInput, createInput, createInputRaw, createOutput, createOutput, createPath, createPath, createReader, createReader, createReader, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataFile, dataPath, day, degrees, delay, destroy, die, die, directionalLight, displayable, dist, dist, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endRaw, endRecord, endShape, endShape, exec, exit, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, floor, flush, focusGained, focusGained, focusLost, focusLost, frameRate, frustum, get, get, get, getCache, getMatrix, getMatrix, getMatrix, getSketchHeight, getSketchRenderer, getSketchWidth, green, handleDraw, hex, hex, hex, hex, hint, hour, hue, image, image, image, imageMode, init, join, join, keyPressed, keyPressed, keyReleased, keyReleased, keyTyped, keyTyped, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, link, loadBytes, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadPixels, loadShape, loadStrings, loadStrings, loadStrings, log, loop, mag, mag, main, map, mask, mask, match, matchAll, max, max, max, max, max, max, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mouseReleased, mouseReleased, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noCursor, noFill, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLights, noLoop, norm, normal, noSmooth, noStroke, noTint, open, open, openStream, ortho, ortho, paint, param, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, perspective, perspective, point, point, pointLight, popMatrix, popStyle, pow, print, print, print, print, print, print, print, printCamera, println, println, println, println, println, println, println, println, printMatrix, printProjection, pushMatrix, pushStyle, quad, radians, random, random, randomSeed, rect, rectMode, red, redraw, registerDispose, registerDraw, registerKeyEvent, registerMouseEvent, registerPost, registerPre, registerSize, removeCache, requestImage, requestImage, resetMatrix, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, run, saturation, save, saveBytes, saveBytes, saveBytes, saveFile, saveFrame, saveFrame, savePath, saveStream, saveStream, saveStream, saveStrings, saveStrings, saveStrings, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, selectFolder, selectFolder, selectInput, selectInput, selectOutput, selectOutput, set, set, setCache, setMatrix, setMatrix, setMatrix, setupExternalMessages, setupFrameResizeListener, shape, shape, shape, shapeMode, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, sin, size, size, size, sketchFile, sketchPath, smooth, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, sphere, sphereDetail, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, start, status, stop, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, unregisterDispose, unregisterDraw, unregisterKeyEvent, unregisterMouseEvent, unregisterPost, unregisterPre, unregisterSize, update, updatePixels, updatePixels, vertex, vertex, vertex, vertex, vertex, year
+ + + + + + + +
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
+ + + + + + + +
Methods inherited from class java.awt.Panel
addNotify
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ColorSelector.ColorRange

+
+public ColorSelector.ColorRange()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setup

+
+public void setup()
+
+
+
Overrides:
setup in class PApplet
+
+
+
+
+
+
+ +

+draw

+
+public void draw()
+
+
+
Overrides:
draw in class PApplet
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed()
+
+
Description copied from class: PApplet
+
Mouse has been pressed, and should be considered "down" + until mouseReleased() is called. If you must, use + int button = mouseEvent.getButton(); + to figure out which button was clicked. It will be one of: + MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3 + Note, however, that this is completely inconsistent across + platforms. +

+

+
Overrides:
mousePressed in class PApplet
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged()
+
+
Description copied from class: PApplet
+
Mouse button is pressed and the mouse has been dragged. +

+

+
Overrides:
mouseDragged in class PApplet
+
+
+
+
+
+
+ +

+updateMouse

+
+public void updateMouse()
+
+
+
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
Overrides:
getPreferredSize in class java.awt.Container
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class java.awt.Container
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
+
Overrides:
getMaximumSize in class java.awt.Container
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/ColorSelector.ColorSlider.html b/build/javadoc/everything/processing/app/tools/ColorSelector.ColorSlider.html new file mode 100644 index 000000000..336428dd9 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/ColorSelector.ColorSlider.html @@ -0,0 +1,535 @@ + + + + + +ColorSelector.ColorSlider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class ColorSelector.ColorSlider

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Panel
+              extended by java.applet.Applet
+                  extended by processing.core.PApplet
+                      extended by processing.app.tools.ColorSelector.ColorSlider
+
+
+
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, PConstants
+
+
+
Enclosing class:
ColorSelector
+
+
+
+
public class ColorSelector.ColorSlider
extends PApplet
+ + +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class processing.core.PApplet
PApplet.RegisteredMethods, PApplet.RendererChangeException
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PApplet
args, ARGS_BGCOLOR, ARGS_DISPLAY, ARGS_EDITOR_LOCATION, ARGS_EXCLUSIVE, ARGS_EXTERNAL, ARGS_HIDE_STOP, ARGS_LOCATION, ARGS_PRESENT, ARGS_SKETCH_FOLDER, ARGS_STOP_COLOR, DEFAULT_HEIGHT, DEFAULT_WIDTH, defaultSize, EXTERNAL_MOVE, EXTERNAL_STOP, finished, firstMouse, focused, frame, frameCount, frameRate, g, height, ICON_IMAGE, javaVersion, javaVersionName, key, keyCode, keyEvent, keyPressed, MENU_SHORTCUT, MIN_WINDOW_HEIGHT, MIN_WINDOW_WIDTH, mouseButton, mouseEvent, mousePressed, mouseX, mouseY, online, pixels, platform, pmouseX, pmouseY, recorder, requestImageMax, screen, selectedFile, sketchPath, width
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
ColorSelector.ColorSlider() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddraw() + +
+           
+ java.awt.DimensiongetMaximumSize() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ java.awt.DimensiongetPreferredSize() + +
+           
+ voidmouseDragged() + +
+          Mouse button is pressed and the mouse has been dragged.
+ voidmousePressed() + +
+          Mouse has been pressed, and should be considered "down" + until mouseReleased() is called.
+ voidsetup() + +
+           
+ voidupdateMouse() + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PApplet
abs, abs, acos, addListeners, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, arc, arraycopy, arrayCopy, arraycopy, arrayCopy, arraycopy, arrayCopy, asin, atan, atan2, background, background, background, background, background, background, background, beginCamera, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blue, box, box, breakShape, brightness, camera, camera, ceil, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createImage, createInput, createInput, createInputRaw, createOutput, createOutput, createPath, createPath, createReader, createReader, createReader, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataFile, dataPath, day, degrees, delay, destroy, die, die, directionalLight, displayable, dist, dist, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endRaw, endRecord, endShape, endShape, exec, exit, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, floor, flush, focusGained, focusGained, focusLost, focusLost, frameRate, frustum, get, get, get, getCache, getMatrix, getMatrix, getMatrix, getSketchHeight, getSketchRenderer, getSketchWidth, green, handleDraw, hex, hex, hex, hex, hint, hour, hue, image, image, image, imageMode, init, join, join, keyPressed, keyPressed, keyReleased, keyReleased, keyTyped, keyTyped, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, link, loadBytes, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadPixels, loadShape, loadStrings, loadStrings, loadStrings, log, loop, mag, mag, main, map, mask, mask, match, matchAll, max, max, max, max, max, max, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mouseReleased, mouseReleased, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noCursor, noFill, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLights, noLoop, norm, normal, noSmooth, noStroke, noTint, open, open, openStream, ortho, ortho, paint, param, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, perspective, perspective, point, point, pointLight, popMatrix, popStyle, pow, print, print, print, print, print, print, print, printCamera, println, println, println, println, println, println, println, println, printMatrix, printProjection, pushMatrix, pushStyle, quad, radians, random, random, randomSeed, rect, rectMode, red, redraw, registerDispose, registerDraw, registerKeyEvent, registerMouseEvent, registerPost, registerPre, registerSize, removeCache, requestImage, requestImage, resetMatrix, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, run, saturation, save, saveBytes, saveBytes, saveBytes, saveFile, saveFrame, saveFrame, savePath, saveStream, saveStream, saveStream, saveStrings, saveStrings, saveStrings, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, selectFolder, selectFolder, selectInput, selectInput, selectOutput, selectOutput, set, set, setCache, setMatrix, setMatrix, setMatrix, setupExternalMessages, setupFrameResizeListener, shape, shape, shape, shapeMode, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, sin, size, size, size, sketchFile, sketchPath, smooth, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, sphere, sphereDetail, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, start, status, stop, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, unregisterDispose, unregisterDraw, unregisterKeyEvent, unregisterMouseEvent, unregisterPost, unregisterPre, unregisterSize, update, updatePixels, updatePixels, vertex, vertex, vertex, vertex, vertex, year
+ + + + + + + +
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
+ + + + + + + +
Methods inherited from class java.awt.Panel
addNotify
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ColorSelector.ColorSlider

+
+public ColorSelector.ColorSlider()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setup

+
+public void setup()
+
+
+
Overrides:
setup in class PApplet
+
+
+
+
+
+
+ +

+draw

+
+public void draw()
+
+
+
Overrides:
draw in class PApplet
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed()
+
+
Description copied from class: PApplet
+
Mouse has been pressed, and should be considered "down" + until mouseReleased() is called. If you must, use + int button = mouseEvent.getButton(); + to figure out which button was clicked. It will be one of: + MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3 + Note, however, that this is completely inconsistent across + platforms. +

+

+
Overrides:
mousePressed in class PApplet
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged()
+
+
Description copied from class: PApplet
+
Mouse button is pressed and the mouse has been dragged. +

+

+
Overrides:
mouseDragged in class PApplet
+
+
+
+
+
+
+ +

+updateMouse

+
+public void updateMouse()
+
+
+
+
+
+
+ +

+getPreferredSize

+
+public java.awt.Dimension getPreferredSize()
+
+
+
Overrides:
getPreferredSize in class java.awt.Container
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class java.awt.Container
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
+
Overrides:
getMaximumSize in class java.awt.Container
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/ColorSelector.html b/build/javadoc/everything/processing/app/tools/ColorSelector.html new file mode 100644 index 000000000..6e7343946 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/ColorSelector.html @@ -0,0 +1,396 @@ + + + + + +ColorSelector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class ColorSelector

+
+java.lang.Object
+  extended by processing.app.tools.ColorSelector
+
+
+
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, javax.swing.event.DocumentListener, Tool
+
+
+
+
public class ColorSelector
extends java.lang.Object
implements Tool, javax.swing.event.DocumentListener
+ + +

+Color selector tool for the Tools menu. +

+ Using the keyboard shortcuts, you can copy/paste the values for the + colors and paste them into your program. We didn't do any sort of + auto-insert of colorMode() or fill() or stroke() code cuz we couldn't + decide on a good way to do this.. your contributions welcome). +

+ +

+


+ +

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+ classColorSelector.ColorRange + +
+           
+ classColorSelector.ColorSlider + +
+           
+  + + + + + + + + + + +
+Constructor Summary
ColorSelector() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidchangedUpdate(javax.swing.event.DocumentEvent e) + +
+           
+ java.lang.StringgetMenuTitle() + +
+           
+ voidinit(Editor editor) + +
+           
+ voidinsertUpdate(javax.swing.event.DocumentEvent e) + +
+           
+ voidremoveUpdate(javax.swing.event.DocumentEvent e) + +
+           
+ voidrun() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ColorSelector

+
+public ColorSelector()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getMenuTitle

+
+public java.lang.String getMenuTitle()
+
+
+
Specified by:
getMenuTitle in interface Tool
+
+
+
+
+
+
+ +

+init

+
+public void init(Editor editor)
+
+
+
Specified by:
init in interface Tool
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
Specified by:
run in interface Tool
+
+
+
+
+
+
+ +

+changedUpdate

+
+public void changedUpdate(javax.swing.event.DocumentEvent e)
+
+
+
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener
+
+
+
+
+
+
+ +

+removeUpdate

+
+public void removeUpdate(javax.swing.event.DocumentEvent e)
+
+
+
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener
+
+
+
+
+
+
+ +

+insertUpdate

+
+public void insertUpdate(javax.swing.event.DocumentEvent e)
+
+
+
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/CreateFont.html b/build/javadoc/everything/processing/app/tools/CreateFont.html new file mode 100644 index 000000000..bd424f073 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/CreateFont.html @@ -0,0 +1,505 @@ + + + + + +CreateFont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class CreateFont

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Window
+              extended by java.awt.Frame
+                  extended by javax.swing.JFrame
+                      extended by processing.app.tools.CreateFont
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, Tool
+
+
+
+
public class CreateFont
extends javax.swing.JFrame
implements Tool
+ + +

+gui interface to font creation heaven/hell. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
+ + + + + + + +
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
CreateFont() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidbuild() + +
+           
+ java.awt.DimensiongetMaximumSize() + +
+          make the window vertically resizable
+ java.lang.StringgetMenuTitle() + +
+           
+ java.awt.DimensiongetMinimumSize() + +
+           
+ voidinit(Editor editor) + +
+           
+ voidrun() + +
+           
+ voidupdate() + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
+ + + + + + + +
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
+ + + + + + + +
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CreateFont

+
+public CreateFont()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getMenuTitle

+
+public java.lang.String getMenuTitle()
+
+
+
Specified by:
getMenuTitle in interface Tool
+
+
+
+
+
+
+ +

+init

+
+public void init(Editor editor)
+
+
+
Specified by:
init in interface Tool
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
Specified by:
run in interface Tool
+
+
+
+
+
+
+ +

+getMaximumSize

+
+public java.awt.Dimension getMaximumSize()
+
+
make the window vertically resizable +

+

+
Overrides:
getMaximumSize in class java.awt.Container
+
+
+
+
+
+
+ +

+getMinimumSize

+
+public java.awt.Dimension getMinimumSize()
+
+
+
Overrides:
getMinimumSize in class java.awt.Container
+
+
+
+
+
+
+ +

+update

+
+public void update()
+
+
+
+
+
+
+
+
+
+ +

+build

+
+public void build()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/DiscourseFormat.html b/build/javadoc/everything/processing/app/tools/DiscourseFormat.html new file mode 100644 index 000000000..860fa33df --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/DiscourseFormat.html @@ -0,0 +1,295 @@ + + + + + +DiscourseFormat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class DiscourseFormat

+
+java.lang.Object
+  extended by processing.app.tools.DiscourseFormat
+
+
+
+
public class DiscourseFormat
extends java.lang.Object
+ + +

+Format for Discourse Tool +

+ Original code by owd. + Revised and updated for revision 0108 by Ben Fry (10 March 2006). + This code may later be moved to its own 'Tool' plugin, but is included + with release 0108+ while features for the "Tools" menu are in testing. +

+ Updated for 0122 to simply copy the code directly to the clipboard, + rather than opening a new window. +

+ Updated for 0144 to only format the selected lines. +

+ Notes from the original source: + Discourse.java This is a dirty-mix source. + NOTE that: No macs and no keyboard. Unreliable source. + Only format processing code using fontMetrics. + It works under my windows XP + PentiumIV + Processing 0091. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
DiscourseFormat(Editor editor) + +
+          Creates a new window with the formated (YaBB tags) sketchcode + from the actual Processing Tab ready to send to the processing discourse + web (copy & paste)
+  + + + + + + + + + + + + + + + +
+Method Summary
+ voidappendFormattedLine(java.lang.StringBuffer cf, + int line) + +
+           
+ voidshow() + +
+          Format and render sketch code.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+DiscourseFormat

+
+public DiscourseFormat(Editor editor)
+
+
Creates a new window with the formated (YaBB tags) sketchcode + from the actual Processing Tab ready to send to the processing discourse + web (copy & paste) +

+

+ + + + + + + + +
+Method Detail
+ +

+show

+
+public void show()
+
+
Format and render sketch code. +

+

+
+
+
+
+ +

+appendFormattedLine

+
+public void appendFormattedLine(java.lang.StringBuffer cf,
+                                int line)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/FixEncoding.html b/build/javadoc/everything/processing/app/tools/FixEncoding.html new file mode 100644 index 000000000..ca0888dae --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/FixEncoding.html @@ -0,0 +1,296 @@ + + + + + +FixEncoding + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Class FixEncoding

+
+java.lang.Object
+  extended by processing.app.tools.FixEncoding
+
+
+
All Implemented Interfaces:
java.lang.Runnable, Tool
+
+
+
+
public class FixEncoding
extends java.lang.Object
implements Tool
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
FixEncoding() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetMenuTitle() + +
+           
+ voidinit(Editor editor) + +
+           
+ voidrun() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+FixEncoding

+
+public FixEncoding()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getMenuTitle

+
+public java.lang.String getMenuTitle()
+
+
+
Specified by:
getMenuTitle in interface Tool
+
+
+
+
+
+
+ +

+init

+
+public void init(Editor editor)
+
+
+
Specified by:
init in interface Tool
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
Specified by:
run in interface Tool
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/Tool.html b/build/javadoc/everything/processing/app/tools/Tool.html new file mode 100644 index 000000000..c553325a2 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/Tool.html @@ -0,0 +1,257 @@ + + + + + +Tool + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.tools +
+Interface Tool

+
+
All Superinterfaces:
java.lang.Runnable
+
+
+
All Known Implementing Classes:
Archiver, AutoFormat, ColorSelector, CreateFont, FixEncoding
+
+
+
+
public interface Tool
extends java.lang.Runnable
+ + +

+Interface for items to be shown in the Tools menu. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetMenuTitle() + +
+           
+ voidinit(Editor editor) + +
+           
+ voidrun() + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+init

+
+void init(Editor editor)
+
+
+
+
+
+
+
+
+
+ +

+run

+
+void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+getMenuTitle

+
+java.lang.String getMenuTitle()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/package-frame.html b/build/javadoc/everything/processing/app/tools/package-frame.html new file mode 100644 index 000000000..d04690d29 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/package-frame.html @@ -0,0 +1,52 @@ + + + + + +processing.app.tools + + + + + + + + + + + +processing.app.tools + + + + +
+Interfaces  + +
+Tool
+ + + + + + +
+Classes  + +
+Archiver +
+AutoFormat +
+ColorSelector +
+CreateFont +
+DiscourseFormat +
+FixEncoding
+ + + + diff --git a/build/javadoc/everything/processing/app/tools/package-summary.html b/build/javadoc/everything/processing/app/tools/package-summary.html new file mode 100644 index 000000000..807d45d23 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/package-summary.html @@ -0,0 +1,187 @@ + + + + + +processing.app.tools + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.tools +

+ + + + + + + + + +
+Interface Summary
ToolInterface for items to be shown in the Tools menu.
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
Archiver 
AutoFormatAlternate handler for dealing with auto format.
ColorSelectorColor selector tool for the Tools menu.
CreateFontgui interface to font creation heaven/hell.
DiscourseFormatFormat for Discourse Tool +

+ Original code by owd.

FixEncoding 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/tools/package-tree.html b/build/javadoc/everything/processing/app/tools/package-tree.html new file mode 100644 index 000000000..81930f529 --- /dev/null +++ b/build/javadoc/everything/processing/app/tools/package-tree.html @@ -0,0 +1,180 @@ + + + + + +processing.app.tools Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.tools +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • processing.app.tools.Archiver (implements processing.app.tools.Tool) +
    • processing.app.tools.AutoFormat (implements processing.app.tools.Tool) +
    • processing.app.tools.ColorSelector (implements javax.swing.event.DocumentListener, processing.app.tools.Tool) +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container
          +
        • java.awt.Panel (implements javax.accessibility.Accessible) + +
        • java.awt.Window (implements javax.accessibility.Accessible) +
            +
          • java.awt.Frame (implements java.awt.MenuContainer) +
              +
            • javax.swing.JFrame (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants) +
                +
              • processing.app.tools.CreateFont (implements processing.app.tools.Tool) +
              +
            +
          +
        +
      +
    • processing.app.tools.DiscourseFormat
    • processing.app.tools.FixEncoding (implements processing.app.tools.Tool) +
    +
+

+Interface Hierarchy +

+
    +
  • java.lang.Runnable
      +
    • processing.app.tools.Tool
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.ChangeServiceConfig2Info.html b/build/javadoc/everything/processing/app/windows/Advapi32.ChangeServiceConfig2Info.html new file mode 100644 index 000000000..b0ba5a1fb --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.ChangeServiceConfig2Info.html @@ -0,0 +1,271 @@ + + + + + +Advapi32.ChangeServiceConfig2Info + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class Advapi32.ChangeServiceConfig2Info

+
+java.lang.Object
+  extended by com.sun.jna.Structure
+      extended by processing.app.windows.Advapi32.ChangeServiceConfig2Info
+
+
+
Direct Known Subclasses:
Advapi32.SERVICE_DESCRIPTION
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static class Advapi32.ChangeServiceConfig2Info
extends com.sun.jna.Structure
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class com.sun.jna.Structure
com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE
+  + + + + + + + + + + +
+Constructor Summary
Advapi32.ChangeServiceConfig2Info() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class com.sun.jna.Structure
clear, equals, getPointer, hashCode, newInstance, read, readField, size, toArray, toArray, toString, write, writeField
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Advapi32.ChangeServiceConfig2Info

+
+public Advapi32.ChangeServiceConfig2Info()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.Handler.html b/build/javadoc/everything/processing/app/windows/Advapi32.Handler.html new file mode 100644 index 000000000..68dc7cb26 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.Handler.html @@ -0,0 +1,227 @@ + + + + + +Advapi32.Handler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface Advapi32.Handler

+
+
All Superinterfaces:
com.sun.jna.AltCallingConvention, com.sun.jna.Callback, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary.StdCallCallback
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static interface Advapi32.Handler
extends com.sun.jna.win32.StdCallLibrary.StdCallCallback
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface com.sun.jna.Callback
METHOD_NAME
+  + + + + + + + + + + + +
+Method Summary
+ voidcallback(int fdwControl) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+callback

+
+void callback(int fdwControl)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.HandlerEx.html b/build/javadoc/everything/processing/app/windows/Advapi32.HandlerEx.html new file mode 100644 index 000000000..70cdbf442 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.HandlerEx.html @@ -0,0 +1,233 @@ + + + + + +Advapi32.HandlerEx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface Advapi32.HandlerEx

+
+
All Superinterfaces:
com.sun.jna.AltCallingConvention, com.sun.jna.Callback, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary.StdCallCallback
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static interface Advapi32.HandlerEx
extends com.sun.jna.win32.StdCallLibrary.StdCallCallback
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface com.sun.jna.Callback
METHOD_NAME
+  + + + + + + + + + + + +
+Method Summary
+ voidcallback(int dwControl, + int dwEventType, + com.sun.jna.Pointer lpEventData, + com.sun.jna.Pointer lpContext) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+callback

+
+void callback(int dwControl,
+              int dwEventType,
+              com.sun.jna.Pointer lpEventData,
+              com.sun.jna.Pointer lpContext)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_DESCRIPTION.html b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_DESCRIPTION.html new file mode 100644 index 000000000..e83cd8755 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_DESCRIPTION.html @@ -0,0 +1,296 @@ + + + + + +Advapi32.SERVICE_DESCRIPTION + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class Advapi32.SERVICE_DESCRIPTION

+
+java.lang.Object
+  extended by com.sun.jna.Structure
+      extended by processing.app.windows.Advapi32.ChangeServiceConfig2Info
+          extended by processing.app.windows.Advapi32.SERVICE_DESCRIPTION
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static class Advapi32.SERVICE_DESCRIPTION
extends Advapi32.ChangeServiceConfig2Info
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class com.sun.jna.Structure
com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue
+  + + + + + + + + + + + +
+Field Summary
+ java.lang.StringlpDescription + +
+           
+ + + + + + + +
Fields inherited from class com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE
+  + + + + + + + + + + +
+Constructor Summary
Advapi32.SERVICE_DESCRIPTION() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class com.sun.jna.Structure
clear, equals, getPointer, hashCode, newInstance, read, readField, size, toArray, toArray, toString, write, writeField
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+lpDescription

+
+public java.lang.String lpDescription
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Advapi32.SERVICE_DESCRIPTION

+
+public Advapi32.SERVICE_DESCRIPTION()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_MAIN_FUNCTION.html b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_MAIN_FUNCTION.html new file mode 100644 index 000000000..8843e55dc --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_MAIN_FUNCTION.html @@ -0,0 +1,229 @@ + + + + + +Advapi32.SERVICE_MAIN_FUNCTION + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface Advapi32.SERVICE_MAIN_FUNCTION

+
+
All Superinterfaces:
com.sun.jna.AltCallingConvention, com.sun.jna.Callback, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary.StdCallCallback
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static interface Advapi32.SERVICE_MAIN_FUNCTION
extends com.sun.jna.win32.StdCallLibrary.StdCallCallback
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface com.sun.jna.Callback
METHOD_NAME
+  + + + + + + + + + + + +
+Method Summary
+ voidcallback(int dwArgc, + com.sun.jna.Pointer lpszArgv) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+callback

+
+void callback(int dwArgc,
+              com.sun.jna.Pointer lpszArgv)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_STATUS.html b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_STATUS.html new file mode 100644 index 000000000..9fb2850ea --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_STATUS.html @@ -0,0 +1,403 @@ + + + + + +Advapi32.SERVICE_STATUS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class Advapi32.SERVICE_STATUS

+
+java.lang.Object
+  extended by com.sun.jna.Structure
+      extended by processing.app.windows.Advapi32.SERVICE_STATUS
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static class Advapi32.SERVICE_STATUS
extends com.sun.jna.Structure
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class com.sun.jna.Structure
com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ intdwCheckPoint + +
+           
+ intdwControlsAccepted + +
+           
+ intdwCurrentState + +
+           
+ intdwServiceSpecificExitCode + +
+           
+ intdwServiceType + +
+           
+ intdwWaitHint + +
+           
+ intdwWin32ExitCode + +
+           
+ + + + + + + +
Fields inherited from class com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE
+  + + + + + + + + + + +
+Constructor Summary
Advapi32.SERVICE_STATUS() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class com.sun.jna.Structure
clear, equals, getPointer, hashCode, newInstance, read, readField, size, toArray, toArray, toString, write, writeField
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+dwServiceType

+
+public int dwServiceType
+
+
+
+
+
+ +

+dwCurrentState

+
+public int dwCurrentState
+
+
+
+
+
+ +

+dwControlsAccepted

+
+public int dwControlsAccepted
+
+
+
+
+
+ +

+dwWin32ExitCode

+
+public int dwWin32ExitCode
+
+
+
+
+
+ +

+dwServiceSpecificExitCode

+
+public int dwServiceSpecificExitCode
+
+
+
+
+
+ +

+dwCheckPoint

+
+public int dwCheckPoint
+
+
+
+
+
+ +

+dwWaitHint

+
+public int dwWaitHint
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Advapi32.SERVICE_STATUS

+
+public Advapi32.SERVICE_STATUS()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_TABLE_ENTRY.html b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_TABLE_ENTRY.html new file mode 100644 index 000000000..0124d3ff2 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.SERVICE_TABLE_ENTRY.html @@ -0,0 +1,313 @@ + + + + + +Advapi32.SERVICE_TABLE_ENTRY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class Advapi32.SERVICE_TABLE_ENTRY

+
+java.lang.Object
+  extended by com.sun.jna.Structure
+      extended by processing.app.windows.Advapi32.SERVICE_TABLE_ENTRY
+
+
+
Enclosing interface:
Advapi32
+
+
+
+
public static class Advapi32.SERVICE_TABLE_ENTRY
extends com.sun.jna.Structure
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class com.sun.jna.Structure
com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue
+  + + + + + + + + + + + + + + + +
+Field Summary
+ java.lang.StringlpServiceName + +
+           
+ Advapi32.SERVICE_MAIN_FUNCTIONlpServiceProc + +
+           
+ + + + + + + +
Fields inherited from class com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE
+  + + + + + + + + + + +
+Constructor Summary
Advapi32.SERVICE_TABLE_ENTRY() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class com.sun.jna.Structure
clear, equals, getPointer, hashCode, newInstance, read, readField, size, toArray, toArray, toString, write, writeField
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+lpServiceName

+
+public java.lang.String lpServiceName
+
+
+
+
+
+ +

+lpServiceProc

+
+public Advapi32.SERVICE_MAIN_FUNCTION lpServiceProc
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Advapi32.SERVICE_TABLE_ENTRY

+
+public Advapi32.SERVICE_TABLE_ENTRY()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Advapi32.html b/build/javadoc/everything/processing/app/windows/Advapi32.html new file mode 100644 index 000000000..928d096ca --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Advapi32.html @@ -0,0 +1,1019 @@ + + + + + +Advapi32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface Advapi32

+
+
All Superinterfaces:
com.sun.jna.AltCallingConvention, com.sun.jna.Library, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary
+
+
+
+
public interface Advapi32
extends com.sun.jna.win32.StdCallLibrary
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Nested Class Summary
+static classAdvapi32.ChangeServiceConfig2Info + +
+           
+static interfaceAdvapi32.Handler + +
+           
+static interfaceAdvapi32.HandlerEx + +
+           
+static classAdvapi32.SERVICE_DESCRIPTION + +
+           
+static interfaceAdvapi32.SERVICE_MAIN_FUNCTION + +
+           
+static classAdvapi32.SERVICE_STATUS + +
+           
+static classAdvapi32.SERVICE_TABLE_ENTRY + +
+           
+ + + + + + + +
Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary
com.sun.jna.win32.StdCallLibrary.StdCallCallback
+  + + + + + + + + + + + +
+Field Summary
+static Advapi32INSTANCE + +
+           
+ + + + + + + +
Fields inherited from interface com.sun.jna.win32.StdCallLibrary
FUNCTION_MAPPER, STDCALL_CONVENTION
+ + + + + + + +
Fields inherited from interface com.sun.jna.Library
OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanChangeServiceConfig2(com.sun.jna.Pointer hService, + int dwInfoLevel, + Advapi32.ChangeServiceConfig2Info lpInfo) + +
+           
+ booleanCloseServiceHandle(com.sun.jna.Pointer hSCObject) + +
+           
+ booleanControlService(com.sun.jna.Pointer hService, + int dwControl, + Advapi32.SERVICE_STATUS lpServiceStatus) + +
+           
+ booleanConvertSidToStringSid(byte[] Sid, + com.sun.jna.ptr.PointerByReference StringSid) + +
+           
+ booleanConvertStringSidToSid(java.lang.String StringSid, + com.sun.jna.ptr.PointerByReference Sid) + +
+           
+ com.sun.jna.PointerCreateService(com.sun.jna.Pointer hSCManager, + java.lang.String lpServiceName, + java.lang.String lpDisplayName, + int dwDesiredAccess, + int dwServiceType, + int dwStartType, + int dwErrorControl, + java.lang.String lpBinaryPathName, + java.lang.String lpLoadOrderGroup, + com.sun.jna.ptr.IntByReference lpdwTagId, + java.lang.String lpDependencies, + java.lang.String lpServiceStartName, + java.lang.String lpPassword) + +
+           
+ booleanDeleteService(com.sun.jna.Pointer hService) + +
+           
+ booleanLookupAccountName(java.lang.String lpSystemName, + java.lang.String lpAccountName, + byte[] Sid, + com.sun.jna.ptr.IntByReference cbSid, + char[] ReferencedDomainName, + com.sun.jna.ptr.IntByReference cchReferencedDomainName, + com.sun.jna.ptr.PointerByReference peUse) + +
+           
+ booleanLookupAccountSid(java.lang.String lpSystemName, + byte[] Sid, + char[] lpName, + com.sun.jna.ptr.IntByReference cchName, + char[] ReferencedDomainName, + com.sun.jna.ptr.IntByReference cchReferencedDomainName, + com.sun.jna.ptr.PointerByReference peUse) + +
+           
+ com.sun.jna.PointerOpenSCManager(java.lang.String lpMachineName, + com.sun.jna.WString lpDatabaseName, + int dwDesiredAccess) + +
+           
+ com.sun.jna.PointerOpenService(com.sun.jna.Pointer hSCManager, + java.lang.String lpServiceName, + int dwDesiredAccess) + +
+           
+ intRegCloseKey(int hKey) + +
+           
+ intRegCreateKeyEx(int hKey, + java.lang.String lpSubKey, + int Reserved, + java.lang.String lpClass, + int dwOptions, + int samDesired, + WINBASE.SECURITY_ATTRIBUTES lpSecurityAttributes, + com.sun.jna.ptr.IntByReference phkResult, + com.sun.jna.ptr.IntByReference lpdwDisposition) + +
+           
+ intRegDeleteKey(int hKey, + java.lang.String name) + +
+           
+ intRegDeleteValue(int hKey, + java.lang.String lpValueName) + +
+           
+ intRegEnumKeyEx(int hKey, + int dwIndex, + char[] lpName, + com.sun.jna.ptr.IntByReference lpcName, + com.sun.jna.ptr.IntByReference reserved, + char[] lpClass, + com.sun.jna.ptr.IntByReference lpcClass, + WINBASE.FILETIME lpftLastWriteTime) + +
+           
+ intRegEnumValue(int hKey, + int dwIndex, + char[] lpValueName, + com.sun.jna.ptr.IntByReference lpcchValueName, + com.sun.jna.ptr.IntByReference reserved, + com.sun.jna.ptr.IntByReference lpType, + byte[] lpData, + com.sun.jna.ptr.IntByReference lpcbData) + +
+           
+ com.sun.jna.PointerRegisterServiceCtrlHandler(java.lang.String lpServiceName, + Advapi32.Handler lpHandlerProc) + +
+           
+ com.sun.jna.PointerRegisterServiceCtrlHandlerEx(java.lang.String lpServiceName, + Advapi32.HandlerEx lpHandlerProc, + com.sun.jna.Pointer lpContext) + +
+           
+ intRegOpenKeyEx(int hKey, + java.lang.String lpSubKey, + int ulOptions, + int samDesired, + com.sun.jna.ptr.IntByReference phkResult) + +
+           
+ intRegQueryValueEx(int hKey, + java.lang.String lpValueName, + com.sun.jna.ptr.IntByReference lpReserved, + com.sun.jna.ptr.IntByReference lpType, + byte[] lpData, + com.sun.jna.ptr.IntByReference lpcbData) + +
+           
+ intRegSetValueEx(int hKey, + java.lang.String lpValueName, + int Reserved, + int dwType, + byte[] lpData, + int cbData) + +
+           
+ booleanSetServiceStatus(com.sun.jna.Pointer hServiceStatus, + Advapi32.SERVICE_STATUS lpServiceStatus) + +
+           
+ booleanStartService(com.sun.jna.Pointer hService, + int dwNumServiceArgs, + char[] lpServiceArgVectors) + +
+           
+ booleanStartServiceCtrlDispatcher(com.sun.jna.Structure[] lpServiceTable) + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+INSTANCE

+
+static final Advapi32 INSTANCE
+
+
+
+
+ + + + + + + + +
+Method Detail
+ +

+LookupAccountName

+
+boolean LookupAccountName(java.lang.String lpSystemName,
+                          java.lang.String lpAccountName,
+                          byte[] Sid,
+                          com.sun.jna.ptr.IntByReference cbSid,
+                          char[] ReferencedDomainName,
+                          com.sun.jna.ptr.IntByReference cchReferencedDomainName,
+                          com.sun.jna.ptr.PointerByReference peUse)
+
+
+
+
+
+
+
+
+
+ +

+LookupAccountSid

+
+boolean LookupAccountSid(java.lang.String lpSystemName,
+                         byte[] Sid,
+                         char[] lpName,
+                         com.sun.jna.ptr.IntByReference cchName,
+                         char[] ReferencedDomainName,
+                         com.sun.jna.ptr.IntByReference cchReferencedDomainName,
+                         com.sun.jna.ptr.PointerByReference peUse)
+
+
+
+
+
+
+
+
+
+ +

+ConvertSidToStringSid

+
+boolean ConvertSidToStringSid(byte[] Sid,
+                              com.sun.jna.ptr.PointerByReference StringSid)
+
+
+
+
+
+
+
+
+
+ +

+ConvertStringSidToSid

+
+boolean ConvertStringSidToSid(java.lang.String StringSid,
+                              com.sun.jna.ptr.PointerByReference Sid)
+
+
+
+
+
+
+
+
+
+ +

+OpenSCManager

+
+com.sun.jna.Pointer OpenSCManager(java.lang.String lpMachineName,
+                                  com.sun.jna.WString lpDatabaseName,
+                                  int dwDesiredAccess)
+
+
+
+
+
+
+
+
+
+ +

+CloseServiceHandle

+
+boolean CloseServiceHandle(com.sun.jna.Pointer hSCObject)
+
+
+
+
+
+
+
+
+
+ +

+OpenService

+
+com.sun.jna.Pointer OpenService(com.sun.jna.Pointer hSCManager,
+                                java.lang.String lpServiceName,
+                                int dwDesiredAccess)
+
+
+
+
+
+
+
+
+
+ +

+StartService

+
+boolean StartService(com.sun.jna.Pointer hService,
+                     int dwNumServiceArgs,
+                     char[] lpServiceArgVectors)
+
+
+
+
+
+
+
+
+
+ +

+ControlService

+
+boolean ControlService(com.sun.jna.Pointer hService,
+                       int dwControl,
+                       Advapi32.SERVICE_STATUS lpServiceStatus)
+
+
+
+
+
+
+
+
+
+ +

+StartServiceCtrlDispatcher

+
+boolean StartServiceCtrlDispatcher(com.sun.jna.Structure[] lpServiceTable)
+
+
+
+
+
+
+
+
+
+ +

+RegisterServiceCtrlHandler

+
+com.sun.jna.Pointer RegisterServiceCtrlHandler(java.lang.String lpServiceName,
+                                               Advapi32.Handler lpHandlerProc)
+
+
+
+
+
+
+
+
+
+ +

+RegisterServiceCtrlHandlerEx

+
+com.sun.jna.Pointer RegisterServiceCtrlHandlerEx(java.lang.String lpServiceName,
+                                                 Advapi32.HandlerEx lpHandlerProc,
+                                                 com.sun.jna.Pointer lpContext)
+
+
+
+
+
+
+
+
+
+ +

+SetServiceStatus

+
+boolean SetServiceStatus(com.sun.jna.Pointer hServiceStatus,
+                         Advapi32.SERVICE_STATUS lpServiceStatus)
+
+
+
+
+
+
+
+
+
+ +

+CreateService

+
+com.sun.jna.Pointer CreateService(com.sun.jna.Pointer hSCManager,
+                                  java.lang.String lpServiceName,
+                                  java.lang.String lpDisplayName,
+                                  int dwDesiredAccess,
+                                  int dwServiceType,
+                                  int dwStartType,
+                                  int dwErrorControl,
+                                  java.lang.String lpBinaryPathName,
+                                  java.lang.String lpLoadOrderGroup,
+                                  com.sun.jna.ptr.IntByReference lpdwTagId,
+                                  java.lang.String lpDependencies,
+                                  java.lang.String lpServiceStartName,
+                                  java.lang.String lpPassword)
+
+
+
+
+
+
+
+
+
+ +

+DeleteService

+
+boolean DeleteService(com.sun.jna.Pointer hService)
+
+
+
+
+
+
+
+
+
+ +

+ChangeServiceConfig2

+
+boolean ChangeServiceConfig2(com.sun.jna.Pointer hService,
+                             int dwInfoLevel,
+                             Advapi32.ChangeServiceConfig2Info lpInfo)
+
+
+
+
+
+
+
+
+
+ +

+RegOpenKeyEx

+
+int RegOpenKeyEx(int hKey,
+                 java.lang.String lpSubKey,
+                 int ulOptions,
+                 int samDesired,
+                 com.sun.jna.ptr.IntByReference phkResult)
+
+
+
+
+
+
+
+
+
+ +

+RegQueryValueEx

+
+int RegQueryValueEx(int hKey,
+                    java.lang.String lpValueName,
+                    com.sun.jna.ptr.IntByReference lpReserved,
+                    com.sun.jna.ptr.IntByReference lpType,
+                    byte[] lpData,
+                    com.sun.jna.ptr.IntByReference lpcbData)
+
+
+
+
+
+
+
+
+
+ +

+RegCloseKey

+
+int RegCloseKey(int hKey)
+
+
+
+
+
+
+
+
+
+ +

+RegDeleteValue

+
+int RegDeleteValue(int hKey,
+                   java.lang.String lpValueName)
+
+
+
+
+
+
+
+
+
+ +

+RegSetValueEx

+
+int RegSetValueEx(int hKey,
+                  java.lang.String lpValueName,
+                  int Reserved,
+                  int dwType,
+                  byte[] lpData,
+                  int cbData)
+
+
+
+
+
+
+
+
+
+ +

+RegCreateKeyEx

+
+int RegCreateKeyEx(int hKey,
+                   java.lang.String lpSubKey,
+                   int Reserved,
+                   java.lang.String lpClass,
+                   int dwOptions,
+                   int samDesired,
+                   WINBASE.SECURITY_ATTRIBUTES lpSecurityAttributes,
+                   com.sun.jna.ptr.IntByReference phkResult,
+                   com.sun.jna.ptr.IntByReference lpdwDisposition)
+
+
+
+
+
+
+
+
+
+ +

+RegDeleteKey

+
+int RegDeleteKey(int hKey,
+                 java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+RegEnumKeyEx

+
+int RegEnumKeyEx(int hKey,
+                 int dwIndex,
+                 char[] lpName,
+                 com.sun.jna.ptr.IntByReference lpcName,
+                 com.sun.jna.ptr.IntByReference reserved,
+                 char[] lpClass,
+                 com.sun.jna.ptr.IntByReference lpcClass,
+                 WINBASE.FILETIME lpftLastWriteTime)
+
+
+
+
+
+
+
+
+
+ +

+RegEnumValue

+
+int RegEnumValue(int hKey,
+                 int dwIndex,
+                 char[] lpValueName,
+                 com.sun.jna.ptr.IntByReference lpcchValueName,
+                 com.sun.jna.ptr.IntByReference reserved,
+                 com.sun.jna.ptr.IntByReference lpType,
+                 byte[] lpData,
+                 com.sun.jna.ptr.IntByReference lpcbData)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Options.html b/build/javadoc/everything/processing/app/windows/Options.html new file mode 100644 index 000000000..eb55d0f52 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Options.html @@ -0,0 +1,198 @@ + + + + + +Options + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface Options

+
+
+
public interface Options
+ + +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+static java.util.Map<java.lang.String,java.lang.Object>UNICODE_OPTIONS + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+UNICODE_OPTIONS

+
+static final java.util.Map<java.lang.String,java.lang.Object> UNICODE_OPTIONS
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Platform.html b/build/javadoc/everything/processing/app/windows/Platform.html new file mode 100644 index 000000000..3206e30c4 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Platform.html @@ -0,0 +1,382 @@ + + + + + +Platform + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class Platform

+
+java.lang.Object
+  extended by processing.app.Platform
+      extended by processing.app.windows.Platform
+
+
+
+
public class Platform
extends Platform
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Platform() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.io.FilegetDefaultSketchbookFolder() + +
+           
+ java.io.FilegetSettingsFolder() + +
+           
+ voidinit(Base base) + +
+           
+ voidopenFolder(java.io.File file) + +
+           
+ booleanopenFolderAvailable() + +
+           
+ voidopenURL(java.lang.String url) + +
+           
+ + + + + + + +
Methods inherited from class processing.app.Platform
setLookAndFeel
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Platform

+
+public Platform()
+
+
+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init(Base base)
+
+
+
Overrides:
init in class Platform
+
+
+
+
+
+
+ +

+getSettingsFolder

+
+public java.io.File getSettingsFolder()
+                               throws java.lang.Exception
+
+
+
Overrides:
getSettingsFolder in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+getDefaultSketchbookFolder

+
+public java.io.File getDefaultSketchbookFolder()
+                                        throws java.lang.Exception
+
+
+
Overrides:
getDefaultSketchbookFolder in class Platform
+
+
+ +
Returns:
null if not overridden, which will cause a prompt to show instead. +
Throws: +
java.lang.Exception
+
+
+
+ +

+openURL

+
+public void openURL(java.lang.String url)
+             throws java.lang.Exception
+
+
+
Overrides:
openURL in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+
+ +

+openFolderAvailable

+
+public boolean openFolderAvailable()
+
+
+
Overrides:
openFolderAvailable in class Platform
+
+
+
+
+
+
+ +

+openFolder

+
+public void openFolder(java.io.File file)
+                throws java.lang.Exception
+
+
+
Overrides:
openFolder in class Platform
+
+
+ +
Throws: +
java.lang.Exception
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Registry.REGISTRY_ROOT_KEY.html b/build/javadoc/everything/processing/app/windows/Registry.REGISTRY_ROOT_KEY.html new file mode 100644 index 000000000..e2874ef7c --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Registry.REGISTRY_ROOT_KEY.html @@ -0,0 +1,350 @@ + + + + + +Registry.REGISTRY_ROOT_KEY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Enum Registry.REGISTRY_ROOT_KEY

+
+java.lang.Object
+  extended by java.lang.Enum<Registry.REGISTRY_ROOT_KEY>
+      extended by processing.app.windows.Registry.REGISTRY_ROOT_KEY
+
+
+
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Registry.REGISTRY_ROOT_KEY>
+
+
+
Enclosing class:
Registry
+
+
+
+
public static enum Registry.REGISTRY_ROOT_KEY
extends java.lang.Enum<Registry.REGISTRY_ROOT_KEY>
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + +
+Enum Constant Summary
CLASSES_ROOT + +
+           
CURRENT_USER + +
+           
LOCAL_MACHINE + +
+           
USERS + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static Registry.REGISTRY_ROOT_KEYvalueOf(java.lang.String name) + +
+          Returns the enum constant of this type with the specified name.
+static Registry.REGISTRY_ROOT_KEY[]values() + +
+          Returns an array containing the constants of this enum type, in +the order they're declared.
+ + + + + + + +
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Enum Constant Detail
+ +

+CLASSES_ROOT

+
+public static final Registry.REGISTRY_ROOT_KEY CLASSES_ROOT
+
+
+
+
+
+ +

+CURRENT_USER

+
+public static final Registry.REGISTRY_ROOT_KEY CURRENT_USER
+
+
+
+
+
+ +

+LOCAL_MACHINE

+
+public static final Registry.REGISTRY_ROOT_KEY LOCAL_MACHINE
+
+
+
+
+
+ +

+USERS

+
+public static final Registry.REGISTRY_ROOT_KEY USERS
+
+
+
+
+ + + + + + + + +
+Method Detail
+ +

+values

+
+public static final Registry.REGISTRY_ROOT_KEY[] values()
+
+
Returns an array containing the constants of this enum type, in +the order they're declared. This method may be used to iterate +over the constants as follows: +
+for(Registry.REGISTRY_ROOT_KEY c : Registry.REGISTRY_ROOT_KEY.values())
+        System.out.println(c);
+
+

+

+ +
Returns:
an array containing the constants of this enum type, in +the order they're declared
+
+
+
+ +

+valueOf

+
+public static Registry.REGISTRY_ROOT_KEY valueOf(java.lang.String name)
+
+
Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.) +

+

+
Parameters:
name - the name of the enum constant to be returned. +
Returns:
the enum constant with the specified name +
Throws: +
java.lang.IllegalArgumentException - if this enum type has no constant +with the specified name
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/Registry.html b/build/javadoc/everything/processing/app/windows/Registry.html new file mode 100644 index 000000000..adcf232a4 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/Registry.html @@ -0,0 +1,541 @@ + + + + + +Registry + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class Registry

+
+java.lang.Object
+  extended by processing.app.windows.Registry
+
+
+
+
public class Registry
extends java.lang.Object
+ + +

+Methods for accessing the Windows Registry. Only String and DWORD values supported at the moment. +

+ +

+


+ +

+ + + + + + + + + + + +
+Nested Class Summary
+static classRegistry.REGISTRY_ROOT_KEY + +
+           
+  + + + + + + + + + + +
+Constructor Summary
Registry() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static booleancreateKey(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String parent, + java.lang.String name) + +
+          Create a new key.
+static booleandeleteKey(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String parent, + java.lang.String name) + +
+          Delete a key.
+static booleandeleteValue(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String subKeyName, + java.lang.String name) + +
+          Delete a value.
+static intgetIntValue(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String subKeyName, + java.lang.String name) + +
+          Read an int value.
+static java.lang.StringgetStringValue(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String subKeyName, + java.lang.String name) + +
+          Read a String value.
+static java.lang.String[]getSubKeys(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String parent) + +
+          Get all sub keys of a key.
+static java.util.TreeMap<java.lang.String,java.lang.Object>getValues(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String key) + +
+          Get all values under a key.
+static voidmain(java.lang.String[] args) + +
+          Testing.
+static booleansetIntValue(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String subKeyName, + java.lang.String name, + int value) + +
+          Writes an int value.
+static booleansetStringValue(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String subKeyName, + java.lang.String name, + java.lang.String value) + +
+          Writes a String value.
+static booleanvalueExists(Registry.REGISTRY_ROOT_KEY rootKey, + java.lang.String subKeyName, + java.lang.String name) + +
+          Check for existence of a value.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Registry

+
+public Registry()
+
+
+ + + + + + + + +
+Method Detail
+ +

+main

+
+public static void main(java.lang.String[] args)
+                 throws java.lang.Exception
+
+
Testing. +

+

+
Parameters:
args - arguments +
Throws: +
java.lang.Exception - on error
+
+
+
+ +

+getStringValue

+
+public static java.lang.String getStringValue(Registry.REGISTRY_ROOT_KEY rootKey,
+                                              java.lang.String subKeyName,
+                                              java.lang.String name)
+                                       throws java.io.UnsupportedEncodingException
+
+
Read a String value. +

+

+
Parameters:
rootKey - root key
subKeyName - key name
name - value name +
Returns:
String or null +
Throws: +
java.io.UnsupportedEncodingException - on error
+
+
+
+ +

+getIntValue

+
+public static int getIntValue(Registry.REGISTRY_ROOT_KEY rootKey,
+                              java.lang.String subKeyName,
+                              java.lang.String name)
+
+
Read an int value. +

+

+
Parameters:
rootKey - root key
subKeyName - key name
name - value name +
Returns:
int or 0
+
+
+
+ +

+deleteValue

+
+public static boolean deleteValue(Registry.REGISTRY_ROOT_KEY rootKey,
+                                  java.lang.String subKeyName,
+                                  java.lang.String name)
+
+
Delete a value. +

+

+
Parameters:
rootKey - root key
subKeyName - key name
name - value name +
Returns:
true on success
+
+
+
+ +

+setStringValue

+
+public static boolean setStringValue(Registry.REGISTRY_ROOT_KEY rootKey,
+                                     java.lang.String subKeyName,
+                                     java.lang.String name,
+                                     java.lang.String value)
+                              throws java.io.UnsupportedEncodingException
+
+
Writes a String value. +

+

+
Parameters:
rootKey - root key
subKeyName - key name
name - value name
value - value +
Returns:
true on success +
Throws: +
java.io.UnsupportedEncodingException - on error
+
+
+
+ +

+setIntValue

+
+public static boolean setIntValue(Registry.REGISTRY_ROOT_KEY rootKey,
+                                  java.lang.String subKeyName,
+                                  java.lang.String name,
+                                  int value)
+
+
Writes an int value. +

+

+
Parameters:
rootKey - root key
subKeyName - key name
name - value name
value - value +
Returns:
true on success
+
+
+
+ +

+valueExists

+
+public static boolean valueExists(Registry.REGISTRY_ROOT_KEY rootKey,
+                                  java.lang.String subKeyName,
+                                  java.lang.String name)
+
+
Check for existence of a value. +

+

+
Parameters:
rootKey - root key
subKeyName - key name
name - value name +
Returns:
true if exists
+
+
+
+ +

+createKey

+
+public static boolean createKey(Registry.REGISTRY_ROOT_KEY rootKey,
+                                java.lang.String parent,
+                                java.lang.String name)
+
+
Create a new key. +

+

+
Parameters:
rootKey - root key
parent - name of parent key
name - key name +
Returns:
true on success
+
+
+
+ +

+deleteKey

+
+public static boolean deleteKey(Registry.REGISTRY_ROOT_KEY rootKey,
+                                java.lang.String parent,
+                                java.lang.String name)
+
+
Delete a key. +

+

+
Parameters:
rootKey - root key
parent - name of parent key
name - key name +
Returns:
true on success
+
+
+
+ +

+getSubKeys

+
+public static java.lang.String[] getSubKeys(Registry.REGISTRY_ROOT_KEY rootKey,
+                                            java.lang.String parent)
+
+
Get all sub keys of a key. +

+

+
Parameters:
rootKey - root key
parent - key name +
Returns:
array with all sub key names
+
+
+
+ +

+getValues

+
+public static java.util.TreeMap<java.lang.String,java.lang.Object> getValues(Registry.REGISTRY_ROOT_KEY rootKey,
+                                                                             java.lang.String key)
+                                                                      throws java.io.UnsupportedEncodingException
+
+
Get all values under a key. +

+

+
Parameters:
rootKey - root key
key - jey name +
Returns:
TreeMap with name and value pairs +
Throws: +
java.io.UnsupportedEncodingException - on error
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/WINBASE.FILETIME.html b/build/javadoc/everything/processing/app/windows/WINBASE.FILETIME.html new file mode 100644 index 000000000..bf24e3436 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/WINBASE.FILETIME.html @@ -0,0 +1,313 @@ + + + + + +WINBASE.FILETIME + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class WINBASE.FILETIME

+
+java.lang.Object
+  extended by com.sun.jna.Structure
+      extended by processing.app.windows.WINBASE.FILETIME
+
+
+
Enclosing interface:
WINBASE
+
+
+
+
public static class WINBASE.FILETIME
extends com.sun.jna.Structure
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class com.sun.jna.Structure
com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue
+  + + + + + + + + + + + + + + + +
+Field Summary
+ intdwHighDateTime + +
+           
+ intdwLowDateTime + +
+           
+ + + + + + + +
Fields inherited from class com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE
+  + + + + + + + + + + +
+Constructor Summary
WINBASE.FILETIME() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class com.sun.jna.Structure
clear, equals, getPointer, hashCode, newInstance, read, readField, size, toArray, toArray, toString, write, writeField
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+dwLowDateTime

+
+public int dwLowDateTime
+
+
+
+
+
+ +

+dwHighDateTime

+
+public int dwHighDateTime
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+WINBASE.FILETIME

+
+public WINBASE.FILETIME()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/WINBASE.SECURITY_ATTRIBUTES.html b/build/javadoc/everything/processing/app/windows/WINBASE.SECURITY_ATTRIBUTES.html new file mode 100644 index 000000000..095537a9d --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/WINBASE.SECURITY_ATTRIBUTES.html @@ -0,0 +1,331 @@ + + + + + +WINBASE.SECURITY_ATTRIBUTES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Class WINBASE.SECURITY_ATTRIBUTES

+
+java.lang.Object
+  extended by com.sun.jna.Structure
+      extended by processing.app.windows.WINBASE.SECURITY_ATTRIBUTES
+
+
+
Enclosing interface:
WINBASE
+
+
+
+
public static class WINBASE.SECURITY_ATTRIBUTES
extends com.sun.jna.Structure
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class com.sun.jna.Structure
com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue
+  + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanbInheritHandle + +
+           
+ com.sun.jna.PointerlpSecurityDescriptor + +
+           
+ intnLength + +
+           
+ + + + + + + +
Fields inherited from class com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE
+  + + + + + + + + + + +
+Constructor Summary
WINBASE.SECURITY_ATTRIBUTES() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class com.sun.jna.Structure
clear, equals, getPointer, hashCode, newInstance, read, readField, size, toArray, toArray, toString, write, writeField
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+nLength

+
+public int nLength
+
+
+
+
+
+ +

+lpSecurityDescriptor

+
+public com.sun.jna.Pointer lpSecurityDescriptor
+
+
+
+
+
+ +

+bInheritHandle

+
+public boolean bInheritHandle
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+WINBASE.SECURITY_ATTRIBUTES

+
+public WINBASE.SECURITY_ATTRIBUTES()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/WINBASE.html b/build/javadoc/everything/processing/app/windows/WINBASE.html new file mode 100644 index 000000000..abdea6576 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/WINBASE.html @@ -0,0 +1,187 @@ + + + + + +WINBASE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface WINBASE

+
+
+
public interface WINBASE
+ + +

+


+ +

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+static classWINBASE.FILETIME + +
+           
+static classWINBASE.SECURITY_ATTRIBUTES + +
+           
+  +

+ +


+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/WINERROR.html b/build/javadoc/everything/processing/app/windows/WINERROR.html new file mode 100644 index 000000000..ceb2f3366 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/WINERROR.html @@ -0,0 +1,252 @@ + + + + + +WINERROR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface WINERROR

+
+
+
public interface WINERROR
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intERROR_FILE_NOT_FOUND + +
+           
+static intERROR_MORE_DATA + +
+           
+static intERROR_SUCCESS + +
+           
+static intNO_ERROR + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+ERROR_SUCCESS

+
+static final int ERROR_SUCCESS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NO_ERROR

+
+static final int NO_ERROR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_FILE_NOT_FOUND

+
+static final int ERROR_FILE_NOT_FOUND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_MORE_DATA

+
+static final int ERROR_MORE_DATA
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/WINNT.html b/build/javadoc/everything/processing/app/windows/WINNT.html new file mode 100644 index 000000000..6d1eed5aa --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/WINNT.html @@ -0,0 +1,882 @@ + + + + + +WINNT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface WINNT

+
+
+
public interface WINNT
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intDELETE + +
+           
+static intGENERIC_EXECUTE + +
+           
+static intKEY_CREATE_LINK + +
+           
+static intKEY_CREATE_SUB_KEY + +
+           
+static intKEY_ENUMERATE_SUB_KEYS + +
+           
+static intKEY_NOTIFY + +
+           
+static intKEY_QUERY_VALUE + +
+           
+static intKEY_READ + +
+           
+static intKEY_SET_VALUE + +
+           
+static intKEY_WRITE + +
+           
+static intREAD_CONTROL + +
+           
+static intREG_BINARY + +
+           
+static intREG_DWORD + +
+           
+static intREG_DWORD_BIG_ENDIAN + +
+           
+static intREG_DWORD_LITTLE_ENDIAN + +
+           
+static intREG_EXPAND_SZ + +
+           
+static intREG_FULL_RESOURCE_DESCRIPTOR + +
+           
+static intREG_LINK + +
+           
+static intREG_MULTI_SZ + +
+           
+static intREG_NONE + +
+           
+static intREG_OPTION_BACKUP_RESTORE + +
+           
+static intREG_OPTION_CREATE_LINK + +
+           
+static intREG_OPTION_NON_VOLATILE + +
+           
+static intREG_OPTION_OPEN_LINK + +
+           
+static intREG_OPTION_RESERVED + +
+           
+static intREG_OPTION_VOLATILE + +
+           
+static intREG_RESOURCE_LIST + +
+           
+static intREG_RESOURCE_REQUIREMENTS_LIST + +
+           
+static intREG_SZ + +
+           
+static intSERVICE_WIN32_OWN_PROCESS + +
+           
+static intSPECIFIC_RIGHTS_ALL + +
+           
+static intSTANDARD_RIGHTS_ALL + +
+           
+static intSTANDARD_RIGHTS_EXECUTE + +
+           
+static intSTANDARD_RIGHTS_READ + +
+           
+static intSTANDARD_RIGHTS_REQUIRED + +
+           
+static intSTANDARD_RIGHTS_WRITE + +
+           
+static intSYNCHRONIZE + +
+           
+static intWRITE_DAC + +
+           
+static intWRITE_OWNER + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+DELETE

+
+static final int DELETE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+READ_CONTROL

+
+static final int READ_CONTROL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WRITE_DAC

+
+static final int WRITE_DAC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WRITE_OWNER

+
+static final int WRITE_OWNER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SYNCHRONIZE

+
+static final int SYNCHRONIZE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STANDARD_RIGHTS_REQUIRED

+
+static final int STANDARD_RIGHTS_REQUIRED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STANDARD_RIGHTS_READ

+
+static final int STANDARD_RIGHTS_READ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STANDARD_RIGHTS_WRITE

+
+static final int STANDARD_RIGHTS_WRITE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STANDARD_RIGHTS_EXECUTE

+
+static final int STANDARD_RIGHTS_EXECUTE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STANDARD_RIGHTS_ALL

+
+static final int STANDARD_RIGHTS_ALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPECIFIC_RIGHTS_ALL

+
+static final int SPECIFIC_RIGHTS_ALL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GENERIC_EXECUTE

+
+static final int GENERIC_EXECUTE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SERVICE_WIN32_OWN_PROCESS

+
+static final int SERVICE_WIN32_OWN_PROCESS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_QUERY_VALUE

+
+static final int KEY_QUERY_VALUE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_SET_VALUE

+
+static final int KEY_SET_VALUE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_CREATE_SUB_KEY

+
+static final int KEY_CREATE_SUB_KEY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_ENUMERATE_SUB_KEYS

+
+static final int KEY_ENUMERATE_SUB_KEYS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_NOTIFY

+
+static final int KEY_NOTIFY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_CREATE_LINK

+
+static final int KEY_CREATE_LINK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_READ

+
+static final int KEY_READ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+KEY_WRITE

+
+static final int KEY_WRITE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_NONE

+
+static final int REG_NONE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_SZ

+
+static final int REG_SZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_EXPAND_SZ

+
+static final int REG_EXPAND_SZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_BINARY

+
+static final int REG_BINARY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_DWORD

+
+static final int REG_DWORD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_DWORD_LITTLE_ENDIAN

+
+static final int REG_DWORD_LITTLE_ENDIAN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_DWORD_BIG_ENDIAN

+
+static final int REG_DWORD_BIG_ENDIAN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_LINK

+
+static final int REG_LINK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_MULTI_SZ

+
+static final int REG_MULTI_SZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_RESOURCE_LIST

+
+static final int REG_RESOURCE_LIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_FULL_RESOURCE_DESCRIPTOR

+
+static final int REG_FULL_RESOURCE_DESCRIPTOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_RESOURCE_REQUIREMENTS_LIST

+
+static final int REG_RESOURCE_REQUIREMENTS_LIST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_OPTION_RESERVED

+
+static final int REG_OPTION_RESERVED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_OPTION_NON_VOLATILE

+
+static final int REG_OPTION_NON_VOLATILE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_OPTION_VOLATILE

+
+static final int REG_OPTION_VOLATILE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_OPTION_CREATE_LINK

+
+static final int REG_OPTION_CREATE_LINK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_OPTION_BACKUP_RESTORE

+
+static final int REG_OPTION_BACKUP_RESTORE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REG_OPTION_OPEN_LINK

+
+static final int REG_OPTION_OPEN_LINK
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/WINREG.html b/build/javadoc/everything/processing/app/windows/WINREG.html new file mode 100644 index 000000000..aab67ecf2 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/WINREG.html @@ -0,0 +1,252 @@ + + + + + +WINREG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.app.windows +
+Interface WINREG

+
+
+
public interface WINREG
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intHKEY_CLASSES_ROOT + +
+           
+static intHKEY_CURRENT_USER + +
+           
+static intHKEY_LOCAL_MACHINE + +
+           
+static intHKEY_USERS + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+HKEY_CLASSES_ROOT

+
+static final int HKEY_CLASSES_ROOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HKEY_CURRENT_USER

+
+static final int HKEY_CURRENT_USER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HKEY_LOCAL_MACHINE

+
+static final int HKEY_LOCAL_MACHINE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HKEY_USERS

+
+static final int HKEY_USERS
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/package-frame.html b/build/javadoc/everything/processing/app/windows/package-frame.html new file mode 100644 index 000000000..c3fcbb1be --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/package-frame.html @@ -0,0 +1,83 @@ + + + + + +processing.app.windows + + + + + + + + + + + +processing.app.windows + + + + +
+Interfaces  + +
+Advapi32 +
+Advapi32.Handler +
+Advapi32.HandlerEx +
+Advapi32.SERVICE_MAIN_FUNCTION +
+Options +
+WINBASE +
+WINERROR +
+WINNT +
+WINREG
+ + + + + + +
+Classes  + +
+Advapi32.ChangeServiceConfig2Info +
+Advapi32.SERVICE_DESCRIPTION +
+Advapi32.SERVICE_STATUS +
+Advapi32.SERVICE_TABLE_ENTRY +
+Platform +
+Registry +
+WINBASE.FILETIME +
+WINBASE.SECURITY_ATTRIBUTES
+ + + + + + +
+Enums  + +
+Registry.REGISTRY_ROOT_KEY
+ + + + diff --git a/build/javadoc/everything/processing/app/windows/package-summary.html b/build/javadoc/everything/processing/app/windows/package-summary.html new file mode 100644 index 000000000..ca5e321be --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/package-summary.html @@ -0,0 +1,239 @@ + + + + + +processing.app.windows + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.app.windows +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Interface Summary
Advapi32 
Advapi32.Handler 
Advapi32.HandlerEx 
Advapi32.SERVICE_MAIN_FUNCTION 
Options 
WINBASE 
WINERROR 
WINNT 
WINREG 
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
Advapi32.ChangeServiceConfig2Info 
Advapi32.SERVICE_DESCRIPTION 
Advapi32.SERVICE_STATUS 
Advapi32.SERVICE_TABLE_ENTRY 
Platform 
RegistryMethods for accessing the Windows Registry.
WINBASE.FILETIME 
WINBASE.SECURITY_ATTRIBUTES 
+  + +

+ + + + + + + + + +
+Enum Summary
Registry.REGISTRY_ROOT_KEY 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/app/windows/package-tree.html b/build/javadoc/everything/processing/app/windows/package-tree.html new file mode 100644 index 000000000..ec31809c0 --- /dev/null +++ b/build/javadoc/everything/processing/app/windows/package-tree.html @@ -0,0 +1,187 @@ + + + + + +processing.app.windows Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.app.windows +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+
    +
  • com.sun.jna.AltCallingConvention +
  • com.sun.jna.Callback +
  • com.sun.jna.Library
      +
    • com.sun.jna.win32.StdCallLibrary (also extends com.sun.jna.win32.StdCall) + +
    +
  • processing.app.windows.Options
  • processing.app.windows.WINBASE
  • processing.app.windows.WINERROR
  • processing.app.windows.WINNT
  • processing.app.windows.WINREG
+

+Enum Hierarchy +

+
    +
  • java.lang.Object
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) + +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/BaseObject.html b/build/javadoc/everything/processing/candy/BaseObject.html new file mode 100644 index 000000000..25efee405 --- /dev/null +++ b/build/javadoc/everything/processing/candy/BaseObject.html @@ -0,0 +1,384 @@ + + + + + +BaseObject + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class BaseObject

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
Direct Known Subclasses:
Circle, Ellipse, Gradient, Line, Path, Poly, Rect, SVG
+
+
+
+
public class BaseObject
extends PShape
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
BaseObject(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ PShapegetChild(java.lang.String name) + +
+          Get a particular element based on its SVG ID.
+ voidignoreStyles() + +
+          Overrides SVG-set styles and uses PGraphics styles and colors.
+ voidignoreStyles(boolean state) + +
+          Enables or disables style information (fill and stroke) set in the file.
+ voidprint() + +
+          Prints out the SVG document useful for parsing
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+BaseObject

+
+public BaseObject(BaseObject parent,
+                  XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+ignoreStyles

+
+public void ignoreStyles()
+
+
Overrides SVG-set styles and uses PGraphics styles and colors. + Identical to ignoreStyles(true). +

+

+
+
+
+
+ +

+ignoreStyles

+
+public void ignoreStyles(boolean state)
+
+
Enables or disables style information (fill and stroke) set in the file. +

+

+
Parameters:
state - true to use user-specified stroke/fill, false for svg version
+
+
+
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Specified by:
drawImpl in class PShape
+
+
+
+
+
+
+ +

+getChild

+
+public PShape getChild(java.lang.String name)
+
+
Get a particular element based on its SVG ID. When editing SVG by hand, + this is the id="" tag on any SVG element. When editing from Illustrator, + these IDs can be edited by expanding the layers palette. The names used + in the layers palette, both for the layers or the shapes and groups + beneath them can be used here. +
+ // This code grabs "Layer 3" and the shapes beneath it.
+ SVG layer3 = svg.get("Layer 3");
+ 
+

+

+
Overrides:
getChild in class PShape
+
+
+
+
+
+
+ +

+print

+
+public void print()
+
+
Prints out the SVG document useful for parsing +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Circle.html b/build/javadoc/everything/processing/candy/Circle.html new file mode 100644 index 000000000..ffe03c0b2 --- /dev/null +++ b/build/javadoc/everything/processing/candy/Circle.html @@ -0,0 +1,295 @@ + + + + + +Circle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Circle

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Circle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class Circle
extends BaseObject
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Circle(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Circle

+
+public Circle(BaseObject parent,
+              XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Ellipse.html b/build/javadoc/everything/processing/candy/Ellipse.html new file mode 100644 index 000000000..d5f5d883c --- /dev/null +++ b/build/javadoc/everything/processing/candy/Ellipse.html @@ -0,0 +1,295 @@ + + + + + +Ellipse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Ellipse

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Ellipse
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class Ellipse
extends BaseObject
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Ellipse(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Ellipse

+
+public Ellipse(BaseObject parent,
+               XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Gradient.html b/build/javadoc/everything/processing/candy/Gradient.html new file mode 100644 index 000000000..5941acb13 --- /dev/null +++ b/build/javadoc/everything/processing/candy/Gradient.html @@ -0,0 +1,298 @@ + + + + + +Gradient + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Gradient

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Gradient
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
Direct Known Subclasses:
LinearGradient, RadialGradient
+
+
+
+
public abstract class Gradient
extends BaseObject
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Gradient(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+abstract  voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Gradient

+
+public Gradient(BaseObject parent,
+                XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public abstract void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Line.html b/build/javadoc/everything/processing/candy/Line.html new file mode 100644 index 000000000..474b27cab --- /dev/null +++ b/build/javadoc/everything/processing/candy/Line.html @@ -0,0 +1,295 @@ + + + + + +Line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Line

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Line
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class Line
extends BaseObject
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Line(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Line

+
+public Line(BaseObject parent,
+            XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/LinearGradient.html b/build/javadoc/everything/processing/candy/LinearGradient.html new file mode 100644 index 000000000..cffc271dc --- /dev/null +++ b/build/javadoc/everything/processing/candy/LinearGradient.html @@ -0,0 +1,296 @@ + + + + + +LinearGradient + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class LinearGradient

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Gradient
+              extended by processing.candy.LinearGradient
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class LinearGradient
extends Gradient
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
LinearGradient(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+LinearGradient

+
+public LinearGradient(BaseObject parent,
+                      XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Specified by:
drawImpl in class Gradient
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/LinearGradientPaint.LinearGradientContext.html b/build/javadoc/everything/processing/candy/LinearGradientPaint.LinearGradientContext.html new file mode 100644 index 000000000..99e86a3cc --- /dev/null +++ b/build/javadoc/everything/processing/candy/LinearGradientPaint.LinearGradientContext.html @@ -0,0 +1,311 @@ + + + + + +LinearGradientPaint.LinearGradientContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class LinearGradientPaint.LinearGradientContext

+
+java.lang.Object
+  extended by processing.candy.LinearGradientPaint.LinearGradientContext
+
+
+
All Implemented Interfaces:
java.awt.PaintContext
+
+
+
Enclosing class:
LinearGradientPaint
+
+
+
+
public class LinearGradientPaint.LinearGradientContext
extends java.lang.Object
implements java.awt.PaintContext
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
LinearGradientPaint.LinearGradientContext(float tx1, + float ty1, + float tx2, + float ty2) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddispose() + +
+           
+ java.awt.image.ColorModelgetColorModel() + +
+           
+ java.awt.image.RastergetRaster(int x, + int y, + int w, + int h) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+LinearGradientPaint.LinearGradientContext

+
+public LinearGradientPaint.LinearGradientContext(float tx1,
+                                                 float ty1,
+                                                 float tx2,
+                                                 float ty2)
+
+
+ + + + + + + + +
+Method Detail
+ +

+dispose

+
+public void dispose()
+
+
+
Specified by:
dispose in interface java.awt.PaintContext
+
+
+
+
+
+
+ +

+getColorModel

+
+public java.awt.image.ColorModel getColorModel()
+
+
+
Specified by:
getColorModel in interface java.awt.PaintContext
+
+
+
+
+
+
+ +

+getRaster

+
+public java.awt.image.Raster getRaster(int x,
+                                       int y,
+                                       int w,
+                                       int h)
+
+
+
Specified by:
getRaster in interface java.awt.PaintContext
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/LinearGradientPaint.html b/build/javadoc/everything/processing/candy/LinearGradientPaint.html new file mode 100644 index 000000000..fb79356f9 --- /dev/null +++ b/build/javadoc/everything/processing/candy/LinearGradientPaint.html @@ -0,0 +1,331 @@ + + + + + +LinearGradientPaint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class LinearGradientPaint

+
+java.lang.Object
+  extended by processing.candy.LinearGradientPaint
+
+
+
All Implemented Interfaces:
java.awt.Paint, java.awt.Transparency
+
+
+
+
public class LinearGradientPaint
extends java.lang.Object
implements java.awt.Paint
+ + +

+


+ +

+ + + + + + + + + + + +
+Nested Class Summary
+ classLinearGradientPaint.LinearGradientContext + +
+           
+ + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
+  + + + + + + + + + + +
+Constructor Summary
LinearGradientPaint(float x1, + float y1, + float x2, + float y2, + float[] offset, + int[] color, + int count, + float opacity) + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+ java.awt.PaintContextcreateContext(java.awt.image.ColorModel cm, + java.awt.Rectangle deviceBounds, + java.awt.geom.Rectangle2D userBounds, + java.awt.geom.AffineTransform xform, + java.awt.RenderingHints hints) + +
+           
+ intgetTransparency() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+LinearGradientPaint

+
+public LinearGradientPaint(float x1,
+                           float y1,
+                           float x2,
+                           float y2,
+                           float[] offset,
+                           int[] color,
+                           int count,
+                           float opacity)
+
+
+ + + + + + + + +
+Method Detail
+ +

+createContext

+
+public java.awt.PaintContext createContext(java.awt.image.ColorModel cm,
+                                           java.awt.Rectangle deviceBounds,
+                                           java.awt.geom.Rectangle2D userBounds,
+                                           java.awt.geom.AffineTransform xform,
+                                           java.awt.RenderingHints hints)
+
+
+
Specified by:
createContext in interface java.awt.Paint
+
+
+
+
+
+
+ +

+getTransparency

+
+public int getTransparency()
+
+
+
Specified by:
getTransparency in interface java.awt.Transparency
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Path.html b/build/javadoc/everything/processing/candy/Path.html new file mode 100644 index 000000000..e9f57b14c --- /dev/null +++ b/build/javadoc/everything/processing/candy/Path.html @@ -0,0 +1,466 @@ + + + + + +Path + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Path

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Path
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class Path
extends BaseObject
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanclosed + +
+           
+ intcount + +
+           
+static intCURVETO + +
+           
+ int[]kind + +
+           
+static intLINETO + +
+           
+static intMOVETO + +
+           
+static intQCURVETO + +
+           
+ float[]x + +
+           
+ float[]y + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Path(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+count

+
+public int count
+
+
+
+
+
+ +

+x

+
+public float[] x
+
+
+
+
+
+ +

+y

+
+public float[] y
+
+
+
+
+
+ +

+MOVETO

+
+public static final int MOVETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINETO

+
+public static final int LINETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CURVETO

+
+public static final int CURVETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QCURVETO

+
+public static final int QCURVETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+kind

+
+public int[] kind
+
+
+
+
+
+ +

+closed

+
+public boolean closed
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Path

+
+public Path(BaseObject parent,
+            XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Poly.html b/build/javadoc/everything/processing/candy/Poly.html new file mode 100644 index 000000000..ce4ad314c --- /dev/null +++ b/build/javadoc/everything/processing/candy/Poly.html @@ -0,0 +1,297 @@ + + + + + +Poly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Poly

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Poly
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class Poly
extends BaseObject
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Poly(BaseObject parent, + XMLElement properties, + boolean closed) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Poly

+
+public Poly(BaseObject parent,
+            XMLElement properties,
+            boolean closed)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/RadialGradient.html b/build/javadoc/everything/processing/candy/RadialGradient.html new file mode 100644 index 000000000..95cf9d9a0 --- /dev/null +++ b/build/javadoc/everything/processing/candy/RadialGradient.html @@ -0,0 +1,296 @@ + + + + + +RadialGradient + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class RadialGradient

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Gradient
+              extended by processing.candy.RadialGradient
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class RadialGradient
extends Gradient
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
RadialGradient(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+RadialGradient

+
+public RadialGradient(BaseObject parent,
+                      XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Specified by:
drawImpl in class Gradient
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/RadialGradientPaint.RadialGradientContext.html b/build/javadoc/everything/processing/candy/RadialGradientPaint.RadialGradientContext.html new file mode 100644 index 000000000..0cc14e20b --- /dev/null +++ b/build/javadoc/everything/processing/candy/RadialGradientPaint.RadialGradientContext.html @@ -0,0 +1,305 @@ + + + + + +RadialGradientPaint.RadialGradientContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class RadialGradientPaint.RadialGradientContext

+
+java.lang.Object
+  extended by processing.candy.RadialGradientPaint.RadialGradientContext
+
+
+
All Implemented Interfaces:
java.awt.PaintContext
+
+
+
Enclosing class:
RadialGradientPaint
+
+
+
+
public class RadialGradientPaint.RadialGradientContext
extends java.lang.Object
implements java.awt.PaintContext
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
RadialGradientPaint.RadialGradientContext() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddispose() + +
+           
+ java.awt.image.ColorModelgetColorModel() + +
+           
+ java.awt.image.RastergetRaster(int x, + int y, + int w, + int h) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+RadialGradientPaint.RadialGradientContext

+
+public RadialGradientPaint.RadialGradientContext()
+
+
+ + + + + + + + +
+Method Detail
+ +

+dispose

+
+public void dispose()
+
+
+
Specified by:
dispose in interface java.awt.PaintContext
+
+
+
+
+
+
+ +

+getColorModel

+
+public java.awt.image.ColorModel getColorModel()
+
+
+
Specified by:
getColorModel in interface java.awt.PaintContext
+
+
+
+
+
+
+ +

+getRaster

+
+public java.awt.image.Raster getRaster(int x,
+                                       int y,
+                                       int w,
+                                       int h)
+
+
+
Specified by:
getRaster in interface java.awt.PaintContext
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/RadialGradientPaint.html b/build/javadoc/everything/processing/candy/RadialGradientPaint.html new file mode 100644 index 000000000..ec389f9ea --- /dev/null +++ b/build/javadoc/everything/processing/candy/RadialGradientPaint.html @@ -0,0 +1,329 @@ + + + + + +RadialGradientPaint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class RadialGradientPaint

+
+java.lang.Object
+  extended by processing.candy.RadialGradientPaint
+
+
+
All Implemented Interfaces:
java.awt.Paint, java.awt.Transparency
+
+
+
+
public class RadialGradientPaint
extends java.lang.Object
implements java.awt.Paint
+ + +

+


+ +

+ + + + + + + + + + + +
+Nested Class Summary
+ classRadialGradientPaint.RadialGradientContext + +
+           
+ + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
+  + + + + + + + + + + +
+Constructor Summary
RadialGradientPaint(float cx, + float cy, + float radius, + float[] offset, + int[] color, + int count, + float opacity) + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+ java.awt.PaintContextcreateContext(java.awt.image.ColorModel cm, + java.awt.Rectangle deviceBounds, + java.awt.geom.Rectangle2D userBounds, + java.awt.geom.AffineTransform xform, + java.awt.RenderingHints hints) + +
+           
+ intgetTransparency() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+RadialGradientPaint

+
+public RadialGradientPaint(float cx,
+                           float cy,
+                           float radius,
+                           float[] offset,
+                           int[] color,
+                           int count,
+                           float opacity)
+
+
+ + + + + + + + +
+Method Detail
+ +

+createContext

+
+public java.awt.PaintContext createContext(java.awt.image.ColorModel cm,
+                                           java.awt.Rectangle deviceBounds,
+                                           java.awt.geom.Rectangle2D userBounds,
+                                           java.awt.geom.AffineTransform xform,
+                                           java.awt.RenderingHints hints)
+
+
+
Specified by:
createContext in interface java.awt.Paint
+
+
+
+
+
+
+ +

+getTransparency

+
+public int getTransparency()
+
+
+
Specified by:
getTransparency in interface java.awt.Transparency
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/Rect.html b/build/javadoc/everything/processing/candy/Rect.html new file mode 100644 index 000000000..f978d18a2 --- /dev/null +++ b/build/javadoc/everything/processing/candy/Rect.html @@ -0,0 +1,295 @@ + + + + + +Rect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class Rect

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.Rect
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class Rect
extends BaseObject
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
Rect(BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Rect

+
+public Rect(BaseObject parent,
+            XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Description copied from class: PShape
+
Draws the SVG document. +

+

+
Overrides:
drawImpl in class BaseObject
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/SVG.Path.html b/build/javadoc/everything/processing/candy/SVG.Path.html new file mode 100644 index 000000000..6bd0d6754 --- /dev/null +++ b/build/javadoc/everything/processing/candy/SVG.Path.html @@ -0,0 +1,403 @@ + + + + + +SVG.Path + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class SVG.Path

+
+java.lang.Object
+  extended by processing.candy.SVG.Path
+
+
+
Enclosing class:
SVG
+
+
+
+
public class SVG.Path
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanclosed + +
+           
+ intcount + +
+           
+static intCURVETO + +
+           
+ int[]kind + +
+           
+static intLINETO + +
+           
+static intMOVETO + +
+           
+static intQCURVETO + +
+           
+ float[]x + +
+           
+ float[]y + +
+           
+  + + + + + + + + + + +
+Constructor Summary
SVG.Path(processing.candy.SVG.BaseObject parent, + XMLElement properties) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+count

+
+public int count
+
+
+
+
+
+ +

+x

+
+public float[] x
+
+
+
+
+
+ +

+y

+
+public float[] y
+
+
+
+
+
+ +

+MOVETO

+
+public static final int MOVETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINETO

+
+public static final int LINETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CURVETO

+
+public static final int CURVETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QCURVETO

+
+public static final int QCURVETO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+kind

+
+public int[] kind
+
+
+
+
+
+ +

+closed

+
+public boolean closed
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+SVG.Path

+
+public SVG.Path(processing.candy.SVG.BaseObject parent,
+                XMLElement properties)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/SVG.html b/build/javadoc/everything/processing/candy/SVG.html new file mode 100644 index 000000000..f0ec17769 --- /dev/null +++ b/build/javadoc/everything/processing/candy/SVG.html @@ -0,0 +1,394 @@ + + + + + +SVG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.candy +
+Class SVG

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.candy.BaseObject
+          extended by processing.candy.SVG
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class SVG
extends BaseObject
+ + +

+Candy is a minimal SVG import library for Processing. + Candy was written by Michael Chang, and later revised and + expanded for use as a Processing core library by Ben Fry. +

+ SVG stands for Scalable Vector Graphics, a portable graphics format. It is + a vector format so it allows for infinite resolution and relatively small + file sizes. Most modern media software can view SVG files, including Adobe + products, Firefox, etc. Illustrator and Inkscape can edit SVG files. +

+ We have no intention of turning this into a full-featured SVG library. + The goal of this project is a basic shape importer that is small enough + to be included with applets, meaning that its download size should be + in the neighborhood of 25-30k. Because of this size, it is not made part + of processing.core, as it's not a feature that will be used by the majority + of our audience. + + For more sophisticated import/export, consider the + Batik + library from the Apache Software Foundation. Future improvements to this + library may focus on this properly supporting a specific subset of SVG, + for instance the simpler SVG profiles known as + SVG Tiny or Basic, + although we still would not support the interactivity options. +

+ This library was specifically tested under SVG files created with Adobe + Illustrator. We can't guarantee that it will work for any SVGs created with + other software. In the future we would like to improve compatibility with + Open Source software such as Inkscape, however initial tests show its + base implementation produces more complicated files, and this will require + more time. +

+ An SVG created under Illustrator must be created in one of two ways: +

    +
  • File → Save for Web (or control-alt-shift-s on a PC). Under + settings, make sure the CSS properties is set to "Presentation Attributes". +
  • With Illustrator CS2, it is also possible to use "Save As" with "SVG" + as the file setting, but the CSS properties should also be set similarly. +
+ Saving it any other way will most likely break Candy. + +


+ + A minimal example program using Candy: + (assuming a working moo.svg is in your data folder) + +

+ import processing.candy.*;
+ import processing.xml.*;
+
+ SVG moo;
+ void setup() {
+   size(400,400);
+   moo = new SVG("moo.svg",this);
+ }
+ void draw() {
+   moo.draw();
+ }
+ 
+ + Note that processing.xml needs to be imported as well. + This may not be required when running code within the Processing + environment, but when exported it may cause a NoClassDefError. + This will be fixed in later releases of Processing + (Bug 518). + +


+ + August 2008 revisions by fry (Processing 0149) +

    +
  • Major changes to rework around PShape. +
  • Now implementing more of the "transform" attribute. +
+ + February 2008 revisions by fry (Processing 0136) +
    +
  • Added support for quadratic curves in paths (Q, q, T, and t operators) +
  • Support for reading SVG font data (though not rendering it yet) +
+ + Revisions for "Candy 2" November 2006 by fry +
    +
  • Switch to the new processing.xml library +
  • Several bug fixes for parsing of shape data +
  • Support for linear and radial gradients +
  • Support for additional types of shapes +
  • Added compound shapes (shapes with interior points) +
  • Added methods to get shapes from an internal table +
+ + Revision 10/31/06 by flux +
    +
  • Now properly supports Processing 0118 +
  • Fixed a bunch of things for Casey's students and general buggity. +
  • Will now properly draw #FFFFFFFF colors (were being represented as -1) +
  • SVGs without tags are now properly caught and loaded +
  • Added a method customStyle() for overriding SVG colors/styles +
  • Added a method SVGStyle() to go back to using SVG colors/styles +
+ + Some SVG objects and features may not yet be supported. + Here is a partial list of non-included features +
    +
  • Rounded rectangles +
  • Drop shadow objects +
  • Typography +
  • Layers added for Candy 2 +
  • Patterns +
  • Embedded images +
+ + For those interested, the SVG specification can be found + here. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + + + + +
+Constructor Summary
SVG(PApplet parent, + java.lang.String filename) + +
+          Initializes a new SVG Object with the given filename.
SVG(XMLElement svg) + +
+          Initializes a new SVG Object with the given filename.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class processing.candy.BaseObject
drawImpl, getChild, ignoreStyles, ignoreStyles, print
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, applyMatrix, applyMatrix, draw, draw, draw, drawMode, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SVG

+
+public SVG(PApplet parent,
+           java.lang.String filename)
+
+
Initializes a new SVG Object with the given filename. +

+

+
+ +

+SVG

+
+public SVG(XMLElement svg)
+
+
Initializes a new SVG Object with the given filename. +

+

+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/package-frame.html b/build/javadoc/everything/processing/candy/package-frame.html new file mode 100644 index 000000000..35ecea8c4 --- /dev/null +++ b/build/javadoc/everything/processing/candy/package-frame.html @@ -0,0 +1,55 @@ + + + + + +processing.candy + + + + + + + + + + + +processing.candy + + + + +
+Classes  + +
+BaseObject +
+Circle +
+Ellipse +
+Gradient +
+Line +
+LinearGradient +
+LinearGradientPaint +
+Path +
+Poly +
+RadialGradient +
+RadialGradientPaint +
+Rect +
+SVG
+ + + + diff --git a/build/javadoc/everything/processing/candy/package-summary.html b/build/javadoc/everything/processing/candy/package-summary.html new file mode 100644 index 000000000..04cdc314f --- /dev/null +++ b/build/javadoc/everything/processing/candy/package-summary.html @@ -0,0 +1,199 @@ + + + + + +processing.candy + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.candy +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
BaseObject 
Circle 
Ellipse 
Gradient 
Line 
LinearGradient 
LinearGradientPaint 
Path 
Poly 
RadialGradient 
RadialGradientPaint 
Rect 
SVGCandy is a minimal SVG import library for Processing.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/candy/package-tree.html b/build/javadoc/everything/processing/candy/package-tree.html new file mode 100644 index 000000000..8a29552c7 --- /dev/null +++ b/build/javadoc/everything/processing/candy/package-tree.html @@ -0,0 +1,157 @@ + + + + + +processing.candy Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.candy +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PApplet.RegisteredMethods.html b/build/javadoc/everything/processing/core/PApplet.RegisteredMethods.html new file mode 100644 index 000000000..85b41c167 --- /dev/null +++ b/build/javadoc/everything/processing/core/PApplet.RegisteredMethods.html @@ -0,0 +1,320 @@ + + + + + +PApplet.RegisteredMethods + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PApplet.RegisteredMethods

+
+java.lang.Object
+  extended by processing.core.PApplet.RegisteredMethods
+
+
+
Enclosing class:
PApplet
+
+
+
+
public class PApplet.RegisteredMethods
extends java.lang.Object
+ + +

+This returns the last width and height specified by the user + via the size() command. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
PApplet.RegisteredMethods() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(java.lang.Object object, + java.lang.reflect.Method method) + +
+           
+ voidhandle() + +
+           
+ voidhandle(java.lang.Object[] oargs) + +
+           
+ voidremove(java.lang.Object object, + java.lang.reflect.Method method) + +
+          Removes first object/method pair matched (and only the first, + must be called multiple times if object is registered multiple times).
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PApplet.RegisteredMethods

+
+public PApplet.RegisteredMethods()
+
+
+ + + + + + + + +
+Method Detail
+ +

+handle

+
+public void handle()
+
+
+
+
+
+
+ +

+handle

+
+public void handle(java.lang.Object[] oargs)
+
+
+
+
+
+
+ +

+add

+
+public void add(java.lang.Object object,
+                java.lang.reflect.Method method)
+
+
+
+
+
+
+ +

+remove

+
+public void remove(java.lang.Object object,
+                   java.lang.reflect.Method method)
+
+
Removes first object/method pair matched (and only the first, + must be called multiple times if object is registered multiple times). + Does not shrink array afterwards, silently returns if method not found. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PApplet.RendererChangeException.html b/build/javadoc/everything/processing/core/PApplet.RendererChangeException.html new file mode 100644 index 000000000..a0826c998 --- /dev/null +++ b/build/javadoc/everything/processing/core/PApplet.RendererChangeException.html @@ -0,0 +1,246 @@ + + + + + +PApplet.RendererChangeException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PApplet.RendererChangeException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.lang.RuntimeException
+              extended by processing.core.PApplet.RendererChangeException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
Enclosing class:
PApplet
+
+
+
+
public static class PApplet.RendererChangeException
extends java.lang.RuntimeException
+ + +

+Exception thrown when size() is called the first time. +

+ This is used internally so that setup() is forced to run twice + when the renderer is changed. This is the only way for us to handle + invoking the new renderer while also in the midst of rendering. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
PApplet.RendererChangeException() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PApplet.RendererChangeException

+
+public PApplet.RendererChangeException()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PApplet.html b/build/javadoc/everything/processing/core/PApplet.html new file mode 100644 index 000000000..04996dff9 --- /dev/null +++ b/build/javadoc/everything/processing/core/PApplet.html @@ -0,0 +1,16709 @@ + + + + + +PApplet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PApplet

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Panel
+              extended by java.applet.Applet
+                  extended by processing.core.PApplet
+
+
+
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, PConstants
+
+
+
Direct Known Subclasses:
ColorSelector.ColorRange, ColorSelector.ColorSlider
+
+
+
+
public class PApplet
extends java.applet.Applet
implements PConstants, java.lang.Runnable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, java.awt.event.FocusListener
+ + +

+Base class for all sketches that use processing.core. +

+ Note that you should not use AWT or Swing components inside a Processing + applet. The surface is made to automatically update itself, and will cause + problems with redraw of components drawn above it. If you'd like to + integrate other Java components, see below. +

+ As of release 0145, Processing uses active mode rendering in all cases. + All animation tasks happen on the "Processing Animation Thread". The + setup() and draw() methods are handled by that thread, and events (like + mouse movement and key presses, which are fired by the event dispatch + thread or EDT) are queued to be (safely) handled at the end of draw(). + For code that needs to run on the EDT, use SwingUtilities.invokeLater(). + When doing so, be careful to synchronize between that code (since + invokeLater() will make your code run from the EDT) and the Processing + animation thread. Use of a callback function or the registerXxx() methods + in PApplet can help ensure that your code doesn't do something naughty. +

+ As of release 0136 of Processing, we have discontinued support for versions + of Java prior to 1.5. We don't have enough people to support it, and for a + project of our size, we should be focusing on the future, rather than + working around legacy Java code. In addition, Java 1.5 gives us access to + better timing facilities which will improve the steadiness of animation. +

+ This class extends Applet instead of JApplet because 1) historically, + we supported Java 1.1, which does not include Swing (without an + additional, sizable, download), and 2) Swing is a bloated piece of crap. + A Processing applet is a heavyweight AWT component, and can be used the + same as any other AWT component, with or without Swing. +

+ Similarly, Processing runs in a Frame and not a JFrame. However, there's + nothing to prevent you from embedding a PApplet into a JFrame, it's just + that the base version uses a regular AWT frame because there's simply + no need for swing in that context. If people want to use Swing, they can + embed themselves as they wish. +

+ It is possible to use PApplet, along with core.jar in other projects. + In addition to enabling you to use Java 1.5+ features with your sketch, + this also allows you to embed a Processing drawing area into another Java + application. This means you can use standard GUI controls with a Processing + sketch. Because AWT and Swing GUI components cannot be used on top of a + PApplet, you can instead embed the PApplet inside another GUI the way you + would any other Component. +

+ It is also possible to resize the Processing window by including + frame.setResizable(true) inside your setup() method. + Note that the Java method frame.setSize() will not work unless + you first set the frame to be resizable. +

+ Because the default animation thread will run at 60 frames per second, + an embedded PApplet can make the parent sluggish. You can use frameRate() + to make it update less often, or you can use noLoop() and loop() to disable + and then re-enable looping. If you want to only update the sketch + intermittently, use noLoop() inside setup(), and redraw() whenever + the screen needs to be updated once (or loop() to re-enable the animation + thread). The following example embeds a sketch and also uses the noLoop() + and redraw() methods. You need not use noLoop() and redraw() when embedding + if you want your application to animate continuously. +

+ public class ExampleFrame extends Frame {
+
+     public ExampleFrame() {
+         super("Embedded PApplet");
+
+         setLayout(new BorderLayout());
+         PApplet embed = new Embedded();
+         add(embed, BorderLayout.CENTER);
+
+         // important to call this whenever embedding a PApplet.
+         // It ensures that the animation thread is started and
+         // that other internal variables are properly set.
+         embed.init();
+     }
+ }
+
+ public class Embedded extends PApplet {
+
+     public void setup() {
+         // original setup code here ...
+         size(400, 400);
+
+         // prevent thread from starving everything else
+         noLoop();
+     }
+
+     public void draw() {
+         // drawing code goes here
+     }
+
+     public void mousePressed() {
+         // do something based on mouse movement
+
+         // update the screen (run draw once)
+         redraw();
+     }
+ }
+ 
+ +

Processing on multiple displays

+

I was asked about Processing with multiple displays, and for lack of a + better place to document it, things will go here.

+

You can address both screens by making a window the width of both, + and the height of the maximum of both screens. In this case, do not use + present mode, because that's exclusive to one screen. Basically it'll + give you a PApplet that spans both screens. If using one half to control + and the other half for graphics, you'd just have to put the 'live' stuff + on one half of the canvas, the control stuff on the other. This works + better in windows because on the mac we can't get rid of the menu bar + unless it's running in present mode.

+

For more control, you need to write straight java code that uses p5. + You can create two windows, that are shown on two separate screens, + that have their own PApplet. this is just one of the tradeoffs of one of + the things that we don't support in p5 from within the environment + itself (we must draw the line somewhere), because of how messy it would + get to start talking about multiple screens. It's also not that tough to + do by hand w/ some Java code.

+

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+ classPApplet.RegisteredMethods + +
+          This returns the last width and height specified by the user + via the size() command.
+static classPApplet.RendererChangeException + +
+          Exception thrown when size() is called the first time.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ java.lang.String[]args + +
+          Command line options passed in from main().
+static java.lang.StringARGS_BGCOLOR + +
+           
+static java.lang.StringARGS_DISPLAY + +
+           
+static java.lang.StringARGS_EDITOR_LOCATION + +
+          Position of the upper-lefthand corner of the editor window + that launched this applet.
+static java.lang.StringARGS_EXCLUSIVE + +
+           
+static java.lang.StringARGS_EXTERNAL + +
+          Location for where to position the applet window on screen.
+static java.lang.StringARGS_HIDE_STOP + +
+           
+static java.lang.StringARGS_LOCATION + +
+           
+static java.lang.StringARGS_PRESENT + +
+           
+static java.lang.StringARGS_SKETCH_FOLDER + +
+          Allows the user or PdeEditor to set a specific sketch folder path.
+static java.lang.StringARGS_STOP_COLOR + +
+           
+static intDEFAULT_HEIGHT + +
+           
+static intDEFAULT_WIDTH + +
+          Default width and height for applet when not specified
+ booleandefaultSize + +
+          true if no size() command has been executed.
+static java.lang.StringEXTERNAL_MOVE + +
+          When run externally to a PDE Editor, this is sent by the applet + whenever the window is moved.
+static java.lang.StringEXTERNAL_STOP + +
+          When run externally to a PdeEditor, + this is sent by the applet when it quits.
+ booleanfinished + +
+          true if this applet has had it.
+ booleanfirstMouse + +
+          Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump.
+ booleanfocused + +
+          Gets set to true/false as the applet gains/loses focus.
+ java.awt.Frameframe + +
+          The frame containing this applet (if any)
+ intframeCount + +
+          How many frames have been displayed since the applet started.
+ floatframeRate + +
+          The current value of frames per second.
+ PGraphicsg + +
+          The PGraphics renderer associated with this PApplet
+ intheight + +
+          height of this applet's associated PGraphics
+static byte[]ICON_IMAGE + +
+          GIF image of the Processing logo.
+static floatjavaVersion + +
+          Version of Java that's in use, whether 1.1 or 1.3 or whatever, + stored as a float.
+static java.lang.StringjavaVersionName + +
+          Full name of the Java version (i.e.
+ charkey + +
+          Last key pressed.
+ intkeyCode + +
+          When "key" is set to CODED, this will contain a Java key code.
+ java.awt.event.KeyEventkeyEvent + +
+          the last KeyEvent object passed into a mouse function.
+ booleankeyPressed + +
+          true if the mouse is currently pressed.
+static intMENU_SHORTCUT + +
+          Modifier flags for the shortcut key used to trigger menus.
+static intMIN_WINDOW_HEIGHT + +
+           
+static intMIN_WINDOW_WIDTH + +
+          Minimum dimensions for the window holding an applet.
+ intmouseButton + +
+          Last mouse button pressed, one of LEFT, CENTER, or RIGHT.
+ java.awt.event.MouseEventmouseEvent + +
+           
+ booleanmousePressed + +
+           
+ intmouseX + +
+          current x position of the mouse
+ intmouseY + +
+          current y position of the mouse
+ booleanonline + +
+          true if the applet is online.
+ int[]pixels + +
+          Pixel buffer from this applet's PGraphics.
+static intplatform + +
+          Current platform in use, one of the + PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER.
+ intpmouseX + +
+          Previous x/y position of the mouse.
+ intpmouseY + +
+          Previous x/y position of the mouse.
+ PGraphicsrecorder + +
+          A leech graphics object that is echoing all events.
+ intrequestImageMax + +
+          By trial and error, four image loading threads seem to work best when + loading images from online.
+ java.awt.Dimensionscreen + +
+          The screen size when the applet was started.
+ java.io.FileselectedFile + +
+           
+ java.lang.StringsketchPath + +
+          Path to sketch folder
+ intwidth + +
+          width of this applet's associated PGraphics
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
PApplet() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static floatabs(float n) + +
+           
+static intabs(int n) + +
+           
+static floatacos(float value) + +
+           
+ voidaddListeners() + +
+           
+ floatalpha(int what) + +
+           
+ voidambient(float gray) + +
+           
+ voidambient(float x, + float y, + float z) + +
+           
+ voidambient(int rgb) + +
+           
+ voidambientLight(float red, + float green, + float blue) + +
+           
+ voidambientLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+static byte[]append(byte[] b, + byte value) + +
+           
+static char[]append(char[] b, + char value) + +
+           
+static float[]append(float[] b, + float value) + +
+           
+static int[]append(int[] b, + int value) + +
+           
+static java.lang.Objectappend(java.lang.Object b, + java.lang.Object value) + +
+           
+static java.lang.String[]append(java.lang.String[] b, + java.lang.String value) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapplyMatrix(PMatrix source) + +
+           
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voidapplyMatrix(PMatrix3D source) + +
+           
+ voidarc(float a, + float b, + float c, + float d, + float start, + float stop) + +
+           
+static voidarraycopy(java.lang.Object src, + int srcPosition, + java.lang.Object dst, + int dstPosition, + int length) + +
+          Deprecated. Use arrayCopy() instead.
+static voidarrayCopy(java.lang.Object src, + int srcPosition, + java.lang.Object dst, + int dstPosition, + int length) + +
+          Calls System.arraycopy(), included here so that we can + avoid people needing to learn about the System object + before they can just copy an array.
+static voidarraycopy(java.lang.Object src, + java.lang.Object dst) + +
+          Deprecated. Use arrayCopy() instead.
+static voidarrayCopy(java.lang.Object src, + java.lang.Object dst) + +
+          Shortcut to copy the entire contents of + the source into the destination array.
+static voidarraycopy(java.lang.Object src, + java.lang.Object dst, + int length) + +
+          Deprecated. Use arrayCopy() instead.
+static voidarrayCopy(java.lang.Object src, + java.lang.Object dst, + int length) + +
+          Convenience method for arraycopy().
+static floatasin(float value) + +
+           
+static floatatan(float value) + +
+           
+static floatatan2(float a, + float b) + +
+           
+ voidbackground(float gray) + +
+           
+ voidbackground(float gray, + float alpha) + +
+           
+ voidbackground(float x, + float y, + float z) + +
+           
+ voidbackground(float x, + float y, + float z, + float a) + +
+           
+ voidbackground(int rgb) + +
+           
+ voidbackground(int rgb, + float alpha) + +
+           
+ voidbackground(PImage image) + +
+           
+ voidbeginCamera() + +
+           
+ voidbeginRaw(PGraphics rawGraphics) + +
+          Begin recording raw shape data to the specified renderer.
+ PGraphicsbeginRaw(java.lang.String renderer, + java.lang.String filename) + +
+          Begin recording raw shape data to a renderer of the specified type, + using the width and height of the main drawing surface.
+ voidbeginRecord(PGraphics recorder) + +
+          Begin recording (echoing) commands to the specified PGraphics object.
+ PGraphicsbeginRecord(java.lang.String renderer, + java.lang.String filename) + +
+          Begin recording to a new renderer of the specified type, using the width + and height of the main drawing surface.
+ voidbeginShape() + +
+           
+ voidbeginShape(int kind) + +
+           
+ voidbezier(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidbezier(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbezierDetail(int detail) + +
+           
+ floatbezierPoint(float a, + float b, + float c, + float d, + float t) + +
+           
+ floatbezierTangent(float a, + float b, + float c, + float d, + float t) + +
+           
+ voidbezierVertex(float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidbezierVertex(float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+static java.lang.Stringbinary(byte what) + +
+          Returns a String that contains the binary value of a byte.
+static java.lang.Stringbinary(char what) + +
+          Returns a String that contains the binary value of a char.
+static java.lang.Stringbinary(int what) + +
+          Returns a String that contains the binary value of an int.
+static java.lang.Stringbinary(int what, + int digits) + +
+          Returns a String that contains the binary value of an int.
+ voidblend(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+           
+ voidblend(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+           
+static intblendColor(int c1, + int c2, + int mode) + +
+           
+ floatblue(int what) + +
+           
+ voidbox(float size) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+           
+ floatbrightness(int what) + +
+           
+ voidcamera() + +
+           
+ voidcamera(float eyeX, + float eyeY, + float eyeZ, + float centerX, + float centerY, + float centerZ, + float upX, + float upY, + float upZ) + +
+           
+static intceil(float what) + +
+           
+ intcolor(float fgray) + +
+           
+ intcolor(float fgray, + float falpha) + +
+           
+ intcolor(float x, + float y, + float z) + +
+           
+ intcolor(float x, + float y, + float z, + float a) + +
+           
+ intcolor(int gray) + +
+           
+ intcolor(int gray, + int alpha) + +
+          As of 0116 this also takes color(#FF8800, alpha)
+ intcolor(int x, + int y, + int z) + +
+           
+ intcolor(int x, + int y, + int z, + int a) + +
+           
+ voidcolorMode(int mode) + +
+           
+ voidcolorMode(int mode, + float max) + +
+           
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ) + +
+           
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ, + float maxA) + +
+           
+static boolean[]concat(boolean[] a, + boolean[] b) + +
+           
+static byte[]concat(byte[] a, + byte[] b) + +
+           
+static char[]concat(char[] a, + char[] b) + +
+           
+static float[]concat(float[] a, + float[] b) + +
+           
+static int[]concat(int[] a, + int[] b) + +
+           
+static java.lang.Objectconcat(java.lang.Object a, + java.lang.Object b) + +
+           
+static java.lang.String[]concat(java.lang.String[] a, + java.lang.String[] b) + +
+           
+static floatconstrain(float amt, + float low, + float high) + +
+           
+static intconstrain(int amt, + int low, + int high) + +
+           
+ voidcopy(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+           
+ voidcopy(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+           
+static floatcos(float angle) + +
+           
+ PFontcreateFont(java.lang.String name, + float size) + +
+           
+ PFontcreateFont(java.lang.String name, + float size, + boolean smooth) + +
+           
+ PFontcreateFont(java.lang.String name, + float size, + boolean smooth, + char[] charset) + +
+          Create a .vlw font on the fly from either a font name that's + installed on the system, or from a .ttf or .otf that's inside + the data folder of this sketch.
+ PGraphicscreateGraphics(int iwidth, + int iheight, + java.lang.String irenderer) + +
+          Create an offscreen PGraphics object for drawing.
+ PGraphicscreateGraphics(int iwidth, + int iheight, + java.lang.String irenderer, + java.lang.String ipath) + +
+          Create an offscreen graphics surface for drawing, in this case + for a renderer that writes to a file (such as PDF or DXF).
+ PImagecreateImage(int wide, + int high, + int format) + +
+          Preferred method of creating new PImage objects, ensures that a + reference to the parent PApplet is included, which makes save() work + without needing an absolute path.
+static java.io.InputStreamcreateInput(java.io.File file) + +
+           
+ java.io.InputStreamcreateInput(java.lang.String filename) + +
+          Simplified method to open a Java InputStream.
+ java.io.InputStreamcreateInputRaw(java.lang.String filename) + +
+          Call openStream() without automatic gzip decompression.
+static java.io.OutputStreamcreateOutput(java.io.File file) + +
+           
+ java.io.OutputStreamcreateOutput(java.lang.String filename) + +
+          Similar to createInput() (formerly openStream), this creates a Java + OutputStream for a given filename or path.
+static voidcreatePath(java.io.File file) + +
+           
+static voidcreatePath(java.lang.String path) + +
+          Takes a path and creates any in-between folders if they don't + already exist.
+static java.io.BufferedReadercreateReader(java.io.File file) + +
+          I want to read lines from a file.
+static java.io.BufferedReadercreateReader(java.io.InputStream input) + +
+          I want to read lines from a stream.
+ java.io.BufferedReadercreateReader(java.lang.String filename) + +
+          I want to read lines from a file.
+static java.io.PrintWritercreateWriter(java.io.File file) + +
+          I want to print lines to a file.
+static java.io.PrintWritercreateWriter(java.io.OutputStream output) + +
+          I want to print lines to a file.
+ java.io.PrintWritercreateWriter(java.lang.String filename) + +
+          I want to print lines to a file.
+ voidcursor() + +
+          Show the cursor after noCursor() was called.
+ voidcursor(int cursorType) + +
+          Set the cursor type
+ voidcursor(PImage image) + +
+          Replace the cursor with the specified PImage.
+ voidcursor(PImage image, + int hotspotX, + int hotspotY) + +
+          Set a custom cursor to an image with a specific hotspot.
+ voidcurve(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidcurve(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidcurveDetail(int detail) + +
+           
+ floatcurvePoint(float a, + float b, + float c, + float d, + float t) + +
+           
+ floatcurveTangent(float a, + float b, + float c, + float d, + float t) + +
+           
+ voidcurveTightness(float tightness) + +
+           
+ voidcurveVertex(float x, + float y) + +
+           
+ voidcurveVertex(float x, + float y, + float z) + +
+           
+ java.io.FiledataFile(java.lang.String where) + +
+          Return a full path to an item in the data folder as a File object.
+ java.lang.StringdataPath(java.lang.String where) + +
+          Return a full path to an item in the data folder.
+static intday() + +
+          Get the current day of the month (1 through 31).
+static floatdegrees(float radians) + +
+           
+ voiddelay(int napTime) + +
+          The delay() function causes the program to halt for a specified time.
+ voiddestroy() + +
+          Called by the browser or applet viewer to inform this applet + that it is being reclaimed and that it should destroy + any resources that it has allocated.
+ voiddie(java.lang.String what) + +
+          Function for an applet/application to kill itself and + display an error.
+ voiddie(java.lang.String what, + java.lang.Exception e) + +
+          Same as above but with an exception.
+ voiddirectionalLight(float red, + float green, + float blue, + float nx, + float ny, + float nz) + +
+           
+ booleandisplayable() + +
+           
+static floatdist(float x1, + float y1, + float x2, + float y2) + +
+           
+static floatdist(float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ voiddraw() + +
+           
+ voidedge(boolean edge) + +
+           
+ voidellipse(float a, + float b, + float c, + float d) + +
+           
+ voidellipseMode(int mode) + +
+           
+ voidemissive(float gray) + +
+           
+ voidemissive(float x, + float y, + float z) + +
+           
+ voidemissive(int rgb) + +
+           
+ voidendCamera() + +
+           
+ voidendRaw() + +
+          Stop recording raw shape data to the specified renderer.
+ voidendRecord() + +
+           
+ voidendShape() + +
+           
+ voidendShape(int mode) + +
+           
+static java.lang.Processexec(java.lang.String[] argv) + +
+           
+ voidexit() + +
+          Call to safely exit the sketch when finished.
+static floatexp(float a) + +
+           
+static boolean[]expand(boolean[] list) + +
+           
+static boolean[]expand(boolean[] list, + int newSize) + +
+           
+static byte[]expand(byte[] list) + +
+           
+static byte[]expand(byte[] list, + int newSize) + +
+           
+static char[]expand(char[] list) + +
+           
+static char[]expand(char[] list, + int newSize) + +
+           
+static float[]expand(float[] list) + +
+           
+static float[]expand(float[] list, + int newSize) + +
+           
+static int[]expand(int[] list) + +
+           
+static int[]expand(int[] list, + int newSize) + +
+           
+static java.lang.Objectexpand(java.lang.Object array) + +
+           
+static java.lang.Objectexpand(java.lang.Object list, + int newSize) + +
+           
+static java.lang.String[]expand(java.lang.String[] list) + +
+           
+static java.lang.String[]expand(java.lang.String[] list, + int newSize) + +
+           
+ voidfill(float gray) + +
+           
+ voidfill(float gray, + float alpha) + +
+           
+ voidfill(float x, + float y, + float z) + +
+           
+ voidfill(float x, + float y, + float z, + float a) + +
+           
+ voidfill(int rgb) + +
+           
+ voidfill(int rgb, + float alpha) + +
+           
+ voidfilter(int kind) + +
+           
+ voidfilter(int kind, + float param) + +
+           
+static intfloor(float what) + +
+           
+ voidflush() + +
+           
+ voidfocusGained() + +
+           
+ voidfocusGained(java.awt.event.FocusEvent e) + +
+           
+ voidfocusLost() + +
+           
+ voidfocusLost(java.awt.event.FocusEvent e) + +
+           
+ voidframeRate(float newRateTarget) + +
+          Set a target frameRate.
+ voidfrustum(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ PImageget() + +
+           
+ intget(int x, + int y) + +
+           
+ PImageget(int x, + int y, + int w, + int h) + +
+           
+ java.lang.ObjectgetCache(java.lang.Object parent) + +
+           
+ PMatrixgetMatrix() + +
+           
+ PMatrix2DgetMatrix(PMatrix2D target) + +
+           
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+           
+ intgetSketchHeight() + +
+           
+ java.lang.StringgetSketchRenderer() + +
+           
+ intgetSketchWidth() + +
+           
+ floatgreen(int what) + +
+           
+ voidhandleDraw() + +
+           
+static java.lang.Stringhex(byte what) + +
+           
+static java.lang.Stringhex(char what) + +
+           
+static java.lang.Stringhex(int what) + +
+           
+static java.lang.Stringhex(int what, + int digits) + +
+           
+ voidhint(int which) + +
+           
+static inthour() + +
+          Hour position of the current time in international format (0-23).
+ floathue(int what) + +
+           
+ voidimage(PImage image, + float x, + float y) + +
+           
+ voidimage(PImage image, + float x, + float y, + float c, + float d) + +
+           
+ voidimage(PImage image, + float a, + float b, + float c, + float d, + int u1, + int v1, + int u2, + int v2) + +
+           
+ voidimageMode(int mode) + +
+           
+ voidinit() + +
+           
+static java.lang.Stringjoin(java.lang.String[] str, + char separator) + +
+          Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator.
+static java.lang.Stringjoin(java.lang.String[] str, + java.lang.String separator) + +
+          Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator.
+ voidkeyPressed() + +
+          Called each time a single key on the keyboard is pressed.
+ voidkeyPressed(java.awt.event.KeyEvent e) + +
+          Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + 'keyCode', and 'keyEvent' variables to no longer work; + key events will no longer be queued until the end of draw(); + and the keyPressed(), keyReleased() and keyTyped() methods + will no longer be called.
+ voidkeyReleased() + +
+          See keyPressed().
+ voidkeyReleased(java.awt.event.KeyEvent e) + +
+           
+ voidkeyTyped() + +
+          Only called for "regular" keys like letters, + see keyPressed() for full documentation.
+ voidkeyTyped(java.awt.event.KeyEvent e) + +
+           
+static floatlerp(float start, + float stop, + float amt) + +
+           
+ intlerpColor(int c1, + int c2, + float amt) + +
+           
+static intlerpColor(int c1, + int c2, + float amt, + int mode) + +
+           
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+           
+ voidlights() + +
+           
+ voidlightSpecular(float x, + float y, + float z) + +
+           
+ voidline(float x1, + float y1, + float x2, + float y2) + +
+           
+ voidline(float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ voidlink(java.lang.String here) + +
+           
+ voidlink(java.lang.String url, + java.lang.String frameTitle) + +
+          Link to an external page without all the muss.
+static byte[]loadBytes(java.io.File file) + +
+           
+static byte[]loadBytes(java.io.InputStream input) + +
+           
+ byte[]loadBytes(java.lang.String filename) + +
+           
+ PFontloadFont(java.lang.String filename) + +
+           
+ PImageloadImage(java.lang.String filename) + +
+          Load an image from the data folder or a local directory.
+ PImageloadImage(java.lang.String filename, + java.lang.String extension) + +
+          Identical to loadImage, but allows you to specify the type of + image by its extension.
+ voidloadPixels() + +
+          Override the g.pixels[] function to set the pixels[] array + that's part of the PApplet object.
+ PShapeloadShape(java.lang.String filename) + +
+          Load a geometry from a file as a PShape.
+static java.lang.String[]loadStrings(java.io.File file) + +
+           
+static java.lang.String[]loadStrings(java.io.InputStream input) + +
+           
+ java.lang.String[]loadStrings(java.lang.String filename) + +
+          Load data from a file and shove it into a String array.
+static floatlog(float a) + +
+           
+ voidloop() + +
+           
+static floatmag(float a, + float b) + +
+           
+static floatmag(float a, + float b, + float c) + +
+           
+static voidmain(java.lang.String[] args) + +
+          main() method for running this class from the command line.
+static floatmap(float value, + float istart, + float istop, + float ostart, + float ostop) + +
+          Convenience function to map a variable from one coordinate space + to another.
+ voidmask(int[] alpha) + +
+           
+ voidmask(PImage alpha) + +
+           
+static java.lang.String[]match(java.lang.String what, + java.lang.String regexp) + +
+          Match a string with a regular expression, and returns the match as an + array.
+static java.lang.String[][]matchAll(java.lang.String what, + java.lang.String regexp) + +
+          Identical to match(), except that it returns an array of all matches in + the specified String, rather than just the first.
+static floatmax(float[] list) + +
+          Find the maximum value in an array.
+static floatmax(float a, + float b) + +
+           
+static floatmax(float a, + float b, + float c) + +
+           
+static intmax(int[] list) + +
+          Find the maximum value in an array.
+static intmax(int a, + int b) + +
+           
+static intmax(int a, + int b, + int c) + +
+           
+ intmillis() + +
+          Get the number of milliseconds since the applet started.
+static floatmin(float[] list) + +
+          Find the minimum value in an array.
+static floatmin(float a, + float b) + +
+           
+static floatmin(float a, + float b, + float c) + +
+           
+static intmin(int[] list) + +
+          Find the minimum value in an array.
+static intmin(int a, + int b) + +
+           
+static intmin(int a, + int b, + int c) + +
+           
+static intminute() + +
+          Minutes position of the current time.
+ floatmodelX(float x, + float y, + float z) + +
+           
+ floatmodelY(float x, + float y, + float z) + +
+           
+ floatmodelZ(float x, + float y, + float z) + +
+           
+static intmonth() + +
+          Get the current month in range 1 through 12.
+ voidmouseClicked() + +
+          When the mouse is clicked, mousePressed() will be called, + then mouseReleased(), then mouseClicked().
+ voidmouseClicked(java.awt.event.MouseEvent e) + +
+           
+ voidmouseDragged() + +
+          Mouse button is pressed and the mouse has been dragged.
+ voidmouseDragged(java.awt.event.MouseEvent e) + +
+           
+ voidmouseEntered(java.awt.event.MouseEvent e) + +
+           
+ voidmouseExited(java.awt.event.MouseEvent e) + +
+           
+ voidmouseMoved() + +
+          Mouse button is not pressed but the mouse has changed locations.
+ voidmouseMoved(java.awt.event.MouseEvent e) + +
+           
+ voidmousePressed() + +
+          Mouse has been pressed, and should be considered "down" + until mouseReleased() is called.
+ voidmousePressed(java.awt.event.MouseEvent e) + +
+          If you override this or any function that takes a "MouseEvent e" + without calling its super.mouseXxxx() then mouseX, mouseY, + mousePressed, and mouseEvent will no longer be set.
+ voidmouseReleased() + +
+          Mouse button has been released.
+ voidmouseReleased(java.awt.event.MouseEvent e) + +
+           
+static java.lang.String[]nf(float[] num, + int left, + int right) + +
+           
+static java.lang.Stringnf(float num, + int left, + int right) + +
+           
+static java.lang.String[]nf(int[] num, + int digits) + +
+           
+static java.lang.Stringnf(int num, + int digits) + +
+           
+static java.lang.String[]nfc(float[] num, + int right) + +
+           
+static java.lang.Stringnfc(float num, + int right) + +
+           
+static java.lang.Stringnfc(int num) + +
+           
+static java.lang.String[]nfc(int[] num) + +
+           
+static java.lang.String[]nfp(float[] num, + int left, + int right) + +
+           
+static java.lang.Stringnfp(float num, + int left, + int right) + +
+           
+static java.lang.String[]nfp(int[] num, + int digits) + +
+           
+static java.lang.Stringnfp(int num, + int digits) + +
+          number format positive (or plus) + Formats a number, always placing a - or + sign + in the front when it's negative or positive.
+static java.lang.String[]nfs(float[] num, + int left, + int right) + +
+          Number formatter that takes into account whether the number + has a sign (positive, negative, etc) in front of it.
+static java.lang.Stringnfs(float num, + int left, + int right) + +
+           
+static java.lang.String[]nfs(int[] num, + int digits) + +
+           
+static java.lang.Stringnfs(int num, + int digits) + +
+          number format signed (or space) + Formats a number but leaves a blank space in the front + when it's positive so that it can be properly aligned with + numbers that have a negative sign in front of them.
+ voidnoCursor() + +
+          Hide the cursor by creating a transparent image + and using it as a custom cursor.
+ voidnoFill() + +
+           
+ floatnoise(float x) + +
+          Computes the Perlin noise function value at point x.
+ floatnoise(float x, + float y) + +
+          Computes the Perlin noise function value at the point x, y.
+ floatnoise(float x, + float y, + float z) + +
+          Computes the Perlin noise function value at x, y, z.
+ voidnoiseDetail(int lod) + +
+           
+ voidnoiseDetail(int lod, + float falloff) + +
+           
+ voidnoiseSeed(long what) + +
+           
+ voidnoLights() + +
+           
+ voidnoLoop() + +
+           
+static floatnorm(float value, + float start, + float stop) + +
+          Normalize a value to exist between 0 and 1 (inclusive).
+ voidnormal(float nx, + float ny, + float nz) + +
+           
+ voidnoSmooth() + +
+           
+ voidnoStroke() + +
+           
+ voidnoTint() + +
+           
+static voidopen(java.lang.String filename) + +
+          Attempt to open a file using the platform's shell.
+static java.lang.Processopen(java.lang.String[] argv) + +
+          Launch a process using a platforms shell.
+ java.io.InputStreamopenStream(java.lang.String filename) + +
+          Deprecated. As of release 0136, use createInput() instead.
+ voidortho() + +
+           
+ voidortho(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ voidpaint(java.awt.Graphics screen) + +
+           
+ java.lang.Stringparam(java.lang.String what) + +
+          Get a param from the web page, or (eventually) + from a properties file.
+static boolean[]parseBoolean(byte[] what) + +
+          Convert a byte array to a boolean array.
+static booleanparseBoolean(int what) + +
+          Convert an integer to a boolean.
+static boolean[]parseBoolean(int[] what) + +
+          Convert an int array to a boolean array.
+static booleanparseBoolean(java.lang.String what) + +
+          Convert the string "true" or "false" to a boolean.
+static boolean[]parseBoolean(java.lang.String[] what) + +
+           
+static byteparseByte(boolean what) + +
+           
+static byte[]parseByte(boolean[] what) + +
+           
+static float[]parseByte(byte[] what) + +
+           
+static byteparseByte(char what) + +
+           
+static byte[]parseByte(char[] what) + +
+           
+static byteparseByte(float what) + +
+           
+static byte[]parseByte(float[] what) + +
+           
+static byteparseByte(int what) + +
+           
+static byte[]parseByte(int[] what) + +
+           
+static charparseChar(byte what) + +
+           
+static char[]parseChar(byte[] what) + +
+           
+static charparseChar(int what) + +
+           
+static char[]parseChar(int[] what) + +
+           
+static floatparseFloat(int what) + +
+          Convert an int to a float value.
+static float[]parseFloat(int[] what) + +
+           
+static floatparseFloat(java.lang.String what) + +
+           
+static float[]parseFloat(java.lang.String[] what) + +
+           
+static float[]parseFloat(java.lang.String[] what, + float missing) + +
+           
+static floatparseFloat(java.lang.String what, + float otherwise) + +
+           
+static intparseInt(boolean what) + +
+           
+static int[]parseInt(boolean[] what) + +
+           
+static intparseInt(byte what) + +
+          Note that parseInt() will un-sign a signed byte value.
+static int[]parseInt(byte[] what) + +
+           
+static intparseInt(char what) + +
+          Note that parseInt('5') is unlike String in the sense that it + won't return 5, but the ascii value.
+static int[]parseInt(char[] what) + +
+           
+static intparseInt(float what) + +
+          Same as floor(), or an (int) cast.
+static int[]parseInt(float[] what) + +
+           
+static intparseInt(java.lang.String what) + +
+          Parse a String into an int value.
+static int[]parseInt(java.lang.String[] what) + +
+          Make an array of int elements from an array of String objects.
+static int[]parseInt(java.lang.String[] what, + int missing) + +
+          Make an array of int elements from an array of String objects.
+static intparseInt(java.lang.String what, + int otherwise) + +
+          Parse a String to an int, and provide an alternate value that + should be used when the number is invalid.
+ voidperspective() + +
+           
+ voidperspective(float fovy, + float aspect, + float zNear, + float zFar) + +
+           
+ voidpoint(float x, + float y) + +
+           
+ voidpoint(float x, + float y, + float z) + +
+           
+ voidpointLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+           
+ voidpopStyle() + +
+           
+static floatpow(float a, + float b) + +
+           
+static voidprint(boolean what) + +
+           
+static voidprint(byte what) + +
+           
+static voidprint(char what) + +
+           
+static voidprint(float what) + +
+           
+static voidprint(int what) + +
+           
+static voidprint(java.lang.Object what) + +
+           
+static voidprint(java.lang.String what) + +
+           
+ voidprintCamera() + +
+           
+static voidprintln() + +
+           
+static voidprintln(boolean what) + +
+           
+static voidprintln(byte what) + +
+           
+static voidprintln(char what) + +
+           
+static voidprintln(float what) + +
+           
+static voidprintln(int what) + +
+           
+static voidprintln(java.lang.Object what) + +
+           
+static voidprintln(java.lang.String what) + +
+           
+ voidprintMatrix() + +
+           
+ voidprintProjection() + +
+           
+ voidpushMatrix() + +
+           
+ voidpushStyle() + +
+           
+ voidquad(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+static floatradians(float degrees) + +
+           
+ floatrandom(float howbig) + +
+          Return a random number in the range [0, howbig).
+ floatrandom(float howsmall, + float howbig) + +
+          Return a random number in the range [howsmall, howbig).
+ voidrandomSeed(long what) + +
+           
+ voidrect(float a, + float b, + float c, + float d) + +
+           
+ voidrectMode(int mode) + +
+           
+ floatred(int what) + +
+           
+ voidredraw() + +
+           
+ voidregisterDispose(java.lang.Object o) + +
+           
+ voidregisterDraw(java.lang.Object o) + +
+           
+ voidregisterKeyEvent(java.lang.Object o) + +
+           
+ voidregisterMouseEvent(java.lang.Object o) + +
+           
+ voidregisterPost(java.lang.Object o) + +
+           
+ voidregisterPre(java.lang.Object o) + +
+           
+ voidregisterSize(java.lang.Object o) + +
+           
+ voidremoveCache(java.lang.Object parent) + +
+           
+ PImagerequestImage(java.lang.String filename) + +
+           
+ PImagerequestImage(java.lang.String filename, + java.lang.String extension) + +
+           
+ voidresetMatrix() + +
+           
+static boolean[]reverse(boolean[] list) + +
+           
+static byte[]reverse(byte[] list) + +
+           
+static char[]reverse(char[] list) + +
+           
+static float[]reverse(float[] list) + +
+           
+static int[]reverse(int[] list) + +
+           
+static java.lang.Objectreverse(java.lang.Object list) + +
+           
+static java.lang.String[]reverse(java.lang.String[] list) + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+static intround(float what) + +
+           
+ voidrun() + +
+          Main method for the primary animation thread.
+ floatsaturation(int what) + +
+           
+ voidsave(java.lang.String filename) + +
+          Intercepts any relative paths to make them absolute (relative + to the sketch folder) before passing to save() in PImage.
+static voidsaveBytes(java.io.File file, + byte[] buffer) + +
+          Saves bytes to a specific File location specified by the user.
+static voidsaveBytes(java.io.OutputStream output, + byte[] buffer) + +
+          Spews a buffer of bytes to an OutputStream.
+ voidsaveBytes(java.lang.String filename, + byte[] buffer) + +
+          Saves bytes to a file to inside the sketch folder.
+ java.io.FilesaveFile(java.lang.String where) + +
+          Identical to savePath(), but returns a File object.
+ voidsaveFrame() + +
+          Grab an image of what's currently in the drawing area and save it + as a .tif or .tga file.
+ voidsaveFrame(java.lang.String what) + +
+          Save the current frame as a .tif or .tga image.
+ java.lang.StringsavePath(java.lang.String where) + +
+          Returns a path inside the applet folder to save to.
+static voidsaveStream(java.io.File targetFile, + java.io.InputStream sourceStream) + +
+           
+ voidsaveStream(java.io.File targetFile, + java.lang.String sourceLocation) + +
+          Identical to the other saveStream(), but writes to a File + object, for greater control over the file location.
+ voidsaveStream(java.lang.String targetFilename, + java.lang.String sourceLocation) + +
+          Save the contents of a stream to a file in the sketch folder.
+static voidsaveStrings(java.io.File file, + java.lang.String[] strings) + +
+           
+static voidsaveStrings(java.io.OutputStream output, + java.lang.String[] strings) + +
+           
+ voidsaveStrings(java.lang.String filename, + java.lang.String[] strings) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ floatscreenX(float x, + float y) + +
+           
+ floatscreenX(float x, + float y, + float z) + +
+           
+ floatscreenY(float x, + float y) + +
+           
+ floatscreenY(float x, + float y, + float z) + +
+           
+ floatscreenZ(float x, + float y, + float z) + +
+           
+static intsecond() + +
+          Seconds position of the current time.
+ java.lang.StringselectFolder() + +
+          Open a platform-specific folder chooser dialog.
+ java.lang.StringselectFolder(java.lang.String prompt) + +
+          Open a platform-specific folder chooser dialog.
+ java.lang.StringselectInput() + +
+          Open a platform-specific file chooser dialog to select a file for input.
+ java.lang.StringselectInput(java.lang.String prompt) + +
+          Open a platform-specific file chooser dialog to select a file for input.
+ java.lang.StringselectOutput() + +
+          Open a platform-specific file save dialog to select a file for output.
+ java.lang.StringselectOutput(java.lang.String prompt) + +
+          Open a platform-specific file save dialog to select a file for output.
+ voidset(int x, + int y, + int c) + +
+           
+ voidset(int x, + int y, + PImage src) + +
+           
+ voidsetCache(java.lang.Object parent, + java.lang.Object storage) + +
+           
+ voidsetMatrix(PMatrix source) + +
+           
+ voidsetMatrix(PMatrix2D source) + +
+           
+ voidsetMatrix(PMatrix3D source) + +
+           
+ voidsetup() + +
+           
+ voidsetupExternalMessages() + +
+          Set this sketch to communicate its state back to the PDE.
+ voidsetupFrameResizeListener() + +
+          Set up a listener that will fire proper component resize events + in cases where frame.setResizable(true) is called.
+ voidshape(PShape shape) + +
+           
+ voidshape(PShape shape, + float x, + float y) + +
+           
+ voidshape(PShape shape, + float x, + float y, + float c, + float d) + +
+           
+ voidshapeMode(int mode) + +
+           
+ voidshininess(float shine) + +
+           
+static boolean[]shorten(boolean[] list) + +
+           
+static byte[]shorten(byte[] list) + +
+           
+static char[]shorten(char[] list) + +
+           
+static float[]shorten(float[] list) + +
+           
+static int[]shorten(int[] list) + +
+           
+static java.lang.Objectshorten(java.lang.Object list) + +
+           
+static java.lang.String[]shorten(java.lang.String[] list) + +
+           
+static floatsin(float angle) + +
+           
+ voidsize(int iwidth, + int iheight) + +
+          Starts up and creates a two-dimensional drawing surface, + or resizes the current drawing surface.
+ voidsize(int iwidth, + int iheight, + java.lang.String irenderer) + +
+           
+ voidsize(int iwidth, + int iheight, + java.lang.String irenderer, + java.lang.String ipath) + +
+          Creates a new PGraphics object and sets it to the specified size.
+ java.io.FilesketchFile(java.lang.String where) + +
+           
+ java.lang.StringsketchPath(java.lang.String where) + +
+          Prepend the sketch folder path to the filename (or path) that is + passed in.
+ voidsmooth() + +
+           
+static byte[]sort(byte[] what) + +
+           
+static byte[]sort(byte[] what, + int count) + +
+           
+static char[]sort(char[] what) + +
+           
+static char[]sort(char[] what, + int count) + +
+           
+static float[]sort(float[] what) + +
+           
+static float[]sort(float[] what, + int count) + +
+           
+static int[]sort(int[] what) + +
+           
+static int[]sort(int[] what, + int count) + +
+           
+static java.lang.String[]sort(java.lang.String[] what) + +
+           
+static java.lang.String[]sort(java.lang.String[] what, + int count) + +
+           
+ voidspecular(float gray) + +
+           
+ voidspecular(float x, + float y, + float z) + +
+           
+ voidspecular(int rgb) + +
+           
+ voidsphere(float r) + +
+           
+ voidsphereDetail(int res) + +
+           
+ voidsphereDetail(int ures, + int vres) + +
+           
+static boolean[]splice(boolean[] list, + boolean[] v, + int index) + +
+           
+static boolean[]splice(boolean[] list, + boolean v, + int index) + +
+           
+static byte[]splice(byte[] list, + byte[] v, + int index) + +
+           
+static byte[]splice(byte[] list, + byte v, + int index) + +
+           
+static char[]splice(char[] list, + char[] v, + int index) + +
+           
+static char[]splice(char[] list, + char v, + int index) + +
+           
+static float[]splice(float[] list, + float[] v, + int index) + +
+           
+static float[]splice(float[] list, + float v, + int index) + +
+           
+static int[]splice(int[] list, + int[] v, + int index) + +
+           
+static int[]splice(int[] list, + int v, + int index) + +
+           
+static java.lang.Objectsplice(java.lang.Object list, + java.lang.Object v, + int index) + +
+           
+static java.lang.String[]splice(java.lang.String[] list, + java.lang.String[] v, + int index) + +
+           
+static java.lang.String[]splice(java.lang.String[] list, + java.lang.String v, + int index) + +
+           
+static java.lang.String[]split(java.lang.String what, + char delim) + +
+          Split a string into pieces along a specific character.
+static java.lang.String[]split(java.lang.String what, + java.lang.String delim) + +
+          Split a String on a specific delimiter.
+static java.lang.String[]splitTokens(java.lang.String what) + +
+          Split the provided String at wherever whitespace occurs.
+static java.lang.String[]splitTokens(java.lang.String what, + java.lang.String delim) + +
+          Splits a string into pieces, using any of the chars in the + String 'delim' as separator characters.
+ voidspotLight(float red, + float green, + float blue, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+static floatsq(float a) + +
+           
+static floatsqrt(float a) + +
+           
+ voidstart() + +
+          Called by the browser or applet viewer to inform this applet that it + should start its execution.
+ voidstatus(java.lang.String what) + +
+          Show status in the status bar of a web browser, or in the + System.out console.
+ voidstop() + +
+          Called by the browser or applet viewer to inform + this applet that it should stop its execution.
+static java.lang.Stringstr(boolean x) + +
+           
+static java.lang.String[]str(boolean[] x) + +
+           
+static java.lang.Stringstr(byte x) + +
+           
+static java.lang.String[]str(byte[] x) + +
+           
+static java.lang.Stringstr(char x) + +
+           
+static java.lang.String[]str(char[] x) + +
+           
+static java.lang.Stringstr(float x) + +
+           
+static java.lang.String[]str(float[] x) + +
+           
+static java.lang.Stringstr(int x) + +
+           
+static java.lang.String[]str(int[] x) + +
+           
+ voidstroke(float gray) + +
+           
+ voidstroke(float gray, + float alpha) + +
+           
+ voidstroke(float x, + float y, + float z) + +
+           
+ voidstroke(float x, + float y, + float z, + float a) + +
+           
+ voidstroke(int rgb) + +
+           
+ voidstroke(int rgb, + float alpha) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ voidstyle(PStyle s) + +
+           
+static boolean[]subset(boolean[] list, + int start) + +
+           
+static boolean[]subset(boolean[] list, + int start, + int count) + +
+           
+static byte[]subset(byte[] list, + int start) + +
+           
+static byte[]subset(byte[] list, + int start, + int count) + +
+           
+static char[]subset(char[] list, + int start) + +
+           
+static char[]subset(char[] list, + int start, + int count) + +
+           
+static float[]subset(float[] list, + int start) + +
+           
+static float[]subset(float[] list, + int start, + int count) + +
+           
+static int[]subset(int[] list, + int start) + +
+           
+static int[]subset(int[] list, + int start, + int count) + +
+           
+static java.lang.Objectsubset(java.lang.Object list, + int start) + +
+           
+static java.lang.Objectsubset(java.lang.Object list, + int start, + int count) + +
+           
+static java.lang.String[]subset(java.lang.String[] list, + int start) + +
+           
+static java.lang.String[]subset(java.lang.String[] list, + int start, + int count) + +
+           
+static floattan(float angle) + +
+           
+ voidtext(char c) + +
+           
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y) + +
+           
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y, + float z) + +
+           
+ voidtext(char c, + float x, + float y) + +
+           
+ voidtext(char c, + float x, + float y, + float z) + +
+           
+ voidtext(float num, + float x, + float y) + +
+           
+ voidtext(float num, + float x, + float y, + float z) + +
+           
+ voidtext(int num, + float x, + float y) + +
+           
+ voidtext(int num, + float x, + float y, + float z) + +
+           
+ voidtext(java.lang.String str) + +
+           
+ voidtext(java.lang.String str, + float x, + float y) + +
+           
+ voidtext(java.lang.String str, + float x, + float y, + float z) + +
+           
+ voidtext(java.lang.String str, + float x1, + float y1, + float x2, + float y2) + +
+           
+ voidtext(java.lang.String s, + float x1, + float y1, + float x2, + float y2, + float z) + +
+           
+ voidtextAlign(int align) + +
+           
+ voidtextAlign(int alignX, + int alignY) + +
+           
+ floattextAscent() + +
+           
+ floattextDescent() + +
+           
+ voidtextFont(PFont which) + +
+           
+ voidtextFont(PFont which, + float size) + +
+           
+ voidtextLeading(float leading) + +
+           
+ voidtextMode(int mode) + +
+           
+ voidtextSize(float size) + +
+           
+ voidtexture(PImage image) + +
+           
+ voidtextureMode(int mode) + +
+           
+ floattextWidth(char c) + +
+           
+ floattextWidth(java.lang.String str) + +
+           
+ voidtint(float gray) + +
+           
+ voidtint(float gray, + float alpha) + +
+           
+ voidtint(float x, + float y, + float z) + +
+           
+ voidtint(float x, + float y, + float z, + float a) + +
+           
+ voidtint(int rgb) + +
+           
+ voidtint(int rgb, + float alpha) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ voidtriangle(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+static java.lang.Stringtrim(java.lang.String str) + +
+          Remove whitespace characters from the beginning and ending + of a String.
+static java.lang.String[]trim(java.lang.String[] array) + +
+          Trim the whitespace from a String array.
+static intunbinary(java.lang.String what) + +
+          Unpack a binary String into an int.
+static intunhex(java.lang.String what) + +
+           
+ voidunregisterDispose(java.lang.Object o) + +
+           
+ voidunregisterDraw(java.lang.Object o) + +
+           
+ voidunregisterKeyEvent(java.lang.Object o) + +
+           
+ voidunregisterMouseEvent(java.lang.Object o) + +
+           
+ voidunregisterPost(java.lang.Object o) + +
+           
+ voidunregisterPre(java.lang.Object o) + +
+           
+ voidunregisterSize(java.lang.Object o) + +
+           
+ voidupdate(java.awt.Graphics screen) + +
+           
+ voidupdatePixels() + +
+           
+ voidupdatePixels(int x1, + int y1, + int x2, + int y2) + +
+           
+ voidvertex(float[] v) + +
+           
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+static intyear() + +
+          Get the current year.
+ + + + + + + +
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
+ + + + + + + +
Methods inherited from class java.awt.Panel
addNotify
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+javaVersionName

+
+public static final java.lang.String javaVersionName
+
+
Full name of the Java version (i.e. 1.5.0_11). + Prior to 0125, this was only the first three digits. +

+

+
+
+
+ +

+javaVersion

+
+public static final float javaVersion
+
+
Version of Java that's in use, whether 1.1 or 1.3 or whatever, + stored as a float. +

+ Note that because this is stored as a float, the values may + not be exactly 1.3 or 1.4. Instead, make sure you're + comparing against 1.3f or 1.4f, which will have the same amount + of error (i.e. 1.40000001). This could just be a double, but + since Processing only uses floats, it's safer for this to be a float + because there's no good way to specify a double with the preproc. +

+

+
+
+
+ +

+platform

+
+public static int platform
+
+
Current platform in use, one of the + PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER. +

+

+
+
+
+ +

+MENU_SHORTCUT

+
+public static final int MENU_SHORTCUT
+
+
Modifier flags for the shortcut key used to trigger menus. + (Cmd on Mac OS X, Ctrl on Linux and Windows) +

+

+
+
+
+ +

+g

+
+public PGraphics g
+
+
The PGraphics renderer associated with this PApplet +

+

+
+
+
+ +

+frame

+
+public java.awt.Frame frame
+
+
The frame containing this applet (if any) +

+

+
+
+
+ +

+screen

+
+public java.awt.Dimension screen
+
+
The screen size when the applet was started. +

+ Access this via screen.width and screen.height. To make an applet + run at full screen, use size(screen.width, screen.height). +

+ If you have multiple displays, this will be the size of the main + display. Running full screen across multiple displays isn't + particularly supported, and requires more monkeying with the values. + This probably can't/won't be fixed until/unless I get a dual head + system. +

+ Note that this won't update if you change the resolution + of your screen once the the applet is running. +

+ This variable is not static, because future releases need to be better + at handling multiple displays. +

+

+
+
+
+ +

+recorder

+
+public PGraphics recorder
+
+
A leech graphics object that is echoing all events. +

+

+
+
+
+ +

+args

+
+public java.lang.String[] args
+
+
Command line options passed in from main(). +

+ This does not include the arguments passed in to PApplet itself. +

+

+
+
+
+ +

+sketchPath

+
+public java.lang.String sketchPath
+
+
Path to sketch folder +

+

+
+
+
+ +

+DEFAULT_WIDTH

+
+public static final int DEFAULT_WIDTH
+
+
Default width and height for applet when not specified +

+

+
See Also:
Constant Field Values
+
+
+ +

+DEFAULT_HEIGHT

+
+public static final int DEFAULT_HEIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MIN_WINDOW_WIDTH

+
+public static final int MIN_WINDOW_WIDTH
+
+
Minimum dimensions for the window holding an applet. + This varies between platforms, Mac OS X 10.3 can do any height + but requires at least 128 pixels width. Windows XP has another + set of limitations. And for all I know, Linux probably lets you + make windows with negative sizes. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MIN_WINDOW_HEIGHT

+
+public static final int MIN_WINDOW_HEIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+defaultSize

+
+public boolean defaultSize
+
+
true if no size() command has been executed. This is used to wait until + a size has been set before placing in the window and showing it. +

+

+
+
+
+ +

+pixels

+
+public int[] pixels
+
+
Pixel buffer from this applet's PGraphics. +

+ When used with OpenGL or Java2D, this value will + be null until loadPixels() has been called. +

+

+
+
+
+ +

+width

+
+public int width
+
+
width of this applet's associated PGraphics +

+

+
+
+
+ +

+height

+
+public int height
+
+
height of this applet's associated PGraphics +

+

+
+
+
+ +

+mouseX

+
+public int mouseX
+
+
current x position of the mouse +

+

+
+
+
+ +

+mouseY

+
+public int mouseY
+
+
current y position of the mouse +

+

+
+
+
+ +

+pmouseX

+
+public int pmouseX
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+ +

+pmouseY

+
+public int pmouseY
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+ +

+firstMouse

+
+public boolean firstMouse
+
+
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump. +

+ Just using (frameCount == 0) won't work since mouseXxxxx() + may not be called until a couple frames into things. +

+

+
+
+
+ +

+mouseButton

+
+public int mouseButton
+
+
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. +

+ If running on Mac OS, a ctrl-click will be interpreted as + the righthand mouse button (unlike Java, which reports it as + the left mouse). +

+

+
+
+
+ +

+mousePressed

+
+public boolean mousePressed
+
+
+
+
+
+ +

+mouseEvent

+
+public java.awt.event.MouseEvent mouseEvent
+
+
+
+
+
+ +

+key

+
+public char key
+
+
Last key pressed. +

+ If it's a coded key, i.e. UP/DOWN/CTRL/SHIFT/ALT, + this will be set to CODED (0xffff or 65535). +

+

+
+
+
+ +

+keyCode

+
+public int keyCode
+
+
When "key" is set to CODED, this will contain a Java key code. +

+ For the arrow keys, keyCode will be one of UP, DOWN, LEFT and RIGHT. + Also available are ALT, CONTROL and SHIFT. A full set of constants + can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables. +

+

+
+
+
+ +

+keyPressed

+
+public boolean keyPressed
+
+
true if the mouse is currently pressed. +

+

+
+
+
+ +

+keyEvent

+
+public java.awt.event.KeyEvent keyEvent
+
+
the last KeyEvent object passed into a mouse function. +

+

+
+
+
+ +

+focused

+
+public boolean focused
+
+
Gets set to true/false as the applet gains/loses focus. +

+

+
+
+
+ +

+online

+
+public boolean online
+
+
true if the applet is online. +

+ This can be used to test how the applet should behave + since online situations are different (no file writing, etc). +

+

+
+
+
+ +

+frameRate

+
+public float frameRate
+
+
The current value of frames per second. +

+ The initial value will be 10 fps, and will be updated with each + frame thereafter. The value is not instantaneous (since that + wouldn't be very useful since it would jump around so much), + but is instead averaged (integrated) over several frames. + As such, this value won't be valid until after 5-10 frames. +

+

+
+
+
+ +

+frameCount

+
+public int frameCount
+
+
How many frames have been displayed since the applet started. +

+ This value is read-only do not attempt to set it, + otherwise bad things will happen. +

+ Inside setup(), frameCount is 0. + For the first iteration of draw(), frameCount will equal 1. +

+

+
+
+
+ +

+finished

+
+public boolean finished
+
+
true if this applet has had it. +

+

+
+
+
+ +

+ARGS_EDITOR_LOCATION

+
+public static final java.lang.String ARGS_EDITOR_LOCATION
+
+
Position of the upper-lefthand corner of the editor window + that launched this applet. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ARGS_EXTERNAL

+
+public static final java.lang.String ARGS_EXTERNAL
+
+
Location for where to position the applet window on screen. +

+ This is used by the editor to when saving the previous applet + location, or could be used by other classes to launch at a + specific position on-screen. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ARGS_LOCATION

+
+public static final java.lang.String ARGS_LOCATION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_DISPLAY

+
+public static final java.lang.String ARGS_DISPLAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_BGCOLOR

+
+public static final java.lang.String ARGS_BGCOLOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_PRESENT

+
+public static final java.lang.String ARGS_PRESENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_EXCLUSIVE

+
+public static final java.lang.String ARGS_EXCLUSIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_STOP_COLOR

+
+public static final java.lang.String ARGS_STOP_COLOR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_HIDE_STOP

+
+public static final java.lang.String ARGS_HIDE_STOP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGS_SKETCH_FOLDER

+
+public static final java.lang.String ARGS_SKETCH_FOLDER
+
+
Allows the user or PdeEditor to set a specific sketch folder path. +

+ Used by PdeEditor to pass in the location where saveFrame() + and all that stuff should write things. +

+

+
See Also:
Constant Field Values
+
+
+ +

+EXTERNAL_STOP

+
+public static final java.lang.String EXTERNAL_STOP
+
+
When run externally to a PdeEditor, + this is sent by the applet when it quits. +

+

+
See Also:
Constant Field Values
+
+
+ +

+EXTERNAL_MOVE

+
+public static final java.lang.String EXTERNAL_MOVE
+
+
When run externally to a PDE Editor, this is sent by the applet + whenever the window is moved. +

+ This is used so that the editor can re-open the sketch window + in the same position as the user last left it. +

+

+
See Also:
Constant Field Values
+
+
+ +

+requestImageMax

+
+public int requestImageMax
+
+
By trial and error, four image loading threads seem to work best when + loading images from online. This is consistent with the number of open + connections that web browsers will maintain. The variable is made public + (however no accessor has been added since it's esoteric) if you really + want to have control over the value used. For instance, when loading local + files, it might be better to only have a single thread (or two) loading + images so that you're disk isn't simply jumping around. +

+

+
+
+
+ +

+selectedFile

+
+public java.io.File selectedFile
+
+
+
+
+
+ +

+ICON_IMAGE

+
+public static final byte[] ICON_IMAGE
+
+
GIF image of the Processing logo. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PApplet

+
+public PApplet()
+
+
+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init()
+
+
+
Overrides:
init in class java.applet.Applet
+
+
+
+
+
+
+ +

+getSketchWidth

+
+public int getSketchWidth()
+
+
+
+
+
+
+
+
+
+ +

+getSketchHeight

+
+public int getSketchHeight()
+
+
+
+
+
+
+
+
+
+ +

+getSketchRenderer

+
+public java.lang.String getSketchRenderer()
+
+
+
+
+
+
+
+
+
+ +

+start

+
+public void start()
+
+
Called by the browser or applet viewer to inform this applet that it + should start its execution. It is called after the init method and + each time the applet is revisited in a Web page. +

+ Called explicitly via the first call to PApplet.paint(), because + PAppletGL needs to have a usable screen before getting things rolling. +

+

+
Overrides:
start in class java.applet.Applet
+
+
+
+
+
+
+ +

+stop

+
+public void stop()
+
+
Called by the browser or applet viewer to inform + this applet that it should stop its execution. +

+ Unfortunately, there are no guarantees from the Java spec + when or if stop() will be called (i.e. on browser quit, + or when moving between web pages), and it's not always called. +

+

+
Overrides:
stop in class java.applet.Applet
+
+
+
+
+
+
+ +

+destroy

+
+public void destroy()
+
+
Called by the browser or applet viewer to inform this applet + that it is being reclaimed and that it should destroy + any resources that it has allocated. +

+ This also attempts to call PApplet.stop(), in case there + was an inadvertent override of the stop() function by a user. +

+ destroy() supposedly gets called as the applet viewer + is shutting down the applet. stop() is called + first, and then destroy() to really get rid of things. + no guarantees on when they're run (on browser quit, or + when moving between pages), though. +

+

+
Overrides:
destroy in class java.applet.Applet
+
+
+
+
+
+
+ +

+registerSize

+
+public void registerSize(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerPre

+
+public void registerPre(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerDraw

+
+public void registerDraw(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerPost

+
+public void registerPost(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerMouseEvent

+
+public void registerMouseEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerKeyEvent

+
+public void registerKeyEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+registerDispose

+
+public void registerDispose(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterSize

+
+public void unregisterSize(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterPre

+
+public void unregisterPre(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterDraw

+
+public void unregisterDraw(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterPost

+
+public void unregisterPost(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterMouseEvent

+
+public void unregisterMouseEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterKeyEvent

+
+public void unregisterKeyEvent(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+unregisterDispose

+
+public void unregisterDispose(java.lang.Object o)
+
+
+
+
+
+
+
+
+
+ +

+setup

+
+public void setup()
+
+
+
+
+
+
+
+
+
+ +

+draw

+
+public void draw()
+
+
+
+
+
+
+
+
+
+ +

+size

+
+public void size(int iwidth,
+                 int iheight)
+
+
Starts up and creates a two-dimensional drawing surface, + or resizes the current drawing surface. +

+ This should be the first thing called inside of setup(). +

+ If using Java 1.3 or later, this will default to using + PGraphics2, the Java2D-based renderer. If using Java 1.1, + or if PGraphics2 is not available, then PGraphics will be used. + To set your own renderer, use the other version of the size() + method that takes a renderer as its last parameter. +

+ If called once a renderer has already been set, this will + use the previous renderer and simply resize it. +

+

+
+
+
+
+
+
+
+ +

+size

+
+public void size(int iwidth,
+                 int iheight,
+                 java.lang.String irenderer)
+
+
+
+
+
+
+
+
+
+ +

+size

+
+public void size(int iwidth,
+                 int iheight,
+                 java.lang.String irenderer,
+                 java.lang.String ipath)
+
+
Creates a new PGraphics object and sets it to the specified size. + + Note that you cannot change the renderer once outside of setup(). + In most cases, you can call size() to give it a new size, + but you need to always ask for the same renderer, otherwise + you're gonna run into trouble. + + The size() method should *only* be called from inside the setup() or + draw() methods, so that it is properly run on the main animation thread. + To change the size of a PApplet externally, use setSize(), which will + update the component size, and queue a resize of the renderer as well. +

+

+
+
+
+
+
+
+
+ +

+createGraphics

+
+public PGraphics createGraphics(int iwidth,
+                                int iheight,
+                                java.lang.String irenderer)
+
+
Create an offscreen PGraphics object for drawing. This can be used + for bitmap or vector images drawing or rendering. +
    +
  • Do not use "new PGraphicsXxxx()", use this method. This method + ensures that internal variables are set up properly that tie the + new graphics context back to its parent PApplet. +
  • The basic way to create bitmap images is to use the saveFrame() + function. +
  • If you want to create a really large scene and write that, + first make sure that you've allocated a lot of memory in the Preferences. +
  • If you want to create images that are larger than the screen, + you should create your own PGraphics object, draw to that, and use + save(). + For now, it's best to use P3D in this scenario. + P2D is currently disabled, and the JAVA2D default will give mixed + results. An example of using P3D: +
    +
    + PGraphics big;
    +
    + void setup() {
    +   big = createGraphics(3000, 3000, P3D);
    +
    +   big.beginDraw();
    +   big.background(128);
    +   big.line(20, 1800, 1800, 900);
    +   // etc..
    +   big.endDraw();
    +
    +   // make sure the file is written to the sketch folder
    +   big.save("big.tif");
    + }
    +
    + 
    +
  • It's important to always wrap drawing to createGraphics() with + beginDraw() and endDraw() (beginFrame() and endFrame() prior to + revision 0115). The reason is that the renderer needs to know when + drawing has stopped, so that it can update itself internally. + This also handles calling the defaults() method, for people familiar + with that. +
  • It's not possible to use createGraphics() with the OPENGL renderer, + because it doesn't allow offscreen use. +
  • With Processing 0115 and later, it's possible to write images in + formats other than the default .tga and .tiff. The exact formats and + background information can be found in the developer's reference for + PImage.save(). +
+

+

+
+
+
+
+
+
+
+ +

+createGraphics

+
+public PGraphics createGraphics(int iwidth,
+                                int iheight,
+                                java.lang.String irenderer,
+                                java.lang.String ipath)
+
+
Create an offscreen graphics surface for drawing, in this case + for a renderer that writes to a file (such as PDF or DXF). +

+

+
+
+
+
Parameters:
ipath - can be an absolute or relative path
+
+
+
+ +

+createImage

+
+public PImage createImage(int wide,
+                          int high,
+                          int format)
+
+
Preferred method of creating new PImage objects, ensures that a + reference to the parent PApplet is included, which makes save() work + without needing an absolute path. +

+

+
+
+
+
+
+
+
+ +

+update

+
+public void update(java.awt.Graphics screen)
+
+
+
Overrides:
update in class java.awt.Container
+
+
+
+
+
+
+ +

+paint

+
+public void paint(java.awt.Graphics screen)
+
+
+
Overrides:
paint in class java.awt.Container
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
Main method for the primary animation thread. + + Painting in AWT and Swing +

+

+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+handleDraw

+
+public void handleDraw()
+
+
+
+
+
+
+
+
+
+ +

+redraw

+
+public void redraw()
+
+
+
+
+
+
+
+
+
+ +

+loop

+
+public void loop()
+
+
+
+
+
+
+
+
+
+ +

+noLoop

+
+public void noLoop()
+
+
+
+
+
+
+
+
+
+ +

+addListeners

+
+public void addListeners()
+
+
+
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed(java.awt.event.MouseEvent e)
+
+
If you override this or any function that takes a "MouseEvent e" + without calling its super.mouseXxxx() then mouseX, mouseY, + mousePressed, and mouseEvent will no longer be set. +

+

+
Specified by:
mousePressed in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseReleased

+
+public void mouseReleased(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseReleased in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseClicked

+
+public void mouseClicked(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseClicked in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseEntered

+
+public void mouseEntered(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseEntered in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseExited

+
+public void mouseExited(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseExited in interface java.awt.event.MouseListener
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
+
+
+
+
+
+
+ +

+mouseMoved

+
+public void mouseMoved(java.awt.event.MouseEvent e)
+
+
+
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
+
+
+
+
+
+
+ +

+mousePressed

+
+public void mousePressed()
+
+
Mouse has been pressed, and should be considered "down" + until mouseReleased() is called. If you must, use + int button = mouseEvent.getButton(); + to figure out which button was clicked. It will be one of: + MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3 + Note, however, that this is completely inconsistent across + platforms. +

+

+
+
+
+
+
+
+
+ +

+mouseReleased

+
+public void mouseReleased()
+
+
Mouse button has been released. +

+

+
+
+
+
+
+
+
+ +

+mouseClicked

+
+public void mouseClicked()
+
+
When the mouse is clicked, mousePressed() will be called, + then mouseReleased(), then mouseClicked(). Note that + mousePressed is already false inside of mouseClicked(). +

+

+
+
+
+
+
+
+
+ +

+mouseDragged

+
+public void mouseDragged()
+
+
Mouse button is pressed and the mouse has been dragged. +

+

+
+
+
+
+
+
+
+ +

+mouseMoved

+
+public void mouseMoved()
+
+
Mouse button is not pressed but the mouse has changed locations. +

+

+
+
+
+
+
+
+
+ +

+keyPressed

+
+public void keyPressed(java.awt.event.KeyEvent e)
+
+
Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + 'keyCode', and 'keyEvent' variables to no longer work; + key events will no longer be queued until the end of draw(); + and the keyPressed(), keyReleased() and keyTyped() methods + will no longer be called. +

+

+
Specified by:
keyPressed in interface java.awt.event.KeyListener
+
+
+
+
+
+
+ +

+keyReleased

+
+public void keyReleased(java.awt.event.KeyEvent e)
+
+
+
Specified by:
keyReleased in interface java.awt.event.KeyListener
+
+
+
+
+
+
+ +

+keyTyped

+
+public void keyTyped(java.awt.event.KeyEvent e)
+
+
+
Specified by:
keyTyped in interface java.awt.event.KeyListener
+
+
+
+
+
+
+ +

+keyPressed

+
+public void keyPressed()
+
+
Called each time a single key on the keyboard is pressed. + Because of how operating systems handle key repeats, holding + down a key will cause multiple calls to keyPressed(), because + the OS repeat takes over. +

+ Examples for key handling: + (Tested on Windows XP, please notify if different on other + platforms, I have a feeling Mac OS and Linux may do otherwise) +

+ 1. Pressing 'a' on the keyboard:
+    keyPressed  with key == 'a' and keyCode == 'A'
+    keyTyped    with key == 'a' and keyCode ==  0
+    keyReleased with key == 'a' and keyCode == 'A'
+
+ 2. Pressing 'A' on the keyboard:
+    keyPressed  with key == 'A' and keyCode == 'A'
+    keyTyped    with key == 'A' and keyCode ==  0
+    keyReleased with key == 'A' and keyCode == 'A'
+
+ 3. Pressing 'shift', then 'a' on the keyboard (caps lock is off):
+    keyPressed  with key == CODED and keyCode == SHIFT
+    keyPressed  with key == 'A'   and keyCode == 'A'
+    keyTyped    with key == 'A'   and keyCode == 0
+    keyReleased with key == 'A'   and keyCode == 'A'
+    keyReleased with key == CODED and keyCode == SHIFT
+
+ 4. Holding down the 'a' key.
+    The following will happen several times,
+    depending on your machine's "key repeat rate" settings:
+    keyPressed  with key == 'a' and keyCode == 'A'
+    keyTyped    with key == 'a' and keyCode ==  0
+    When you finally let go, you'll get:
+    keyReleased with key == 'a' and keyCode == 'A'
+
+ 5. Pressing and releasing the 'shift' key
+    keyPressed  with key == CODED and keyCode == SHIFT
+    keyReleased with key == CODED and keyCode == SHIFT
+    (note there is no keyTyped)
+
+ 6. Pressing the tab key in an applet with Java 1.4 will
+    normally do nothing, but PApplet dynamically shuts
+    this behavior off if Java 1.4 is in use (tested 1.4.2_05 Windows).
+    Java 1.1 (Microsoft VM) passes the TAB key through normally.
+    Not tested on other platforms or for 1.3.
+ 
+

+

+
+
+
+
+
+
+
+ +

+keyReleased

+
+public void keyReleased()
+
+
See keyPressed(). +

+

+
+
+
+
+
+
+
+ +

+keyTyped

+
+public void keyTyped()
+
+
Only called for "regular" keys like letters, + see keyPressed() for full documentation. +

+

+
+
+
+
+
+
+
+ +

+focusGained

+
+public void focusGained()
+
+
+
+
+
+
+
+
+
+ +

+focusGained

+
+public void focusGained(java.awt.event.FocusEvent e)
+
+
+
Specified by:
focusGained in interface java.awt.event.FocusListener
+
+
+
+
+
+
+ +

+focusLost

+
+public void focusLost()
+
+
+
+
+
+
+
+
+
+ +

+focusLost

+
+public void focusLost(java.awt.event.FocusEvent e)
+
+
+
Specified by:
focusLost in interface java.awt.event.FocusListener
+
+
+
+
+
+
+ +

+millis

+
+public int millis()
+
+
Get the number of milliseconds since the applet started. +

+ This is a function, rather than a variable, because it may + change multiple times per frame. +

+

+
+
+
+
+
+
+
+ +

+second

+
+public static int second()
+
+
Seconds position of the current time. +

+

+
+
+
+
+
+
+
+ +

+minute

+
+public static int minute()
+
+
Minutes position of the current time. +

+

+
+
+
+
+
+
+
+ +

+hour

+
+public static int hour()
+
+
Hour position of the current time in international format (0-23). +

+ To convert this value to American time:
+

int yankeeHour = (hour() % 12);
+ if (yankeeHour == 0) yankeeHour = 12;
+

+

+
+
+
+
+
+
+
+ +

+day

+
+public static int day()
+
+
Get the current day of the month (1 through 31). +

+ If you're looking for the day of the week (M-F or whatever) + or day of the year (1..365) then use java's Calendar.get() +

+

+
+
+
+
+
+
+
+ +

+month

+
+public static int month()
+
+
Get the current month in range 1 through 12. +

+

+
+
+
+
+
+
+
+ +

+year

+
+public static int year()
+
+
Get the current year. +

+

+
+
+
+
+
+
+
+ +

+delay

+
+public void delay(int napTime)
+
+
The delay() function causes the program to halt for a specified time. + Delay times are specified in thousandths of a second. For example, + running delay(3000) will stop the program for three seconds and + delay(500) will stop the program for a half-second. Remember: the + display window is updated only at the end of draw(), so putting more + than one delay() inside draw() will simply add them together and the new + frame will be drawn when the total delay is over. +

+ I'm not sure if this is even helpful anymore, as the screen isn't + updated before or after the delay, meaning which means it just + makes the app lock up temporarily. +

+

+
+
+
+
+
+
+
+ +

+frameRate

+
+public void frameRate(float newRateTarget)
+
+
Set a target frameRate. This will cause delay() to be called + after each frame so that the sketch synchronizes to a particular speed. + Note that this only sets the maximum frame rate, it cannot be used to + make a slow sketch go faster. Sketches have no default frame rate + setting, and will attempt to use maximum processor power to achieve + maximum speed. +

+

+
+
+
+
+
+
+
+ +

+param

+
+public java.lang.String param(java.lang.String what)
+
+
Get a param from the web page, or (eventually) + from a properties file. +

+

+
+
+
+
+
+
+
+ +

+status

+
+public void status(java.lang.String what)
+
+
Show status in the status bar of a web browser, or in the + System.out console. Eventually this might show status in the + p5 environment itself, rather than relying on the console. +

+

+
+
+
+
+
+
+
+ +

+link

+
+public void link(java.lang.String here)
+
+
+
+
+
+
+
+
+
+ +

+link

+
+public void link(java.lang.String url,
+                 java.lang.String frameTitle)
+
+
Link to an external page without all the muss. +

+ When run with an applet, uses the browser to open the url, + for applications, attempts to launch a browser with the url. +

+ Works on Mac OS X and Windows. For Linux, use: +

open(new String[] { "firefox", url });
+ or whatever you want as your browser, since Linux doesn't + yet have a standard method for launching URLs. +

+

+
+
+
+
+
+
+
+ +

+open

+
+public static void open(java.lang.String filename)
+
+
Attempt to open a file using the platform's shell. +

+

+
+
+
+
+
+
+
+ +

+open

+
+public static java.lang.Process open(java.lang.String[] argv)
+
+
Launch a process using a platforms shell. This version uses an array + to make it easier to deal with spaces in the individual elements. + (This avoids the situation of trying to put single or double quotes + around different bits). +

+

+
+
+
+
+
+
+
+ +

+exec

+
+public static java.lang.Process exec(java.lang.String[] argv)
+
+
+
+
+
+
+
+
+
+ +

+die

+
+public void die(java.lang.String what)
+
+
Function for an applet/application to kill itself and + display an error. Mostly this is here to be improved later. +

+

+
+
+
+
+
+
+
+ +

+die

+
+public void die(java.lang.String what,
+                java.lang.Exception e)
+
+
Same as above but with an exception. Also needs work. +

+

+
+
+
+
+
+
+
+ +

+exit

+
+public void exit()
+
+
Call to safely exit the sketch when finished. For instance, + to render a single frame, save it, and quit. +

+

+
+
+
+
+
+
+
+ +

+save

+
+public void save(java.lang.String filename)
+
+
Intercepts any relative paths to make them absolute (relative + to the sketch folder) before passing to save() in PImage. + (Changed in 0100) +

+

+
+
+
+
+
+
+
+ +

+saveFrame

+
+public void saveFrame()
+
+
Grab an image of what's currently in the drawing area and save it + as a .tif or .tga file. +

+ Best used just before endDraw() at the end of your draw(). + This can only create .tif or .tga images, so if neither extension + is specified it defaults to writing a tiff and adds a .tif suffix. +

+

+
+
+
+
+
+
+
+ +

+saveFrame

+
+public void saveFrame(java.lang.String what)
+
+
Save the current frame as a .tif or .tga image. +

+ The String passed in can contain a series of # signs + that will be replaced with the screengrab number. +

+ i.e. saveFrame("blah-####.tif");
+      // saves a numbered tiff image, replacing the
+      // #### signs with zeros and the frame number 
+

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor(int cursorType)
+
+
Set the cursor type +

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor(PImage image)
+
+
Replace the cursor with the specified PImage. The x- and y- + coordinate of the center will be the center of the image. +

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor(PImage image,
+                   int hotspotX,
+                   int hotspotY)
+
+
Set a custom cursor to an image with a specific hotspot. + Only works with JDK 1.2 and later. + Currently seems to be broken on Java 1.4 for Mac OS X +

+ Based on code contributed by Amit Pitaru, plus additional + code to handle Java versions via reflection by Jonathan Feinberg. + Reflection removed for release 0128 and later. +

+

+
+
+
+
+
+
+
+ +

+cursor

+
+public void cursor()
+
+
Show the cursor after noCursor() was called. + Notice that the program remembers the last set cursor type +

+

+
+
+
+
+
+
+
+ +

+noCursor

+
+public void noCursor()
+
+
Hide the cursor by creating a transparent image + and using it as a custom cursor. +

+

+
+
+
+
+
+
+
+ +

+print

+
+public static void print(byte what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(char what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(int what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(float what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+print

+
+public static void print(java.lang.Object what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println()
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(byte what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(char what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(int what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(float what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+println

+
+public static void println(java.lang.Object what)
+
+
+
+
+
+
+
+
+
+ +

+abs

+
+public static final float abs(float n)
+
+
+
+
+
+
+
+
+
+ +

+abs

+
+public static final int abs(int n)
+
+
+
+
+
+
+
+
+
+ +

+sq

+
+public static final float sq(float a)
+
+
+
+
+
+
+
+
+
+ +

+sqrt

+
+public static final float sqrt(float a)
+
+
+
+
+
+
+
+
+
+ +

+log

+
+public static final float log(float a)
+
+
+
+
+
+
+
+
+
+ +

+exp

+
+public static final float exp(float a)
+
+
+
+
+
+
+
+
+
+ +

+pow

+
+public static final float pow(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final int max(int a,
+                            int b)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final float max(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final int max(int a,
+                            int b,
+                            int c)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final float max(float a,
+                              float b,
+                              float c)
+
+
+
+
+
+
+
+
+
+ +

+max

+
+public static final int max(int[] list)
+
+
Find the maximum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The maximum value
+
+
+
+ +

+max

+
+public static final float max(float[] list)
+
+
Find the maximum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The maximum value
+
+
+
+ +

+min

+
+public static final int min(int a,
+                            int b)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final float min(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final int min(int a,
+                            int b,
+                            int c)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final float min(float a,
+                              float b,
+                              float c)
+
+
+
+
+
+
+
+
+
+ +

+min

+
+public static final int min(int[] list)
+
+
Find the minimum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The minimum value
+
+
+
+ +

+min

+
+public static final float min(float[] list)
+
+
Find the minimum value in an array. + Throws an ArrayIndexOutOfBoundsException if the array is length 0. +

+

+
+
+
+
Parameters:
list - the source array +
Returns:
The minimum value
+
+
+
+ +

+constrain

+
+public static final int constrain(int amt,
+                                  int low,
+                                  int high)
+
+
+
+
+
+
+
+
+
+ +

+constrain

+
+public static final float constrain(float amt,
+                                    float low,
+                                    float high)
+
+
+
+
+
+
+
+
+
+ +

+sin

+
+public static final float sin(float angle)
+
+
+
+
+
+
+
+
+
+ +

+cos

+
+public static final float cos(float angle)
+
+
+
+
+
+
+
+
+
+ +

+tan

+
+public static final float tan(float angle)
+
+
+
+
+
+
+
+
+
+ +

+asin

+
+public static final float asin(float value)
+
+
+
+
+
+
+
+
+
+ +

+acos

+
+public static final float acos(float value)
+
+
+
+
+
+
+
+
+
+ +

+atan

+
+public static final float atan(float value)
+
+
+
+
+
+
+
+
+
+ +

+atan2

+
+public static final float atan2(float a,
+                                float b)
+
+
+
+
+
+
+
+
+
+ +

+degrees

+
+public static final float degrees(float radians)
+
+
+
+
+
+
+
+
+
+ +

+radians

+
+public static final float radians(float degrees)
+
+
+
+
+
+
+
+
+
+ +

+ceil

+
+public static final int ceil(float what)
+
+
+
+
+
+
+
+
+
+ +

+floor

+
+public static final int floor(float what)
+
+
+
+
+
+
+
+
+
+ +

+round

+
+public static final int round(float what)
+
+
+
+
+
+
+
+
+
+ +

+mag

+
+public static final float mag(float a,
+                              float b)
+
+
+
+
+
+
+
+
+
+ +

+mag

+
+public static final float mag(float a,
+                              float b,
+                              float c)
+
+
+
+
+
+
+
+
+
+ +

+dist

+
+public static final float dist(float x1,
+                               float y1,
+                               float x2,
+                               float y2)
+
+
+
+
+
+
+
+
+
+ +

+dist

+
+public static final float dist(float x1,
+                               float y1,
+                               float z1,
+                               float x2,
+                               float y2,
+                               float z2)
+
+
+
+
+
+
+
+
+
+ +

+lerp

+
+public static final float lerp(float start,
+                               float stop,
+                               float amt)
+
+
+
+
+
+
+
+
+
+ +

+norm

+
+public static final float norm(float value,
+                               float start,
+                               float stop)
+
+
Normalize a value to exist between 0 and 1 (inclusive). + Mathematically the opposite of lerp(), figures out what proportion + a particular value is relative to start and stop coordinates. +

+

+
+
+
+
+
+
+
+ +

+map

+
+public static final float map(float value,
+                              float istart,
+                              float istop,
+                              float ostart,
+                              float ostop)
+
+
Convenience function to map a variable from one coordinate space + to another. Equivalent to unlerp() followed by lerp(). +

+

+
+
+
+
+
+
+
+ +

+random

+
+public final float random(float howbig)
+
+
Return a random number in the range [0, howbig). +

+ The number returned will range from zero up to + (but not including) 'howbig'. +

+

+
+
+
+
+
+
+
+ +

+random

+
+public final float random(float howsmall,
+                          float howbig)
+
+
Return a random number in the range [howsmall, howbig). +

+ The number returned will range from 'howsmall' up to + (but not including 'howbig'. +

+ If howsmall is >= howbig, howsmall will be returned, + meaning that random(5, 5) will return 5 (useful) + and random(7, 4) will return 7 (not useful.. better idea?) +

+

+
+
+
+
+
+
+
+ +

+randomSeed

+
+public final void randomSeed(long what)
+
+
+
+
+
+
+
+
+
+ +

+noise

+
+public float noise(float x)
+
+
Computes the Perlin noise function value at point x. +

+

+
+
+
+
+
+
+
+ +

+noise

+
+public float noise(float x,
+                   float y)
+
+
Computes the Perlin noise function value at the point x, y. +

+

+
+
+
+
+
+
+
+ +

+noise

+
+public float noise(float x,
+                   float y,
+                   float z)
+
+
Computes the Perlin noise function value at x, y, z. +

+

+
+
+
+
+
+
+
+ +

+noiseDetail

+
+public void noiseDetail(int lod)
+
+
+
+
+
+
+
+
+
+ +

+noiseDetail

+
+public void noiseDetail(int lod,
+                        float falloff)
+
+
+
+
+
+
+
+
+
+ +

+noiseSeed

+
+public void noiseSeed(long what)
+
+
+
+
+
+
+
+
+
+ +

+loadImage

+
+public PImage loadImage(java.lang.String filename)
+
+
Load an image from the data folder or a local directory. + Supports .gif (including transparency), .tga, and .jpg images. + In Java 1.3 or later, .png images are + + also supported. +

+ Generally, loadImage() should only be used during setup, because + re-loading images inside draw() is likely to cause a significant + delay while memory is allocated and the thread blocks while waiting + for the image to load because loading is not asynchronous. +

+ To load several images asynchronously, see more information in the + FAQ about writing your own threaded image loading method. +

+ As of 0096, returns null if no image of that name is found, + rather than an error. +

+ Release 0115 also provides support for reading TIFF and RLE-encoded + Targa (.tga) files written by Processing via save() and saveFrame(). + Other TIFF and Targa files will probably not load, use a different + format (gif, jpg and png are safest bets) when creating images with + another application to use with Processing. +

+ Also in release 0115, more image formats (BMP and others) can + be read when using Java 1.4 and later. Because many people still + use Java 1.1 and 1.3, these formats are not recommended for + work that will be posted on the web. To get a list of possible + image formats for use with Java 1.4 and later, use the following: + println(javax.imageio.ImageIO.getReaderFormatNames()) +

+ Images are loaded via a byte array that is passed to + Toolkit.createImage(). Unfortunately, we cannot use Applet.getImage() + because it takes a URL argument, which would be a pain in the a-- + to make work consistently for online and local sketches. + Sometimes this causes problems, resulting in issues like + Bug 279 + and + Bug 305. + In release 0115, everything was instead run through javax.imageio, + but that turned out to be very slow, see + Bug 392. + As a result, starting with 0116, the following happens: +

    +
  • TGA and TIFF images are loaded using the internal load methods. +
  • JPG, GIF, and PNG images are loaded via loadBytes(). +
  • If the image still isn't loaded, it's passed to javax.imageio. +
+ For releases 0116 and later, if you have problems such as those seen + in Bugs 279 and 305, use Applet.getImage() instead. You'll be stuck + with the limitations of getImage() (the headache of dealing with + online/offline use). Set up your own MediaTracker, and pass the resulting + java.awt.Image to the PImage constructor that takes an AWT image. +

+

+
+
+
+
+
+
+
+ +

+loadImage

+
+public PImage loadImage(java.lang.String filename,
+                        java.lang.String extension)
+
+
Identical to loadImage, but allows you to specify the type of + image by its extension. Especially useful when downloading from + CGI scripts. +

+ Use 'unknown' as the extension to pass off to the default + image loader that handles gif, jpg, and png. +

+

+
+
+
+
+
+
+
+ +

+requestImage

+
+public PImage requestImage(java.lang.String filename)
+
+
+
+
+
+
+
+
+
+ +

+requestImage

+
+public PImage requestImage(java.lang.String filename,
+                           java.lang.String extension)
+
+
+
+
+
+
+
+
+
+ +

+loadShape

+
+public PShape loadShape(java.lang.String filename)
+
+
Load a geometry from a file as a PShape. Currently only supports SVG data. +

+

+
+
+
+
+
+
+
+ +

+loadFont

+
+public PFont loadFont(java.lang.String filename)
+
+
+
+
+
+
+
+
+
+ +

+createFont

+
+public PFont createFont(java.lang.String name,
+                        float size)
+
+
+
+
+
+
+
+
+
+ +

+createFont

+
+public PFont createFont(java.lang.String name,
+                        float size,
+                        boolean smooth)
+
+
+
+
+
+
+
+
+
+ +

+createFont

+
+public PFont createFont(java.lang.String name,
+                        float size,
+                        boolean smooth,
+                        char[] charset)
+
+
Create a .vlw font on the fly from either a font name that's + installed on the system, or from a .ttf or .otf that's inside + the data folder of this sketch. +

+ Only works with Java 1.3 or later. Many .otf fonts don't seem + to be supported by Java, perhaps because they're CFF based? +

+ Font names are inconsistent across platforms and Java versions. + On Mac OS X, Java 1.3 uses the font menu name of the font, + whereas Java 1.4 uses the PostScript name of the font. Java 1.4 + on OS X will also accept the font menu name as well. On Windows, + it appears that only the menu names are used, no matter what + Java version is in use. Naming system unknown/untested for 1.5. +

+ Use 'null' for the charset if you want to use any of the 65,536 + unicode characters that exist in the font. Note that this can + produce an enormous file or may cause an OutOfMemoryError. +

+

+
+
+
+
+
+
+
+ +

+selectInput

+
+public java.lang.String selectInput()
+
+
Open a platform-specific file chooser dialog to select a file for input. +

+

+
+
+
+ +
Returns:
full path to the selected file, or null if no selection.
+
+
+
+ +

+selectInput

+
+public java.lang.String selectInput(java.lang.String prompt)
+
+
Open a platform-specific file chooser dialog to select a file for input. +

+

+
+
+
+
Parameters:
prompt - Mesage to show the user when prompting for a file. +
Returns:
full path to the selected file, or null if canceled.
+
+
+
+ +

+selectOutput

+
+public java.lang.String selectOutput()
+
+
Open a platform-specific file save dialog to select a file for output. +

+

+
+
+
+ +
Returns:
full path to the file entered, or null if canceled.
+
+
+
+ +

+selectOutput

+
+public java.lang.String selectOutput(java.lang.String prompt)
+
+
Open a platform-specific file save dialog to select a file for output. +

+

+
+
+
+
Parameters:
prompt - Mesage to show the user when prompting for a file. +
Returns:
full path to the file entered, or null if canceled.
+
+
+
+ +

+selectFolder

+
+public java.lang.String selectFolder()
+
+
Open a platform-specific folder chooser dialog. +

+

+
+
+
+ +
Returns:
full path to the selected folder, or null if no selection.
+
+
+
+ +

+selectFolder

+
+public java.lang.String selectFolder(java.lang.String prompt)
+
+
Open a platform-specific folder chooser dialog. +

+

+
+
+
+
Parameters:
prompt - Mesage to show the user when prompting for a file. +
Returns:
full path to the selected folder, or null if no selection.
+
+
+
+ +

+createReader

+
+public java.io.BufferedReader createReader(java.lang.String filename)
+
+
I want to read lines from a file. I have RSI from typing these + eight lines of code so many times. +

+

+
+
+
+
+
+
+
+ +

+createReader

+
+public static java.io.BufferedReader createReader(java.io.File file)
+
+
I want to read lines from a file. And I'm still annoyed. +

+

+
+
+
+
+
+
+
+ +

+createReader

+
+public static java.io.BufferedReader createReader(java.io.InputStream input)
+
+
I want to read lines from a stream. If I have to type the + following lines any more I'm gonna send Sun my medical bills. +

+

+
+
+
+
+
+
+
+ +

+createWriter

+
+public java.io.PrintWriter createWriter(java.lang.String filename)
+
+
I want to print lines to a file. Why can't I? +

+

+
+
+
+
+
+
+
+ +

+createWriter

+
+public static java.io.PrintWriter createWriter(java.io.File file)
+
+
I want to print lines to a file. I have RSI from typing these + eight lines of code so many times. +

+

+
+
+
+
+
+
+
+ +

+createWriter

+
+public static java.io.PrintWriter createWriter(java.io.OutputStream output)
+
+
I want to print lines to a file. Why am I always explaining myself? + It's the JavaSoft API engineers who need to explain themselves. +

+

+
+
+
+
+
+
+
+ +

+openStream

+
+public java.io.InputStream openStream(java.lang.String filename)
+
+
Deprecated. As of release 0136, use createInput() instead. +

+

+
+
+
+
+
+
+
+ +

+createInput

+
+public java.io.InputStream createInput(java.lang.String filename)
+
+
Simplified method to open a Java InputStream. +

+ This method is useful if you want to use the facilities provided + by PApplet to easily open things from the data folder or from a URL, + but want an InputStream object so that you can use other Java + methods to take more control of how the stream is read. +

+ If the requested item doesn't exist, null is returned. + (Prior to 0096, die() would be called, killing the applet) +

+ For 0096+, the "data" folder is exported intact with subfolders, + and openStream() properly handles subdirectories from the data folder +

+ If not online, this will also check to see if the user is asking + for a file whose name isn't properly capitalized. This helps prevent + issues when a sketch is exported to the web, where case sensitivity + matters, as opposed to Windows and the Mac OS default where + case sensitivity is preserved but ignored. +

+ It is strongly recommended that libraries use this method to open + data files, so that the loading sequence is handled in the same way + as functions like loadBytes(), loadImage(), etc. +

+ The filename passed in can be: +

    +
  • A URL, for instance openStream("http://processing.org/"); +
  • A file in the sketch's data folder +
  • Another file to be opened locally (when running as an application) +
+

+

+
+
+
+
+
+
+
+ +

+createInputRaw

+
+public java.io.InputStream createInputRaw(java.lang.String filename)
+
+
Call openStream() without automatic gzip decompression. +

+

+
+
+
+
+
+
+
+ +

+createInput

+
+public static java.io.InputStream createInput(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+loadBytes

+
+public byte[] loadBytes(java.lang.String filename)
+
+
+
+
+
+
+
+
+
+ +

+loadBytes

+
+public static byte[] loadBytes(java.io.InputStream input)
+
+
+
+
+
+
+
+
+
+ +

+loadBytes

+
+public static byte[] loadBytes(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+loadStrings

+
+public static java.lang.String[] loadStrings(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+loadStrings

+
+public java.lang.String[] loadStrings(java.lang.String filename)
+
+
Load data from a file and shove it into a String array. +

+ Exceptions are handled internally, when an error, occurs, an + exception is printed to the console and 'null' is returned, + but the program continues running. This is a tradeoff between + 1) showing the user that there was a problem but 2) not requiring + that all i/o code is contained in try/catch blocks, for the sake + of new users (or people who are just trying to get things done + in a "scripting" fashion. If you want to handle exceptions, + use Java methods for I/O. +

+

+
+
+
+
+
+
+
+ +

+loadStrings

+
+public static java.lang.String[] loadStrings(java.io.InputStream input)
+
+
+
+
+
+
+
+
+
+ +

+createOutput

+
+public java.io.OutputStream createOutput(java.lang.String filename)
+
+
Similar to createInput() (formerly openStream), this creates a Java + OutputStream for a given filename or path. The file will be created in + the sketch folder, or in the same folder as an exported application. +

+ If the path does not exist, intermediate folders will be created. If an + exception occurs, it will be printed to the console, and null will be + returned. +

+ Future releases may also add support for handling HTTP POST via this + method (for better symmetry with createInput), however that's maybe a + little too clever (and then we'd have to add the same features to the + other file functions like createWriter). Who you callin' bloated? +

+

+
+
+
+
+
+
+
+ +

+createOutput

+
+public static java.io.OutputStream createOutput(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+saveStream

+
+public void saveStream(java.lang.String targetFilename,
+                       java.lang.String sourceLocation)
+
+
Save the contents of a stream to a file in the sketch folder. + This is basically saveBytes(blah, loadBytes()), but done + more efficiently (and with less confusing syntax). +

+

+
+
+
+
+
+
+
+ +

+saveStream

+
+public void saveStream(java.io.File targetFile,
+                       java.lang.String sourceLocation)
+
+
Identical to the other saveStream(), but writes to a File + object, for greater control over the file location. + Note that unlike other api methods, this will not automatically + compress or uncompress gzip files. +

+

+
+
+
+
+
+
+
+ +

+saveStream

+
+public static void saveStream(java.io.File targetFile,
+                              java.io.InputStream sourceStream)
+
+
+
+
+
+
+
+
+
+ +

+saveBytes

+
+public void saveBytes(java.lang.String filename,
+                      byte[] buffer)
+
+
Saves bytes to a file to inside the sketch folder. + The filename can be a relative path, i.e. "poo/bytefun.txt" + would save to a file named "bytefun.txt" to a subfolder + called 'poo' inside the sketch folder. If the in-between + subfolders don't exist, they'll be created. +

+

+
+
+
+
+
+
+
+ +

+saveBytes

+
+public static void saveBytes(java.io.File file,
+                             byte[] buffer)
+
+
Saves bytes to a specific File location specified by the user. +

+

+
+
+
+
+
+
+
+ +

+saveBytes

+
+public static void saveBytes(java.io.OutputStream output,
+                             byte[] buffer)
+
+
Spews a buffer of bytes to an OutputStream. +

+

+
+
+
+
+
+
+
+ +

+saveStrings

+
+public void saveStrings(java.lang.String filename,
+                        java.lang.String[] strings)
+
+
+
+
+
+
+
+
+
+ +

+saveStrings

+
+public static void saveStrings(java.io.File file,
+                               java.lang.String[] strings)
+
+
+
+
+
+
+
+
+
+ +

+saveStrings

+
+public static void saveStrings(java.io.OutputStream output,
+                               java.lang.String[] strings)
+
+
+
+
+
+
+
+
+
+ +

+sketchPath

+
+public java.lang.String sketchPath(java.lang.String where)
+
+
Prepend the sketch folder path to the filename (or path) that is + passed in. External libraries should use this function to save to + the sketch folder. +

+ Note that when running as an applet inside a web browser, + the sketchPath will be set to null, because security restrictions + prevent applets from accessing that information. +

+ This will also cause an error if the sketch is not inited properly, + meaning that init() was never called on the PApplet when hosted + my some other main() or by other code. For proper use of init(), + see the examples in the main description text for PApplet. +

+

+
+
+
+
+
+
+
+ +

+sketchFile

+
+public java.io.File sketchFile(java.lang.String where)
+
+
+
+
+
+
+
+
+
+ +

+savePath

+
+public java.lang.String savePath(java.lang.String where)
+
+
Returns a path inside the applet folder to save to. Like sketchPath(), + but creates any in-between folders so that things save properly. +

+ All saveXxxx() functions use the path to the sketch folder, rather than + its data folder. Once exported, the data folder will be found inside the + jar file of the exported application or applet. In this case, it's not + possible to save data into the jar file, because it will often be running + from a server, or marked in-use if running from a local file system. + With this in mind, saving to the data path doesn't make sense anyway. + If you know you're running locally, and want to save to the data folder, + use saveXxxx("data/blah.dat"). +

+

+
+
+
+
+
+
+
+ +

+saveFile

+
+public java.io.File saveFile(java.lang.String where)
+
+
Identical to savePath(), but returns a File object. +

+

+
+
+
+
+
+
+
+ +

+dataPath

+
+public java.lang.String dataPath(java.lang.String where)
+
+
Return a full path to an item in the data folder. +

+ In this method, the data path is defined not as the applet's actual + data path, but a folder titled "data" in the sketch's working + directory. When running inside the PDE, this will be the sketch's + "data" folder. However, when exported (as application or applet), + sketch's data folder is exported as part of the applications jar file, + and it's not possible to read/write from the jar file in a generic way. + If you need to read data from the jar file, you should use createInput(). +

+

+
+
+
+
+
+
+
+ +

+dataFile

+
+public java.io.File dataFile(java.lang.String where)
+
+
Return a full path to an item in the data folder as a File object. + See the dataPath() method for more information. +

+

+
+
+
+
+
+
+
+ +

+createPath

+
+public static void createPath(java.lang.String path)
+
+
Takes a path and creates any in-between folders if they don't + already exist. Useful when trying to save to a subfolder that + may not actually exist. +

+

+
+
+
+
+
+
+
+ +

+createPath

+
+public static void createPath(java.io.File file)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static byte[] sort(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static byte[] sort(byte[] what,
+                          int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static char[] sort(char[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static char[] sort(char[] what,
+                          int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static int[] sort(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static int[] sort(int[] what,
+                         int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static float[] sort(float[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static float[] sort(float[] what,
+                           int count)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static java.lang.String[] sort(java.lang.String[] what)
+
+
+
+
+
+
+
+
+
+ +

+sort

+
+public static java.lang.String[] sort(java.lang.String[] what,
+                                      int count)
+
+
+
+
+
+
+
+
+
+ +

+arrayCopy

+
+public static void arrayCopy(java.lang.Object src,
+                             int srcPosition,
+                             java.lang.Object dst,
+                             int dstPosition,
+                             int length)
+
+
Calls System.arraycopy(), included here so that we can + avoid people needing to learn about the System object + before they can just copy an array. +

+

+
+
+
+
+
+
+
+ +

+arrayCopy

+
+public static void arrayCopy(java.lang.Object src,
+                             java.lang.Object dst,
+                             int length)
+
+
Convenience method for arraycopy(). + Identical to arraycopy(src, 0, dst, 0, length); +

+

+
+
+
+
+
+
+
+ +

+arrayCopy

+
+public static void arrayCopy(java.lang.Object src,
+                             java.lang.Object dst)
+
+
Shortcut to copy the entire contents of + the source into the destination array. + Identical to arraycopy(src, 0, dst, 0, src.length); +

+

+
+
+
+
+
+
+
+ +

+arraycopy

+
+public static void arraycopy(java.lang.Object src,
+                             int srcPosition,
+                             java.lang.Object dst,
+                             int dstPosition,
+                             int length)
+
+
Deprecated. Use arrayCopy() instead. +

+

+
+
+
+
+
+
+
+ +

+arraycopy

+
+public static void arraycopy(java.lang.Object src,
+                             java.lang.Object dst,
+                             int length)
+
+
Deprecated. Use arrayCopy() instead. +

+

+
+
+
+
+
+
+
+ +

+arraycopy

+
+public static void arraycopy(java.lang.Object src,
+                             java.lang.Object dst)
+
+
Deprecated. Use arrayCopy() instead. +

+

+
+
+
+
+
+
+
+ +

+expand

+
+public static boolean[] expand(boolean[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static boolean[] expand(boolean[] list,
+                               int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static byte[] expand(byte[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static byte[] expand(byte[] list,
+                            int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static char[] expand(char[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static char[] expand(char[] list,
+                            int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static int[] expand(int[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static int[] expand(int[] list,
+                           int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static float[] expand(float[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static float[] expand(float[] list,
+                             int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.String[] expand(java.lang.String[] list)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.String[] expand(java.lang.String[] list,
+                                        int newSize)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.Object expand(java.lang.Object array)
+
+
+
+
+
+
+
+
+
+ +

+expand

+
+public static java.lang.Object expand(java.lang.Object list,
+                                      int newSize)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static byte[] append(byte[] b,
+                            byte value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static char[] append(char[] b,
+                            char value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static int[] append(int[] b,
+                           int value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static float[] append(float[] b,
+                             float value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static java.lang.String[] append(java.lang.String[] b,
+                                        java.lang.String value)
+
+
+
+
+
+
+
+
+
+ +

+append

+
+public static java.lang.Object append(java.lang.Object b,
+                                      java.lang.Object value)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static boolean[] shorten(boolean[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static byte[] shorten(byte[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static char[] shorten(char[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static int[] shorten(int[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static float[] shorten(float[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static java.lang.String[] shorten(java.lang.String[] list)
+
+
+
+
+
+
+
+
+
+ +

+shorten

+
+public static java.lang.Object shorten(java.lang.Object list)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final boolean[] splice(boolean[] list,
+                                     boolean v,
+                                     int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final boolean[] splice(boolean[] list,
+                                     boolean[] v,
+                                     int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final byte[] splice(byte[] list,
+                                  byte v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final byte[] splice(byte[] list,
+                                  byte[] v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final char[] splice(char[] list,
+                                  char v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final char[] splice(char[] list,
+                                  char[] v,
+                                  int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final int[] splice(int[] list,
+                                 int v,
+                                 int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final int[] splice(int[] list,
+                                 int[] v,
+                                 int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final float[] splice(float[] list,
+                                   float v,
+                                   int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final float[] splice(float[] list,
+                                   float[] v,
+                                   int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final java.lang.String[] splice(java.lang.String[] list,
+                                              java.lang.String v,
+                                              int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final java.lang.String[] splice(java.lang.String[] list,
+                                              java.lang.String[] v,
+                                              int index)
+
+
+
+
+
+
+
+
+
+ +

+splice

+
+public static final java.lang.Object splice(java.lang.Object list,
+                                            java.lang.Object v,
+                                            int index)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static boolean[] subset(boolean[] list,
+                               int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static boolean[] subset(boolean[] list,
+                               int start,
+                               int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static byte[] subset(byte[] list,
+                            int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static byte[] subset(byte[] list,
+                            int start,
+                            int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static char[] subset(char[] list,
+                            int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static char[] subset(char[] list,
+                            int start,
+                            int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static int[] subset(int[] list,
+                           int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static int[] subset(int[] list,
+                           int start,
+                           int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static float[] subset(float[] list,
+                             int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static float[] subset(float[] list,
+                             int start,
+                             int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.String[] subset(java.lang.String[] list,
+                                        int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.String[] subset(java.lang.String[] list,
+                                        int start,
+                                        int count)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.Object subset(java.lang.Object list,
+                                      int start)
+
+
+
+
+
+
+
+
+
+ +

+subset

+
+public static java.lang.Object subset(java.lang.Object list,
+                                      int start,
+                                      int count)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static boolean[] concat(boolean[] a,
+                               boolean[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static byte[] concat(byte[] a,
+                            byte[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static char[] concat(char[] a,
+                            char[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static int[] concat(int[] a,
+                           int[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static float[] concat(float[] a,
+                             float[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static java.lang.String[] concat(java.lang.String[] a,
+                                        java.lang.String[] b)
+
+
+
+
+
+
+
+
+
+ +

+concat

+
+public static java.lang.Object concat(java.lang.Object a,
+                                      java.lang.Object b)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static boolean[] reverse(boolean[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static byte[] reverse(byte[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static char[] reverse(char[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static int[] reverse(int[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static float[] reverse(float[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static java.lang.String[] reverse(java.lang.String[] list)
+
+
+
+
+
+
+
+
+
+ +

+reverse

+
+public static java.lang.Object reverse(java.lang.Object list)
+
+
+
+
+
+
+
+
+
+ +

+trim

+
+public static java.lang.String trim(java.lang.String str)
+
+
Remove whitespace characters from the beginning and ending + of a String. Works like String.trim() but includes the + unicode nbsp character as well. +

+

+
+
+
+
+
+
+
+ +

+trim

+
+public static java.lang.String[] trim(java.lang.String[] array)
+
+
Trim the whitespace from a String array. This returns a new + array and does not affect the passed-in array. +

+

+
+
+
+
+
+
+
+ +

+join

+
+public static java.lang.String join(java.lang.String[] str,
+                                    char separator)
+
+
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +

+

+
+
+
+
+
+
+
+ +

+join

+
+public static java.lang.String join(java.lang.String[] str,
+                                    java.lang.String separator)
+
+
Join an array of Strings together as a single String, + separated by the whatever's passed in for the separator. +

+ To use this on numbers, first pass the array to nf() or nfs() + to get a list of String objects, then use join on that. +

+ e.g. String stuff[] = { "apple", "bear", "cat" };
+      String list = join(stuff, ", ");
+      // list is now "apple, bear, cat"
+

+

+
+
+
+
+
+
+
+ +

+splitTokens

+
+public static java.lang.String[] splitTokens(java.lang.String what)
+
+
Split the provided String at wherever whitespace occurs. + Multiple whitespace (extra spaces or tabs or whatever) + between items will count as a single break. +

+ The whitespace characters are "\t\n\r\f", which are the defaults + for java.util.StringTokenizer, plus the unicode non-breaking space + character, which is found commonly on files created by or used + in conjunction with Mac OS X (character 160, or 0x00A0 in hex). +

+ i.e. splitTokens("a b") -> { "a", "b" }
+      splitTokens("a    b") -> { "a", "b" }
+      splitTokens("a\tb") -> { "a", "b" }
+      splitTokens("a \t  b  ") -> { "a", "b" }
+

+

+
+
+
+
+
+
+
+ +

+splitTokens

+
+public static java.lang.String[] splitTokens(java.lang.String what,
+                                             java.lang.String delim)
+
+
Splits a string into pieces, using any of the chars in the + String 'delim' as separator characters. For instance, + in addition to white space, you might want to treat commas + as a separator. The delimeter characters won't appear in + the returned String array. +
+ i.e. splitTokens("a, b", " ,") -> { "a", "b" }
+ 
+ To include all the whitespace possibilities, use the variable + WHITESPACE, found in PConstants: +
+ i.e. splitTokens("a   | b", WHITESPACE + "|");  ->  { "a", "b" }
+

+

+
+
+
+
+
+
+
+ +

+split

+
+public static java.lang.String[] split(java.lang.String what,
+                                       char delim)
+
+
Split a string into pieces along a specific character. + Most commonly used to break up a String along a space or a tab + character. +

+ This operates differently than the others, where the + single delimeter is the only breaking point, and consecutive + delimeters will produce an empty string (""). This way, + one can split on tab characters, but maintain the column + alignments (of say an excel file) where there are empty columns. +

+

+
+
+
+
+
+
+
+ +

+split

+
+public static java.lang.String[] split(java.lang.String what,
+                                       java.lang.String delim)
+
+
Split a String on a specific delimiter. Unlike Java's String.split() + method, this does not parse the delimiter as a regexp because it's more + confusing than necessary, and String.split() is always available for + those who want regexp. +

+

+
+
+
+
+
+
+
+ +

+match

+
+public static java.lang.String[] match(java.lang.String what,
+                                       java.lang.String regexp)
+
+
Match a string with a regular expression, and returns the match as an + array. The first index is the matching expression, and array elements + [1] and higher represent each of the groups (sequences found in parens). + + This uses multiline matching (Pattern.MULTILINE) and dotall mode + (Pattern.DOTALL) by default, so that ^ and $ match the beginning and + end of any lines found in the source, and the . operator will also + pick up newline characters. +

+

+
+
+
+
+
+
+
+ +

+matchAll

+
+public static java.lang.String[][] matchAll(java.lang.String what,
+                                            java.lang.String regexp)
+
+
Identical to match(), except that it returns an array of all matches in + the specified String, rather than just the first. +

+

+
+
+
+
+
+
+
+ +

+parseBoolean

+
+public static final boolean parseBoolean(int what)
+
+

Convert an integer to a boolean. Because of how Java handles upgrading + numbers, this will also cover byte and char (as they will upgrade to + an int without any sort of explicit cast).

+

The preprocessor will convert boolean(what) to parseBoolean(what).

+

+

+
+
+
+ +
Returns:
false if 0, true if any other number
+
+
+
+ +

+parseBoolean

+
+public static final boolean parseBoolean(java.lang.String what)
+
+
Convert the string "true" or "false" to a boolean. +

+

+
+
+
+ +
Returns:
true if 'what' is "true" or "TRUE", false otherwise
+
+
+
+ +

+parseBoolean

+
+public static final boolean[] parseBoolean(byte[] what)
+
+
Convert a byte array to a boolean array. Each element will be + evaluated identical to the integer case, where a byte equal + to zero will return false, and any other value will return true. +

+

+
+
+
+ +
Returns:
array of boolean elements
+
+
+
+ +

+parseBoolean

+
+public static final boolean[] parseBoolean(int[] what)
+
+
Convert an int array to a boolean array. An int equal + to zero will return false, and any other value will return true. +

+

+
+
+
+ +
Returns:
array of boolean elements
+
+
+
+ +

+parseBoolean

+
+public static final boolean[] parseBoolean(java.lang.String[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(char what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(int what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte parseByte(float what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(boolean[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(char[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final byte[] parseByte(float[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char parseChar(byte what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char parseChar(int what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char[] parseChar(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseChar

+
+public static final char[] parseChar(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(boolean what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(byte what)
+
+
Note that parseInt() will un-sign a signed byte value. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(char what)
+
+
Note that parseInt('5') is unlike String in the sense that it + won't return 5, but the ascii value. This is because ((int) someChar) + returns the ascii value, and parseInt() is just longhand for the cast. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(float what)
+
+
Same as floor(), or an (int) cast. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(java.lang.String what)
+
+
Parse a String into an int value. Returns 0 if the value is bad. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int parseInt(java.lang.String what,
+                                 int otherwise)
+
+
Parse a String to an int, and provide an alternate value that + should be used when the number is invalid. +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int[] parseInt(boolean[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int[] parseInt(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static final int[] parseInt(char[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static int[] parseInt(float[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseInt

+
+public static int[] parseInt(java.lang.String[] what)
+
+
Make an array of int elements from an array of String objects. + If the String can't be parsed as a number, it will be set to zero. + + String s[] = { "1", "300", "44" }; + int numbers[] = parseInt(s); + + numbers will contain { 1, 300, 44 } +

+

+
+
+
+
+
+
+
+ +

+parseInt

+
+public static int[] parseInt(java.lang.String[] what,
+                             int missing)
+
+
Make an array of int elements from an array of String objects. + If the String can't be parsed as a number, its entry in the + array will be set to the value of the "missing" parameter. + + String s[] = { "1", "300", "apple", "44" }; + int numbers[] = parseInt(s, 9999); + + numbers will contain { 1, 300, 9999, 44 } +

+

+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float parseFloat(int what)
+
+
Convert an int to a float value. Also handles bytes because of + Java's rules for upgrading values. +

+

+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float parseFloat(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float parseFloat(java.lang.String what,
+                                     float otherwise)
+
+
+
+
+
+
+
+
+
+ +

+parseByte

+
+public static final float[] parseByte(byte[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float[] parseFloat(int[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float[] parseFloat(java.lang.String[] what)
+
+
+
+
+
+
+
+
+
+ +

+parseFloat

+
+public static final float[] parseFloat(java.lang.String[] what,
+                                       float missing)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(boolean x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(byte x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(char x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(int x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String str(float x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(boolean[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(byte[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(char[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(int[] x)
+
+
+
+
+
+
+
+
+
+ +

+str

+
+public static final java.lang.String[] str(float[] x)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String[] nf(int[] num,
+                                    int digits)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String nf(int num,
+                                  int digits)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String[] nfc(int[] num)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String nfc(int num)
+
+
+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String nfs(int num,
+                                   int digits)
+
+
number format signed (or space) + Formats a number but leaves a blank space in the front + when it's positive so that it can be properly aligned with + numbers that have a negative sign in front of them. +

+

+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String[] nfs(int[] num,
+                                     int digits)
+
+
+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String nfp(int num,
+                                   int digits)
+
+
number format positive (or plus) + Formats a number, always placing a - or + sign + in the front when it's negative or positive. +

+

+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String[] nfp(int[] num,
+                                     int digits)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String[] nf(float[] num,
+                                    int left,
+                                    int right)
+
+
+
+
+
+
+
+
+
+ +

+nf

+
+public static java.lang.String nf(float num,
+                                  int left,
+                                  int right)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String[] nfc(float[] num,
+                                     int right)
+
+
+
+
+
+
+
+
+
+ +

+nfc

+
+public static java.lang.String nfc(float num,
+                                   int right)
+
+
+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String[] nfs(float[] num,
+                                     int left,
+                                     int right)
+
+
Number formatter that takes into account whether the number + has a sign (positive, negative, etc) in front of it. +

+

+
+
+
+
+
+
+
+ +

+nfs

+
+public static java.lang.String nfs(float num,
+                                   int left,
+                                   int right)
+
+
+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String[] nfp(float[] num,
+                                     int left,
+                                     int right)
+
+
+
+
+
+
+
+
+
+ +

+nfp

+
+public static java.lang.String nfp(float num,
+                                   int left,
+                                   int right)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(byte what)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(char what)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(int what)
+
+
+
+
+
+
+
+
+
+ +

+hex

+
+public static final java.lang.String hex(int what,
+                                         int digits)
+
+
+
+
+
+
+
+
+
+ +

+unhex

+
+public static final int unhex(java.lang.String what)
+
+
+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(byte what)
+
+
Returns a String that contains the binary value of a byte. + The returned value will always have 8 digits. +

+

+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(char what)
+
+
Returns a String that contains the binary value of a char. + The returned value will always have 16 digits because chars + are two bytes long. +

+

+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(int what)
+
+
Returns a String that contains the binary value of an int. + The length depends on the size of the number itself. + An int can be up to 32 binary digits, but that seems like + overkill for almost any situation, so this function just + auto-size. If you want a specific number of digits (like all 32) + use binary(int what, int digits) to specify how many digits. +

+

+
+
+
+
+
+
+
+ +

+binary

+
+public static final java.lang.String binary(int what,
+                                            int digits)
+
+
Returns a String that contains the binary value of an int. + The digits parameter determines how many digits will be used. +

+

+
+
+
+
+
+
+
+ +

+unbinary

+
+public static final int unbinary(java.lang.String what)
+
+
Unpack a binary String into an int. + i.e. unbinary("00001000") would return 8. +

+

+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float fgray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray,
+                       int alpha)
+
+
As of 0116 this also takes color(#FF8800, alpha) +

+

+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float fgray,
+                       float falpha)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z,
+                       int a)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
+
+
+
+
+
+
+
+ +

+setupExternalMessages

+
+public void setupExternalMessages()
+
+
Set this sketch to communicate its state back to the PDE. +

+ This uses the stderr stream to write positions of the window + (so that it will be saved by the PDE for the next run) and + notify on quit. See more notes in the Worker class. +

+

+
+
+
+
+
+
+
+ +

+setupFrameResizeListener

+
+public void setupFrameResizeListener()
+
+
Set up a listener that will fire proper component resize events + in cases where frame.setResizable(true) is called. +

+

+
+
+
+
+
+
+
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
main() method for running this class from the command line. +

+ The options shown here are not yet finalized and will be + changing over the next several releases. +

+ The simplest way to turn and applet into an application is to + add the following code to your program: +

static public void main(String args[]) {
+   PApplet.main(new String[] { "YourSketchName" });
+ }
+ This will properly launch your applet from a double-clickable + .jar or from the command line. +
+ Parameters useful for launching or also used by the PDE:
+
+ --location=x,y        upper-lefthand corner of where the applet
+                       should appear on screen. if not used,
+                       the default is to center on the main screen.
+
+ --present             put the applet into full screen presentation
+                       mode. requires java 1.4 or later.
+                       
+ --exclusive           use full screen exclusive mode when presenting.
+                       disables new windows or interaction with other 
+                       monitors, this is like a "game" mode.
+
+ --hide-stop           use to hide the stop button in situations where
+                       you don't want to allow users to exit. also
+                       see the FAQ on information for capturing the ESC
+                       key when running in presentation mode.
+
+ --stop-color=#xxxxxx  color of the 'stop' text used to quit an
+                       sketch when it's in present mode.
+
+ --bgcolor=#xxxxxx     background color of the window.
+
+ --sketch-path         location of where to save files from functions
+                       like saveStrings() or saveFrame(). defaults to
+                       the folder that the java application was
+                       launched from, which means if this isn't set by
+                       the pde, everything goes into the same folder
+                       as processing.exe.
+
+ --display=n           set what display should be used by this applet.
+                       displays are numbered starting from 1.
+
+ Parameters used by Processing when running via the PDE
+
+ --external            set when the applet is being used by the PDE
+
+ --editor-location=x,y position of the upper-lefthand corner of the
+                       editor window, for placement of applet window
+ 
+

+

+
+
+
+
+
+
+
+ +

+beginRecord

+
+public PGraphics beginRecord(java.lang.String renderer,
+                             java.lang.String filename)
+
+
Begin recording to a new renderer of the specified type, using the width + and height of the main drawing surface. +

+

+
+
+
+
+
+
+
+ +

+beginRecord

+
+public void beginRecord(PGraphics recorder)
+
+
Begin recording (echoing) commands to the specified PGraphics object. +

+

+
+
+
+
+
+
+
+ +

+endRecord

+
+public void endRecord()
+
+
+
+
+
+
+
+
+
+ +

+beginRaw

+
+public PGraphics beginRaw(java.lang.String renderer,
+                          java.lang.String filename)
+
+
Begin recording raw shape data to a renderer of the specified type, + using the width and height of the main drawing surface. + + If hashmarks (###) are found in the filename, they'll be replaced + by the current frame number (frameCount). +

+

+
+
+
+
+
+
+
+ +

+beginRaw

+
+public void beginRaw(PGraphics rawGraphics)
+
+
Begin recording raw shape data to the specified renderer. + + This simply echoes to g.beginRaw(), but since is placed here (rather than + generated by preproc.pl) for clarity and so that it doesn't echo the + command should beginRecord() be in use. +

+

+
+
+
+
+
+
+
+ +

+endRaw

+
+public void endRaw()
+
+
Stop recording raw shape data to the specified renderer. + + This simply echoes to g.beginRaw(), but since is placed here (rather than + generated by preproc.pl) for clarity and so that it doesn't echo the + command should beginRecord() be in use. +

+

+
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Override the g.pixels[] function to set the pixels[] array + that's part of the PApplet object. Allows the use of + pixels[] in the code, rather than g.pixels[]. +

+

+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x1,
+                         int y1,
+                         int x2,
+                         int y2)
+
+
+
+
+
+
+
+
+
+ +

+flush

+
+public void flush()
+
+
+
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape()
+
+
+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
+
+
+
+
+
+
+
+ +

+edge

+
+public void edge(boolean edge)
+
+
+
+
+
+
+
+
+
+ +

+normal

+
+public void normal(float nx,
+                   float ny,
+                   float nz)
+
+
+
+
+
+
+
+
+
+ +

+textureMode

+
+public void textureMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float[] v)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape()
+
+
+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float x3,
+                         float y3,
+                         float x4,
+                         float y4)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float z2,
+                         float x3,
+                         float y3,
+                         float z3,
+                         float x4,
+                         float y4,
+                         float z4)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y,
+                        float z)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float z1,
+                 float x2,
+                 float y2,
+                 float z2)
+
+
+
+
+
+
+
+
+
+ +

+triangle

+
+public void triangle(float x1,
+                     float y1,
+                     float x2,
+                     float y2,
+                     float x3,
+                     float y3)
+
+
+
+
+
+
+
+
+
+ +

+quad

+
+public void quad(float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float x3,
+                 float y3,
+                 float x4,
+                 float y4)
+
+
+
+
+
+
+
+
+
+ +

+rectMode

+
+public void rectMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+rect

+
+public void rect(float a,
+                 float b,
+                 float c,
+                 float d)
+
+
+
+
+
+
+
+
+
+ +

+ellipseMode

+
+public void ellipseMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+ellipse

+
+public void ellipse(float a,
+                    float b,
+                    float c,
+                    float d)
+
+
+
+
+
+
+
+
+
+ +

+arc

+
+public void arc(float a,
+                float b,
+                float c,
+                float d,
+                float start,
+                float stop)
+
+
+
+
+
+
+
+
+
+ +

+box

+
+public void box(float size)
+
+
+
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int res)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int ures,
+                         int vres)
+
+
+
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
+
+
+
+
+
+
+
+ +

+bezierPoint

+
+public float bezierPoint(float a,
+                         float b,
+                         float c,
+                         float d,
+                         float t)
+
+
+
+
+
+
+
+
+
+ +

+bezierTangent

+
+public float bezierTangent(float a,
+                           float b,
+                           float c,
+                           float d,
+                           float t)
+
+
+
+
+
+
+
+
+
+ +

+bezierDetail

+
+public void bezierDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float x2,
+                   float y2,
+                   float x3,
+                   float y3,
+                   float x4,
+                   float y4)
+
+
+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float z1,
+                   float x2,
+                   float y2,
+                   float z2,
+                   float x3,
+                   float y3,
+                   float z3,
+                   float x4,
+                   float y4,
+                   float z4)
+
+
+
+
+
+
+
+
+
+ +

+curvePoint

+
+public float curvePoint(float a,
+                        float b,
+                        float c,
+                        float d,
+                        float t)
+
+
+
+
+
+
+
+
+
+ +

+curveTangent

+
+public float curveTangent(float a,
+                          float b,
+                          float c,
+                          float d,
+                          float t)
+
+
+
+
+
+
+
+
+
+ +

+curveDetail

+
+public void curveDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+curveTightness

+
+public void curveTightness(float tightness)
+
+
+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float x2,
+                  float y2,
+                  float x3,
+                  float y3,
+                  float x4,
+                  float y4)
+
+
+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float z1,
+                  float x2,
+                  float y2,
+                  float z2,
+                  float x3,
+                  float y3,
+                  float z3,
+                  float x4,
+                  float y4,
+                  float z4)
+
+
+
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
+
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
+
+
+
+
+
+
+
+ +

+imageMode

+
+public void imageMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float a,
+                  float b,
+                  float c,
+                  float d,
+                  int u1,
+                  int v1,
+                  int u2,
+                  int v2)
+
+
+
+
+
+
+
+
+
+ +

+shapeMode

+
+public void shapeMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int align)
+
+
+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int alignX,
+                      int alignY)
+
+
+
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
+
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which)
+
+
+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which,
+                     float size)
+
+
+
+
+
+
+
+
+
+ +

+textLeading

+
+public void textLeading(float leading)
+
+
+
+
+
+
+
+
+
+ +

+textMode

+
+public void textMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+textSize

+
+public void textSize(float size)
+
+
+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(char c)
+
+
+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(java.lang.String str)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String s,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
+
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix2D getMatrix(PMatrix2D target)
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
+
+
+
+
+
+
+
+ +

+beginCamera

+
+public void beginCamera()
+
+
+
+
+
+
+
+
+
+ +

+endCamera

+
+public void endCamera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera(float eyeX,
+                   float eyeY,
+                   float eyeZ,
+                   float centerX,
+                   float centerY,
+                   float centerZ,
+                   float upX,
+                   float upY,
+                   float upZ)
+
+
+
+
+
+
+
+
+
+ +

+printCamera

+
+public void printCamera()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho(float left,
+                  float right,
+                  float bottom,
+                  float top,
+                  float near,
+                  float far)
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective()
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective(float fovy,
+                        float aspect,
+                        float zNear,
+                        float zFar)
+
+
+
+
+
+
+
+
+
+ +

+frustum

+
+public void frustum(float left,
+                    float right,
+                    float bottom,
+                    float top,
+                    float near,
+                    float far)
+
+
+
+
+
+
+
+
+
+ +

+printProjection

+
+public void printProjection()
+
+
+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+modelX

+
+public float modelX(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+modelY

+
+public float modelY(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+modelZ

+
+public float modelZ(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+pushStyle

+
+public void pushStyle()
+
+
+
+
+
+
+
+
+
+ +

+popStyle

+
+public void popStyle()
+
+
+
+
+
+
+
+
+
+ +

+style

+
+public void style(PStyle s)
+
+
+
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
+
+
+
+
+
+
+ +

+noStroke

+
+public void noStroke()
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z,
+                   float a)
+
+
+
+
+
+
+
+
+
+ +

+noTint

+
+public void noTint()
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+noFill

+
+public void noFill()
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float gray)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float gray)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float shine)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float gray)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+lights

+
+public void lights()
+
+
+
+
+
+
+
+
+
+ +

+noLights

+
+public void noLights()
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue)
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue,
+                         float x,
+                         float y,
+                         float z)
+
+
+
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float red,
+                             float green,
+                             float blue,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float red,
+                       float green,
+                       float blue,
+                       float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float red,
+                      float green,
+                      float blue,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
+
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb,
+                       float alpha)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray,
+                       float alpha)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(PImage image)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float max)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ,
+                      float maxA)
+
+
+
+
+
+
+
+
+
+ +

+alpha

+
+public final float alpha(int what)
+
+
+
+
+
+
+
+
+
+ +

+red

+
+public final float red(int what)
+
+
+
+
+
+
+
+
+
+ +

+green

+
+public final float green(int what)
+
+
+
+
+
+
+
+
+
+ +

+blue

+
+public final float blue(int what)
+
+
+
+
+
+
+
+
+
+ +

+hue

+
+public final float hue(int what)
+
+
+
+
+
+
+
+
+
+ +

+saturation

+
+public final float saturation(int what)
+
+
+
+
+
+
+
+
+
+ +

+brightness

+
+public final float brightness(int what)
+
+
+
+
+
+
+
+
+
+ +

+lerpColor

+
+public int lerpColor(int c1,
+                     int c2,
+                     float amt)
+
+
+
+
+
+
+
+
+
+ +

+lerpColor

+
+public static int lerpColor(int c1,
+                            int c2,
+                            float amt,
+                            int mode)
+
+
+
+
+
+
+
+
+
+ +

+displayable

+
+public boolean displayable()
+
+
+
+
+
+
+
+
+
+ +

+setCache

+
+public void setCache(java.lang.Object parent,
+                     java.lang.Object storage)
+
+
+
+
+
+
+
+
+
+ +

+getCache

+
+public java.lang.Object getCache(java.lang.Object parent)
+
+
+
+
+
+
+
+
+
+ +

+removeCache

+
+public void removeCache(java.lang.Object parent)
+
+
+
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
+
+
+
+
+
+
+
+ +

+get

+
+public PImage get(int x,
+                  int y,
+                  int w,
+                  int h)
+
+
+
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int c)
+
+
+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                PImage src)
+
+
+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind)
+
+
+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind,
+                   float param)
+
+
+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(PImage src,
+                 int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
+
+
+
+
+
+
+
+ +

+blendColor

+
+public static int blendColor(int c1,
+                             int c2,
+                             int mode)
+
+
+
+
+
+
+
+
+
+ +

+blend

+
+public void blend(int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
+
+
+
+
+
+
+
+ +

+blend

+
+public void blend(PImage src,
+                  int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PConstants.html b/build/javadoc/everything/processing/core/PConstants.html new file mode 100644 index 000000000..dd2cb2ed8 --- /dev/null +++ b/build/javadoc/everything/processing/core/PConstants.html @@ -0,0 +1,3632 @@ + + + + + +PConstants + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Interface PConstants

+
+
All Known Implementing Classes:
Capture, ColorSelector.ColorRange, ColorSelector.ColorSlider, Movie, PApplet, PFont, PGraphics, PGraphics2D, PGraphics3D, PGraphicsJava2D, PGraphicsOpenGL, PGraphicsPDF, PImage, PLine, PPolygon, PShape, PShapeSVG, PSmoothTriangle, PStyle, PTriangle, RawDXF
+
+
+
+
public interface PConstants
+ + +

+Numbers shared throughout processing.core. +

+ An attempt is made to keep the constants as short/non-verbose + as possible. For instance, the constant is TIFF instead of + FILE_TYPE_TIFF. We'll do this as long as we can get away with it. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intA + +
+           
+static intAB + +
+           
+static intADD + +
+           
+static intAG + +
+           
+static intALPHA + +
+           
+static intALPHA_MASK + +
+           
+static intALT + +
+           
+static intAMBIENT + +
+           
+static intAR + +
+           
+static intARC + +
+           
+static intARGB + +
+           
+static intARROW + +
+           
+static intB + +
+           
+static charBACKSPACE + +
+           
+static intBASELINE + +
+          Default vertical alignment for text placement
+static intBEEN_LIT + +
+           
+static intBEVEL + +
+           
+static intBLEND + +
+           
+static intBLUE_MASK + +
+           
+static intBLUR + +
+           
+static intBOTTOM + +
+          Align text from the bottom, using the baseline.
+static intBOX + +
+           
+static intBURN + +
+           
+static intCENTER + +
+          Draw from the center, using second pair of values as the diameter.
+static intCENTER_DIAMETER + +
+          Deprecated. Use DIAMETER instead.
+static intCENTER_RADIUS + +
+          Deprecated. Use RADIUS instead.
+static intCHATTER + +
+           
+static intCLOSE + +
+           
+static intCMYK + +
+           
+static intCODED + +
+           
+static intCOMPLAINT + +
+           
+static intCONTROL + +
+           
+static intCORNER + +
+          Draw mode convention to use (x, y) to (width, height)
+static intCORNERS + +
+          Draw mode convention to use (x1, y1) to (x2, y2) coordinates
+static intCROSS + +
+           
+static intCUSTOM + +
+           
+static intDA + +
+           
+static intDARKEST + +
+           
+static intDB + +
+           
+static floatDEG_TO_RAD + +
+           
+static charDELETE + +
+           
+static intDG + +
+           
+static intDIAMETER + +
+          Synonym for the CENTER constant.
+static intDIFFERENCE + +
+           
+static intDILATE + +
+           
+static intDIRECTIONAL + +
+           
+static intDISABLE_ACCURATE_TEXTURES + +
+           
+static intDISABLE_DEPTH_SORT + +
+           
+static intDISABLE_DEPTH_TEST + +
+           
+static intDISABLE_OPENGL_2X_SMOOTH + +
+           
+static intDISABLE_OPENGL_ERROR_REPORT + +
+           
+static intDODGE + +
+           
+static intDOWN + +
+           
+static intDR + +
+           
+static java.lang.StringDXF + +
+           
+static intEB + +
+           
+static intEDGE + +
+           
+static intEG + +
+           
+static intELLIPSE + +
+           
+static intENABLE_ACCURATE_TEXTURES + +
+           
+static intENABLE_DEPTH_SORT + +
+           
+static intENABLE_DEPTH_TEST + +
+           
+static intENABLE_NATIVE_FONTS + +
+           
+static intENABLE_OPENGL_2X_SMOOTH + +
+           
+static intENABLE_OPENGL_4X_SMOOTH + +
+           
+static intENABLE_OPENGL_ERROR_REPORT + +
+           
+static charENTER + +
+           
+static floatEPSILON + +
+           
+static intER + +
+           
+static intERODE + +
+           
+static java.lang.StringERROR_BACKGROUND_IMAGE_FORMAT + +
+           
+static java.lang.StringERROR_BACKGROUND_IMAGE_SIZE + +
+           
+static java.lang.StringERROR_PUSHMATRIX_OVERFLOW + +
+           
+static java.lang.StringERROR_PUSHMATRIX_UNDERFLOW + +
+           
+static java.lang.StringERROR_TEXTFONT_NULL_PFONT + +
+           
+static charESC + +
+           
+static intEXCLUSION + +
+           
+static intG + +
+           
+static intGIF + +
+           
+static intGRAY + +
+           
+static intGREEN_MASK + +
+           
+static floatHALF_PI + +
+           
+static intHAND + +
+           
+static intHARD_LIGHT + +
+           
+static intHINT_COUNT + +
+           
+static intHSB + +
+           
+static intIMAGE + +
+          texture coordinates based on image width/height
+static intINVERT + +
+           
+static java.lang.StringJAVA2D + +
+           
+static intJPEG + +
+           
+static intLEFT + +
+           
+static intLIGHTEST + +
+           
+static intLINE + +
+           
+static intLINES + +
+           
+static intLINUX + +
+           
+static intMACOSX + +
+           
+static floatMAX_FLOAT + +
+          Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + and to avoid teaching static methods on the first day.
+static intMAX_INT + +
+          Largest possible (positive) integer value
+static floatMIN_FLOAT + +
+          Note that Float.MIN_VALUE is the smallest positive value + for a floating point number, not actually the minimum (negative) value + for a float.
+static intMIN_INT + +
+          Smallest possible (negative) integer value
+static intMITER + +
+           
+static intMODEL + +
+          textMode(MODEL) is the default, meaning that characters + will be affected by transformations like any other shapes.
+static intMOVE + +
+           
+static intMULTIPLY + +
+           
+static intNORMAL + +
+          texture coordinates in 0..1 range
+static intNORMALIZED + +
+          Deprecated. use NORMAL instead
+static intNX + +
+           
+static intNY + +
+           
+static intNZ + +
+           
+static intOPAQUE + +
+           
+static intOPEN + +
+           
+static java.lang.StringOPENGL + +
+           
+static intORTHOGRAPHIC + +
+           
+static intOTHER + +
+           
+static intOVERLAY + +
+           
+static java.lang.StringP2D + +
+           
+static java.lang.StringP3D + +
+           
+static intPATH + +
+           
+static java.lang.StringPDF + +
+           
+static intPERSPECTIVE + +
+           
+static floatPI + +
+           
+static java.lang.String[]platformNames + +
+           
+static intPOINT + +
+           
+static intPOINTS + +
+           
+static intPOLYGON + +
+           
+static intPOSTERIZE + +
+           
+static intPROBLEM + +
+           
+static intPROJECT + +
+           
+static intQUAD + +
+           
+static intQUAD_STRIP + +
+           
+static intQUADS + +
+           
+static floatQUARTER_PI + +
+           
+static intR + +
+           
+static floatRAD_TO_DEG + +
+           
+static intRADIUS + +
+          Draw mode from the center, and using the radius
+static intRECT + +
+           
+static intRED_MASK + +
+           
+static intREPLACE + +
+           
+static charRETURN + +
+           
+static intRGB + +
+           
+static intRIGHT + +
+           
+static intROUND + +
+           
+static intSA + +
+           
+static intSB + +
+           
+static intSCREEN + +
+           
+static intSG + +
+           
+static intSHAPE + +
+          textMode(SHAPE) draws text using the the glyph outlines of + individual characters rather than as textures.
+static intSHIFT + +
+           
+static intSHINE + +
+           
+static intSOFT_LIGHT + +
+           
+static intSPB + +
+           
+static intSPG + +
+           
+static intSPHERE + +
+           
+static intSPOT + +
+           
+static intSPR + +
+           
+static intSQUARE + +
+           
+static intSR + +
+          stroke argb values
+static intSUBTRACT + +
+           
+static intSW + +
+          stroke weight
+static charTAB + +
+           
+static intTARGA + +
+           
+static intTEXT + +
+           
+static floatTHIRD_PI + +
+           
+static intTHRESHOLD + +
+           
+static intTIFF + +
+           
+static intTOP + +
+          Align text to the top
+static intTRIANGLE + +
+           
+static intTRIANGLE_FAN + +
+           
+static intTRIANGLE_STRIP + +
+           
+static intTRIANGLES + +
+           
+static floatTWO_PI + +
+           
+static intTX + +
+           
+static intTY + +
+           
+static intTZ + +
+           
+static intU + +
+           
+static intUP + +
+           
+static intV + +
+           
+static intVERTEX_FIELD_COUNT + +
+           
+static intVW + +
+           
+static intVX + +
+           
+static intVY + +
+           
+static intVZ + +
+           
+static intWAIT + +
+           
+static java.lang.StringWHITESPACE + +
+           
+static intWINDOWS + +
+           
+static intX + +
+           
+static intY + +
+           
+static intZ + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+X

+
+static final int X
+
+
+
See Also:
Constant Field Values
+
+
+ +

+Y

+
+static final int Y
+
+
+
See Also:
Constant Field Values
+
+
+ +

+Z

+
+static final int Z
+
+
+
See Also:
Constant Field Values
+
+
+ +

+R

+
+static final int R
+
+
+
See Also:
Constant Field Values
+
+
+ +

+G

+
+static final int G
+
+
+
See Also:
Constant Field Values
+
+
+ +

+B

+
+static final int B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+A

+
+static final int A
+
+
+
See Also:
Constant Field Values
+
+
+ +

+U

+
+static final int U
+
+
+
See Also:
Constant Field Values
+
+
+ +

+V

+
+static final int V
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NX

+
+static final int NX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NY

+
+static final int NY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NZ

+
+static final int NZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EDGE

+
+static final int EDGE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SR

+
+static final int SR
+
+
stroke argb values +

+

+
See Also:
Constant Field Values
+
+
+ +

+SG

+
+static final int SG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SB

+
+static final int SB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SA

+
+static final int SA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SW

+
+static final int SW
+
+
stroke weight +

+

+
See Also:
Constant Field Values
+
+
+ +

+TX

+
+static final int TX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TY

+
+static final int TY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TZ

+
+static final int TZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VX

+
+static final int VX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VY

+
+static final int VY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VZ

+
+static final int VZ
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VW

+
+static final int VW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AR

+
+static final int AR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AG

+
+static final int AG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AB

+
+static final int AB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DR

+
+static final int DR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DG

+
+static final int DG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DB

+
+static final int DB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DA

+
+static final int DA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPR

+
+static final int SPR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPG

+
+static final int SPG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPB

+
+static final int SPB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SHINE

+
+static final int SHINE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ER

+
+static final int ER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EG

+
+static final int EG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EB

+
+static final int EB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEEN_LIT

+
+static final int BEEN_LIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VERTEX_FIELD_COUNT

+
+static final int VERTEX_FIELD_COUNT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+P2D

+
+static final java.lang.String P2D
+
+
+
See Also:
Constant Field Values
+
+
+ +

+P3D

+
+static final java.lang.String P3D
+
+
+
See Also:
Constant Field Values
+
+
+ +

+JAVA2D

+
+static final java.lang.String JAVA2D
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OPENGL

+
+static final java.lang.String OPENGL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PDF

+
+static final java.lang.String PDF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DXF

+
+static final java.lang.String DXF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OTHER

+
+static final int OTHER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WINDOWS

+
+static final int WINDOWS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MACOSX

+
+static final int MACOSX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINUX

+
+static final int LINUX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+platformNames

+
+static final java.lang.String[] platformNames
+
+
+
+
+
+ +

+EPSILON

+
+static final float EPSILON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MAX_FLOAT

+
+static final float MAX_FLOAT
+
+
Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + and to avoid teaching static methods on the first day. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MIN_FLOAT

+
+static final float MIN_FLOAT
+
+
Note that Float.MIN_VALUE is the smallest positive value + for a floating point number, not actually the minimum (negative) value + for a float. This constant equals 0xFF7FFFFF, the smallest (farthest + negative) value a float can have before it hits NaN. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MAX_INT

+
+static final int MAX_INT
+
+
Largest possible (positive) integer value +

+

+
See Also:
Constant Field Values
+
+
+ +

+MIN_INT

+
+static final int MIN_INT
+
+
Smallest possible (negative) integer value +

+

+
See Also:
Constant Field Values
+
+
+ +

+PI

+
+static final float PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HALF_PI

+
+static final float HALF_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+THIRD_PI

+
+static final float THIRD_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUARTER_PI

+
+static final float QUARTER_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TWO_PI

+
+static final float TWO_PI
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DEG_TO_RAD

+
+static final float DEG_TO_RAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RAD_TO_DEG

+
+static final float RAD_TO_DEG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WHITESPACE

+
+static final java.lang.String WHITESPACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RGB

+
+static final int RGB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARGB

+
+static final int ARGB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HSB

+
+static final int HSB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ALPHA

+
+static final int ALPHA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CMYK

+
+static final int CMYK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TIFF

+
+static final int TIFF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGA

+
+static final int TARGA
+
+
+
See Also:
Constant Field Values
+
+
+ +

+JPEG

+
+static final int JPEG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GIF

+
+static final int GIF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLUR

+
+static final int BLUR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GRAY

+
+static final int GRAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INVERT

+
+static final int INVERT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OPAQUE

+
+static final int OPAQUE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POSTERIZE

+
+static final int POSTERIZE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+THRESHOLD

+
+static final int THRESHOLD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERODE

+
+static final int ERODE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DILATE

+
+static final int DILATE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+REPLACE

+
+static final int REPLACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLEND

+
+static final int BLEND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ADD

+
+static final int ADD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SUBTRACT

+
+static final int SUBTRACT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LIGHTEST

+
+static final int LIGHTEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DARKEST

+
+static final int DARKEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIFFERENCE

+
+static final int DIFFERENCE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+EXCLUSION

+
+static final int EXCLUSION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MULTIPLY

+
+static final int MULTIPLY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SCREEN

+
+static final int SCREEN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OVERLAY

+
+static final int OVERLAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HARD_LIGHT

+
+static final int HARD_LIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SOFT_LIGHT

+
+static final int SOFT_LIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DODGE

+
+static final int DODGE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BURN

+
+static final int BURN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ALPHA_MASK

+
+static final int ALPHA_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RED_MASK

+
+static final int RED_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GREEN_MASK

+
+static final int GREEN_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BLUE_MASK

+
+static final int BLUE_MASK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CHATTER

+
+static final int CHATTER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMPLAINT

+
+static final int COMPLAINT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PROBLEM

+
+static final int PROBLEM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CUSTOM

+
+static final int CUSTOM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ORTHOGRAPHIC

+
+static final int ORTHOGRAPHIC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PERSPECTIVE

+
+static final int PERSPECTIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POINT

+
+static final int POINT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POINTS

+
+static final int POINTS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINE

+
+static final int LINE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LINES

+
+static final int LINES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLE

+
+static final int TRIANGLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLES

+
+static final int TRIANGLES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLE_STRIP

+
+static final int TRIANGLE_STRIP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRIANGLE_FAN

+
+static final int TRIANGLE_FAN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUAD

+
+static final int QUAD
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUADS

+
+static final int QUADS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+QUAD_STRIP

+
+static final int QUAD_STRIP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+POLYGON

+
+static final int POLYGON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PATH

+
+static final int PATH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RECT

+
+static final int RECT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ELLIPSE

+
+static final int ELLIPSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARC

+
+static final int ARC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPHERE

+
+static final int SPHERE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BOX

+
+static final int BOX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+OPEN

+
+static final int OPEN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CLOSE

+
+static final int CLOSE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CORNER

+
+static final int CORNER
+
+
Draw mode convention to use (x, y) to (width, height) +

+

+
See Also:
Constant Field Values
+
+
+ +

+CORNERS

+
+static final int CORNERS
+
+
Draw mode convention to use (x1, y1) to (x2, y2) coordinates +

+

+
See Also:
Constant Field Values
+
+
+ +

+RADIUS

+
+static final int RADIUS
+
+
Draw mode from the center, and using the radius +

+

+
See Also:
Constant Field Values
+
+
+ +

+CENTER_RADIUS

+
+static final int CENTER_RADIUS
+
+
Deprecated. Use RADIUS instead.
+
See Also:
Constant Field Values
+
+
+ +

+CENTER

+
+static final int CENTER
+
+
Draw from the center, using second pair of values as the diameter. + Formerly called CENTER_DIAMETER in alpha releases. +

+

+
See Also:
Constant Field Values
+
+
+ +

+DIAMETER

+
+static final int DIAMETER
+
+
Synonym for the CENTER constant. Draw from the center, + using second pair of values as the diameter. +

+

+
See Also:
Constant Field Values
+
+
+ +

+CENTER_DIAMETER

+
+static final int CENTER_DIAMETER
+
+
Deprecated. Use DIAMETER instead.
+
See Also:
Constant Field Values
+
+
+ +

+BASELINE

+
+static final int BASELINE
+
+
Default vertical alignment for text placement +

+

+
See Also:
Constant Field Values
+
+
+ +

+TOP

+
+static final int TOP
+
+
Align text to the top +

+

+
See Also:
Constant Field Values
+
+
+ +

+BOTTOM

+
+static final int BOTTOM
+
+
Align text from the bottom, using the baseline. +

+

+
See Also:
Constant Field Values
+
+
+ +

+NORMAL

+
+static final int NORMAL
+
+
texture coordinates in 0..1 range +

+

+
See Also:
Constant Field Values
+
+
+ +

+NORMALIZED

+
+static final int NORMALIZED
+
+
Deprecated. use NORMAL instead
+
See Also:
Constant Field Values
+
+
+ +

+IMAGE

+
+static final int IMAGE
+
+
texture coordinates based on image width/height +

+

+
See Also:
Constant Field Values
+
+
+ +

+MODEL

+
+static final int MODEL
+
+
textMode(MODEL) is the default, meaning that characters + will be affected by transformations like any other shapes. +

+ Changed value in 0093 to not interfere with LEFT, CENTER, and RIGHT. +

+

+
See Also:
Constant Field Values
+
+
+ +

+SHAPE

+
+static final int SHAPE
+
+
textMode(SHAPE) draws text using the the glyph outlines of + individual characters rather than as textures. If the outlines are + not available, then textMode(SHAPE) will be ignored and textMode(MODEL) + will be used instead. For this reason, be sure to call textMode() + after calling textFont(). +

+ Currently, textMode(SHAPE) is only supported by OPENGL mode. + It also requires Java 1.2 or higher (OPENGL requires 1.4 anyway) +

+

+
See Also:
Constant Field Values
+
+
+ +

+SQUARE

+
+static final int SQUARE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ROUND

+
+static final int ROUND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PROJECT

+
+static final int PROJECT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MITER

+
+static final int MITER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEVEL

+
+static final int BEVEL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+AMBIENT

+
+static final int AMBIENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DIRECTIONAL

+
+static final int DIRECTIONAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SPOT

+
+static final int SPOT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BACKSPACE

+
+static final char BACKSPACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TAB

+
+static final char TAB
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENTER

+
+static final char ENTER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RETURN

+
+static final char RETURN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ESC

+
+static final char ESC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DELETE

+
+static final char DELETE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CODED

+
+static final int CODED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UP

+
+static final int UP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DOWN

+
+static final int DOWN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LEFT

+
+static final int LEFT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+RIGHT

+
+static final int RIGHT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ALT

+
+static final int ALT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CONTROL

+
+static final int CONTROL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SHIFT

+
+static final int SHIFT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ARROW

+
+static final int ARROW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CROSS

+
+static final int CROSS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HAND

+
+static final int HAND
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOVE

+
+static final int MOVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TEXT

+
+static final int TEXT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WAIT

+
+static final int WAIT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_OPENGL_2X_SMOOTH

+
+static final int DISABLE_OPENGL_2X_SMOOTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_OPENGL_2X_SMOOTH

+
+static final int ENABLE_OPENGL_2X_SMOOTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_OPENGL_4X_SMOOTH

+
+static final int ENABLE_OPENGL_4X_SMOOTH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_NATIVE_FONTS

+
+static final int ENABLE_NATIVE_FONTS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_DEPTH_TEST

+
+static final int DISABLE_DEPTH_TEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_DEPTH_TEST

+
+static final int ENABLE_DEPTH_TEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_DEPTH_SORT

+
+static final int ENABLE_DEPTH_SORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_DEPTH_SORT

+
+static final int DISABLE_DEPTH_SORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_OPENGL_ERROR_REPORT

+
+static final int DISABLE_OPENGL_ERROR_REPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_OPENGL_ERROR_REPORT

+
+static final int ENABLE_OPENGL_ERROR_REPORT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ENABLE_ACCURATE_TEXTURES

+
+static final int ENABLE_ACCURATE_TEXTURES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DISABLE_ACCURATE_TEXTURES

+
+static final int DISABLE_ACCURATE_TEXTURES
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HINT_COUNT

+
+static final int HINT_COUNT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_BACKGROUND_IMAGE_SIZE

+
+static final java.lang.String ERROR_BACKGROUND_IMAGE_SIZE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_BACKGROUND_IMAGE_FORMAT

+
+static final java.lang.String ERROR_BACKGROUND_IMAGE_FORMAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_TEXTFONT_NULL_PFONT

+
+static final java.lang.String ERROR_TEXTFONT_NULL_PFONT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_PUSHMATRIX_OVERFLOW

+
+static final java.lang.String ERROR_PUSHMATRIX_OVERFLOW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ERROR_PUSHMATRIX_UNDERFLOW

+
+static final java.lang.String ERROR_PUSHMATRIX_UNDERFLOW
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PFont.html b/build/javadoc/everything/processing/core/PFont.html new file mode 100644 index 000000000..2be5bdaa3 --- /dev/null +++ b/build/javadoc/everything/processing/core/PFont.html @@ -0,0 +1,990 @@ + + + + + +PFont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PFont

+
+java.lang.Object
+  extended by processing.core.PFont
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PFont
extends java.lang.Object
implements PConstants
+ + +

+Grayscale bitmap font class used by Processing. +

+ Awful (and by that, I mean awesome) ascii (non)art for how this works: +

+   |
+   |                   height is the full used height of the image
+   |
+   |   ..XX..       }
+   |   ..XX..       }
+   |   ......       }
+   |   XXXX..       }  topExtent (top y is baseline - topExtent)
+   |   ..XX..       }
+   |   ..XX..       }  dotted areas are where the image data
+   |   ..XX..       }  is actually located for the character
+   +---XXXXXX----   }  (it extends to the right and down
+   |                   for power of two texture sizes)
+   ^^^^ leftExtent (amount to move over before drawing the image
+
+   ^^^^^^^^^^^^^^ setWidth (width displaced by char)
+ 
+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ intascent + +
+           
+ intcharCount + +
+           
+static char[]DEFAULT_CHARSET + +
+          The default Processing character set.
+ intdescent + +
+           
+ int[]height + +
+           
+ PImage[]images + +
+           
+ int[]leftExtent + +
+           
+ intmbox2 + +
+          next power of 2 over the max image size (usually 64)
+ java.lang.Stringname + +
+          Name of the font as seen by Java when it was created.
+ java.lang.Stringpsname + +
+          Postscript name of the font that this bitmap was created from.
+ int[]setWidth + +
+           
+ intsize + +
+          "natural" size of the font (most often 48)
+ booleansmooth + +
+          true if smoothing was enabled for this font, used for native impl
+ inttheight + +
+          texture height, same as mbox2, but reserved for future use
+ int[]topExtent + +
+           
+ inttwidth + +
+          texture width, same as mbox2, but reserved for future use
+ int[]value + +
+           
+ int[]width + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PFont() + +
+           
PFont(java.awt.Font font, + boolean smooth, + char[] charset) + +
+          Create a new image-based font on the fly.
PFont(java.io.InputStream input) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ floatascent() + +
+          Returns the ascent of this font from the baseline.
+ floatdescent() + +
+          Returns how far this font descends from the baseline.
+ java.awt.FontfindFont() + +
+          Attempt to find the native version of this font.
+static java.awt.FontfindFont(java.lang.String name) + +
+          Starting with Java 1.5, Apple broke the ability to specify most fonts.
+ java.awt.FontgetFont() + +
+          Return the native java.awt.Font associated with this PFont (if any).
+ intindex(char c) + +
+          Get index for the char (convert from unicode to bagel charset).
+ floatkern(char a, + char b) + +
+          Currently un-implemented for .vlw fonts, + but honored for layout in case subclasses use it.
+static java.lang.String[]list() + +
+          Get a list of the fonts installed on the system that can be used + by Java.
+static voidloadFonts() + +
+           
+ voidsave(java.io.OutputStream output) + +
+          Write this PFont to an OutputStream.
+ voidsetFont(java.awt.Font font) + +
+          Set the native complement of this font.
+ floatwidth(char c) + +
+          Width of this character for a font of size 1.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+charCount

+
+public int charCount
+
+
+
+
+
+ +

+images

+
+public PImage[] images
+
+
+
+
+
+ +

+name

+
+public java.lang.String name
+
+
Name of the font as seen by Java when it was created. + If the font is available, the native version will be used. +

+

+
+
+
+ +

+psname

+
+public java.lang.String psname
+
+
Postscript name of the font that this bitmap was created from. +

+

+
+
+
+ +

+size

+
+public int size
+
+
"natural" size of the font (most often 48) +

+

+
+
+
+ +

+smooth

+
+public boolean smooth
+
+
true if smoothing was enabled for this font, used for native impl +

+

+
+
+
+ +

+mbox2

+
+public int mbox2
+
+
next power of 2 over the max image size (usually 64) +

+

+
+
+
+ +

+twidth

+
+public int twidth
+
+
texture width, same as mbox2, but reserved for future use +

+

+
+
+
+ +

+theight

+
+public int theight
+
+
texture height, same as mbox2, but reserved for future use +

+

+
+
+
+ +

+value

+
+public int[] value
+
+
+
+
+
+ +

+height

+
+public int[] height
+
+
+
+
+
+ +

+width

+
+public int[] width
+
+
+
+
+
+ +

+setWidth

+
+public int[] setWidth
+
+
+
+
+
+ +

+topExtent

+
+public int[] topExtent
+
+
+
+
+
+ +

+leftExtent

+
+public int[] leftExtent
+
+
+
+
+
+ +

+ascent

+
+public int ascent
+
+
+
+
+
+ +

+descent

+
+public int descent
+
+
+
+
+
+ +

+DEFAULT_CHARSET

+
+public static char[] DEFAULT_CHARSET
+
+
The default Processing character set. +

+ This is the union of the Mac Roman and Windows ANSI (CP1250) + character sets. ISO 8859-1 Latin 1 is Unicode characters 0x80 -> 0xFF, + and would seem a good standard, but in practice, most P5 users would + rather have characters that they expect from their platform's fonts. +

+ This is more of an interim solution until a much better + font solution can be determined. (i.e. create fonts on + the fly from some sort of vector format). +

+ Not that I expect that to happen. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PFont

+
+public PFont()
+
+
+
+ +

+PFont

+
+public PFont(java.io.InputStream input)
+      throws java.io.IOException
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +

+PFont

+
+public PFont(java.awt.Font font,
+             boolean smooth,
+             char[] charset)
+
+
Create a new image-based font on the fly. +

+

+
Parameters:
font - the font object to create from
charset - array of all unicode chars that should be included
smooth - true to enable smoothing/anti-aliasing
+
+ + + + + + + + +
+Method Detail
+ +

+setFont

+
+public void setFont(java.awt.Font font)
+
+
Set the native complement of this font. +

+

+
+
+
+
+
+
+
+ +

+getFont

+
+public java.awt.Font getFont()
+
+
Return the native java.awt.Font associated with this PFont (if any). +

+

+
+
+
+
+
+
+
+ +

+findFont

+
+public java.awt.Font findFont()
+
+
Attempt to find the native version of this font. + (Public so that it can be used by OpenGL or other renderers.) +

+

+
+
+
+
+
+
+
+ +

+save

+
+public void save(java.io.OutputStream output)
+          throws java.io.IOException
+
+
Write this PFont to an OutputStream. +

+ This is used by the Create Font tool, or whatever anyone else dreams + up for messing with fonts themselves. +

+ It is assumed that the calling class will handle closing + the stream when finished. +

+

+
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+index

+
+public int index(char c)
+
+
Get index for the char (convert from unicode to bagel charset). +

+

+
+
+
+ +
Returns:
index into arrays or -1 if not found
+
+
+
+ +

+kern

+
+public float kern(char a,
+                  char b)
+
+
Currently un-implemented for .vlw fonts, + but honored for layout in case subclasses use it. +

+

+
+
+
+
+
+
+
+ +

+ascent

+
+public float ascent()
+
+
Returns the ascent of this font from the baseline. + The value is based on a font of size 1. +

+

+
+
+
+
+
+
+
+ +

+descent

+
+public float descent()
+
+
Returns how far this font descends from the baseline. + The value is based on a font size of 1. +

+

+
+
+
+
+
+
+
+ +

+width

+
+public float width(char c)
+
+
Width of this character for a font of size 1. +

+

+
+
+
+
+
+
+
+ +

+list

+
+public static java.lang.String[] list()
+
+
Get a list of the fonts installed on the system that can be used + by Java. Not all fonts can be used in Java, in fact it's mostly + only TrueType fonts. OpenType fonts with CFF data such as Adobe's + OpenType fonts seem to have trouble (even though they're sort of + TrueType fonts as well, or may have a .ttf extension). Regular + PostScript fonts seem to work OK, however. +

+ Not recommended for use in applets, but this is implemented + in PFont because the Java methods to access this information + have changed between 1.1 and 1.4, and the 1.4 method is + typical of the sort of undergraduate-level over-abstraction + that the seems to have made its way into the Java API after 1.1. +

+

+
+
+
+
+
+
+
+ +

+loadFonts

+
+public static void loadFonts()
+
+
+
+
+
+
+
+
+
+ +

+findFont

+
+public static java.awt.Font findFont(java.lang.String name)
+
+
Starting with Java 1.5, Apple broke the ability to specify most fonts. + This has been filed as bug #4769141 at bugreporter.apple.com. More info at + Bug 407. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PGraphics.html b/build/javadoc/everything/processing/core/PGraphics.html new file mode 100644 index 000000000..388f82bff --- /dev/null +++ b/build/javadoc/everything/processing/core/PGraphics.html @@ -0,0 +1,7309 @@ + + + + + +PGraphics + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphics

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
Direct Known Subclasses:
PGraphics2D, PGraphics3D, PGraphicsJava2D
+
+
+
+
public class PGraphics
extends PImage
implements PConstants
+ + +

+Main graphics and rendering context, as well as the base API implementation. + +

Subclassing and initializing PGraphics objects

+ Starting in release 0149, subclasses of PGraphics are handled differently. + The constructor for subclasses takes no parameters, instead a series of + functions are called by the hosting PApplet to specify its attributes. +
    +
  • setParent(PApplet) - is called to specify the parent PApplet. +
  • setPrimary(boolean) - called with true if this PGraphics will be the + primary drawing surface used by the sketch, or false if not. +
  • setPath(String) - called when the renderer needs a filename or output + path, such as with the PDF or DXF renderers. +
  • setSize(int, int) - this is called last, at which point it's safe for + the renderer to complete its initialization routine. +
+ The functions were broken out because of the growing number of parameters + such as these that might be used by a renderer, yet with the exception of + setSize(), it's not clear which will be necessary. So while the size could + be passed in to the constructor instead of a setSize() function, a function + would still be needed that would notify the renderer that it was time to + finish its initialization. Thus, setSize() simply does both. + +

Know your rights: public vs. private methods

+ Methods that are protected are often subclassed by other renderers, however + they are not set 'public' because they shouldn't be part of the user-facing + public API accessible from PApplet. That is, we don't want sketches calling + textModeCheck() or vertexTexture() directly. + +

Handling warnings and exceptions

+ Methods that are unavailable generally show a warning, unless their lack of + availability will soon cause another exception. For instance, if a method + like getMatrix() returns null because it is unavailable, an exception will + be thrown stating that the method is unavailable, rather than waiting for + the NullPointerException that will occur when the sketch tries to use that + method. As of release 0149, warnings will only be shown once, and exceptions + have been changed to warnings where possible. + +

Using xxxxImpl() for subclassing smoothness

+ The xxxImpl() methods are generally renderer-specific handling for some + subset if tasks for a particular function (vague enough for you?) For + instance, imageImpl() handles drawing an image whose x/y/w/h and u/v coords + have been specified, and screen placement (independent of imageMode) has + been determined. There's no point in all renderers implementing the + if (imageMode == BLAH) placement/sizing logic, so that's handled + by PGraphics, which then calls imageImpl() once all that is figured out. + +

His brother PImage

+ PGraphics subclasses PImage so that it can be drawn and manipulated in a + similar fashion. As such, many methods are inherited from PGraphics, + though many are unavailable: for instance, resize() is not likely to be + implemented; the same goes for mask(), depending on the situation. + +

What's in PGraphics, what ain't

+ For the benefit of subclasses, as much as possible has been placed inside + PGraphics. For instance, bezier interpolation code and implementations of + the strokeCap() method (that simply sets the strokeCap variable) are + handled here. Features that will vary widely between renderers are located + inside the subclasses themselves. For instance, all matrix handling code + is per-renderer: Java 2D uses its own AffineTransform, P2D uses a PMatrix2D, + and PGraphics3D needs to keep continually update forward and reverse + transformations. A proper (future) OpenGL implementation will have all its + matrix madness handled by the card. Lighting also falls under this + category, however the base material property settings (emissive, specular, + et al.) are handled in PGraphics because they use the standard colorMode() + logic. Subclasses should override methods like emissiveFromCalc(), which + is a point where a valid color has been defined internally, and can be + applied in some manner based on the calcXxxx values. + +

What's in the PGraphics documentation, what ain't

+ Some things are noted here, some things are not. For public API, always + refer to the reference + on Processing.org for proper explanations. No attempt has been made to + keep the javadoc up to date or complete. It's an enormous task for + which we simply do not have the time. That is, it's not something that + to be done once—it's a matter of keeping the multiple references + synchronized (to say nothing of the translation issues), while targeting + them for their separate audiences. Ouch. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatambientB + +
+           
+ floatambientG + +
+           
+ floatambientR + +
+           
+ intbackgroundColor + +
+          Last background color that was set, zero if an image
+ intbezierDetail + +
+           
+ intcolorMode + +
+          The current colorMode
+ floatcolorModeA + +
+          Max value for alpha set by colorMode
+ floatcolorModeX + +
+          Max value for red (or hue) set by colorMode
+ floatcolorModeY + +
+          Max value for green (or saturation) set by colorMode
+ floatcolorModeZ + +
+          Max value for blue (or value) set by colorMode
+ floatcurveTightness + +
+           
+ booleanedge + +
+           
+ intellipseMode + +
+          The current ellipse mode (read-only)
+ floatemissiveB + +
+           
+ floatemissiveG + +
+           
+ floatemissiveR + +
+           
+ booleanfill + +
+          true if fill() is enabled, (read-only)
+ intfillColor + +
+          fill that was last set (read-only)
+ java.awt.Imageimage + +
+          Java AWT Image object associated with this renderer.
+ intimageMode + +
+          The current image alignment (read-only)
+ floatnormalX + +
+          Current normal vector.
+ floatnormalY + +
+          Current normal vector.
+ floatnormalZ + +
+          Current normal vector.
+ intpixelCount + +
+           
+ intrectMode + +
+          The current rect mode (read-only)
+ intshapeMode + +
+          The current shape alignment mode (read-only)
+ floatshininess + +
+           
+ booleansmooth + +
+           
+ floatspecularB + +
+           
+ floatspecularG + +
+           
+ floatspecularR + +
+           
+ intsphereDetailU + +
+           
+ intsphereDetailV + +
+           
+ booleanstroke + +
+          true if stroke() is enabled, (read-only)
+ intstrokeCap + +
+          Set by strokeCap() (read-only).
+ intstrokeColor + +
+          stroke that was last set (read-only)
+ intstrokeJoin + +
+          Set by strokeJoin() (read-only).
+ floatstrokeWeight + +
+          Last value set by strokeWeight() (read-only).
+ inttextAlign + +
+          The current text align (read-only)
+ inttextAlignY + +
+          The current vertical text alignment (read-only)
+ PFonttextFont + +
+          The current text font (read-only)
+ floattextLeading + +
+          The current text leading (read-only)
+ inttextMode + +
+          The current text mode (read-only)
+ floattextSize + +
+          The current text size (read-only)
+ PImagetextureImage + +
+          Current image being used as a texture
+ inttextureMode + +
+          Sets whether texture coordinates passed to + vertex() calls will be based on coordinates that are + based on the IMAGE or NORMALIZED.
+ floattextureU + +
+          Current horizontal coordinate for texture, will always + be between 0 and 1, even if using textureMode(IMAGE).
+ floattextureV + +
+          Current vertical coordinate for texture, see above.
+ booleantint + +
+          True if tint() is enabled (read-only).
+ inttintColor + +
+          tint that was last set (read-only)
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphics() + +
+          Constructor for the PGraphics object.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ floatalpha(int what) + +
+           
+ voidambient(float gray) + +
+           
+ voidambient(float x, + float y, + float z) + +
+           
+ voidambient(int rgb) + +
+           
+ voidambientLight(float red, + float green, + float blue) + +
+           
+ voidambientLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidapplyMatrix(PMatrix source) + +
+           
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voidapplyMatrix(PMatrix3D source) + +
+           
+ voidarc(float a, + float b, + float c, + float d, + float start, + float stop) + +
+          Identical parameters and placement to ellipse, + but draws only an arc of that ellipse.
+ voidbackground(float gray) + +
+          Set the background to a grayscale value, based on the + current colorMode.
+ voidbackground(float gray, + float alpha) + +
+          See notes about alpha in background(x, y, z, a).
+ voidbackground(float x, + float y, + float z) + +
+          Set the background to an r, g, b or h, s, b value, + based on the current colorMode.
+ voidbackground(float x, + float y, + float z, + float a) + +
+          Clear the background with a color that includes an alpha value.
+ voidbackground(int rgb) + +
+          Set the background to a gray or ARGB color.
+ voidbackground(int rgb, + float alpha) + +
+          See notes about alpha in background(x, y, z, a).
+ voidbackground(PImage image) + +
+          Takes an RGB or ARGB image and sets it as the background.
+ voidbeginCamera() + +
+           
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginRaw(PGraphics rawGraphics) + +
+          Record individual lines and triangles by echoing them to another renderer.
+ voidbeginShape() + +
+          Start a new shape of type POLYGON
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbezier(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+          Draw a cubic bezier curve.
+ voidbezier(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbezierDetail(int detail) + +
+           
+ floatbezierPoint(float a, + float b, + float c, + float d, + float t) + +
+          Evalutes quadratic bezier at point t for points a, b, c, d.
+ floatbezierTangent(float a, + float b, + float c, + float d, + float t) + +
+          Provide the tangent at the given point on the bezier curve.
+ voidbezierVertex(float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidbezierVertex(float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ floatblue(int what) + +
+           
+ voidbox(float size) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+          This feature is in testing, do not use or rely upon its implementation
+ floatbrightness(int what) + +
+           
+ voidcamera() + +
+           
+ voidcamera(float eyeX, + float eyeY, + float eyeZ, + float centerX, + float centerY, + float centerZ, + float upX, + float upY, + float upZ) + +
+           
+ booleancanDraw() + +
+          Some renderers have requirements re: when they are ready to draw.
+ intcolor(float gray) + +
+           
+ intcolor(float gray, + float alpha) + +
+           
+ intcolor(float x, + float y, + float z) + +
+           
+ intcolor(float x, + float y, + float z, + float a) + +
+           
+ intcolor(int gray) + +
+           
+ intcolor(int rgb, + float alpha) + +
+           
+ intcolor(int gray, + int alpha) + +
+           
+ intcolor(int x, + int y, + int z) + +
+           
+ intcolor(int x, + int y, + int z, + int a) + +
+           
+ voidcolorMode(int mode) + +
+          Callback to handle clearing the background when begin/endRaw is in use.
+ voidcolorMode(int mode, + float max) + +
+           
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ) + +
+          Set the colorMode and the maximum values for (r, g, b) + or (h, s, b).
+ voidcolorMode(int mode, + float maxX, + float maxY, + float maxZ, + float maxA) + +
+           
+ voidcurve(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+          Draws a segment of Catmull-Rom curve.
+ voidcurve(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidcurveDetail(int detail) + +
+           
+ floatcurvePoint(float a, + float b, + float c, + float d, + float t) + +
+          Get a location along a catmull-rom curve segment.
+ floatcurveTangent(float a, + float b, + float c, + float d, + float t) + +
+          Calculate the tangent at a t value (0..1) on a Catmull-Rom curve.
+ voidcurveTightness(float tightness) + +
+           
+ voidcurveVertex(float x, + float y) + +
+           
+ voidcurveVertex(float x, + float y, + float z) + +
+           
+ voiddirectionalLight(float red, + float green, + float blue, + float nx, + float ny, + float nz) + +
+           
+ booleandisplayable() + +
+          Return true if this renderer should be drawn to the screen.
+ voiddispose() + +
+          Handle any takedown for this graphics context.
+ voidedge(boolean edge) + +
+          Sets whether the upcoming vertex is part of an edge.
+ voidellipse(float a, + float b, + float c, + float d) + +
+           
+ voidellipseMode(int mode) + +
+           
+ voidemissive(float gray) + +
+           
+ voidemissive(float x, + float y, + float z) + +
+           
+ voidemissive(int rgb) + +
+           
+ voidendCamera() + +
+           
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidendRaw() + +
+           
+ voidendShape() + +
+           
+ voidendShape(int mode) + +
+           
+ voidfill(float gray) + +
+           
+ voidfill(float gray, + float alpha) + +
+           
+ voidfill(float x, + float y, + float z) + +
+           
+ voidfill(float x, + float y, + float z, + float a) + +
+           
+ voidfill(int rgb) + +
+          Set the fill to either a grayscale value or an ARGB int.
+ voidfill(int rgb, + float alpha) + +
+           
+ voidflush() + +
+           
+ voidfrustum(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ PMatrixgetMatrix() + +
+           
+ PMatrix2DgetMatrix(PMatrix2D target) + +
+          Copy the current transformation matrix into the specified target.
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+          Copy the current transformation matrix into the specified target.
+ PStylegetStyle() + +
+           
+ PStylegetStyle(PStyle s) + +
+           
+ floatgreen(int what) + +
+           
+ voidhint(int which) + +
+          Enable a hint option.
+ floathue(int what) + +
+           
+ voidimage(PImage image, + float x, + float y) + +
+           
+ voidimage(PImage image, + float x, + float y, + float c, + float d) + +
+           
+ voidimage(PImage image, + float a, + float b, + float c, + float d, + int u1, + int v1, + int u2, + int v2) + +
+          Draw an image(), also specifying u/v coordinates.
+ voidimageMode(int mode) + +
+          The mode can only be set to CORNERS, CORNER, and CENTER.
+ booleanis2D() + +
+          Return true if this renderer supports 2D drawing.
+ booleanis3D() + +
+          Return true if this renderer supports 2D drawing.
+ intlerpColor(int c1, + int c2, + float amt) + +
+          Interpolate between two colors, using the current color mode.
+static intlerpColor(int c1, + int c2, + float amt, + int mode) + +
+          Interpolate between two colors.
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+           
+ voidlights() + +
+           
+ voidlightSpecular(float x, + float y, + float z) + +
+           
+ voidline(float x1, + float y1, + float x2, + float y2) + +
+           
+ voidline(float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ floatmodelX(float x, + float y, + float z) + +
+          Returns the model space x value for an x, y, z coordinate.
+ floatmodelY(float x, + float y, + float z) + +
+          Returns the model space y value for an x, y, z coordinate.
+ floatmodelZ(float x, + float y, + float z) + +
+          Returns the model space z value for an x, y, z coordinate.
+ voidnoFill() + +
+           
+ voidnoLights() + +
+           
+ voidnormal(float nx, + float ny, + float nz) + +
+          Sets the current normal vector.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidnoStroke() + +
+           
+ voidnoTint() + +
+           
+ voidortho() + +
+           
+ voidortho(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+           
+ voidperspective() + +
+           
+ voidperspective(float fovy, + float aspect, + float zNear, + float zFar) + +
+           
+ voidpoint(float x, + float y) + +
+           
+ voidpoint(float x, + float y, + float z) + +
+           
+ voidpointLight(float red, + float green, + float blue, + float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidpopStyle() + +
+           
+ voidprintCamera() + +
+           
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidprintProjection() + +
+           
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidpushStyle() + +
+           
+ voidquad(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidrect(float a, + float b, + float c, + float d) + +
+           
+ voidrectMode(int mode) + +
+           
+ floatred(int what) + +
+           
+ voidresetMatrix() + +
+          Set the current transformation matrix to identity.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+          Rotate about a vector in space.
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ floatsaturation(int what) + +
+           
+ voidscale(float s) + +
+          Scale in all dimensions.
+ voidscale(float sx, + float sy) + +
+          Scale in X and Y.
+ voidscale(float x, + float y, + float z) + +
+          Scale in X, Y, and Z.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenX(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenZ(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ voidsetMatrix(PMatrix source) + +
+          Set the current transformation matrix to the contents of another.
+ voidsetMatrix(PMatrix2D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetMatrix(PMatrix3D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetParent(PApplet parent) + +
+           
+ voidsetPath(java.lang.String path) + +
+           
+ voidsetPrimary(boolean primary) + +
+          Set (or unset) this as the main drawing surface.
+ voidsetSize(int w, + int h) + +
+          The final step in setting up a renderer, set its size of this renderer.
+ voidshape(PShape shape) + +
+           
+ voidshape(PShape shape, + float x, + float y) + +
+          Convenience method to draw at a particular location.
+ voidshape(PShape shape, + float x, + float y, + float c, + float d) + +
+           
+ voidshapeMode(int mode) + +
+          Set the orientation for the shape() command (like imageMode() or rectMode()).
+ voidshininess(float shine) + +
+           
+static voidshowException(java.lang.String msg) + +
+          Show an renderer-related exception that halts the program.
+static voidshowWarning(java.lang.String msg) + +
+          Show a renderer error, and keep track of it so that it's only shown once.
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidspecular(float gray) + +
+           
+ voidspecular(float x, + float y, + float z) + +
+           
+ voidspecular(int rgb) + +
+           
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidsphereDetail(int res) + +
+           
+ voidsphereDetail(int ures, + int vres) + +
+          Set the detail level for approximating a sphere.
+ voidspotLight(float red, + float green, + float blue, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+ voidstroke(float gray) + +
+           
+ voidstroke(float gray, + float alpha) + +
+           
+ voidstroke(float x, + float y, + float z) + +
+           
+ voidstroke(float x, + float y, + float z, + float a) + +
+           
+ voidstroke(int rgb) + +
+          Set the tint to either a grayscale or ARGB value.
+ voidstroke(int rgb, + float alpha) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ voidstyle(PStyle s) + +
+           
+ voidtext(char c) + +
+          Write text where we just left off.
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y) + +
+          Method to draw text from an array of chars.
+ voidtext(char[] chars, + int start, + int stop, + float x, + float y, + float z) + +
+           
+ voidtext(char c, + float x, + float y) + +
+          Draw a single character on screen.
+ voidtext(char c, + float x, + float y, + float z) + +
+          Draw a single character on screen (with a z coordinate)
+ voidtext(float num, + float x, + float y) + +
+          This does a basic number formatting, to avoid the + generally ugly appearance of printing floats.
+ voidtext(float num, + float x, + float y, + float z) + +
+           
+ voidtext(int num, + float x, + float y) + +
+           
+ voidtext(int num, + float x, + float y, + float z) + +
+           
+ voidtext(java.lang.String str) + +
+          Write text where we just left off.
+ voidtext(java.lang.String str, + float x, + float y) + +
+          Draw a chunk of text.
+ voidtext(java.lang.String str, + float x, + float y, + float z) + +
+          Same as above but with a z coordinate.
+ voidtext(java.lang.String str, + float x1, + float y1, + float x2, + float y2) + +
+          Draw text in a box that is constrained to a particular size.
+ voidtext(java.lang.String s, + float x1, + float y1, + float x2, + float y2, + float z) + +
+           
+ voidtextAlign(int align) + +
+          Sets the alignment of the text to one of LEFT, CENTER, or RIGHT.
+ voidtextAlign(int alignX, + int alignY) + +
+          Sets the horizontal and vertical alignment of the text.
+ floattextAscent() + +
+          Returns the ascent of the current font at the current size.
+ floattextDescent() + +
+          Returns the descent of the current font at the current size.
+ voidtextFont(PFont which) + +
+          Sets the current font.
+ voidtextFont(PFont which, + float size) + +
+          Useful function to set the font and size at the same time.
+ voidtextLeading(float leading) + +
+          Set the text leading to a specific value.
+ voidtextMode(int mode) + +
+          Sets the text rendering/placement to be either SCREEN (direct + to the screen, exact coordinates, only use the font's original size) + or MODEL (the default, where text is manipulated by translate() and + can have a textSize).
+ voidtextSize(float size) + +
+          Sets the text size, also resets the value for the leading.
+ voidtexture(PImage image) + +
+          Set texture image for current shape.
+ voidtextureMode(int mode) + +
+          Set texture mode to either to use coordinates based on the IMAGE + (more intuitive for new users) or NORMALIZED (better for advanced chaps)
+ floattextWidth(char c) + +
+           
+ floattextWidth(java.lang.String str) + +
+          Return the width of a line of text.
+ voidtint(float gray) + +
+           
+ voidtint(float gray, + float alpha) + +
+           
+ voidtint(float x, + float y, + float z) + +
+           
+ voidtint(float x, + float y, + float z, + float a) + +
+           
+ voidtint(int rgb) + +
+          Set the tint to either a grayscale or ARGB value.
+ voidtint(int rgb, + float alpha) + +
+           
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtranslate(float tx, + float ty, + float tz) + +
+          Translate in X, Y, and Z.
+ voidtriangle(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+ voidvertex(float[] v) + +
+          Used by renderer subclasses or PShape to efficiently pass in already + formatted vertex information.
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+pixelCount

+
+public int pixelCount
+
+
+
+
+
+ +

+smooth

+
+public boolean smooth
+
+
+
+
+
+ +

+colorMode

+
+public int colorMode
+
+
The current colorMode +

+

+
+
+
+ +

+colorModeX

+
+public float colorModeX
+
+
Max value for red (or hue) set by colorMode +

+

+
+
+
+ +

+colorModeY

+
+public float colorModeY
+
+
Max value for green (or saturation) set by colorMode +

+

+
+
+
+ +

+colorModeZ

+
+public float colorModeZ
+
+
Max value for blue (or value) set by colorMode +

+

+
+
+
+ +

+colorModeA

+
+public float colorModeA
+
+
Max value for alpha set by colorMode +

+

+
+
+
+ +

+tint

+
+public boolean tint
+
+
True if tint() is enabled (read-only). + + Using tint/tintColor seems a better option for naming than + tintEnabled/tint because the latter seems ugly, even though + g.tint as the actual color seems a little more intuitive, + it's just that g.tintEnabled is even more unintuitive. + Same goes for fill and stroke, et al. +

+

+
+
+
+ +

+tintColor

+
+public int tintColor
+
+
tint that was last set (read-only) +

+

+
+
+
+ +

+fill

+
+public boolean fill
+
+
true if fill() is enabled, (read-only) +

+

+
+
+
+ +

+fillColor

+
+public int fillColor
+
+
fill that was last set (read-only) +

+

+
+
+
+ +

+stroke

+
+public boolean stroke
+
+
true if stroke() is enabled, (read-only) +

+

+
+
+
+ +

+strokeColor

+
+public int strokeColor
+
+
stroke that was last set (read-only) +

+

+
+
+
+ +

+strokeWeight

+
+public float strokeWeight
+
+
Last value set by strokeWeight() (read-only). This has a default + setting, rather than fighting with renderers about whether that + renderer supports thick lines. +

+

+
+
+
+ +

+strokeJoin

+
+public int strokeJoin
+
+
Set by strokeJoin() (read-only). This has a default setting + so that strokeJoin() need not be called by defaults, + because subclasses may not implement it (i.e. PGraphicsGL) +

+

+
+
+
+ +

+strokeCap

+
+public int strokeCap
+
+
Set by strokeCap() (read-only). This has a default setting + so that strokeCap() need not be called by defaults, + because subclasses may not implement it (i.e. PGraphicsGL) +

+

+
+
+
+ +

+rectMode

+
+public int rectMode
+
+
The current rect mode (read-only) +

+

+
+
+
+ +

+ellipseMode

+
+public int ellipseMode
+
+
The current ellipse mode (read-only) +

+

+
+
+
+ +

+shapeMode

+
+public int shapeMode
+
+
The current shape alignment mode (read-only) +

+

+
+
+
+ +

+imageMode

+
+public int imageMode
+
+
The current image alignment (read-only) +

+

+
+
+
+ +

+textFont

+
+public PFont textFont
+
+
The current text font (read-only) +

+

+
+
+
+ +

+textAlign

+
+public int textAlign
+
+
The current text align (read-only) +

+

+
+
+
+ +

+textAlignY

+
+public int textAlignY
+
+
The current vertical text alignment (read-only) +

+

+
+
+
+ +

+textMode

+
+public int textMode
+
+
The current text mode (read-only) +

+

+
+
+
+ +

+textSize

+
+public float textSize
+
+
The current text size (read-only) +

+

+
+
+
+ +

+textLeading

+
+public float textLeading
+
+
The current text leading (read-only) +

+

+
+
+
+ +

+ambientR

+
+public float ambientR
+
+
+
+
+
+ +

+ambientG

+
+public float ambientG
+
+
+
+
+
+ +

+ambientB

+
+public float ambientB
+
+
+
+
+
+ +

+specularR

+
+public float specularR
+
+
+
+
+
+ +

+specularG

+
+public float specularG
+
+
+
+
+
+ +

+specularB

+
+public float specularB
+
+
+
+
+
+ +

+emissiveR

+
+public float emissiveR
+
+
+
+
+
+ +

+emissiveG

+
+public float emissiveG
+
+
+
+
+
+ +

+emissiveB

+
+public float emissiveB
+
+
+
+
+
+ +

+shininess

+
+public float shininess
+
+
+
+
+
+ +

+backgroundColor

+
+public int backgroundColor
+
+
Last background color that was set, zero if an image +

+

+
+
+
+ +

+image

+
+public java.awt.Image image
+
+
Java AWT Image object associated with this renderer. For P2D and P3D, + this will be associated with their MemoryImageSource. For PGraphicsJava2D, + it will be the offscreen drawing buffer. +

+

+
+
+
+ +

+bezierDetail

+
+public int bezierDetail
+
+
+
+
+
+ +

+curveTightness

+
+public float curveTightness
+
+
+
+
+
+ +

+edge

+
+public boolean edge
+
+
+
+
+
+ +

+normalX

+
+public float normalX
+
+
Current normal vector. +

+

+
+
+
+ +

+normalY

+
+public float normalY
+
+
Current normal vector. +

+

+
+
+
+ +

+normalZ

+
+public float normalZ
+
+
Current normal vector. +

+

+
+
+
+ +

+textureMode

+
+public int textureMode
+
+
Sets whether texture coordinates passed to + vertex() calls will be based on coordinates that are + based on the IMAGE or NORMALIZED. +

+

+
+
+
+ +

+textureU

+
+public float textureU
+
+
Current horizontal coordinate for texture, will always + be between 0 and 1, even if using textureMode(IMAGE). +

+

+
+
+
+ +

+textureV

+
+public float textureV
+
+
Current vertical coordinate for texture, see above. +

+

+
+
+
+ +

+textureImage

+
+public PImage textureImage
+
+
Current image being used as a texture +

+

+
+
+
+ +

+sphereDetailU

+
+public int sphereDetailU
+
+
+
+
+
+ +

+sphereDetailV

+
+public int sphereDetailV
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphics

+
+public PGraphics()
+
+
Constructor for the PGraphics object. Use this to ensure that + the defaults get set properly. In a subclass, use this(w, h) + as the first line of a subclass' constructor to properly set + the internal fields and defaults. +

+

+ + + + + + + + +
+Method Detail
+ +

+setParent

+
+public void setParent(PApplet parent)
+
+
+
+
+
+
+
+
+
+ +

+setPrimary

+
+public void setPrimary(boolean primary)
+
+
Set (or unset) this as the main drawing surface. Meaning that it can + safely be set to opaque (and given a default gray background), or anything + else that goes along with that. +

+

+
+
+
+
+
+
+
+ +

+setPath

+
+public void setPath(java.lang.String path)
+
+
+
+
+
+
+
+
+
+ +

+setSize

+
+public void setSize(int w,
+                    int h)
+
+
The final step in setting up a renderer, set its size of this renderer. + This was formerly handled by the constructor, but instead it's been broken + out so that setParent/setPrimary/setPath can be handled differently. + + Important that this is ignored by preproc.pl because otherwise it will + override setSize() in PApplet/Applet/Component, which will 1) not call + super.setSize(), and 2) will cause the renderer to be resized from the + event thread (EDT), causing a nasty crash as it collides with the + animation thread. +

+

+
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Handle any takedown for this graphics context. +

+ This is called when a sketch is shut down and this renderer was + specified using the size() command, or inside endRecord() and + endRaw(), in order to shut things off. +

+

+
+
+
+
+
+
+
+ +

+canDraw

+
+public boolean canDraw()
+
+
Some renderers have requirements re: when they are ready to draw. +

+

+
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
+
+
+
+
+
+
+ +

+flush

+
+public void flush()
+
+
+
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
Enable a hint option. +

+ For the most part, hints are temporary api quirks, + for which a proper api hasn't been properly worked out. + for instance SMOOTH_IMAGES existed because smooth() + wasn't yet implemented, but it will soon go away. +

+ They also exist for obscure features in the graphics + engine, like enabling/disabling single pixel lines + that ignore the zbuffer, the way they do in alphabot. +

+ Current hint options: +

    +
  • DISABLE_DEPTH_TEST - + turns off the z-buffer in the P3D or OPENGL renderers. +
+

+

+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape()
+
+
Start a new shape of type POLYGON +

+

+
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
+
+
+
+
+
+
+ +

+edge

+
+public void edge(boolean edge)
+
+
Sets whether the upcoming vertex is part of an edge. + Equivalent to glEdgeFlag(), for people familiar with OpenGL. +

+

+
+
+
+
+
+
+
+ +

+normal

+
+public void normal(float nx,
+                   float ny,
+                   float nz)
+
+
Sets the current normal vector. Only applies with 3D rendering + and inside a beginShape/endShape block. +

+ This is for drawing three dimensional shapes and surfaces, + allowing you to specify a vector perpendicular to the surface + of the shape, which determines how lighting affects it. +

+ For the most part, PGraphics3D will attempt to automatically + assign normals to shapes, but since that's imperfect, + this is a better option when you want more control. +

+ For people familiar with OpenGL, this function is basically + identical to glNormal3f(). +

+

+
+
+
+
+
+
+
+ +

+textureMode

+
+public void textureMode(int mode)
+
+
Set texture mode to either to use coordinates based on the IMAGE + (more intuitive for new users) or NORMALIZED (better for advanced chaps) +

+

+
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
Set texture image for current shape. + Needs to be called between @see beginShape and @see endShape +

+

+
+
+
+
Parameters:
image - reference to a PImage object
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float[] v)
+
+
Used by renderer subclasses or PShape to efficiently pass in already + formatted vertex information. +

+

+
+
+
+
Parameters:
v - vertex parameters, as a float array of length VERTEX_FIELD_COUNT
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
This feature is in testing, do not use or rely upon its implementation +

+

+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape()
+
+
+
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float x3,
+                         float y3,
+                         float x4,
+                         float y4)
+
+
+
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float z2,
+                         float x3,
+                         float y3,
+                         float z3,
+                         float x4,
+                         float y4,
+                         float z4)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y)
+
+
+
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y,
+                        float z)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float z1,
+                 float x2,
+                 float y2,
+                 float z2)
+
+
+
+
+
+
+
+
+
+ +

+triangle

+
+public void triangle(float x1,
+                     float y1,
+                     float x2,
+                     float y2,
+                     float x3,
+                     float y3)
+
+
+
+
+
+
+
+
+
+ +

+quad

+
+public void quad(float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float x3,
+                 float y3,
+                 float x4,
+                 float y4)
+
+
+
+
+
+
+
+
+
+ +

+rectMode

+
+public void rectMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+rect

+
+public void rect(float a,
+                 float b,
+                 float c,
+                 float d)
+
+
+
+
+
+
+
+
+
+ +

+ellipseMode

+
+public void ellipseMode(int mode)
+
+
+
+
+
+
+
+
+
+ +

+ellipse

+
+public void ellipse(float a,
+                    float b,
+                    float c,
+                    float d)
+
+
+
+
+
+
+
+
+
+ +

+arc

+
+public void arc(float a,
+                float b,
+                float c,
+                float d,
+                float start,
+                float stop)
+
+
Identical parameters and placement to ellipse, + but draws only an arc of that ellipse. +

+ start and stop are always radians because angleMode() was goofy. + ellipseMode() sets the placement. +

+ also tries to be smart about start < stop. +

+

+
+
+
+
+
+
+
+ +

+box

+
+public void box(float size)
+
+
+
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int res)
+
+
+
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int ures,
+                         int vres)
+
+
Set the detail level for approximating a sphere. The ures and vres params + control the horizontal and vertical resolution. + + Code for sphereDetail() submitted by toxi [031031]. + Code for enhanced u/v version from davbol [080801]. +

+

+
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
+
+
+
+
+
+
+ +

+bezierPoint

+
+public float bezierPoint(float a,
+                         float b,
+                         float c,
+                         float d,
+                         float t)
+
+
Evalutes quadratic bezier at point t for points a, b, c, d. + t varies between 0 and 1, and a and d are the on curve points, + b and c are the control points. this can be done once with the + x coordinates and a second time with the y coordinates to get + the location of a bezier curve at t. +

+ For instance, to convert the following example:

+ stroke(255, 102, 0);
+ line(85, 20, 10, 10);
+ line(90, 90, 15, 80);
+ stroke(0, 0, 0);
+ bezier(85, 20, 10, 10, 90, 90, 15, 80);
+
+ // draw it in gray, using 10 steps instead of the default 20
+ // this is a slower way to do it, but useful if you need
+ // to do things with the coordinates at each step
+ stroke(128);
+ beginShape(LINE_STRIP);
+ for (int i = 0; i <= 10; i++) {
+   float t = i / 10.0f;
+   float x = bezierPoint(85, 10, 90, 15, t);
+   float y = bezierPoint(20, 10, 90, 80, t);
+   vertex(x, y);
+ }
+ endShape();
+

+

+
+
+
+
+
+
+
+ +

+bezierTangent

+
+public float bezierTangent(float a,
+                           float b,
+                           float c,
+                           float d,
+                           float t)
+
+
Provide the tangent at the given point on the bezier curve. + Fix from davbol for 0136. +

+

+
+
+
+
+
+
+
+ +

+bezierDetail

+
+public void bezierDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float x2,
+                   float y2,
+                   float x3,
+                   float y3,
+                   float x4,
+                   float y4)
+
+
Draw a cubic bezier curve. The first and last points are + the on-curve points. The middle two are the 'control' points, + or 'handles' in an application like Illustrator. +

+ Identical to typing: +

beginShape();
+ vertex(x1, y1);
+ bezierVertex(x2, y2, x3, y3, x4, y4);
+ endShape();
+ 
+ In Postscript-speak, this would be: +
moveto(x1, y1);
+ curveto(x2, y2, x3, y3, x4, y4);
+ If you were to try and continue that curve like so: +
curveto(x5, y5, x6, y6, x7, y7);
+ This would be done in processing by adding these statements: +
bezierVertex(x5, y5, x6, y6, x7, y7)
+ 
+ To draw a quadratic (instead of cubic) curve, + use the control point twice by doubling it: +
bezier(x1, y1, cx, cy, cx, cy, x2, y2);
+

+

+
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float z1,
+                   float x2,
+                   float y2,
+                   float z2,
+                   float x3,
+                   float y3,
+                   float z3,
+                   float x4,
+                   float y4,
+                   float z4)
+
+
+
+
+
+
+
+
+
+ +

+curvePoint

+
+public float curvePoint(float a,
+                        float b,
+                        float c,
+                        float d,
+                        float t)
+
+
Get a location along a catmull-rom curve segment. +

+

+
+
+
+
Parameters:
t - Value between zero and one for how far along the segment
+
+
+
+ +

+curveTangent

+
+public float curveTangent(float a,
+                          float b,
+                          float c,
+                          float d,
+                          float t)
+
+
Calculate the tangent at a t value (0..1) on a Catmull-Rom curve. + Code thanks to Dave Bollinger (Bug #715) +

+

+
+
+
+
+
+
+
+ +

+curveDetail

+
+public void curveDetail(int detail)
+
+
+
+
+
+
+
+
+
+ +

+curveTightness

+
+public void curveTightness(float tightness)
+
+
+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float x2,
+                  float y2,
+                  float x3,
+                  float y3,
+                  float x4,
+                  float y4)
+
+
Draws a segment of Catmull-Rom curve. +

+ As of 0070, this function no longer doubles the first and + last points. The curves are a bit more boring, but it's more + mathematically correct, and properly mirrored in curvePoint(). +

+ Identical to typing out:

+ beginShape();
+ curveVertex(x1, y1);
+ curveVertex(x2, y2);
+ curveVertex(x3, y3);
+ curveVertex(x4, y4);
+ endShape();
+ 
+

+

+
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float z1,
+                  float x2,
+                  float y2,
+                  float z2,
+                  float x3,
+                  float y3,
+                  float z3,
+                  float x4,
+                  float y4,
+                  float z4)
+
+
+
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Disable smoothing. See smooth(). +

+

+
+
+
+
+
+
+
+ +

+imageMode

+
+public void imageMode(int mode)
+
+
The mode can only be set to CORNERS, CORNER, and CENTER. +

+ Support for CENTER was added in release 0146. +

+

+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+image

+
+public void image(PImage image,
+                  float a,
+                  float b,
+                  float c,
+                  float d,
+                  int u1,
+                  int v1,
+                  int u2,
+                  int v2)
+
+
Draw an image(), also specifying u/v coordinates. + In this method, the u, v coordinates are always based on image space + location, regardless of the current textureMode(). +

+

+
+
+
+
+
+
+
+ +

+shapeMode

+
+public void shapeMode(int mode)
+
+
Set the orientation for the shape() command (like imageMode() or rectMode()). +

+

+
+
+
+
Parameters:
mode - Either CORNER, CORNERS, or CENTER.
+
+
+
+ +

+shape

+
+public void shape(PShape shape)
+
+
+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y)
+
+
Convenience method to draw at a particular location. +

+

+
+
+
+
+
+
+
+ +

+shape

+
+public void shape(PShape shape,
+                  float x,
+                  float y,
+                  float c,
+                  float d)
+
+
+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int align)
+
+
Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. + This will also reset the vertical text alignment to BASELINE. +

+

+
+
+
+
+
+
+
+ +

+textAlign

+
+public void textAlign(int alignX,
+                      int alignY)
+
+
Sets the horizontal and vertical alignment of the text. The horizontal + alignment can be one of LEFT, CENTER, or RIGHT. The vertical alignment + can be TOP, BOTTOM, CENTER, or the BASELINE (the default). +

+

+
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
Returns the ascent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
Returns the descent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which)
+
+
Sets the current font. The font's size will be the "natural" + size of this font (the size that was set when using "Create Font"). + The leading will also be reset. +

+

+
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which,
+                     float size)
+
+
Useful function to set the font and size at the same time. +

+

+
+
+
+
+
+
+
+ +

+textLeading

+
+public void textLeading(float leading)
+
+
Set the text leading to a specific value. If using a custom + value for the text leading, you'll have to call textLeading() + again after any calls to textSize(). +

+

+
+
+
+
+
+
+
+ +

+textMode

+
+public void textMode(int mode)
+
+
Sets the text rendering/placement to be either SCREEN (direct + to the screen, exact coordinates, only use the font's original size) + or MODEL (the default, where text is manipulated by translate() and + can have a textSize). The text size cannot be set when using + textMode(SCREEN), because it uses the pixels directly from the font. +

+

+
+
+
+
+
+
+
+ +

+textSize

+
+public void textSize(float size)
+
+
Sets the text size, also resets the value for the leading. +

+

+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(char c)
+
+
+
+
+
+
+
+
+
+ +

+textWidth

+
+public float textWidth(java.lang.String str)
+
+
Return the width of a line of text. If the text has multiple + lines, this returns the length of the longest line. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c)
+
+
Write text where we just left off. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y)
+
+
Draw a single character on screen. + Extremely slow when used with textMode(SCREEN) and Java 2D, + because loadPixels has to be called first and updatePixels last. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char c,
+                 float x,
+                 float y,
+                 float z)
+
+
Draw a single character on screen (with a z coordinate) +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str)
+
+
Write text where we just left off. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y)
+
+
Draw a chunk of text. + Newlines that are \n (Unix newline or linefeed char, ascii 10) + are honored, but \r (carriage return, Windows and Mac OS) are + ignored. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y)
+
+
Method to draw text from an array of chars. This method will usually be + more efficient than drawing from a String object, because the String will + not be converted to a char array before drawing. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x,
+                 float y,
+                 float z)
+
+
Same as above but with a z coordinate. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(char[] chars,
+                 int start,
+                 int stop,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String str,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
Draw text in a box that is constrained to a particular size. + The current rectMode() determines what the coordinates mean + (whether x1/y1/x2/y2 or x/y/w/h). +

+ Note that the x,y coords of the start of the box + will align with the *ascent* of the text, not the baseline, + as is the case for the other text() functions. +

+ Newlines that are \n (Unix newline or linefeed char, ascii 10) + are honored, and \r (carriage return, Windows and Mac OS) are + ignored. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(java.lang.String s,
+                 float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(int num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y)
+
+
This does a basic number formatting, to avoid the + generally ugly appearance of printing floats. + Users who want more control should use their own nf() cmmand, + or if they want the long, ugly version of float, + use String.valueOf() to convert the float to a String first. +

+

+
+
+
+
+
+
+
+ +

+text

+
+public void text(float num,
+                 float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Push a copy of the current transformation matrix onto the stack. +

+

+
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Replace the current transformation matrix with the top of the stack. +

+

+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Translate in X and Y. +

+

+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
Translate in X, Y, and Z. +

+

+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Two dimensional rotation. + + Same as rotateZ (this is identical to a 3D rotation along the z-axis) + but included for clarity. It'd be weird for people drawing 2D graphics + to be using rotateZ. And they might kick our a-- for the confusion. + + Additional background. +

+

+
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Rotate around the X axis. +

+

+
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Rotate around the Y axis. +

+

+
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
Rotate about a vector in space. Same as the glRotatef() function. +

+

+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Scale in all dimensions. +

+

+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Scale in X and Y. Equivalent to scale(sx, sy, 1). + + Not recommended for use in 3D, because the z-dimension is just + scaled by 1, since there's no way to know what else to scale it by. +

+

+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
Scale in X, Y, and Z. +

+

+
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Set the current transformation matrix to identity. +

+

+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Apply a 3x2 affine transformation matrix. +

+

+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Apply a 4x4 transformation matrix. +

+

+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix2D getMatrix(PMatrix2D target)
+
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix source)
+
+
Set the current transformation matrix to the contents of another. +

+

+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
Set the current transformation to the contents of the specified source. +

+

+
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
Set the current transformation to the contents of the specified source. +

+

+
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Print the current model (or "transformation") matrix. +

+

+
+
+
+
+
+
+
+ +

+beginCamera

+
+public void beginCamera()
+
+
+
+
+
+
+
+
+
+ +

+endCamera

+
+public void endCamera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera()
+
+
+
+
+
+
+
+
+
+ +

+camera

+
+public void camera(float eyeX,
+                   float eyeY,
+                   float eyeZ,
+                   float centerX,
+                   float centerY,
+                   float centerZ,
+                   float upX,
+                   float upY,
+                   float upZ)
+
+
+
+
+
+
+
+
+
+ +

+printCamera

+
+public void printCamera()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho()
+
+
+
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho(float left,
+                  float right,
+                  float bottom,
+                  float top,
+                  float near,
+                  float far)
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective()
+
+
+
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective(float fovy,
+                        float aspect,
+                        float zNear,
+                        float zFar)
+
+
+
+
+
+
+
+
+
+ +

+frustum

+
+public void frustum(float left,
+                    float right,
+                    float bottom,
+                    float top,
+                    float near,
+                    float far)
+
+
+
+
+
+
+
+
+
+ +

+printProjection

+
+public void printProjection()
+
+
+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns its z value. + This value can be used to determine if an (x, y, z) coordinate + is in front or in back of another (x, y, z) coordinate. + The units are based on how the zbuffer is set up, and don't + relate to anything "real". They're only useful for in + comparison to another value obtained from screenZ(), + or directly out of the zbuffer[]. +

+

+
+
+
+
+
+
+
+ +

+modelX

+
+public float modelX(float x,
+                    float y,
+                    float z)
+
+
Returns the model space x value for an x, y, z coordinate. +

+ This will give you a coordinate after it has been transformed + by translate(), rotate(), and camera(), but not yet transformed + by the projection matrix. For instance, his can be useful for + figuring out how points in 3D space relate to the edge + coordinates of a shape. +

+

+
+
+
+
+
+
+
+ +

+modelY

+
+public float modelY(float x,
+                    float y,
+                    float z)
+
+
Returns the model space y value for an x, y, z coordinate. +

+

+
+
+
+
+
+
+
+ +

+modelZ

+
+public float modelZ(float x,
+                    float y,
+                    float z)
+
+
Returns the model space z value for an x, y, z coordinate. +

+

+
+
+
+
+
+
+
+ +

+pushStyle

+
+public void pushStyle()
+
+
+
+
+
+
+
+
+
+ +

+popStyle

+
+public void popStyle()
+
+
+
+
+
+
+
+
+
+ +

+style

+
+public void style(PStyle s)
+
+
+
+
+
+
+
+
+
+ +

+getStyle

+
+public PStyle getStyle()
+
+
+
+
+
+
+
+
+
+ +

+getStyle

+
+public PStyle getStyle(PStyle s)
+
+
+
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
+
+
+
+
+
+
+ +

+noStroke

+
+public void noStroke()
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb)
+
+
Set the tint to either a grayscale or ARGB value. + See notes attached to the fill() function. +

+

+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(int rgb,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float gray,
+                   float alpha)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+stroke

+
+public void stroke(float x,
+                   float y,
+                   float z,
+                   float a)
+
+
+
+
+
+
+
+
+
+ +

+noTint

+
+public void noTint()
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb)
+
+
Set the tint to either a grayscale or ARGB value. +

+

+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+tint

+
+public void tint(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+noFill

+
+public void noFill()
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb)
+
+
Set the fill to either a grayscale value or an ARGB int. +

+

+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(int rgb,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float gray,
+                 float alpha)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+
+
+
+ +

+fill

+
+public void fill(float x,
+                 float y,
+                 float z,
+                 float a)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float gray)
+
+
+
+
+
+
+
+
+
+ +

+ambient

+
+public void ambient(float x,
+                    float y,
+                    float z)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float gray)
+
+
+
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float shine)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(int rgb)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float gray)
+
+
+
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float x,
+                     float y,
+                     float z)
+
+
+
+
+
+
+
+
+
+ +

+lights

+
+public void lights()
+
+
+
+
+
+
+
+
+
+ +

+noLights

+
+public void noLights()
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue)
+
+
+
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float red,
+                         float green,
+                         float blue,
+                         float x,
+                         float y,
+                         float z)
+
+
+
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float red,
+                             float green,
+                             float blue,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float red,
+                       float green,
+                       float blue,
+                       float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float red,
+                      float green,
+                      float blue,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
+
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb)
+
+
Set the background to a gray or ARGB color. +

+ For the main drawing surface, the alpha value will be ignored. However, + alpha can be used on PGraphics objects from createGraphics(). This is + the only way to set all the pixels partially transparent, for instance. +

+ Note that background() should be called before any transformations occur, + because some implementations may require the current transformation matrix + to be identity before drawing. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(int rgb,
+                       float alpha)
+
+
See notes about alpha in background(x, y, z, a). +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray)
+
+
Set the background to a grayscale value, based on the + current colorMode. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float gray,
+                       float alpha)
+
+
See notes about alpha in background(x, y, z, a). +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z)
+
+
Set the background to an r, g, b or h, s, b value, + based on the current colorMode. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
Clear the background with a color that includes an alpha value. This can + only be used with objects created by createGraphics(), because the main + drawing surface cannot be set transparent. +

+ It might be tempting to use this function to partially clear the screen + on each frame, however that's not how this function works. When calling + background(), the pixels will be replaced with pixels that have that level + of transparency. To do a semi-transparent overlay, use fill() with alpha + and draw a rectangle. +

+

+
+
+
+
+
+
+
+ +

+background

+
+public void background(PImage image)
+
+
Takes an RGB or ARGB image and sets it as the background. + The width and height of the image must be the same size as the sketch. + Use image.resize(width, height) to make short work of such a task. +

+ Note that even if the image is set as RGB, the high 8 bits of each pixel + should be set opaque (0xFF000000), because the image data will be copied + directly to the screen, and non-opaque background images may have strange + behavior. Using image.filter(OPAQUE) will handle this easily. +

+ When using 3D, this will also clear the zbuffer (if it exists). +

+

+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode)
+
+
Callback to handle clearing the background when begin/endRaw is in use. + Handled as separate function for OpenGL (or other) subclasses that + override backgroundImpl() but still needs this to work properly. +

+

+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float max)
+
+
+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ)
+
+
Set the colorMode and the maximum values for (r, g, b) + or (h, s, b). +

+ Note that this doesn't set the maximum for the alpha value, + which might be confusing if for instance you switched to +

colorMode(HSB, 360, 100, 100);
+ because the alpha values were still between 0 and 255. +

+

+
+
+
+
+
+
+
+ +

+colorMode

+
+public void colorMode(int mode,
+                      float maxX,
+                      float maxY,
+                      float maxZ,
+                      float maxA)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float gray)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int gray,
+                       int alpha)
+
+
+
+
+
+
Parameters:
gray - can be packed ARGB or a gray in this case
+
+
+
+ +

+color

+
+public final int color(int rgb,
+                       float alpha)
+
+
+
+
+
+
Parameters:
rgb - can be packed ARGB or a gray in this case
+
+
+
+ +

+color

+
+public final int color(float gray,
+                       float alpha)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(int x,
+                       int y,
+                       int z,
+                       int a)
+
+
+
+
+
+
+
+
+
+ +

+color

+
+public final int color(float x,
+                       float y,
+                       float z,
+                       float a)
+
+
+
+
+
+
+
+
+
+ +

+alpha

+
+public final float alpha(int what)
+
+
+
+
+
+
+
+
+
+ +

+red

+
+public final float red(int what)
+
+
+
+
+
+
+
+
+
+ +

+green

+
+public final float green(int what)
+
+
+
+
+
+
+
+
+
+ +

+blue

+
+public final float blue(int what)
+
+
+
+
+
+
+
+
+
+ +

+hue

+
+public final float hue(int what)
+
+
+
+
+
+
+
+
+
+ +

+saturation

+
+public final float saturation(int what)
+
+
+
+
+
+
+
+
+
+ +

+brightness

+
+public final float brightness(int what)
+
+
+
+
+
+
+
+
+
+ +

+lerpColor

+
+public int lerpColor(int c1,
+                     int c2,
+                     float amt)
+
+
Interpolate between two colors, using the current color mode. +

+

+
+
+
+
+
+
+
+ +

+lerpColor

+
+public static int lerpColor(int c1,
+                            int c2,
+                            float amt,
+                            int mode)
+
+
Interpolate between two colors. Like lerp(), but for the + individual color components of a color supplied as an int value. +

+

+
+
+
+
+
+
+
+ +

+beginRaw

+
+public void beginRaw(PGraphics rawGraphics)
+
+
Record individual lines and triangles by echoing them to another renderer. +

+

+
+
+
+
+
+
+
+ +

+endRaw

+
+public void endRaw()
+
+
+
+
+
+
+
+
+
+ +

+showWarning

+
+public static void showWarning(java.lang.String msg)
+
+
Show a renderer error, and keep track of it so that it's only shown once. +

+

+
+
+
+
Parameters:
msg - the error message (which will be stored for later comparison)
+
+
+
+ +

+showException

+
+public static void showException(java.lang.String msg)
+
+
Show an renderer-related exception that halts the program. Currently just + wraps the message as a RuntimeException and throws it, but might do + something more specific might be used in the future. +

+

+
+
+
+
+
+
+
+ +

+displayable

+
+public boolean displayable()
+
+
Return true if this renderer should be drawn to the screen. Defaults to + returning true, since nearly all renderers are on-screen beasts. But can + be overridden for subclasses like PDF so that a window doesn't open up. +

+ A better name? showFrame, displayable, isVisible, visible, shouldDisplay, + what to call this? +

+

+
+
+
+
+
+
+
+ +

+is2D

+
+public boolean is2D()
+
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
+
+
+
+
+
+
+ +

+is3D

+
+public boolean is3D()
+
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PGraphics2D.html b/build/javadoc/everything/processing/core/PGraphics2D.html new file mode 100644 index 000000000..53f1c90ce --- /dev/null +++ b/build/javadoc/everything/processing/core/PGraphics2D.html @@ -0,0 +1,1312 @@ + + + + + +PGraphics2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphics2D

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphics2D
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class PGraphics2D
extends PGraphics
+ + +

+Subclass of PGraphics that handles fast 2D rendering using a + MemoryImageSource. The renderer found in this class is not as accurate as + PGraphicsJava2D, but offers certain speed tradeoffs, particular when + messing with the pixels array, or displaying image or video data. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphics2D() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbezier(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbox(float size) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+          This feature is in testing, do not use or rely upon its implementation
+ booleancanDraw() + +
+          Some renderers have requirements re: when they are ready to draw.
+ voidcurve(float x1, + float y1, + float z1, + float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidendShape(int mode) + +
+           
+ voidpoint(float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidresetMatrix() + +
+          Load identity as the transform/model matrix.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+          Rotate about a vector in space.
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ voidscale(float s) + +
+          Scale in all dimensions.
+ voidscale(float sx, + float sy) + +
+          Scale in X and Y.
+ voidscale(float x, + float y, + float z) + +
+          Scale in X, Y, and Z.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidsphereDetail(int res) + +
+           
+ voidsphereDetail(int ures, + int vres) + +
+          Set the detail level for approximating a sphere.
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtranslate(float tx, + float ty, + float tz) + +
+          Translate in X, Y, and Z.
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, background, background, background, background, background, background, background, beginCamera, beginRaw, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, brightness, camera, camera, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endRaw, endShape, fill, fill, fill, fill, fill, fill, flush, frustum, getMatrix, getMatrix, getMatrix, getStyle, getStyle, green, hint, hue, image, image, image, imageMode, is2D, is3D, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, modelX, modelY, modelZ, noFill, noLights, normal, noSmooth, noStroke, noTint, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, quad, rect, rectMode, red, saturation, screenX, screenY, screenZ, setMatrix, setMatrix, setMatrix, setParent, setPath, setPrimary, setSize, shape, shape, shape, shapeMode, shininess, showException, showWarning, smooth, specular, specular, specular, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PGraphics2D

+
+public PGraphics2D()
+
+
+ + + + + + + + +
+Method Detail
+ +

+canDraw

+
+public boolean canDraw()
+
+
Description copied from class: PGraphics
+
Some renderers have requirements re: when they are ready to draw. +

+

+
Overrides:
canDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
Overrides:
endDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
Description copied from class: PGraphics
+
This feature is in testing, do not use or rely upon its implementation +

+

+
Overrides:
breakShape in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y,
+                  float z)
+
+
+
Overrides:
point in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float size)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int res)
+
+
+
Overrides:
sphereDetail in class PGraphics
+
+
+
+
+
+
+ +

+sphereDetail

+
+public void sphereDetail(int ures,
+                         int vres)
+
+
Description copied from class: PGraphics
+
Set the detail level for approximating a sphere. The ures and vres params + control the horizontal and vertical resolution. + + Code for sphereDetail() submitted by toxi [031031]. + Code for enhanced u/v version from davbol [080801]. +

+

+
Overrides:
sphereDetail in class PGraphics
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Description copied from class: PGraphics
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
Overrides:
sphere in class PGraphics
+
+
+
+
+
+
+ +

+bezier

+
+public void bezier(float x1,
+                   float y1,
+                   float z1,
+                   float x2,
+                   float y2,
+                   float z2,
+                   float x3,
+                   float y3,
+                   float z3,
+                   float x4,
+                   float y4,
+                   float z4)
+
+
+
Overrides:
bezier in class PGraphics
+
+
+
+
+
+
+ +

+curve

+
+public void curve(float x1,
+                  float y1,
+                  float z1,
+                  float x2,
+                  float y2,
+                  float z2,
+                  float x3,
+                  float y3,
+                  float z3,
+                  float x4,
+                  float y4,
+                  float z4)
+
+
+
Overrides:
curve in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Description copied from class: PGraphics
+
Translate in X and Y. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
Description copied from class: PGraphics
+
Translate in X, Y, and Z. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Description copied from class: PGraphics
+
Two dimensional rotation. + + Same as rotateZ (this is identical to a 3D rotation along the z-axis) + but included for clarity. It'd be weird for people drawing 2D graphics + to be using rotateZ. And they might kick our a-- for the confusion. + + Additional background. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the X axis. +

+

+
Overrides:
rotateX in class PGraphics
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Y axis. +

+

+
Overrides:
rotateY in class PGraphics
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
Overrides:
rotateZ in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
Description copied from class: PGraphics
+
Rotate about a vector in space. Same as the glRotatef() function. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Description copied from class: PGraphics
+
Scale in all dimensions. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Description copied from class: PGraphics
+
Scale in X and Y. Equivalent to scale(sx, sy, 1). + + Not recommended for use in 3D, because the z-dimension is just + scaled by 1, since there's no way to know what else to scale it by. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
Description copied from class: PGraphics
+
Scale in X, Y, and Z. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Description copied from class: PGraphics
+
Push a copy of the current transformation matrix onto the stack. +

+

+
Overrides:
pushMatrix in class PGraphics
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Description copied from class: PGraphics
+
Replace the current transformation matrix with the top of the stack. +

+

+
Overrides:
popMatrix in class PGraphics
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Load identity as the transform/model matrix. + Same as glLoadIdentity(). +

+

+
Overrides:
resetMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Apply a 3x2 affine transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Description copied from class: PGraphics
+
Apply a 4x4 transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Print the current model (or "transformation") matrix. +

+

+
Overrides:
printMatrix in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PGraphics3D.html b/build/javadoc/everything/processing/core/PGraphics3D.html new file mode 100644 index 000000000..420148956 --- /dev/null +++ b/build/javadoc/everything/processing/core/PGraphics3D.html @@ -0,0 +1,3325 @@ + + + + + +PGraphics3D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphics3D

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphics3D
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
Direct Known Subclasses:
PGraphicsOpenGL, RawDXF
+
+
+
+
public class PGraphics3D
extends PGraphics
+ + +

+Subclass of PGraphics that handles 3D rendering. + It can render 3D inside a browser window and requires no plug-ins. +

+ The renderer is mostly set up based on the structure of the OpenGL API, + if you have questions about specifics that aren't covered here, + look for reference on the OpenGL implementation of a similar feature. +

+ Lighting and camera implementation by Simon Greenwold. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ PMatrix3Dcamera + +
+          The camera matrix, the modelview will be set to this on beginDraw.
+ floatcameraAspect + +
+          Aspect ratio of camera's view.
+ floatcameraFar + +
+           
+ floatcameraFOV + +
+          Camera field of view.
+ floatcameraNear + +
+           
+ floatcameraX + +
+          Position of the camera.
+ floatcameraY + +
+          Position of the camera.
+ floatcameraZ + +
+          Position of the camera.
+ floatcurrentLightFalloffConstant + +
+          Current light falloff
+ floatcurrentLightFalloffLinear + +
+           
+ floatcurrentLightFalloffQuadratic + +
+           
+ float[]currentLightSpecular + +
+          Current specular color for lighting
+ intlightCount + +
+           
+ float[][]lightDiffuse + +
+          Diffuse colors for lights.
+ float[]lightFalloffConstant + +
+          Light falloff
+ float[]lightFalloffLinear + +
+           
+ float[]lightFalloffQuadratic + +
+           
+ PVector[]lightNormal + +
+          Light direction (normalized vector)
+ PVector[]lightPosition + +
+          Light positions
+ float[][]lightSpecular + +
+          Specular colors for lights.
+ float[]lightSpotAngle + +
+          Light spot angle
+ float[]lightSpotAngleCos + +
+          Cosine of light spot angle
+ float[]lightSpotConcentration + +
+          Light spot concentration
+ int[]lightType + +
+          Light types
+ PLineline + +
+           
+static intMAX_LIGHTS + +
+          Maximum lights by default is 8, which is arbitrary for this renderer, + but is the minimum defined by OpenGL
+ PMatrix3Dmodelview + +
+          The modelview matrix.
+ PMatrix3DmodelviewInv + +
+          Inverse modelview matrix, used for lighting.
+ PMatrix3Dprojection + +
+          Current projection matrix.
+ PSmoothTrianglesmoothTriangle + +
+          Used for anti-aliased and perspective corrected rendering.
+static intTRI_COLOR_COUNT + +
+           
+static intTRI_DIFFUSE_A + +
+           
+static intTRI_DIFFUSE_B + +
+           
+static intTRI_DIFFUSE_G + +
+           
+static intTRI_DIFFUSE_R + +
+           
+static intTRI_SPECULAR_B + +
+           
+static intTRI_SPECULAR_G + +
+           
+static intTRI_SPECULAR_R + +
+           
+ PTriangletriangle + +
+           
+ float[]zbuffer + +
+          The depth buffer.
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphics3D() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidambientLight(float r, + float g, + float b) + +
+          Add an ambient light based on the current color mode.
+ voidambientLight(float r, + float g, + float b, + float x, + float y, + float z) + +
+          Add an ambient light based on the current color mode.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voidapplyMatrix(PMatrix3D source) + +
+           
+ voidbeginCamera() + +
+          Set matrix mode to the camera matrix (instead of the current + transformation matrix).
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbox(float w, + float h, + float d) + +
+           
+ voidcamera() + +
+          Set camera to the default settings.
+ voidcamera(float eyeX, + float eyeY, + float eyeZ, + float centerX, + float centerY, + float centerZ, + float upX, + float upY, + float upZ) + +
+          More flexible method for dealing with camera().
+ voiddirectionalLight(float r, + float g, + float b, + float nx, + float ny, + float nz) + +
+           
+ voidendCamera() + +
+          Record the current settings into the camera matrix, and set + the matrix mode back to the current transformation matrix.
+ voidendDraw() + +
+          See notes in PGraphics.
+ voidendShape(int mode) + +
+           
+ voidflush() + +
+          Emit any sorted geometry that's been collected on this frame.
+ voidfrustum(float left, + float right, + float bottom, + float top, + float znear, + float zfar) + +
+          Same as glFrustum(), except that it wipes out (rather than + multiplies against) the current perspective matrix.
+ PMatrixgetMatrix() + +
+           
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+          Copy the current transformation matrix into the specified target.
+ voidhint(int which) + +
+          Enable a hint option.
+ booleanis2D() + +
+          Return true if this renderer supports 2D drawing.
+ booleanis3D() + +
+          Return true if this renderer supports 2D drawing.
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+          Set the light falloff rates for the last light that was created.
+ voidlights() + +
+          Sets up an ambient and directional light.
+ voidlightSpecular(float x, + float y, + float z) + +
+          Set the specular color of the last light created.
+ floatmodelX(float x, + float y, + float z) + +
+          Returns the model space x value for an x, y, z coordinate.
+ floatmodelY(float x, + float y, + float z) + +
+          Returns the model space y value for an x, y, z coordinate.
+ floatmodelZ(float x, + float y, + float z) + +
+          Returns the model space z value for an x, y, z coordinate.
+ voidnoLights() + +
+          Turn off all lights.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidortho() + +
+          Calls ortho() with the proper parameters for Processing's + standard orthographic projection.
+ voidortho(float left, + float right, + float bottom, + float top, + float near, + float far) + +
+          Similar to gluOrtho(), but wipes out the current projection matrix.
+ voidperspective() + +
+          Calls perspective() with Processing's standard coordinate projection.
+ voidperspective(float fov, + float aspect, + float zNear, + float zFar) + +
+          Similar to gluPerspective().
+ voidpointLight(float r, + float g, + float b, + float x, + float y, + float z) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidprintCamera() + +
+          Print the current camera matrix.
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidprintProjection() + +
+          Print the current projection matrix.
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidresetMatrix() + +
+          Set the current transformation matrix to identity.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+          Rotate around an arbitrary vector, similar to glRotate(), + except that it takes radians (instead of degrees).
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ voidscale(float s) + +
+          Same as scale(s, s, s).
+ voidscale(float sx, + float sy) + +
+          Same as scale(sx, sy, 1).
+ voidscale(float x, + float y, + float z) + +
+          Scale in three dimensions.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenX(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenZ(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ voidsetMatrix(PMatrix2D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetMatrix(PMatrix3D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetSize(int iwidth, + int iheight) + +
+          Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size.
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidspotLight(float r, + float g, + float b, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidtexture(PImage image) + +
+          Set texture image for current shape.
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtranslate(float tx, + float ty, + float tz) + +
+          Translate in X, Y, and Z.
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, applyMatrix, arc, background, background, background, background, background, background, background, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, box, breakShape, brightness, canDraw, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getStyle, getStyle, green, hue, image, image, image, imageMode, lerpColor, lerpColor, line, line, noFill, normal, noStroke, noTint, point, point, popStyle, pushStyle, quad, rect, rectMode, red, saturation, setMatrix, setParent, setPath, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, stroke, stroke, stroke, stroke, stroke, stroke, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+zbuffer

+
+public float[] zbuffer
+
+
The depth buffer. +

+

+
+
+
+ +

+modelview

+
+public PMatrix3D modelview
+
+
The modelview matrix. +

+

+
+
+
+ +

+modelviewInv

+
+public PMatrix3D modelviewInv
+
+
Inverse modelview matrix, used for lighting. +

+

+
+
+
+ +

+camera

+
+public PMatrix3D camera
+
+
The camera matrix, the modelview will be set to this on beginDraw. +

+

+
+
+
+ +

+cameraFOV

+
+public float cameraFOV
+
+
Camera field of view. +

+

+
+
+
+ +

+cameraX

+
+public float cameraX
+
+
Position of the camera. +

+

+
+
+
+ +

+cameraY

+
+public float cameraY
+
+
Position of the camera. +

+

+
+
+
+ +

+cameraZ

+
+public float cameraZ
+
+
Position of the camera. +

+

+
+
+
+ +

+cameraNear

+
+public float cameraNear
+
+
+
+
+
+ +

+cameraFar

+
+public float cameraFar
+
+
+
+
+
+ +

+cameraAspect

+
+public float cameraAspect
+
+
Aspect ratio of camera's view. +

+

+
+
+
+ +

+projection

+
+public PMatrix3D projection
+
+
Current projection matrix. +

+

+
+
+
+ +

+MAX_LIGHTS

+
+public static final int MAX_LIGHTS
+
+
Maximum lights by default is 8, which is arbitrary for this renderer, + but is the minimum defined by OpenGL +

+

+
See Also:
Constant Field Values
+
+
+ +

+lightCount

+
+public int lightCount
+
+
+
+
+
+ +

+lightType

+
+public int[] lightType
+
+
Light types +

+

+
+
+
+ +

+lightPosition

+
+public PVector[] lightPosition
+
+
Light positions +

+

+
+
+
+ +

+lightNormal

+
+public PVector[] lightNormal
+
+
Light direction (normalized vector) +

+

+
+
+
+ +

+lightFalloffConstant

+
+public float[] lightFalloffConstant
+
+
Light falloff +

+

+
+
+
+ +

+lightFalloffLinear

+
+public float[] lightFalloffLinear
+
+
+
+
+
+ +

+lightFalloffQuadratic

+
+public float[] lightFalloffQuadratic
+
+
+
+
+
+ +

+lightSpotAngle

+
+public float[] lightSpotAngle
+
+
Light spot angle +

+

+
+
+
+ +

+lightSpotAngleCos

+
+public float[] lightSpotAngleCos
+
+
Cosine of light spot angle +

+

+
+
+
+ +

+lightSpotConcentration

+
+public float[] lightSpotConcentration
+
+
Light spot concentration +

+

+
+
+
+ +

+lightDiffuse

+
+public float[][] lightDiffuse
+
+
Diffuse colors for lights. + For an ambient light, this will hold the ambient color. + Internally these are stored as numbers between 0 and 1. +

+

+
+
+
+ +

+lightSpecular

+
+public float[][] lightSpecular
+
+
Specular colors for lights. + Internally these are stored as numbers between 0 and 1. +

+

+
+
+
+ +

+currentLightSpecular

+
+public float[] currentLightSpecular
+
+
Current specular color for lighting +

+

+
+
+
+ +

+currentLightFalloffConstant

+
+public float currentLightFalloffConstant
+
+
Current light falloff +

+

+
+
+
+ +

+currentLightFalloffLinear

+
+public float currentLightFalloffLinear
+
+
+
+
+
+ +

+currentLightFalloffQuadratic

+
+public float currentLightFalloffQuadratic
+
+
+
+
+
+ +

+TRI_DIFFUSE_R

+
+public static final int TRI_DIFFUSE_R
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_DIFFUSE_G

+
+public static final int TRI_DIFFUSE_G
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_DIFFUSE_B

+
+public static final int TRI_DIFFUSE_B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_DIFFUSE_A

+
+public static final int TRI_DIFFUSE_A
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_SPECULAR_R

+
+public static final int TRI_SPECULAR_R
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_SPECULAR_G

+
+public static final int TRI_SPECULAR_G
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_SPECULAR_B

+
+public static final int TRI_SPECULAR_B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRI_COLOR_COUNT

+
+public static final int TRI_COLOR_COUNT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+smoothTriangle

+
+public PSmoothTriangle smoothTriangle
+
+
Used for anti-aliased and perspective corrected rendering. +

+

+
+
+
+ +

+line

+
+public PLine line
+
+
+
+
+
+ +

+triangle

+
+public PTriangle triangle
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphics3D

+
+public PGraphics3D()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setSize

+
+public void setSize(int iwidth,
+                    int iheight)
+
+
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. + + Note that this will nuke any cameraMode() settings. +

+

+
Overrides:
setSize in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
See notes in PGraphics. + If z-sorting has been turned on, then the triangles will + all be quicksorted here (to make alpha work more properly) + and then blit to the screen. +

+

+
Overrides:
endDraw in class PGraphics
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
Description copied from class: PGraphics
+
Enable a hint option. +

+ For the most part, hints are temporary api quirks, + for which a proper api hasn't been properly worked out. + for instance SMOOTH_IMAGES existed because smooth() + wasn't yet implemented, but it will soon go away. +

+ They also exist for obscure features in the graphics + engine, like enabling/disabling single pixel lines + that ignore the zbuffer, the way they do in alphabot. +

+ Current hint options: +

    +
  • DISABLE_DEPTH_TEST - + turns off the z-buffer in the P3D or OPENGL renderers. +
+

+

+
Overrides:
hint in class PGraphics
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
Description copied from class: PGraphics
+
Set texture image for current shape. + Needs to be called between @see beginShape and @see endShape +

+

+
Overrides:
texture in class PGraphics
+
+
+
Parameters:
image - reference to a PImage object
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics
+
+
+
+
+
+
+ +

+flush

+
+public void flush()
+
+
Emit any sorted geometry that's been collected on this frame. +

+

+
Overrides:
flush in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Description copied from class: PGraphics
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
Overrides:
sphere in class PGraphics
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
Description copied from class: PGraphics
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
Overrides:
smooth in class PGraphics
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Description copied from class: PGraphics
+
Disable smoothing. See smooth(). +

+

+
Overrides:
noSmooth in class PGraphics
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Description copied from class: PGraphics
+
Push a copy of the current transformation matrix onto the stack. +

+

+
Overrides:
pushMatrix in class PGraphics
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Description copied from class: PGraphics
+
Replace the current transformation matrix with the top of the stack. +

+

+
Overrides:
popMatrix in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Description copied from class: PGraphics
+
Translate in X and Y. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
Description copied from class: PGraphics
+
Translate in X, Y, and Z. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Two dimensional rotation. Same as rotateZ (this is identical + to a 3D rotation along the z-axis) but included for clarity -- + it'd be weird for people drawing 2D graphics to be using rotateZ. + And they might kick our a-- for the confusion. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the X axis. +

+

+
Overrides:
rotateX in class PGraphics
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Y axis. +

+

+
Overrides:
rotateY in class PGraphics
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
Overrides:
rotateZ in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
Rotate around an arbitrary vector, similar to glRotate(), + except that it takes radians (instead of degrees). +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Same as scale(s, s, s). +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Same as scale(sx, sy, 1). +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
Scale in three dimensions. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Description copied from class: PGraphics
+
Set the current transformation matrix to identity. +

+

+
Overrides:
resetMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Description copied from class: PGraphics
+
Apply a 3x2 affine transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix3D source)
+
+
+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Apply a 4x4 transformation matrix. Same as glMultMatrix(). + This call will be slow because it will try to calculate the + inverse of the transform. So avoid it whenever possible. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
Description copied from class: PGraphics
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
Description copied from class: PGraphics
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Print the current model (or "transformation") matrix. +

+

+
Overrides:
printMatrix in class PGraphics
+
+
+
+
+
+
+ +

+beginCamera

+
+public void beginCamera()
+
+
Set matrix mode to the camera matrix (instead of the current + transformation matrix). This means applyMatrix, resetMatrix, etc. + will affect the camera. +

+ Note that the camera matrix is *not* the perspective matrix, + it is in front of the modelview matrix (hence the name "model" + and "view" for that matrix). +

+ beginCamera() specifies that all coordinate transforms until endCamera() + should be pre-applied in inverse to the camera transform matrix. + Note that this is only challenging when a user specifies an arbitrary + matrix with applyMatrix(). Then that matrix will need to be inverted, + which may not be possible. But take heart, if a user is applying a + non-invertible matrix to the camera transform, then he is clearly + up to no good, and we can wash our hands of those bad intentions. +

+ begin/endCamera clauses do not automatically reset the camera transform + matrix. That's because we set up a nice default camera transform int + setup(), and we expect it to hold through draw(). So we don't reset + the camera transform matrix at the top of draw(). That means that an + innocuous-looking clause like +

+ beginCamera();
+ translate(0, 0, 10);
+ endCamera();
+ 
+ at the top of draw(), will result in a runaway camera that shoots + infinitely out of the screen over time. In order to prevent this, + it is necessary to call some function that does a hard reset of the + camera transform matrix inside of begin/endCamera. Two options are +
+ camera(); // sets up the nice default camera transform
+ resetMatrix(); // sets up the identity camera transform
+ 
+ So to rotate a camera a constant amount, you might try +
+ beginCamera();
+ camera();
+ rotateY(PI/8);
+ endCamera();
+ 
+

+

+
Overrides:
beginCamera in class PGraphics
+
+
+
+
+
+
+ +

+endCamera

+
+public void endCamera()
+
+
Record the current settings into the camera matrix, and set + the matrix mode back to the current transformation matrix. +

+ Note that this will destroy any settings to scale(), translate(), + or whatever, because the final camera matrix will be copied + (not multiplied) into the modelview. +

+

+
Overrides:
endCamera in class PGraphics
+
+
+
+
+
+
+ +

+camera

+
+public void camera()
+
+
Set camera to the default settings. +

+ Processing camera behavior: +

+ Camera behavior can be split into two separate components, camera + transformation, and projection. The transformation corresponds to the + physical location, orientation, and scale of the camera. In a physical + camera metaphor, this is what can manipulated by handling the camera + body (with the exception of scale, which doesn't really have a physcial + analog). The projection corresponds to what can be changed by + manipulating the lens. +

+ We maintain separate matrices to represent the camera transform and + projection. An important distinction between the two is that the camera + transform should be invertible, where the projection matrix should not, + since it serves to map three dimensions to two. It is possible to bake + the two matrices into a single one just by multiplying them together, + but it isn't a good idea, since lighting, z-ordering, and z-buffering + all demand a true camera z coordinate after modelview and camera + transforms have been applied but before projection. If the camera + transform and projection are combined there is no way to recover a + good camera-space z-coordinate from a model coordinate. +

+ Fortunately, there are no functions that manipulate both camera + transformation and projection. +

+ camera() sets the camera position, orientation, and center of the scene. + It replaces the camera transform with a new one. This is different from + gluLookAt(), but I think the only reason that GLU's lookat doesn't fully + replace the camera matrix with the new one, but instead multiplies it, + is that GL doesn't enforce the separation of camera transform and + projection, so it wouldn't be safe (you'd probably stomp your projection). +

+ The transformation functions are the same ones used to manipulate the + modelview matrix (scale, translate, rotate, etc.). But they are bracketed + with beginCamera(), endCamera() to indicate that they should apply + (in inverse), to the camera transformation matrix. +

+ This differs considerably from camera transformation in OpenGL. + OpenGL only lets you say, apply everything from here out to the + projection or modelview matrix. This makes it very hard to treat camera + manipulation as if it were a physical camera. Imagine that you want to + move your camera 100 units forward. In OpenGL, you need to apply the + inverse of that transformation or else you'll move your scene 100 units + forward--whether or not you've specified modelview or projection matrix. + Remember they're just multiplied by model coods one after another. + So in order to treat a camera like a physical camera, it is necessary + to pre-apply inverse transforms to a matrix that will be applied to model + coordinates. OpenGL provides nothing of this sort, but Processing does! + This is the camera transform matrix. +

+

+
Overrides:
camera in class PGraphics
+
+
+
+
+
+
+ +

+camera

+
+public void camera(float eyeX,
+                   float eyeY,
+                   float eyeZ,
+                   float centerX,
+                   float centerY,
+                   float centerZ,
+                   float upX,
+                   float upY,
+                   float upZ)
+
+
More flexible method for dealing with camera(). +

+ The actual call is like gluLookat. Here's the real skinny on + what does what: +

+ camera(); or
+ camera(ex, ey, ez, cx, cy, cz, ux, uy, uz);
+ 
+ do not need to be called from with beginCamera();/endCamera(); + That's because they always apply to the camera transformation, + and they always totally replace it. That means that any coordinate + transforms done before camera(); in draw() will be wiped out. + It also means that camera() always operates in untransformed world + coordinates. Therefore it is always redundant to call resetMatrix(); + before camera(); This isn't technically true of gluLookat, but it's + pretty much how it's used. +

+ Now, beginCamera(); and endCamera(); are useful if you want to move + the camera around using transforms like translate(), etc. They will + wipe out any coordinate system transforms that occur before them in + draw(), but they will not automatically wipe out the camera transform. + This means that they should be at the top of draw(). It also means + that the following: +

+ beginCamera();
+ rotateY(PI/8);
+ endCamera();
+ 
+ will result in a camera that spins without stopping. If you want to + just rotate a small constant amount, try this: +
+ beginCamera();
+ camera(); // sets up the default view
+ rotateY(PI/8);
+ endCamera();
+ 
+ That will rotate a little off of the default view. Note that this + is entirely equivalent to +
+ camera(); // sets up the default view
+ beginCamera();
+ rotateY(PI/8);
+ endCamera();
+ 
+ because camera() doesn't care whether or not it's inside a + begin/end clause. Basically it's safe to use camera() or + camera(ex, ey, ez, cx, cy, cz, ux, uy, uz) as naked calls because + they do all the matrix resetting automatically. +

+

+
Overrides:
camera in class PGraphics
+
+
+
+
+
+
+ +

+printCamera

+
+public void printCamera()
+
+
Print the current camera matrix. +

+

+
Overrides:
printCamera in class PGraphics
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho()
+
+
Calls ortho() with the proper parameters for Processing's + standard orthographic projection. +

+

+
Overrides:
ortho in class PGraphics
+
+
+
+
+
+
+ +

+ortho

+
+public void ortho(float left,
+                  float right,
+                  float bottom,
+                  float top,
+                  float near,
+                  float far)
+
+
Similar to gluOrtho(), but wipes out the current projection matrix. +

+ Implementation partially based on Mesa's matrix.c. +

+

+
Overrides:
ortho in class PGraphics
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective()
+
+
Calls perspective() with Processing's standard coordinate projection. +

+ Projection functions: +

    +
  • frustrum() +
  • ortho() +
  • perspective() +
+ Each of these three functions completely replaces the projection + matrix with a new one. They can be called inside setup(), and their + effects will be felt inside draw(). At the top of draw(), the projection + matrix is not reset. Therefore the last projection function to be + called always dominates. On resize, the default projection is always + established, which has perspective. +

+ This behavior is pretty much familiar from OpenGL, except where + functions replace matrices, rather than multiplying against the + previous. +

+

+

+
Overrides:
perspective in class PGraphics
+
+
+
+
+
+
+ +

+perspective

+
+public void perspective(float fov,
+                        float aspect,
+                        float zNear,
+                        float zFar)
+
+
Similar to gluPerspective(). Implementation based on Mesa's glu.c +

+

+
Overrides:
perspective in class PGraphics
+
+
+
+
+
+
+ +

+frustum

+
+public void frustum(float left,
+                    float right,
+                    float bottom,
+                    float top,
+                    float znear,
+                    float zfar)
+
+
Same as glFrustum(), except that it wipes out (rather than + multiplies against) the current perspective matrix. +

+ Implementation based on the explanation in the OpenGL blue book. +

+

+
Overrides:
frustum in class PGraphics
+
+
+
+
+
+
+ +

+printProjection

+
+public void printProjection()
+
+
Print the current projection matrix. +

+

+
Overrides:
printProjection in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns its z value. + This value can be used to determine if an (x, y, z) coordinate + is in front or in back of another (x, y, z) coordinate. + The units are based on how the zbuffer is set up, and don't + relate to anything "real". They're only useful for in + comparison to another value obtained from screenZ(), + or directly out of the zbuffer[]. +

+

+
Overrides:
screenZ in class PGraphics
+
+
+
+
+
+
+ +

+modelX

+
+public float modelX(float x,
+                    float y,
+                    float z)
+
+
Description copied from class: PGraphics
+
Returns the model space x value for an x, y, z coordinate. +

+ This will give you a coordinate after it has been transformed + by translate(), rotate(), and camera(), but not yet transformed + by the projection matrix. For instance, his can be useful for + figuring out how points in 3D space relate to the edge + coordinates of a shape. +

+

+
Overrides:
modelX in class PGraphics
+
+
+
+
+
+
+ +

+modelY

+
+public float modelY(float x,
+                    float y,
+                    float z)
+
+
Description copied from class: PGraphics
+
Returns the model space y value for an x, y, z coordinate. +

+

+
Overrides:
modelY in class PGraphics
+
+
+
+
+
+
+ +

+modelZ

+
+public float modelZ(float x,
+                    float y,
+                    float z)
+
+
Description copied from class: PGraphics
+
Returns the model space z value for an x, y, z coordinate. +

+

+
Overrides:
modelZ in class PGraphics
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
Overrides:
strokeJoin in class PGraphics
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
Overrides:
strokeCap in class PGraphics
+
+
+
+
+
+
+ +

+lights

+
+public void lights()
+
+
Sets up an ambient and directional light. +
+ The Lighting Skinny:
+
+ The way lighting works is complicated enough that it's worth
+ producing a document to describe it. Lighting calculations proceed
+ pretty much exactly as described in the OpenGL red book.
+
+ Light-affecting material properties:
+
+   AMBIENT COLOR
+   - multiplies by light's ambient component
+   - for believability this should match diffuse color
+
+   DIFFUSE COLOR
+   - multiplies by light's diffuse component
+
+   SPECULAR COLOR
+   - multiplies by light's specular component
+   - usually less colored than diffuse/ambient
+
+   SHININESS
+   - the concentration of specular effect
+   - this should be set pretty high (20-50) to see really
+     noticeable specularity
+
+   EMISSIVE COLOR
+   - constant additive color effect
+
+ Light types:
+
+   AMBIENT
+   - one color
+   - no specular color
+   - no direction
+   - may have falloff (constant, linear, and quadratic)
+   - may have position (which matters in non-constant falloff case)
+   - multiplies by a material's ambient reflection
+
+   DIRECTIONAL
+   - has diffuse color
+   - has specular color
+   - has direction
+   - no position
+   - no falloff
+   - multiplies by a material's diffuse and specular reflections
+
+   POINT
+   - has diffuse color
+   - has specular color
+   - has position
+   - no direction
+   - may have falloff (constant, linear, and quadratic)
+   - multiplies by a material's diffuse and specular reflections
+
+   SPOT
+   - has diffuse color
+   - has specular color
+   - has position
+   - has direction
+   - has cone angle (set to half the total cone angle)
+   - has concentration value
+   - may have falloff (constant, linear, and quadratic)
+   - multiplies by a material's diffuse and specular reflections
+
+ Normal modes:
+
+ All of the primitives (rect, box, sphere, etc.) have their normals
+ set nicely. During beginShape/endShape normals can be set by the user.
+
+   AUTO-NORMAL
+   - if no normal is set during the shape, we are in auto-normal mode
+   - auto-normal calculates one normal per triangle (face-normal mode)
+
+   SHAPE-NORMAL
+   - if one normal is set during the shape, it will be used for
+     all vertices
+
+   VERTEX-NORMAL
+   - if multiple normals are set, each normal applies to
+     subsequent vertices
+   - (except for the first one, which applies to previous
+     and subsequent vertices)
+
+ Efficiency consequences:
+
+   There is a major efficiency consequence of position-dependent
+   lighting calculations per vertex. (See below for determining
+   whether lighting is vertex position-dependent.) If there is no
+   position dependency then the only factors that affect the lighting
+   contribution per vertex are its colors and its normal.
+   There is a major efficiency win if
+
+   1) lighting is not position dependent
+   2) we are in AUTO-NORMAL or SHAPE-NORMAL mode
+
+   because then we can calculate one lighting contribution per shape
+   (SHAPE-NORMAL) or per triangle (AUTO-NORMAL) and simply multiply it
+   into the vertex colors. The converse is our worst-case performance when
+
+   1) lighting is position dependent
+   2) we are in AUTO-NORMAL mode
+
+   because then we must calculate lighting per-face * per-vertex.
+   Each vertex has a different lighting contribution per face in
+   which it appears. Yuck.
+
+ Determining vertex position dependency:
+
+   If any of the following factors are TRUE then lighting is
+   vertex position dependent:
+
+   1) Any lights uses non-constant falloff
+   2) There are any point or spot lights
+   3) There is a light with specular color AND there is a
+      material with specular color
+
+ So worth noting is that default lighting (a no-falloff ambient
+ and a directional without specularity) is not position-dependent.
+ We should capitalize.
+
+ Simon Greenwold, April 2005
+ 
+

+

+
Overrides:
lights in class PGraphics
+
+
+
+
+
+
+ +

+noLights

+
+public void noLights()
+
+
Turn off all lights. +

+

+
Overrides:
noLights in class PGraphics
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float r,
+                         float g,
+                         float b)
+
+
Add an ambient light based on the current color mode. +

+

+
Overrides:
ambientLight in class PGraphics
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float r,
+                         float g,
+                         float b,
+                         float x,
+                         float y,
+                         float z)
+
+
Add an ambient light based on the current color mode. + This version includes an (x, y, z) position for situations + where the falloff distance is used. +

+

+
Overrides:
ambientLight in class PGraphics
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float r,
+                             float g,
+                             float b,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
Overrides:
directionalLight in class PGraphics
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float r,
+                       float g,
+                       float b,
+                       float x,
+                       float y,
+                       float z)
+
+
+
Overrides:
pointLight in class PGraphics
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float r,
+                      float g,
+                      float b,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
Overrides:
spotLight in class PGraphics
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
Set the light falloff rates for the last light that was created. + Default is lightFalloff(1, 0, 0). +

+

+
Overrides:
lightFalloff in class PGraphics
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
Set the specular color of the last light created. +

+

+
Overrides:
lightSpecular in class PGraphics
+
+
+
+
+
+
+ +

+is2D

+
+public boolean is2D()
+
+
Description copied from class: PGraphics
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
Overrides:
is2D in class PGraphics
+
+
+
+
+
+
+ +

+is3D

+
+public boolean is3D()
+
+
Description copied from class: PGraphics
+
Return true if this renderer supports 2D drawing. Defaults to true. +

+

+
Overrides:
is3D in class PGraphics
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PGraphicsJava2D.html b/build/javadoc/everything/processing/core/PGraphicsJava2D.html new file mode 100644 index 000000000..db235cb9a --- /dev/null +++ b/build/javadoc/everything/processing/core/PGraphicsJava2D.html @@ -0,0 +1,2435 @@ + + + + + +PGraphicsJava2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PGraphicsJava2D

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphicsJava2D
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
Direct Known Subclasses:
PGraphicsPDF
+
+
+
+
public class PGraphicsJava2D
extends PGraphics
+ + +

+Subclass for PGraphics that implements the graphics API using Java2D. + +

Pixel operations too slow? As of release 0085 (the first beta), + the default renderer uses Java2D. It's more accurate than the renderer + used in alpha releases of Processing (it handles stroke caps and joins, + and has better polygon tessellation), but it's super slow for handling + pixels. At least until we get a chance to get the old 2D renderer + (now called P2D) working in a similar fashion, you can use + size(w, h, P3D) instead of size(w, h) which will + be faster for general pixel flipping madness.

+ +

To get access to the Java 2D "Graphics2D" object for the default + renderer, use: +

Graphics2D g2 = ((PGraphicsJava2D)g).g2;
+ This will let you do Java 2D stuff directly, but is not supported in + any way shape or form. Which just means "have fun, but don't complain + if it breaks."

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanfillGradient + +
+           
+ java.awt.PaintfillGradientObject + +
+           
+ java.awt.Graphics2Dg2 + +
+           
+ booleanstrokeGradient + +
+           
+ java.awt.PaintstrokeGradientObject + +
+           
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphicsJava2D() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+          Apply a 3x2 affine transformation matrix.
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+          Apply a 4x4 transformation matrix.
+ voidbackgroundImpl() + +
+          Actual implementation of clearing the background, now that the + internal variables for background color have been set.
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginRaw(PGraphics recorderRaw) + +
+          Record individual lines and triangles by echoing them to another renderer.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ voidbezierDetail(int detail) + +
+          Ignored (not needed) in Java 2D.
+ voidbezierVertex(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+ voidbezierVertex(float x2, + float y2, + float z2, + float x3, + float y3, + float z3, + float x4, + float y4, + float z4) + +
+           
+ voidbox(float w, + float h, + float d) + +
+           
+ voidbreakShape() + +
+          This feature is in testing, do not use or rely upon its implementation
+ booleancanDraw() + +
+          Some renderers have requirements re: when they are ready to draw.
+ voidcopy(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+          Copy things from one area of this image + to another area in the same image.
+ voidcurveDetail(int detail) + +
+          Ignored (not needed) in Java 2D.
+ voidcurveVertex(float x, + float y, + float z) + +
+           
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidendRaw() + +
+           
+ voidendShape(int mode) + +
+           
+ PImageget() + +
+          Returns a copy of this PImage.
+ intget(int x, + int y) + +
+          Returns an ARGB "color" type (a packed 32 bit int with the color.
+ PImagegetImpl(int x, + int y, + int w, + int h) + +
+          Internal function to actually handle getting a block of pixels that + has already been properly cropped to a valid region.
+ PMatrixgetMatrix() + +
+           
+ PMatrix2DgetMatrix(PMatrix2D target) + +
+          Copy the current transformation matrix into the specified target.
+ PMatrix3DgetMatrix(PMatrix3D target) + +
+          Copy the current transformation matrix into the specified target.
+ voidline(float x1, + float y1, + float x2, + float y2) + +
+           
+ voidloadPixels() + +
+          Call this when you want to mess with the pixels[] array.
+ voidmask(int[] alpha) + +
+          Set alpha channel for an image.
+ voidmask(PImage alpha) + +
+          Set alpha channel for an image using another image as the source.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidpoint(float x, + float y) + +
+           
+ voidpopMatrix() + +
+          Replace the current transformation matrix with the top of the stack.
+ voidprintMatrix() + +
+          Print the current model (or "transformation") matrix.
+ voidpushMatrix() + +
+          Push a copy of the current transformation matrix onto the stack.
+ voidquad(float x1, + float y1, + float x2, + float y2, + float x3, + float y3, + float x4, + float y4) + +
+           
+ voidresetMatrix() + +
+          Set the current transformation matrix to identity.
+ voidresize(int wide, + int high) + +
+          Resize this image to a new width and height.
+ voidrotate(float angle) + +
+          Two dimensional rotation.
+ voidrotate(float angle, + float vx, + float vy, + float vz) + +
+          Rotate about a vector in space.
+ voidrotateX(float angle) + +
+          Rotate around the X axis.
+ voidrotateY(float angle) + +
+          Rotate around the Y axis.
+ voidrotateZ(float angle) + +
+          Rotate around the Z axis.
+ voidscale(float s) + +
+          Scale in all dimensions.
+ voidscale(float sx, + float sy) + +
+          Scale in X and Y.
+ voidscale(float sx, + float sy, + float sz) + +
+          Scale in X, Y, and Z.
+ floatscreenX(float x, + float y) + +
+          Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenX(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenY(float x, + float y) + +
+          Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations.
+ floatscreenY(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ floatscreenZ(float x, + float y, + float z) + +
+          Maps a three dimensional point to its placement on-screen.
+ voidset(int x, + int y, + int argb) + +
+          Set a single pixel to the specified color.
+ voidsetMatrix(PMatrix2D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetMatrix(PMatrix3D source) + +
+          Set the current transformation to the contents of the specified source.
+ voidsetSize(int iwidth, + int iheight) + +
+          Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size.
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidsphere(float r) + +
+          Draw a sphere with radius r centered at coordinate 0, 0, 0.
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ floattextAscent() + +
+          Returns the ascent of the current font at the current size.
+ floattextDescent() + +
+          Returns the descent of the current font at the current size.
+ voidtextSize(float size) + +
+          Same as parent, but override for native version of the font.
+ voidtexture(PImage image) + +
+          Set texture image for current shape.
+ voidtranslate(float tx, + float ty) + +
+          Translate in X and Y.
+ voidtriangle(float x1, + float y1, + float x2, + float y2, + float x3, + float y3) + +
+           
+ voidupdatePixels() + +
+          Update the pixels[] buffer to the PGraphics image.
+ voidupdatePixels(int x, + int y, + int c, + int d) + +
+          Update the pixels[] buffer to the PGraphics image.
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidvertex(float x, + float y, + float u, + float v) + +
+           
+ voidvertex(float x, + float y, + float z, + float u, + float v) + +
+           
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, background, background, background, background, background, background, background, beginCamera, beginShape, bezier, bezier, bezierPoint, bezierTangent, blue, box, brightness, camera, camera, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endShape, fill, fill, fill, fill, fill, fill, flush, frustum, getStyle, getStyle, green, hint, hue, image, image, image, imageMode, is2D, is3D, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, modelX, modelY, modelZ, noFill, noLights, normal, noStroke, noTint, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, rect, rectMode, red, saturation, setMatrix, setParent, setPath, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textMode, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, filter, filter, get, getCache, getImage, init, isModified, removeCache, save, set, setCache, setModified, setModified
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+g2

+
+public java.awt.Graphics2D g2
+
+
+
+
+
+ +

+fillGradient

+
+public boolean fillGradient
+
+
+
+
+
+ +

+fillGradientObject

+
+public java.awt.Paint fillGradientObject
+
+
+
+
+
+ +

+strokeGradient

+
+public boolean strokeGradient
+
+
+
+
+
+ +

+strokeGradientObject

+
+public java.awt.Paint strokeGradientObject
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphicsJava2D

+
+public PGraphicsJava2D()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setSize

+
+public void setSize(int iwidth,
+                    int iheight)
+
+
Called in response to a resize event, handles setting the + new width and height internally, as well as re-allocating + the pixel buffer for the new size. + + Note that this will nuke any cameraMode() settings. +

+

+
Overrides:
setSize in class PGraphics
+
+
+
+
+
+
+ +

+canDraw

+
+public boolean canDraw()
+
+
Description copied from class: PGraphics
+
Some renderers have requirements re: when they are ready to draw. +

+

+
Overrides:
canDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
Overrides:
endDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
Description copied from class: PGraphics
+
Set texture image for current shape. + Needs to be called between @see beginShape and @see endShape +

+

+
Overrides:
texture in class PGraphics
+
+
+
Parameters:
image - reference to a PImage object
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z,
+                   float u,
+                   float v)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+breakShape

+
+public void breakShape()
+
+
Description copied from class: PGraphics
+
This feature is in testing, do not use or rely upon its implementation +

+

+
Overrides:
breakShape in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x1,
+                         float y1,
+                         float x2,
+                         float y2,
+                         float x3,
+                         float y3)
+
+
+
Overrides:
bezierVertex in class PGraphics
+
+
+
+
+
+
+ +

+bezierVertex

+
+public void bezierVertex(float x2,
+                         float y2,
+                         float z2,
+                         float x3,
+                         float y3,
+                         float z3,
+                         float x4,
+                         float y4,
+                         float z4)
+
+
+
Overrides:
bezierVertex in class PGraphics
+
+
+
+
+
+
+ +

+curveVertex

+
+public void curveVertex(float x,
+                        float y,
+                        float z)
+
+
+
Overrides:
curveVertex in class PGraphics
+
+
+
+
+
+
+ +

+point

+
+public void point(float x,
+                  float y)
+
+
+
Overrides:
point in class PGraphics
+
+
+
+
+
+
+ +

+line

+
+public void line(float x1,
+                 float y1,
+                 float x2,
+                 float y2)
+
+
+
Overrides:
line in class PGraphics
+
+
+
+
+
+
+ +

+triangle

+
+public void triangle(float x1,
+                     float y1,
+                     float x2,
+                     float y2,
+                     float x3,
+                     float y3)
+
+
+
Overrides:
triangle in class PGraphics
+
+
+
+
+
+
+ +

+quad

+
+public void quad(float x1,
+                 float y1,
+                 float x2,
+                 float y2,
+                 float x3,
+                 float y3,
+                 float x4,
+                 float y4)
+
+
+
Overrides:
quad in class PGraphics
+
+
+
+
+
+
+ +

+box

+
+public void box(float w,
+                float h,
+                float d)
+
+
+
Overrides:
box in class PGraphics
+
+
+
+
+
+
+ +

+sphere

+
+public void sphere(float r)
+
+
Description copied from class: PGraphics
+
Draw a sphere with radius r centered at coordinate 0, 0, 0. +

+ Implementation notes: +

+ cache all the points of the sphere in a static array + top and bottom are just a bunch of triangles that land + in the center point +

+ sphere is a series of concentric circles who radii vary + along the shape, based on, er.. cos or something +

+ [toxi 031031] new sphere code. removed all multiplies with
+ radius, as scale() will take care of that anyway
+
+ [toxi 031223] updated sphere code (removed modulos)
+ and introduced sphereAt(x,y,z,r)
+ to avoid additional translate()'s on the user/sketch side
+
+ [davbol 080801] now using separate sphereDetailU/V
+ 
+

+

+
Overrides:
sphere in class PGraphics
+
+
+
+
+
+
+ +

+bezierDetail

+
+public void bezierDetail(int detail)
+
+
Ignored (not needed) in Java 2D. +

+

+
Overrides:
bezierDetail in class PGraphics
+
+
+
+
+
+
+ +

+curveDetail

+
+public void curveDetail(int detail)
+
+
Ignored (not needed) in Java 2D. +

+

+
Overrides:
curveDetail in class PGraphics
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
Description copied from class: PGraphics
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
Overrides:
smooth in class PGraphics
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Description copied from class: PGraphics
+
Disable smoothing. See smooth(). +

+

+
Overrides:
noSmooth in class PGraphics
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
Description copied from class: PGraphics
+
Returns the ascent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
Overrides:
textAscent in class PGraphics
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
Description copied from class: PGraphics
+
Returns the descent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
Overrides:
textDescent in class PGraphics
+
+
+
+
+
+
+ +

+textSize

+
+public void textSize(float size)
+
+
Same as parent, but override for native version of the font. +

+ Also gets called by textFont, so the metrics + will get recorded properly. +

+

+
Overrides:
textSize in class PGraphics
+
+
+
+
+
+
+ +

+pushMatrix

+
+public void pushMatrix()
+
+
Description copied from class: PGraphics
+
Push a copy of the current transformation matrix onto the stack. +

+

+
Overrides:
pushMatrix in class PGraphics
+
+
+
+
+
+
+ +

+popMatrix

+
+public void popMatrix()
+
+
Description copied from class: PGraphics
+
Replace the current transformation matrix with the top of the stack. +

+

+
Overrides:
popMatrix in class PGraphics
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
Description copied from class: PGraphics
+
Translate in X and Y. +

+

+
Overrides:
translate in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
Description copied from class: PGraphics
+
Two dimensional rotation. + + Same as rotateZ (this is identical to a 3D rotation along the z-axis) + but included for clarity. It'd be weird for people drawing 2D graphics + to be using rotateZ. And they might kick our a-- for the confusion. + + Additional background. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the X axis. +

+

+
Overrides:
rotateX in class PGraphics
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Y axis. +

+

+
Overrides:
rotateY in class PGraphics
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
Description copied from class: PGraphics
+
Rotate around the Z axis. + + The functions rotate() and rotateZ() are identical, it's just that it make + sense to have rotate() and then rotateX() and rotateY() when using 3D; + nor does it make sense to use a function called rotateZ() if you're only + doing things in 2D. so we just decided to have them both be the same. +

+

+
Overrides:
rotateZ in class PGraphics
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float vx,
+                   float vy,
+                   float vz)
+
+
Description copied from class: PGraphics
+
Rotate about a vector in space. Same as the glRotatef() function. +

+

+
Overrides:
rotate in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
Description copied from class: PGraphics
+
Scale in all dimensions. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
Description copied from class: PGraphics
+
Scale in X and Y. Equivalent to scale(sx, sy, 1). + + Not recommended for use in 3D, because the z-dimension is just + scaled by 1, since there's no way to know what else to scale it by. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy,
+                  float sz)
+
+
Description copied from class: PGraphics
+
Scale in X, Y, and Z. +

+

+
Overrides:
scale in class PGraphics
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
Description copied from class: PGraphics
+
Set the current transformation matrix to identity. +

+

+
Overrides:
resetMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
Description copied from class: PGraphics
+
Apply a 3x2 affine transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
Description copied from class: PGraphics
+
Apply a 4x4 transformation matrix. +

+

+
Overrides:
applyMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix getMatrix()
+
+
+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix2D getMatrix(PMatrix2D target)
+
+
Description copied from class: PGraphics
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+getMatrix

+
+public PMatrix3D getMatrix(PMatrix3D target)
+
+
Description copied from class: PGraphics
+
Copy the current transformation matrix into the specified target. + Pass in null to create a new matrix. +

+

+
Overrides:
getMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix2D source)
+
+
Description copied from class: PGraphics
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+setMatrix

+
+public void setMatrix(PMatrix3D source)
+
+
Description copied from class: PGraphics
+
Set the current transformation to the contents of the specified source. +

+

+
Overrides:
setMatrix in class PGraphics
+
+
+
+
+
+
+ +

+printMatrix

+
+public void printMatrix()
+
+
Description copied from class: PGraphics
+
Print the current model (or "transformation") matrix. +

+

+
Overrides:
printMatrix in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y)
+
+
Description copied from class: PGraphics
+
Given an x and y coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenX

+
+public float screenX(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the x position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenX in class PGraphics
+
+
+
+
+
+
+ +

+screenY

+
+public float screenY(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns the y position of where + that point would be placed on screen, once affected by translate(), + scale(), or any other transformations. +

+

+
Overrides:
screenY in class PGraphics
+
+
+
+
+
+
+ +

+screenZ

+
+public float screenZ(float x,
+                     float y,
+                     float z)
+
+
Description copied from class: PGraphics
+
Maps a three dimensional point to its placement on-screen. +

+ Given an (x, y, z) coordinate, returns its z value. + This value can be used to determine if an (x, y, z) coordinate + is in front or in back of another (x, y, z) coordinate. + The units are based on how the zbuffer is set up, and don't + relate to anything "real". They're only useful for in + comparison to another value obtained from screenZ(), + or directly out of the zbuffer[]. +

+

+
Overrides:
screenZ in class PGraphics
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
Overrides:
strokeCap in class PGraphics
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
Overrides:
strokeJoin in class PGraphics
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
Overrides:
strokeWeight in class PGraphics
+
+
+
+
+
+
+ +

+backgroundImpl

+
+public void backgroundImpl()
+
+
Description copied from class: PGraphics
+
Actual implementation of clearing the background, now that the + internal variables for background color have been set. Called by the + backgroundFromCalc() method, which is what all the other background() + methods call once the work is done. +

+

+
+
+
+
+
+
+
+ +

+beginRaw

+
+public void beginRaw(PGraphics recorderRaw)
+
+
Description copied from class: PGraphics
+
Record individual lines and triangles by echoing them to another renderer. +

+

+
Overrides:
beginRaw in class PGraphics
+
+
+
+
+
+
+ +

+endRaw

+
+public void endRaw()
+
+
+
Overrides:
endRaw in class PGraphics
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Description copied from class: PImage
+
Call this when you want to mess with the pixels[] array. +

+ For subclasses where the pixels[] buffer isn't set by default, + this should copy all data into the pixels[] array +

+

+
Overrides:
loadPixels in class PImage
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
Update the pixels[] buffer to the PGraphics image. +

+ Unlike in PImage, where updatePixels() only requests that the + update happens, in PGraphicsJava2D, this will happen immediately. +

+

+
Overrides:
updatePixels in class PImage
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x,
+                         int y,
+                         int c,
+                         int d)
+
+
Update the pixels[] buffer to the PGraphics image. +

+ Unlike in PImage, where updatePixels() only requests that the + update happens, in PGraphicsJava2D, this will happen immediately. +

+

+
Overrides:
updatePixels in class PImage
+
+
+
+
+
+
+ +

+resize

+
+public void resize(int wide,
+                   int high)
+
+
Description copied from class: PImage
+
Resize this image to a new width and height. + Use 0 for wide or high to make that dimension scale proportionally. +

+

+
Overrides:
resize in class PImage
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
Description copied from class: PImage
+
Returns an ARGB "color" type (a packed 32 bit int with the color. + If the coordinate is outside the image, zero is returned + (black, but completely transparent). +

+ If the image is in RGB format (i.e. on a PVideo object), + the value will get its high bits set, just to avoid cases where + they haven't been set already. +

+ If the image is in ALPHA format, this returns a white with its + alpha value set. +

+ This function is included primarily for beginners. It is quite + slow because it has to check to see if the x, y that was provided + is inside the bounds, and then has to check to see what image + type it is. If you want things to be more efficient, access the + pixels[] array directly. +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+getImpl

+
+public PImage getImpl(int x,
+                      int y,
+                      int w,
+                      int h)
+
+
Description copied from class: PImage
+
Internal function to actually handle getting a block of pixels that + has already been properly cropped to a valid region. That is, x/y/w/h + are guaranteed to be inside the image space, so the implementation can + use the fastest possible pixel copying method. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
Description copied from class: PImage
+
Returns a copy of this PImage. Equivalent to get(0, 0, width, height). +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int argb)
+
+
Description copied from class: PImage
+
Set a single pixel to the specified color. +

+

+
Overrides:
set in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image. Black colors in the source + image will make the destination image completely transparent, + and white will make things fully opaque. Gray values will + be in-between steps. +

+ Strictly speaking the "blue" value from the source image is + used as the alpha color. For a fully grayscale image, this + is correct, but for a color image it's not 100% accurate. + For a more accurate conversion, first use filter(GRAY) + which will make the image into a "correct" grayscake by + performing a proper luminance-based conversion. +

+

+
Overrides:
mask in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image using another image as the source. +

+

+
Overrides:
mask in class PImage
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
Description copied from class: PImage
+
Copy things from one area of this image + to another area in the same image. +

+

+
Overrides:
copy in class PImage
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PImage.html b/build/javadoc/everything/processing/core/PImage.html new file mode 100644 index 000000000..5623fe398 --- /dev/null +++ b/build/javadoc/everything/processing/core/PImage.html @@ -0,0 +1,1364 @@ + + + + + +PImage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PImage

+
+java.lang.Object
+  extended by processing.core.PImage
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
Direct Known Subclasses:
Capture, Movie, PGraphics
+
+
+
+
public class PImage
extends java.lang.Object
implements PConstants, java.lang.Cloneable
+ + +

+Storage class for pixel data. This is the base class for most image and + pixel information, such as PGraphics and the video library classes. +

+ Code for copying, resizing, scaling, and blending contributed + by toxi. +

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ intformat + +
+          Format for this image, one of RGB, ARGB or ALPHA.
+ intheight + +
+           
+ PAppletparent + +
+          Path to parent object that will be used with save().
+ int[]pixels + +
+           
+ intwidth + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
PImage() + +
+          Create an empty image object, set its format to RGB.
PImage(java.awt.Image img) + +
+          Construct a new PImage from a java.awt.Image.
PImage(int width, + int height) + +
+          Create a new RGB (alpha ignored) image of a specific size.
PImage(int width, + int height, + int format) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidblend(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+          Blends one area of this image to another area.
+ voidblend(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh, + int mode) + +
+          Copies area of one image into another PImage object.
+static intblendColor(int c1, + int c2, + int mode) + +
+          Blend two colors based on a particular mode.
+ java.lang.Objectclone() + +
+          Duplicate an image, returns new PImage object.
+ voidcopy(int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+          Copy things from one area of this image + to another area in the same image.
+ voidcopy(PImage src, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + int dw, + int dh) + +
+          Copies area of one image into another PImage object.
+ voidfilter(int kind) + +
+          Method to apply a variety of basic filters to this image.
+ voidfilter(int kind, + float param) + +
+          Method to apply a variety of basic filters to this image.
+ PImageget() + +
+          Returns a copy of this PImage.
+ intget(int x, + int y) + +
+          Returns an ARGB "color" type (a packed 32 bit int with the color.
+ PImageget(int x, + int y, + int w, + int h) + +
+          Grab a subsection of a PImage, and copy it into a fresh PImage.
+ java.lang.ObjectgetCache(java.lang.Object parent) + +
+          Get cache storage data for the specified renderer.
+ java.awt.ImagegetImage() + +
+          Returns a BufferedImage from this PImage.
+ voidinit(int width, + int height, + int format) + +
+          Function to be used by subclasses of PImage to init later than + at the constructor, or re-init later when things changes.
+ booleanisModified() + +
+           
+ voidloadPixels() + +
+          Call this when you want to mess with the pixels[] array.
+ voidmask(int[] alpha) + +
+          Set alpha channel for an image.
+ voidmask(PImage alpha) + +
+          Set alpha channel for an image using another image as the source.
+ voidremoveCache(java.lang.Object parent) + +
+          Remove information associated with this renderer from the cache, if any.
+ voidresize(int wide, + int high) + +
+          Resize this image to a new width and height.
+ voidsave(java.lang.String path) + +
+          Save this image to disk.
+ voidset(int x, + int y, + int c) + +
+          Set a single pixel to the specified color.
+ voidset(int x, + int y, + PImage src) + +
+          Efficient method of drawing an image's pixels directly to this surface.
+ voidsetCache(java.lang.Object parent, + java.lang.Object storage) + +
+          Store data of some kind for a renderer that requires extra metadata of + some kind.
+ voidsetModified() + +
+           
+ voidsetModified(boolean m) + +
+           
+ voidupdatePixels() + +
+          Call this when finished messing with the pixels[] array.
+ voidupdatePixels(int x, + int y, + int w, + int h) + +
+          Mark the pixels in this region as needing an update.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+format

+
+public int format
+
+
Format for this image, one of RGB, ARGB or ALPHA. + note that RGB images still require 0xff in the high byte + because of how they'll be manipulated by other functions +

+

+
+
+
+ +

+pixels

+
+public int[] pixels
+
+
+
+
+
+ +

+width

+
+public int width
+
+
+
+
+
+ +

+height

+
+public int height
+
+
+
+
+
+ +

+parent

+
+public PApplet parent
+
+
Path to parent object that will be used with save(). + This prevents users from needing savePath() to use PImage.save(). +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PImage

+
+public PImage()
+
+
Create an empty image object, set its format to RGB. + The pixel array is not allocated. +

+

+
+ +

+PImage

+
+public PImage(int width,
+              int height)
+
+
Create a new RGB (alpha ignored) image of a specific size. + All pixels are set to zero, meaning black, but since the + alpha is zero, it will be transparent. +

+

+
+ +

+PImage

+
+public PImage(int width,
+              int height,
+              int format)
+
+
+
+ +

+PImage

+
+public PImage(java.awt.Image img)
+
+
Construct a new PImage from a java.awt.Image. This constructor assumes + that you've done the work of making sure a MediaTracker has been used + to fully download the data and that the img is valid. +

+

+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init(int width,
+                 int height,
+                 int format)
+
+
Function to be used by subclasses of PImage to init later than + at the constructor, or re-init later when things changes. + Used by Capture and Movie classes (and perhaps others), + because the width/height will not be known when super() is called. + (Leave this public so that other libraries can do the same.) +

+

+
+
+
+
+
+
+
+ +

+getImage

+
+public java.awt.Image getImage()
+
+
Returns a BufferedImage from this PImage. +

+

+
+
+
+
+
+
+
+ +

+setCache

+
+public void setCache(java.lang.Object parent,
+                     java.lang.Object storage)
+
+
Store data of some kind for a renderer that requires extra metadata of + some kind. Usually this is a renderer-specific representation of the + image data, for instance a BufferedImage with tint() settings applied for + PGraphicsJava2D, or resized image data and OpenGL texture indices for + PGraphicsOpenGL. +

+

+
+
+
+
+
+
+
+ +

+getCache

+
+public java.lang.Object getCache(java.lang.Object parent)
+
+
Get cache storage data for the specified renderer. Because each renderer + will cache data in different formats, it's necessary to store cache data + keyed by the renderer object. Otherwise, attempting to draw the same + image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors. +

+

+
+
+
+
Parameters:
parent - The PGraphics object (or any object, really) associated +
Returns:
data stored for the specified parent
+
+
+
+ +

+removeCache

+
+public void removeCache(java.lang.Object parent)
+
+
Remove information associated with this renderer from the cache, if any. +

+

+
+
+
+
Parameters:
parent - The PGraphics object whose cache data should be removed
+
+
+
+ +

+isModified

+
+public boolean isModified()
+
+
+
+
+
+
+
+
+
+ +

+setModified

+
+public void setModified()
+
+
+
+
+
+
+
+
+
+ +

+setModified

+
+public void setModified(boolean m)
+
+
+
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Call this when you want to mess with the pixels[] array. +

+ For subclasses where the pixels[] buffer isn't set by default, + this should copy all data into the pixels[] array +

+

+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
Call this when finished messing with the pixels[] array. +

+ Mark all pixels as needing update. +

+

+
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x,
+                         int y,
+                         int w,
+                         int h)
+
+
Mark the pixels in this region as needing an update. +

+ This is not currently used by any of the renderers, however the api + is structured this way in the hope of being able to use this to + speed things up in the future. +

+

+
+
+
+
+
+
+
+ +

+clone

+
+public java.lang.Object clone()
+                       throws java.lang.CloneNotSupportedException
+
+
Duplicate an image, returns new PImage object. + The pixels[] array for the new object will be unique + and recopied from the source image. This is implemented as an + override of Object.clone(). We recommend using get() instead, + because it prevents you from needing to catch the + CloneNotSupportedException, and from doing a cast from the result. +

+

+
Overrides:
clone in class java.lang.Object
+
+
+ +
Throws: +
java.lang.CloneNotSupportedException
+
+
+
+ +

+resize

+
+public void resize(int wide,
+                   int high)
+
+
Resize this image to a new width and height. + Use 0 for wide or high to make that dimension scale proportionally. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
Returns an ARGB "color" type (a packed 32 bit int with the color. + If the coordinate is outside the image, zero is returned + (black, but completely transparent). +

+ If the image is in RGB format (i.e. on a PVideo object), + the value will get its high bits set, just to avoid cases where + they haven't been set already. +

+ If the image is in ALPHA format, this returns a white with its + alpha value set. +

+ This function is included primarily for beginners. It is quite + slow because it has to check to see if the x, y that was provided + is inside the bounds, and then has to check to see what image + type it is. If you want things to be more efficient, access the + pixels[] array directly. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public PImage get(int x,
+                  int y,
+                  int w,
+                  int h)
+
+
Grab a subsection of a PImage, and copy it into a fresh PImage. + As of release 0149, no longer honors imageMode() for the coordinates. +

+

+
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
Returns a copy of this PImage. Equivalent to get(0, 0, width, height). +

+

+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int c)
+
+
Set a single pixel to the specified color. +

+

+
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                PImage src)
+
+
Efficient method of drawing an image's pixels directly to this surface. + No variations are employed, meaning that any scale, tint, or imageMode + settings will be ignored. +

+

+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
Set alpha channel for an image. Black colors in the source + image will make the destination image completely transparent, + and white will make things fully opaque. Gray values will + be in-between steps. +

+ Strictly speaking the "blue" value from the source image is + used as the alpha color. For a fully grayscale image, this + is correct, but for a color image it's not 100% accurate. + For a more accurate conversion, first use filter(GRAY) + which will make the image into a "correct" grayscake by + performing a proper luminance-based conversion. +

+

+
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
Set alpha channel for an image using another image as the source. +

+

+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind)
+
+
Method to apply a variety of basic filters to this image. +

+

    +
  • filter(BLUR) provides a basic blur. +
  • filter(GRAY) converts the image to grayscale based on luminance. +
  • filter(INVERT) will invert the color components in the image. +
  • filter(OPAQUE) set all the high bits in the image to opaque +
  • filter(THRESHOLD) converts the image to black and white. +
  • filter(DILATE) grow white/light areas +
  • filter(ERODE) shrink white/light areas +
+ Luminance conversion code contributed by + toxi +

+ Gaussian blur code contributed by + Mario Klingemann +

+

+
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind,
+                   float param)
+
+
Method to apply a variety of basic filters to this image. + These filters all take a parameter. +

+

    +
  • filter(BLUR, int radius) performs a gaussian blur of the + specified radius. +
  • filter(POSTERIZE, int levels) will posterize the image to + between 2 and 255 levels. +
  • filter(THRESHOLD, float center) allows you to set the + center point for the threshold. It takes a value from 0 to 1.0. +
+ Gaussian blur code contributed by + Mario Klingemann + and later updated by toxi for better speed. +

+

+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
Copy things from one area of this image + to another area in the same image. +

+

+
+
+
+
+
+
+
+ +

+copy

+
+public void copy(PImage src,
+                 int sx,
+                 int sy,
+                 int sw,
+                 int sh,
+                 int dx,
+                 int dy,
+                 int dw,
+                 int dh)
+
+
Copies area of one image into another PImage object. +

+

+
+
+
+
+
+
+
+ +

+blendColor

+
+public static int blendColor(int c1,
+                             int c2,
+                             int mode)
+
+
Blend two colors based on a particular mode. +
    +
  • REPLACE - destination colour equals colour of source pixel: C = A. + Sometimes called "Normal" or "Copy" in other software. + +
  • BLEND - linear interpolation of colours: + C = A*factor + B + +
  • ADD - additive blending with white clip: + C = min(A*factor + B, 255). + Clipped to 0..255, Photoshop calls this "Linear Burn", + and Director calls it "Add Pin". + +
  • SUBTRACT - substractive blend with black clip: + C = max(B - A*factor, 0). + Clipped to 0..255, Photoshop calls this "Linear Dodge", + and Director calls it "Subtract Pin". + +
  • DARKEST - only the darkest colour succeeds: + C = min(A*factor, B). + Illustrator calls this "Darken". + +
  • LIGHTEST - only the lightest colour succeeds: + C = max(A*factor, B). + Illustrator calls this "Lighten". + +
  • DIFFERENCE - subtract colors from underlying image. + +
  • EXCLUSION - similar to DIFFERENCE, but less extreme. + +
  • MULTIPLY - Multiply the colors, result will always be darker. + +
  • SCREEN - Opposite multiply, uses inverse values of the colors. + +
  • OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, + and screens light values. + +
  • HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower. + +
  • SOFT_LIGHT - Mix of DARKEST and LIGHTEST. + Works like OVERLAY, but not as harsh. + +
  • DODGE - Lightens light tones and increases contrast, ignores darks. + Called "Color Dodge" in Illustrator and Photoshop. + +
  • BURN - Darker areas are applied, increasing contrast, ignores lights. + Called "Color Burn" in Illustrator and Photoshop. +
+

A useful reference for blending modes and their algorithms can be + found in the SVG + specification.

+

It is important to note that Processing uses "fast" code, not + necessarily "correct" code. No biggie, most software does. A nitpicker + can find numerous "off by 1 division" problems in the blend code where + >>8 or >>7 is used when strictly speaking + /255.0 or /127.0 should have been used.

+

For instance, exclusion (not intended for real-time use) reads + r1 + r2 - ((2 * r1 * r2) / 255) because 255 == 1.0 + not 256 == 1.0. In other words, (255*255)>>8 is not + the same as (255*255)/255. But for real-time use the shifts + are preferrable, and the difference is insignificant for applications + built with Processing.

+

+

+
+
+
+
+
+
+
+ +

+blend

+
+public void blend(int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
Blends one area of this image to another area. +

+

+
+
+
+
See Also:
blendColor(int,int,int)
+
+
+
+ +

+blend

+
+public void blend(PImage src,
+                  int sx,
+                  int sy,
+                  int sw,
+                  int sh,
+                  int dx,
+                  int dy,
+                  int dw,
+                  int dh,
+                  int mode)
+
+
Copies area of one image into another PImage object. +

+

+
+
+
+
See Also:
blendColor(int,int,int)
+
+
+
+ +

+save

+
+public void save(java.lang.String path)
+
+
Save this image to disk. +

+ As of revision 0100, this function requires an absolute path, + in order to avoid confusion. To save inside the sketch folder, + use the function savePath() from PApplet, or use saveFrame() instead. + As of revision 0116, savePath() is not needed if this object has been + created (as recommended) via createImage() or createGraphics() or + one of its neighbors. +

+ As of revision 0115, when using Java 1.4 and later, you can write + to several formats besides tga and tiff. If Java 1.4 is installed + and the extension used is supported (usually png, jpg, jpeg, bmp, + and tiff), then those methods will be used to write the image. + To get a list of the supported formats for writing, use:
+ println(javax.imageio.ImageIO.getReaderFormatNames()) +

+ To use the original built-in image writers, use .tga or .tif as the + extension, or don't include an extension. When no extension is used, + the extension .tif will be added to the file name. +

+ The ImageIO API claims to support wbmp files, however they probably + require a black and white image. Basic testing produced a zero-length + file with no error. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PLine.html b/build/javadoc/everything/processing/core/PLine.html new file mode 100644 index 000000000..4c47d9d7b --- /dev/null +++ b/build/javadoc/everything/processing/core/PLine.html @@ -0,0 +1,507 @@ + + + + + +PLine + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PLine

+
+java.lang.Object
+  extended by processing.core.PLine
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PLine
extends java.lang.Object
implements PConstants
+ + +

+Code for rendering lines with P2D and P3D. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanINTERPOLATE_ALPHA + +
+           
+ booleanINTERPOLATE_RGB + +
+           
+ booleanINTERPOLATE_THICK + +
+           
+ booleanINTERPOLATE_Z + +
+           
+ intm_drawFlags + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PLine(PGraphics g) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddraw() + +
+           
+ booleanlineClipping() + +
+           
+ voidreset() + +
+           
+ voidsetIndex(int index) + +
+           
+ voidsetIntensities(float r0, + float g0, + float b0, + float a0, + float r1, + float g1, + float b1, + float a1) + +
+           
+ voidsetVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+INTERPOLATE_RGB

+
+public boolean INTERPOLATE_RGB
+
+
+
+
+
+ +

+INTERPOLATE_ALPHA

+
+public boolean INTERPOLATE_ALPHA
+
+
+
+
+
+ +

+INTERPOLATE_Z

+
+public boolean INTERPOLATE_Z
+
+
+
+
+
+ +

+INTERPOLATE_THICK

+
+public boolean INTERPOLATE_THICK
+
+
+
+
+
+ +

+m_drawFlags

+
+public int m_drawFlags
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PLine

+
+public PLine(PGraphics g)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
+
+
+
+
+
+
+
+ +

+setVertices

+
+public void setVertices(float x0,
+                        float y0,
+                        float z0,
+                        float x1,
+                        float y1,
+                        float z1)
+
+
+
+
+
+
+
+
+
+ +

+setIntensities

+
+public void setIntensities(float r0,
+                           float g0,
+                           float b0,
+                           float a0,
+                           float r1,
+                           float g1,
+                           float b1,
+                           float a1)
+
+
+
+
+
+
+
+
+
+ +

+setIndex

+
+public void setIndex(int index)
+
+
+
+
+
+
+
+
+
+ +

+draw

+
+public void draw()
+
+
+
+
+
+
+
+
+
+ +

+lineClipping

+
+public boolean lineClipping()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PMaterial.html b/build/javadoc/everything/processing/core/PMaterial.html new file mode 100644 index 000000000..255a8d0cf --- /dev/null +++ b/build/javadoc/everything/processing/core/PMaterial.html @@ -0,0 +1,640 @@ + + + + + +PMaterial + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PMaterial

+
+java.lang.Object
+  extended by processing.core.PMaterial
+
+
+
+
public class PMaterial
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatambientB + +
+          Ka parameters of the material.
+ floatambientG + +
+          Ka parameters of the material.
+ floatambientR + +
+          Ka parameters of the material.
+ floatdiffuseB + +
+          Kd parameters of the material
+ floatdiffuseG + +
+          Kd parameters of the material
+ floatdiffuseR + +
+          Kd parameters of the material
+ floatemissiveB + +
+          Ke parameters of the material
+ floatemissiveG + +
+          Ke parameters of the material
+ floatemissiveR + +
+          Ke parameters of the material
+ floatshininess + +
+          Se parameter of the material
+ floatspecularB + +
+          Ks parameters of the material
+ floatspecularG + +
+          Ks parameters of the material
+ floatspecularR + +
+          Ks parameters of the material
+  + + + + + + + + + + +
+Constructor Summary
PMaterial(float ambientR, + float ambientG, + float ambientB, + float diffuseR, + float diffuseG, + float diffuseB, + float specularR, + float specularG, + float specularB, + float emissiveR, + float emissiveG, + float emissiveB, + float shininess) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidambient(float r, + float g, + float b) + +
+           
+ voiddiffuse(float r, + float g, + float b) + +
+           
+ voidemissive(float r, + float g, + float b) + +
+           
+ voidshininess(float s) + +
+           
+ voidspecular(float r, + float g, + float b) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+ambientR

+
+public float ambientR
+
+
Ka parameters of the material. +

+

+
+
+
+ +

+ambientG

+
+public float ambientG
+
+
Ka parameters of the material. +

+

+
+
+
+ +

+ambientB

+
+public float ambientB
+
+
Ka parameters of the material. +

+

+
+
+
+ +

+diffuseR

+
+public float diffuseR
+
+
Kd parameters of the material +

+

+
+
+
+ +

+diffuseG

+
+public float diffuseG
+
+
Kd parameters of the material +

+

+
+
+
+ +

+diffuseB

+
+public float diffuseB
+
+
Kd parameters of the material +

+

+
+
+
+ +

+specularR

+
+public float specularR
+
+
Ks parameters of the material +

+

+
+
+
+ +

+specularG

+
+public float specularG
+
+
Ks parameters of the material +

+

+
+
+
+ +

+specularB

+
+public float specularB
+
+
Ks parameters of the material +

+

+
+
+
+ +

+emissiveR

+
+public float emissiveR
+
+
Ke parameters of the material +

+

+
+
+
+ +

+emissiveG

+
+public float emissiveG
+
+
Ke parameters of the material +

+

+
+
+
+ +

+emissiveB

+
+public float emissiveB
+
+
Ke parameters of the material +

+

+
+
+
+ +

+shininess

+
+public float shininess
+
+
Se parameter of the material +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PMaterial

+
+public PMaterial(float ambientR,
+                 float ambientG,
+                 float ambientB,
+                 float diffuseR,
+                 float diffuseG,
+                 float diffuseB,
+                 float specularR,
+                 float specularG,
+                 float specularB,
+                 float emissiveR,
+                 float emissiveG,
+                 float emissiveB,
+                 float shininess)
+
+
+ + + + + + + + +
+Method Detail
+ +

+ambient

+
+public void ambient(float r,
+                    float g,
+                    float b)
+
+
+
+
+
+
+ +

+diffuse

+
+public void diffuse(float r,
+                    float g,
+                    float b)
+
+
+
+
+
+
+ +

+specular

+
+public void specular(float r,
+                     float g,
+                     float b)
+
+
+
+
+
+
+ +

+emissive

+
+public void emissive(float r,
+                     float g,
+                     float b)
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float s)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PMatrix.html b/build/javadoc/everything/processing/core/PMatrix.html new file mode 100644 index 000000000..74fe0be78 --- /dev/null +++ b/build/javadoc/everything/processing/core/PMatrix.html @@ -0,0 +1,972 @@ + + + + + +PMatrix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Interface PMatrix

+
+
All Known Implementing Classes:
PMatrix2D, PMatrix3D
+
+
+
+
public interface PMatrix
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapply(PMatrix source) + +
+          Multiply this matrix by another.
+ voidapply(PMatrix2D source) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ floatdeterminant() + +
+           
+ PMatrixget() + +
+          Returns a copy of this PMatrix.
+ float[]get(float[] target) + +
+          Copies the matrix contents into a float array.
+ booleaninvert() + +
+          Invert this matrix.
+ float[]mult(float[] source, + float[] target) + +
+          Multiply a multi-element vector against this matrix.
+ PVectormult(PVector source, + PVector target) + +
+          Multiply a PVector by this matrix.
+ voidpreApply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidpreApply(PMatrix2D left) + +
+          Apply another matrix to the left of this one.
+ voidpreApply(PMatrix3D left) + +
+           
+ voidreset() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidset(float[] source) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
+ voidset(PMatrix src) + +
+           
+ voidskewX(float angle) + +
+           
+ voidskewY(float angle) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ voidtranspose() + +
+          Transpose this matrix.
+  +

+ + + + + + + + +
+Method Detail
+ +

+reset

+
+void reset()
+
+
+
+
+
+
+ +

+get

+
+PMatrix get()
+
+
Returns a copy of this PMatrix. +

+

+
+
+
+
+ +

+get

+
+float[] get(float[] target)
+
+
Copies the matrix contents into a float array. + If target is null (or not the correct size), a new array will be created. +

+

+
+
+
+
+ +

+set

+
+void set(PMatrix src)
+
+
+
+
+
+
+ +

+set

+
+void set(float[] source)
+
+
+
+
+
+
+ +

+set

+
+void set(float m00,
+         float m01,
+         float m02,
+         float m10,
+         float m11,
+         float m12)
+
+
+
+
+
+
+ +

+set

+
+void set(float m00,
+         float m01,
+         float m02,
+         float m03,
+         float m10,
+         float m11,
+         float m12,
+         float m13,
+         float m20,
+         float m21,
+         float m22,
+         float m23,
+         float m30,
+         float m31,
+         float m32,
+         float m33)
+
+
+
+
+
+
+ +

+translate

+
+void translate(float tx,
+               float ty)
+
+
+
+
+
+
+ +

+translate

+
+void translate(float tx,
+               float ty,
+               float tz)
+
+
+
+
+
+
+ +

+rotate

+
+void rotate(float angle)
+
+
+
+
+
+
+ +

+rotateX

+
+void rotateX(float angle)
+
+
+
+
+
+
+ +

+rotateY

+
+void rotateY(float angle)
+
+
+
+
+
+
+ +

+rotateZ

+
+void rotateZ(float angle)
+
+
+
+
+
+
+ +

+rotate

+
+void rotate(float angle,
+            float v0,
+            float v1,
+            float v2)
+
+
+
+
+
+
+ +

+scale

+
+void scale(float s)
+
+
+
+
+
+
+ +

+scale

+
+void scale(float sx,
+           float sy)
+
+
+
+
+
+
+ +

+scale

+
+void scale(float x,
+           float y,
+           float z)
+
+
+
+
+
+
+ +

+skewX

+
+void skewX(float angle)
+
+
+
+
+
+
+ +

+skewY

+
+void skewY(float angle)
+
+
+
+
+
+
+ +

+apply

+
+void apply(PMatrix source)
+
+
Multiply this matrix by another. +

+

+
+
+
+
+ +

+apply

+
+void apply(PMatrix2D source)
+
+
+
+
+
+
+ +

+apply

+
+void apply(PMatrix3D source)
+
+
+
+
+
+
+ +

+apply

+
+void apply(float n00,
+           float n01,
+           float n02,
+           float n10,
+           float n11,
+           float n12)
+
+
+
+
+
+
+ +

+apply

+
+void apply(float n00,
+           float n01,
+           float n02,
+           float n03,
+           float n10,
+           float n11,
+           float n12,
+           float n13,
+           float n20,
+           float n21,
+           float n22,
+           float n23,
+           float n30,
+           float n31,
+           float n32,
+           float n33)
+
+
+
+
+
+
+ +

+preApply

+
+void preApply(PMatrix2D left)
+
+
Apply another matrix to the left of this one. +

+

+
+
+
+
+ +

+preApply

+
+void preApply(PMatrix3D left)
+
+
+
+
+
+
+ +

+preApply

+
+void preApply(float n00,
+              float n01,
+              float n02,
+              float n10,
+              float n11,
+              float n12)
+
+
+
+
+
+
+ +

+preApply

+
+void preApply(float n00,
+              float n01,
+              float n02,
+              float n03,
+              float n10,
+              float n11,
+              float n12,
+              float n13,
+              float n20,
+              float n21,
+              float n22,
+              float n23,
+              float n30,
+              float n31,
+              float n32,
+              float n33)
+
+
+
+
+
+
+ +

+mult

+
+PVector mult(PVector source,
+             PVector target)
+
+
Multiply a PVector by this matrix. +

+

+
+
+
+
+ +

+mult

+
+float[] mult(float[] source,
+             float[] target)
+
+
Multiply a multi-element vector against this matrix. +

+

+
+
+
+
+ +

+transpose

+
+void transpose()
+
+
Transpose this matrix. +

+

+
+
+
+
+ +

+invert

+
+boolean invert()
+
+
Invert this matrix. +

+

+ +
Returns:
true if successful
+
+
+
+ +

+determinant

+
+float determinant()
+
+
+ +
Returns:
the determinant of the matrix
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PMatrix2D.html b/build/javadoc/everything/processing/core/PMatrix2D.html new file mode 100644 index 000000000..4745103f6 --- /dev/null +++ b/build/javadoc/everything/processing/core/PMatrix2D.html @@ -0,0 +1,1380 @@ + + + + + +PMatrix2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PMatrix2D

+
+java.lang.Object
+  extended by processing.core.PMatrix2D
+
+
+
All Implemented Interfaces:
PMatrix
+
+
+
+
public class PMatrix2D
extends java.lang.Object
implements PMatrix
+ + +

+3x2 affine matrix implementation. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatm00 + +
+           
+ floatm01 + +
+           
+ floatm02 + +
+           
+ floatm10 + +
+           
+ floatm11 + +
+           
+ floatm12 + +
+           
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PMatrix2D() + +
+           
PMatrix2D(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
PMatrix2D(PMatrix matrix) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapply(PMatrix source) + +
+          Multiply this matrix by another.
+ voidapply(PMatrix2D source) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ floatdeterminant() + +
+           
+ PMatrix2Dget() + +
+          Returns a copy of this PMatrix.
+ float[]get(float[] target) + +
+          Copies the matrix contents into a 6 entry float array.
+ booleaninvert() + +
+          Invert this matrix.
+ float[]mult(float[] vec, + float[] out) + +
+          Multiply a two element vector against this matrix.
+ PVectormult(PVector source, + PVector target) + +
+          Multiply the x and y coordinates of a PVector against this matrix.
+ floatmultX(float x, + float y) + +
+           
+ floatmultY(float x, + float y) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidpreApply(PMatrix2D left) + +
+          Apply another matrix to the left of this one.
+ voidpreApply(PMatrix3D left) + +
+           
+ voidprint() + +
+           
+ voidreset() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidset(float[] source) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
+ voidset(PMatrix matrix) + +
+           
+ voidset(PMatrix3D src) + +
+           
+ voidskewX(float angle) + +
+           
+ voidskewY(float angle) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float x, + float y, + float z) + +
+           
+ voidtranspose() + +
+          Transpose this matrix.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+m00

+
+public float m00
+
+
+
+
+
+ +

+m01

+
+public float m01
+
+
+
+
+
+ +

+m02

+
+public float m02
+
+
+
+
+
+ +

+m10

+
+public float m10
+
+
+
+
+
+ +

+m11

+
+public float m11
+
+
+
+
+
+ +

+m12

+
+public float m12
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PMatrix2D

+
+public PMatrix2D()
+
+
+
+ +

+PMatrix2D

+
+public PMatrix2D(float m00,
+                 float m01,
+                 float m02,
+                 float m10,
+                 float m11,
+                 float m12)
+
+
+
+ +

+PMatrix2D

+
+public PMatrix2D(PMatrix matrix)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
+
Specified by:
reset in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public PMatrix2D get()
+
+
Returns a copy of this PMatrix. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public float[] get(float[] target)
+
+
Copies the matrix contents into a 6 entry float array. + If target is null (or not the correct size), a new array will be created. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(PMatrix matrix)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(PMatrix3D src)
+
+
+
+
+
+
+
+
+
+ +

+set

+
+public void set(float[] source)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m10,
+                float m11,
+                float m12)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m03,
+                float m10,
+                float m11,
+                float m12,
+                float m13,
+                float m20,
+                float m21,
+                float m22,
+                float m23,
+                float m30,
+                float m31,
+                float m32,
+                float m33)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float x,
+                      float y,
+                      float z)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
Specified by:
rotateX in interface PMatrix
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
Specified by:
rotateY in interface PMatrix
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
Specified by:
rotateZ in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+skewX

+
+public void skewX(float angle)
+
+
+
Specified by:
skewX in interface PMatrix
+
+
+
+
+
+
+ +

+skewY

+
+public void skewY(float angle)
+
+
+
Specified by:
skewY in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix source)
+
+
Description copied from interface: PMatrix
+
Multiply this matrix by another. +

+

+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix2D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix3D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n10,
+                  float n11,
+                  float n12)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n03,
+                  float n10,
+                  float n11,
+                  float n12,
+                  float n13,
+                  float n20,
+                  float n21,
+                  float n22,
+                  float n23,
+                  float n30,
+                  float n31,
+                  float n32,
+                  float n33)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix2D left)
+
+
Apply another matrix to the left of this one. +

+

+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix3D left)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n10,
+                     float n11,
+                     float n12)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n03,
+                     float n10,
+                     float n11,
+                     float n12,
+                     float n13,
+                     float n20,
+                     float n21,
+                     float n22,
+                     float n23,
+                     float n30,
+                     float n31,
+                     float n32,
+                     float n33)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public PVector mult(PVector source,
+                    PVector target)
+
+
Multiply the x and y coordinates of a PVector against this matrix. +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public float[] mult(float[] vec,
+                    float[] out)
+
+
Multiply a two element vector against this matrix. + If out is null or not length four, a new float array will be returned. + The values for vec and out can be the same (though that's less efficient). +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+transpose

+
+public void transpose()
+
+
Transpose this matrix. +

+

+
Specified by:
transpose in interface PMatrix
+
+
+
+
+
+
+ +

+invert

+
+public boolean invert()
+
+
Invert this matrix. Implementation stolen from OpenJDK. +

+

+
Specified by:
invert in interface PMatrix
+
+
+ +
Returns:
true if successful
+
+
+
+ +

+determinant

+
+public float determinant()
+
+
+
Specified by:
determinant in interface PMatrix
+
+
+ +
Returns:
the determinant of the matrix
+
+
+
+ +

+print

+
+public void print()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PMatrix3D.html b/build/javadoc/everything/processing/core/PMatrix3D.html new file mode 100644 index 000000000..558398f28 --- /dev/null +++ b/build/javadoc/everything/processing/core/PMatrix3D.html @@ -0,0 +1,1801 @@ + + + + + +PMatrix3D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PMatrix3D

+
+java.lang.Object
+  extended by processing.core.PMatrix3D
+
+
+
All Implemented Interfaces:
PMatrix
+
+
+
+
public final class PMatrix3D
extends java.lang.Object
implements PMatrix
+ + +

+4x4 matrix implementation. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatm00 + +
+           
+ floatm01 + +
+           
+ floatm02 + +
+           
+ floatm03 + +
+           
+ floatm10 + +
+           
+ floatm11 + +
+           
+ floatm12 + +
+           
+ floatm13 + +
+           
+ floatm20 + +
+           
+ floatm21 + +
+           
+ floatm22 + +
+           
+ floatm23 + +
+           
+ floatm30 + +
+           
+ floatm31 + +
+           
+ floatm32 + +
+           
+ floatm33 + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
PMatrix3D() + +
+           
PMatrix3D(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
PMatrix3D(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
PMatrix3D(PMatrix matrix) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidapply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapply(PMatrix source) + +
+          Multiply this matrix by another.
+ voidapply(PMatrix2D source) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ floatdeterminant() + +
+           
+ PMatrix3Dget() + +
+          Returns a copy of this PMatrix.
+ float[]get(float[] target) + +
+          Copies the matrix contents into a 16 entry float array.
+ booleaninvert() + +
+          Invert this matrix.
+ float[]mult(float[] source, + float[] target) + +
+          Multiply a three or four element vector against this matrix.
+ PVectormult(PVector source, + PVector target) + +
+          Multiply a PVector by this matrix.
+ floatmultW(float x, + float y, + float z) + +
+           
+ floatmultW(float x, + float y, + float z, + float w) + +
+           
+ floatmultX(float x, + float y) + +
+           
+ floatmultX(float x, + float y, + float z) + +
+           
+ floatmultX(float x, + float y, + float z, + float w) + +
+           
+ floatmultY(float x, + float y) + +
+           
+ floatmultY(float x, + float y, + float z) + +
+           
+ floatmultY(float x, + float y, + float z, + float w) + +
+           
+ floatmultZ(float x, + float y, + float z) + +
+           
+ floatmultZ(float x, + float y, + float z, + float w) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidpreApply(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidpreApply(PMatrix2D left) + +
+          Apply another matrix to the left of this one.
+ voidpreApply(PMatrix3D left) + +
+          Apply another matrix to the left of this one.
+ voidprint() + +
+           
+ voidreset() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidset(float[] source) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m10, + float m11, + float m12) + +
+           
+ voidset(float m00, + float m01, + float m02, + float m03, + float m10, + float m11, + float m12, + float m13, + float m20, + float m21, + float m22, + float m23, + float m30, + float m31, + float m32, + float m33) + +
+           
+ voidset(PMatrix matrix) + +
+           
+ voidskewX(float angle) + +
+           
+ voidskewY(float angle) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ voidtranspose() + +
+          Transpose this matrix.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+m00

+
+public float m00
+
+
+
+
+
+ +

+m01

+
+public float m01
+
+
+
+
+
+ +

+m02

+
+public float m02
+
+
+
+
+
+ +

+m03

+
+public float m03
+
+
+
+
+
+ +

+m10

+
+public float m10
+
+
+
+
+
+ +

+m11

+
+public float m11
+
+
+
+
+
+ +

+m12

+
+public float m12
+
+
+
+
+
+ +

+m13

+
+public float m13
+
+
+
+
+
+ +

+m20

+
+public float m20
+
+
+
+
+
+ +

+m21

+
+public float m21
+
+
+
+
+
+ +

+m22

+
+public float m22
+
+
+
+
+
+ +

+m23

+
+public float m23
+
+
+
+
+
+ +

+m30

+
+public float m30
+
+
+
+
+
+ +

+m31

+
+public float m31
+
+
+
+
+
+ +

+m32

+
+public float m32
+
+
+
+
+
+ +

+m33

+
+public float m33
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PMatrix3D

+
+public PMatrix3D()
+
+
+
+ +

+PMatrix3D

+
+public PMatrix3D(float m00,
+                 float m01,
+                 float m02,
+                 float m10,
+                 float m11,
+                 float m12)
+
+
+
+ +

+PMatrix3D

+
+public PMatrix3D(float m00,
+                 float m01,
+                 float m02,
+                 float m03,
+                 float m10,
+                 float m11,
+                 float m12,
+                 float m13,
+                 float m20,
+                 float m21,
+                 float m22,
+                 float m23,
+                 float m30,
+                 float m31,
+                 float m32,
+                 float m33)
+
+
+
+ +

+PMatrix3D

+
+public PMatrix3D(PMatrix matrix)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
+
Specified by:
reset in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public PMatrix3D get()
+
+
Returns a copy of this PMatrix. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+get

+
+public float[] get(float[] target)
+
+
Copies the matrix contents into a 16 entry float array. + If target is null (or not the correct size), a new array will be created. +

+

+
Specified by:
get in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(PMatrix matrix)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float[] source)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m10,
+                float m11,
+                float m12)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+set

+
+public void set(float m00,
+                float m01,
+                float m02,
+                float m03,
+                float m10,
+                float m11,
+                float m12,
+                float m13,
+                float m20,
+                float m21,
+                float m22,
+                float m23,
+                float m30,
+                float m31,
+                float m32,
+                float m33)
+
+
+
Specified by:
set in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
+
Specified by:
translate in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
Specified by:
rotateX in interface PMatrix
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
Specified by:
rotateY in interface PMatrix
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
Specified by:
rotateZ in interface PMatrix
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
+
Specified by:
rotate in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
Specified by:
scale in interface PMatrix
+
+
+
+
+
+
+ +

+skewX

+
+public void skewX(float angle)
+
+
+
Specified by:
skewX in interface PMatrix
+
+
+
+
+
+
+ +

+skewY

+
+public void skewY(float angle)
+
+
+
Specified by:
skewY in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix source)
+
+
Description copied from interface: PMatrix
+
Multiply this matrix by another. +

+

+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix2D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix3D source)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n10,
+                  float n11,
+                  float n12)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+apply

+
+public void apply(float n00,
+                  float n01,
+                  float n02,
+                  float n03,
+                  float n10,
+                  float n11,
+                  float n12,
+                  float n13,
+                  float n20,
+                  float n21,
+                  float n22,
+                  float n23,
+                  float n30,
+                  float n31,
+                  float n32,
+                  float n33)
+
+
+
Specified by:
apply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix2D left)
+
+
Description copied from interface: PMatrix
+
Apply another matrix to the left of this one. +

+

+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(PMatrix3D left)
+
+
Apply another matrix to the left of this one. +

+

+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n10,
+                     float n11,
+                     float n12)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+preApply

+
+public void preApply(float n00,
+                     float n01,
+                     float n02,
+                     float n03,
+                     float n10,
+                     float n11,
+                     float n12,
+                     float n13,
+                     float n20,
+                     float n21,
+                     float n22,
+                     float n23,
+                     float n30,
+                     float n31,
+                     float n32,
+                     float n33)
+
+
+
Specified by:
preApply in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public PVector mult(PVector source,
+                    PVector target)
+
+
Description copied from interface: PMatrix
+
Multiply a PVector by this matrix. +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+mult

+
+public float[] mult(float[] source,
+                    float[] target)
+
+
Multiply a three or four element vector against this matrix. If out is + null or not length 3 or 4, a new float array (length 3) will be returned. +

+

+
Specified by:
mult in interface PMatrix
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y)
+
+
+
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multZ

+
+public float multZ(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multW

+
+public float multW(float x,
+                   float y,
+                   float z)
+
+
+
+
+
+
+
+
+
+ +

+multX

+
+public float multX(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+multY

+
+public float multY(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+multZ

+
+public float multZ(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+multW

+
+public float multW(float x,
+                   float y,
+                   float z,
+                   float w)
+
+
+
+
+
+
+
+
+
+ +

+transpose

+
+public void transpose()
+
+
Transpose this matrix. +

+

+
Specified by:
transpose in interface PMatrix
+
+
+
+
+
+
+ +

+invert

+
+public boolean invert()
+
+
Invert this matrix. +

+

+
Specified by:
invert in interface PMatrix
+
+
+ +
Returns:
true if successful
+
+
+
+ +

+determinant

+
+public float determinant()
+
+
+
Specified by:
determinant in interface PMatrix
+
+
+ +
Returns:
the determinant of the matrix
+
+
+
+ +

+print

+
+public void print()
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PPolygon.html b/build/javadoc/everything/processing/core/PPolygon.html new file mode 100644 index 000000000..a807cc4b6 --- /dev/null +++ b/build/javadoc/everything/processing/core/PPolygon.html @@ -0,0 +1,243 @@ + + + + + +PPolygon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PPolygon

+
+java.lang.Object
+  extended by processing.core.PPolygon
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PPolygon
extends java.lang.Object
implements PConstants
+ + +

+Z-buffer polygon rendering object used by PGraphics2D. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PPolygon(PGraphics iparent) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PPolygon

+
+public PPolygon(PGraphics iparent)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PShape.html b/build/javadoc/everything/processing/core/PShape.html new file mode 100644 index 000000000..f30506045 --- /dev/null +++ b/build/javadoc/everything/processing/core/PShape.html @@ -0,0 +1,1274 @@ + + + + + +PShape + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PShape

+
+java.lang.Object
+  extended by processing.core.PShape
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
Direct Known Subclasses:
PShapeSVG
+
+
+
+
public class PShape
extends java.lang.Object
implements PConstants
+ + +

+In-progress class to handle shape data, currently to be considered of + alpha or beta quality. Major structural work may be performed on this class + after the release of Processing 1.0. Such changes may include: + +

    +
  • addition of proper accessors to read shape vertex and coloring data + (this is the second most important part of having a PShape class after all). +
  • a means of creating PShape objects ala beginShape() and endShape(). +
  • load(), update(), and cache methods ala PImage, so that shapes can + have renderer-specific optimizations, such as vertex arrays in OpenGL. +
  • splitting this class into multiple classes to handle different + varieties of shape data (primitives vs collections of vertices vs paths) +
  • change of package declaration, for instance moving the code into + package processing.shape (if the code grows too much). +
+ +

For the time being, this class and its shape() and loadShape() friends in + PApplet exist as placeholders for more exciting things to come. If you'd + like to work with this class, make a subclass (see how PShapeSVG works) + and you can play with its internal methods all you like.

+ +

Library developers are encouraged to create PShape objects when loading + shape data, so that they can eventually hook into the bounty that will be + the PShape interface, and the ease of loadShape() and shape().

+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intBEZIER_VERTEX + +
+           
+static intBREAK + +
+           
+static intCURVE_VERTEX + +
+           
+static intGEOMETRY + +
+          Collections of vertices created with beginShape().
+static intGROUP + +
+          Generic, only draws its child objects.
+ floatheight + +
+           
+static intPATH + +
+          A series of vertex, curveVertex, and bezierVertex calls.
+static intPRIMITIVE + +
+          A line, ellipse, arc, image, etc.
+static intVERTEX + +
+           
+ floatwidth + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + +
+Constructor Summary
PShape() + +
+           
PShape(int family) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddChild(PShape who) + +
+           
+ voidapply(PMatrix3D source) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n10, + float n11, + float n12) + +
+           
+ voidapplyMatrix(float n00, + float n01, + float n02, + float n03, + float n10, + float n11, + float n12, + float n13, + float n20, + float n21, + float n22, + float n23, + float n30, + float n31, + float n32, + float n33) + +
+           
+ voidapplyMatrix(PMatrix source) + +
+           
+ voidapplyMatrix(PMatrix2D source) + +
+           
+ voiddisableStyle() + +
+          Overrides this shape's style information and uses PGraphics styles and + colors.
+ voiddraw(PGraphics g) + +
+          Called by the following (the shape() command adds the g) + PShape s = loadShapes("blah.svg"); + shape(s);
+ voiddrawImpl(PGraphics g) + +
+          Draws the SVG document.
+ voidenableStyle() + +
+          Re-enables style information (fill and stroke) set in the shape.
+ PShapefindChild(java.lang.String target) + +
+          Same as getChild(name), except that it first walks all the way up the + hierarchy to the farthest parent, so that children can be found anywhere.
+ PShapegetChild(int index) + +
+           
+ PShapegetChild(java.lang.String target) + +
+           
+ intgetChildCount() + +
+           
+ floatgetHeight() + +
+          Get the height of the drawing area (not necessarily the shape boundary).
+ java.lang.StringgetName() + +
+           
+ floatgetWidth() + +
+          Get the width of the drawing area (not necessarily the shape boundary).
+ booleanisVisible() + +
+           
+ voidpost(PGraphics g) + +
+           
+ voidresetMatrix() + +
+           
+ voidrotate(float angle) + +
+           
+ voidrotate(float angle, + float v0, + float v1, + float v2) + +
+           
+ voidrotateX(float angle) + +
+           
+ voidrotateY(float angle) + +
+           
+ voidrotateZ(float angle) + +
+           
+ voidscale(float s) + +
+           
+ voidscale(float sx, + float sy) + +
+           
+ voidscale(float x, + float y, + float z) + +
+           
+ voidsetName(java.lang.String name) + +
+           
+ voidsetVisible(boolean visible) + +
+           
+ voidtranslate(float tx, + float ty) + +
+           
+ voidtranslate(float tx, + float ty, + float tz) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+GROUP

+
+public static final int GROUP
+
+
Generic, only draws its child objects. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PRIMITIVE

+
+public static final int PRIMITIVE
+
+
A line, ellipse, arc, image, etc. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PATH

+
+public static final int PATH
+
+
A series of vertex, curveVertex, and bezierVertex calls. +

+

+
See Also:
Constant Field Values
+
+
+ +

+GEOMETRY

+
+public static final int GEOMETRY
+
+
Collections of vertices created with beginShape(). +

+

+
See Also:
Constant Field Values
+
+
+ +

+width

+
+public float width
+
+
+
+
+
+ +

+height

+
+public float height
+
+
+
+
+
+ +

+VERTEX

+
+public static final int VERTEX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEZIER_VERTEX

+
+public static final int BEZIER_VERTEX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CURVE_VERTEX

+
+public static final int CURVE_VERTEX
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BREAK

+
+public static final int BREAK
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+PShape

+
+public PShape()
+
+
+
+ +

+PShape

+
+public PShape(int family)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setName

+
+public void setName(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getName

+
+public java.lang.String getName()
+
+
+
+
+
+
+
+
+
+ +

+isVisible

+
+public boolean isVisible()
+
+
+
+
+
+
+
+
+
+ +

+setVisible

+
+public void setVisible(boolean visible)
+
+
+
+
+
+
+
+
+
+ +

+disableStyle

+
+public void disableStyle()
+
+
Overrides this shape's style information and uses PGraphics styles and + colors. Identical to ignoreStyles(true). Also disables styles for all + child shapes. +

+

+
+
+
+
+
+
+
+ +

+enableStyle

+
+public void enableStyle()
+
+
Re-enables style information (fill and stroke) set in the shape. +

+

+
+
+
+
+
+
+
+ +

+getWidth

+
+public float getWidth()
+
+
Get the width of the drawing area (not necessarily the shape boundary). +

+

+
+
+
+
+
+
+
+ +

+getHeight

+
+public float getHeight()
+
+
Get the height of the drawing area (not necessarily the shape boundary). +

+

+
+
+
+
+
+
+
+ +

+post

+
+public void post(PGraphics g)
+
+
+
+
+
+
+
+
+
+ +

+draw

+
+public void draw(PGraphics g)
+
+
Called by the following (the shape() command adds the g) + PShape s = loadShapes("blah.svg"); + shape(s); +

+

+
+
+
+
+
+
+
+ +

+drawImpl

+
+public void drawImpl(PGraphics g)
+
+
Draws the SVG document. +

+

+
+
+
+
+
+
+
+ +

+getChildCount

+
+public int getChildCount()
+
+
+
+
+
+
+
+
+
+ +

+getChild

+
+public PShape getChild(int index)
+
+
+
+
+
+
+
+
+
+ +

+getChild

+
+public PShape getChild(java.lang.String target)
+
+
+
+
+
+
+
+
+
+ +

+findChild

+
+public PShape findChild(java.lang.String target)
+
+
Same as getChild(name), except that it first walks all the way up the + hierarchy to the farthest parent, so that children can be found anywhere. +

+

+
+
+
+
+
+
+
+ +

+addChild

+
+public void addChild(PShape who)
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty)
+
+
+
+
+
+
+
+
+
+ +

+translate

+
+public void translate(float tx,
+                      float ty,
+                      float tz)
+
+
+
+
+
+
+
+
+
+ +

+rotateX

+
+public void rotateX(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateY

+
+public void rotateY(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotateZ

+
+public void rotateZ(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle)
+
+
+
+
+
+
+
+
+
+ +

+rotate

+
+public void rotate(float angle,
+                   float v0,
+                   float v1,
+                   float v2)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float s)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float sx,
+                  float sy)
+
+
+
+
+
+
+
+
+
+ +

+scale

+
+public void scale(float x,
+                  float y,
+                  float z)
+
+
+
+
+
+
+
+
+
+ +

+resetMatrix

+
+public void resetMatrix()
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(PMatrix2D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n10,
+                        float n11,
+                        float n12)
+
+
+
+
+
+
+
+
+
+ +

+apply

+
+public void apply(PMatrix3D source)
+
+
+
+
+
+
+
+
+
+ +

+applyMatrix

+
+public void applyMatrix(float n00,
+                        float n01,
+                        float n02,
+                        float n03,
+                        float n10,
+                        float n11,
+                        float n12,
+                        float n13,
+                        float n20,
+                        float n21,
+                        float n22,
+                        float n23,
+                        float n30,
+                        float n31,
+                        float n32,
+                        float n33)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PShapeSVG.html b/build/javadoc/everything/processing/core/PShapeSVG.html new file mode 100644 index 000000000..6326902d8 --- /dev/null +++ b/build/javadoc/everything/processing/core/PShapeSVG.html @@ -0,0 +1,460 @@ + + + + + +PShapeSVG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PShapeSVG

+
+java.lang.Object
+  extended by processing.core.PShape
+      extended by processing.core.PShapeSVG
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PShapeSVG
extends PShape
+ + +

+SVG stands for Scalable Vector Graphics, a portable graphics format. It is + a vector format so it allows for infinite resolution and relatively small + file sizes. Most modern media software can view SVG files, including Adobe + products, Firefox, etc. Illustrator and Inkscape can edit SVG files. +

+ We have no intention of turning this into a full-featured SVG library. + The goal of this project is a basic shape importer that is small enough + to be included with applets, meaning that its download size should be + in the neighborhood of 25-30k. Starting with release 0149, this library + has been incorporated into the core via the loadShape() command, because + vector shape data is just as important as the image data from loadImage(). +

+ For more sophisticated import/export, consider the + Batik + library from the Apache Software Foundation. Future improvements to this + library may focus on this properly supporting a specific subset of SVG, + for instance the simpler SVG profiles known as + SVG Tiny or Basic, + although we still would not support the interactivity options. + +


+ + A minimal example program using SVG: + (assuming a working moo.svg is in your data folder) + +

+ PShape moo;
+
+ void setup() {
+   size(400, 400);
+   moo = loadShape("moo.svg");
+ }
+ void draw() {
+   background(255);
+   shape(moo, mouseX, mouseY);
+ }
+ 
+ + This code is based on the Candy library written by Michael Chang, which was + later revised and expanded for use as a Processing core library by Ben Fry. + Thanks to Ricard Marxer Pinon for help with better Inkscape support in 0154. + +


+ + Late October 2008 revisions from ricardmp, incorporated by fry (0154) +

    +
  • Better style attribute handling, enabling better Inkscape support. +
+ + October 2008 revisions by fry (Processing 0149, pre-1.0) +
    +
  • Candy is no longer a separate library, and is instead part of core. +
  • Loading now works through loadShape() +
  • Shapes are now drawn using the new PGraphics shape() method. +
+ + August 2008 revisions by fry (Processing 0149) +
    +
  • Major changes to rework around PShape. +
  • Now implementing more of the "transform" attribute. +
+ + February 2008 revisions by fry (Processing 0136) +
    +
  • Added support for quadratic curves in paths (Q, q, T, and t operators) +
  • Support for reading SVG font data (though not rendering it yet) +
+ + Revisions for "Candy 2" November 2006 by fry +
    +
  • Switch to the new processing.xml library +
  • Several bug fixes for parsing of shape data +
  • Support for linear and radial gradients +
  • Support for additional types of shapes +
  • Added compound shapes (shapes with interior points) +
  • Added methods to get shapes from an internal table +
+ + Revision 10/31/06 by flux +
    +
  • Now properly supports Processing 0118 +
  • Fixed a bunch of things for Casey's students and general buggity. +
  • Will now properly draw #FFFFFFFF colors (were being represented as -1) +
  • SVGs without tags are now properly caught and loaded +
  • Added a method customStyle() for overriding SVG colors/styles +
  • Added a method SVGStyle() to go back to using SVG colors/styles +
+ + Some SVG objects and features may not yet be supported. + Here is a partial list of non-included features +
    +
  • Rounded rectangles +
  • Drop shadow objects +
  • Typography +
  • Layers added for Candy 2 +
  • Patterns +
  • Embedded images +
+ + For those interested, the SVG specification can be found + here. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PShape
BEZIER_VERTEX, BREAK, CURVE_VERTEX, GEOMETRY, GROUP, height, PATH, PRIMITIVE, VERTEX, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PShapeSVG(PApplet parent, + java.lang.String filename) + +
+          Initializes a new SVG Object with the given filename.
PShapeSVG(PShapeSVG parent, + XMLElement properties) + +
+           
PShapeSVG(XMLElement svg) + +
+          Initializes a new SVG Object from the given XMLElement.
+  + + + + + + + + + + + + + + + +
+Method Summary
+ PShapegetChild(java.lang.String name) + +
+          Get a particular element based on its SVG ID.
+ voidprint() + +
+          Prints out the SVG document.
+ + + + + + + +
Methods inherited from class processing.core.PShape
addChild, apply, applyMatrix, applyMatrix, applyMatrix, applyMatrix, disableStyle, draw, drawImpl, enableStyle, findChild, getChild, getChildCount, getHeight, getName, getWidth, isVisible, post, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, setName, setVisible, translate, translate
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PShapeSVG

+
+public PShapeSVG(PApplet parent,
+                 java.lang.String filename)
+
+
Initializes a new SVG Object with the given filename. +

+

+
+ +

+PShapeSVG

+
+public PShapeSVG(XMLElement svg)
+
+
Initializes a new SVG Object from the given XMLElement. +

+

+
+ +

+PShapeSVG

+
+public PShapeSVG(PShapeSVG parent,
+                 XMLElement properties)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getChild

+
+public PShape getChild(java.lang.String name)
+
+
Get a particular element based on its SVG ID. When editing SVG by hand, + this is the id="" tag on any SVG element. When editing from Illustrator, + these IDs can be edited by expanding the layers palette. The names used + in the layers palette, both for the layers or the shapes and groups + beneath them can be used here. +
+ // This code grabs "Layer 3" and the shapes beneath it.
+ SVG layer3 = svg.getChild("Layer 3");
+ 
+

+

+
Overrides:
getChild in class PShape
+
+
+
+
+
+
+ +

+print

+
+public void print()
+
+
Prints out the SVG document. Useful for parsing. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PSmoothTriangle.html b/build/javadoc/everything/processing/core/PSmoothTriangle.html new file mode 100644 index 000000000..936200b59 --- /dev/null +++ b/build/javadoc/everything/processing/core/PSmoothTriangle.html @@ -0,0 +1,490 @@ + + + + + +PSmoothTriangle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PSmoothTriangle

+
+java.lang.Object
+  extended by processing.core.PSmoothTriangle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PSmoothTriangle
extends java.lang.Object
implements PConstants
+ + +

+Smoothed triangle renderer for P3D. + + Based off of the PPolygon class in old versions of Processing. + Name and location of this class will change in a future release. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, UP, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS
+  + + + + + + + + + + +
+Constructor Summary
PSmoothTriangle(PGraphics3D iparent) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ float[]nextVertex() + +
+           
+ voidrender() + +
+           
+ voidreset(int count) + +
+           
+ voidsetCamVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+          Pass camera-space coordinates for the triangle.
+ voidsetIntensities(float ar, + float ag, + float ab, + float aa, + float br, + float bg, + float bb, + float ba, + float cr, + float cg, + float cb, + float ca) + +
+           
+ voidsetVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+           
+ voidtexture(PImage image) + +
+           
+ voidunexpand() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PSmoothTriangle

+
+public PSmoothTriangle(PGraphics3D iparent)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset(int count)
+
+
+
+
+
+
+
+
+
+ +

+nextVertex

+
+public float[] nextVertex()
+
+
+
+
+
+
+
+
+
+ +

+texture

+
+public void texture(PImage image)
+
+
+
+
+
+
+
+
+
+ +

+render

+
+public void render()
+
+
+
+
+
+
+
+
+
+ +

+unexpand

+
+public void unexpand()
+
+
+
+
+
+
+
+
+
+ +

+setCamVertices

+
+public void setCamVertices(float x0,
+                           float y0,
+                           float z0,
+                           float x1,
+                           float y1,
+                           float z1,
+                           float x2,
+                           float y2,
+                           float z2)
+
+
Pass camera-space coordinates for the triangle. + Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. + Generally this will not need to be called manually, + currently called from PGraphics3D.render_triangles() +

+

+
+
+
+
+
+
+
+ +

+setVertices

+
+public void setVertices(float x0,
+                        float y0,
+                        float z0,
+                        float x1,
+                        float y1,
+                        float z1,
+                        float x2,
+                        float y2,
+                        float z2)
+
+
+
+
+
+
+
+
+
+ +

+setIntensities

+
+public void setIntensities(float ar,
+                           float ag,
+                           float ab,
+                           float aa,
+                           float br,
+                           float bg,
+                           float bb,
+                           float ba,
+                           float cr,
+                           float cg,
+                           float cb,
+                           float ca)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PStyle.html b/build/javadoc/everything/processing/core/PStyle.html new file mode 100644 index 000000000..1211d0c09 --- /dev/null +++ b/build/javadoc/everything/processing/core/PStyle.html @@ -0,0 +1,860 @@ + + + + + +PStyle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PStyle

+
+java.lang.Object
+  extended by processing.core.PStyle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PStyle
extends java.lang.Object
implements PConstants
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatambientB + +
+           
+ floatambientG + +
+           
+ floatambientR + +
+           
+ intcolorMode + +
+           
+ floatcolorModeA + +
+           
+ floatcolorModeX + +
+           
+ floatcolorModeY + +
+           
+ floatcolorModeZ + +
+           
+ intellipseMode + +
+           
+ floatemissiveB + +
+           
+ floatemissiveG + +
+           
+ floatemissiveR + +
+           
+ booleanfill + +
+           
+ intfillColor + +
+           
+ intimageMode + +
+           
+ intrectMode + +
+           
+ intshapeMode + +
+           
+ floatshininess + +
+           
+ floatspecularB + +
+           
+ floatspecularG + +
+           
+ floatspecularR + +
+           
+ booleanstroke + +
+           
+ intstrokeCap + +
+           
+ intstrokeColor + +
+           
+ intstrokeJoin + +
+           
+ floatstrokeWeight + +
+           
+ inttextAlign + +
+           
+ inttextAlignY + +
+           
+ PFonttextFont + +
+           
+ floattextLeading + +
+           
+ inttextMode + +
+           
+ floattextSize + +
+           
+ booleantint + +
+           
+ inttintColor + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PStyle() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+imageMode

+
+public int imageMode
+
+
+
+
+
+ +

+rectMode

+
+public int rectMode
+
+
+
+
+
+ +

+ellipseMode

+
+public int ellipseMode
+
+
+
+
+
+ +

+shapeMode

+
+public int shapeMode
+
+
+
+
+
+ +

+colorMode

+
+public int colorMode
+
+
+
+
+
+ +

+colorModeX

+
+public float colorModeX
+
+
+
+
+
+ +

+colorModeY

+
+public float colorModeY
+
+
+
+
+
+ +

+colorModeZ

+
+public float colorModeZ
+
+
+
+
+
+ +

+colorModeA

+
+public float colorModeA
+
+
+
+
+
+ +

+tint

+
+public boolean tint
+
+
+
+
+
+ +

+tintColor

+
+public int tintColor
+
+
+
+
+
+ +

+fill

+
+public boolean fill
+
+
+
+
+
+ +

+fillColor

+
+public int fillColor
+
+
+
+
+
+ +

+stroke

+
+public boolean stroke
+
+
+
+
+
+ +

+strokeColor

+
+public int strokeColor
+
+
+
+
+
+ +

+strokeWeight

+
+public float strokeWeight
+
+
+
+
+
+ +

+strokeCap

+
+public int strokeCap
+
+
+
+
+
+ +

+strokeJoin

+
+public int strokeJoin
+
+
+
+
+
+ +

+ambientR

+
+public float ambientR
+
+
+
+
+
+ +

+ambientG

+
+public float ambientG
+
+
+
+
+
+ +

+ambientB

+
+public float ambientB
+
+
+
+
+
+ +

+specularR

+
+public float specularR
+
+
+
+
+
+ +

+specularG

+
+public float specularG
+
+
+
+
+
+ +

+specularB

+
+public float specularB
+
+
+
+
+
+ +

+emissiveR

+
+public float emissiveR
+
+
+
+
+
+ +

+emissiveG

+
+public float emissiveG
+
+
+
+
+
+ +

+emissiveB

+
+public float emissiveB
+
+
+
+
+
+ +

+shininess

+
+public float shininess
+
+
+
+
+
+ +

+textFont

+
+public PFont textFont
+
+
+
+
+
+ +

+textAlign

+
+public int textAlign
+
+
+
+
+
+ +

+textAlignY

+
+public int textAlignY
+
+
+
+
+
+ +

+textMode

+
+public int textMode
+
+
+
+
+
+ +

+textSize

+
+public float textSize
+
+
+
+
+
+ +

+textLeading

+
+public float textLeading
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PStyle

+
+public PStyle()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PTriangle.html b/build/javadoc/everything/processing/core/PTriangle.html new file mode 100644 index 000000000..eec565f07 --- /dev/null +++ b/build/javadoc/everything/processing/core/PTriangle.html @@ -0,0 +1,643 @@ + + + + + +PTriangle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PTriangle

+
+java.lang.Object
+  extended by processing.core.PTriangle
+
+
+
All Implemented Interfaces:
PConstants
+
+
+
+
public class PTriangle
extends java.lang.Object
implements PConstants
+ + +

+Handles rendering of single (tesselated) triangles in 3D. +

+ Originally written by sami (www.sumea.com) +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ booleanINTERPOLATE_ALPHA + +
+           
+ booleanINTERPOLATE_RGB + +
+           
+ booleanINTERPOLATE_UV + +
+           
+ intm_drawFlags + +
+           
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PTriangle(PGraphics3D g) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidrender() + +
+          Renders the polygon
+ voidreset() + +
+          Resets polygon attributes
+ voidsetCamVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+          Pass camera-space coordinates for the triangle.
+ voidsetCulling(boolean tf) + +
+          Sets backface culling on/off
+ voidsetIntensities(float r0, + float g0, + float b0, + float a0, + float r1, + float g1, + float b1, + float a1, + float r2, + float g2, + float b2, + float a2) + +
+          Sets vertex intensities in 0xRRGGBBAA format
+static voidsetInterpPower(int pwr) + +
+          Set the power of two used for linear interpolation of texture coordinates.
+ voidsetTexture(PImage image) + +
+          Sets texture image used for the polygon
+ voidsetUV(float[] u, + float[] v) + +
+           
+ voidsetUV(float u0, + float v0, + float u1, + float v1, + float u2, + float v2) + +
+          Sets the UV coordinates of the texture
+ voidsetVertices(float x0, + float y0, + float z0, + float x1, + float y1, + float z1, + float x2, + float y2, + float z2) + +
+          Sets vertex coordinates for the triangle
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+INTERPOLATE_UV

+
+public boolean INTERPOLATE_UV
+
+
+
+
+
+ +

+INTERPOLATE_RGB

+
+public boolean INTERPOLATE_RGB
+
+
+
+
+
+ +

+INTERPOLATE_ALPHA

+
+public boolean INTERPOLATE_ALPHA
+
+
+
+
+
+ +

+m_drawFlags

+
+public int m_drawFlags
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PTriangle

+
+public PTriangle(PGraphics3D g)
+
+
+ + + + + + + + +
+Method Detail
+ +

+reset

+
+public void reset()
+
+
Resets polygon attributes +

+

+
+
+
+
+
+
+
+ +

+setCulling

+
+public void setCulling(boolean tf)
+
+
Sets backface culling on/off +

+

+
+
+
+
+
+
+
+ +

+setVertices

+
+public void setVertices(float x0,
+                        float y0,
+                        float z0,
+                        float x1,
+                        float y1,
+                        float z1,
+                        float x2,
+                        float y2,
+                        float z2)
+
+
Sets vertex coordinates for the triangle +

+

+
+
+
+
+
+
+
+ +

+setCamVertices

+
+public void setCamVertices(float x0,
+                           float y0,
+                           float z0,
+                           float x1,
+                           float y1,
+                           float z1,
+                           float x2,
+                           float y2,
+                           float z2)
+
+
Pass camera-space coordinates for the triangle. + Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. + Generally this will not need to be called manually, + currently called from PGraphics3D.render_triangles() +

+

+
+
+
+
+
+
+
+ +

+setUV

+
+public void setUV(float u0,
+                  float v0,
+                  float u1,
+                  float v1,
+                  float u2,
+                  float v2)
+
+
Sets the UV coordinates of the texture +

+

+
+
+
+
+
+
+
+ +

+setIntensities

+
+public void setIntensities(float r0,
+                           float g0,
+                           float b0,
+                           float a0,
+                           float r1,
+                           float g1,
+                           float b1,
+                           float a1,
+                           float r2,
+                           float g2,
+                           float b2,
+                           float a2)
+
+
Sets vertex intensities in 0xRRGGBBAA format +

+

+
+
+
+
+
+
+
+ +

+setTexture

+
+public void setTexture(PImage image)
+
+
Sets texture image used for the polygon +

+

+
+
+
+
+
+
+
+ +

+setUV

+
+public void setUV(float[] u,
+                  float[] v)
+
+
+
+
+
+
+
+
+
+ +

+render

+
+public void render()
+
+
Renders the polygon +

+

+
+
+
+
+
+
+
+ +

+setInterpPower

+
+public static void setInterpPower(int pwr)
+
+
Set the power of two used for linear interpolation of texture coordinates. + A true texture coordinate is computed every 2^pwr pixels along a scanline. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/PVector.html b/build/javadoc/everything/processing/core/PVector.html new file mode 100644 index 000000000..cdbb3c268 --- /dev/null +++ b/build/javadoc/everything/processing/core/PVector.html @@ -0,0 +1,1278 @@ + + + + + +PVector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.core +
+Class PVector

+
+java.lang.Object
+  extended by processing.core.PVector
+
+
+
+
public class PVector
extends java.lang.Object
+ + +

+A class to describe a two or three dimensional vector. +

+ The result of all functions are applied to the vector itself, with the + exception of cross(), which returns a new PVector (or writes to a specified + 'target' PVector). That is, add() will add the contents of one vector to + this one. Using add() with additional parameters allows you to put the + result into a new PVector. Functions that act on multiple vectors also + include static versions. Because creating new objects can be computationally + expensive, most functions include an optional 'target' PVector, so that a + new PVector object is not created with each operation. +

+ Initially based on the Vector3D class by Dan Shiffman. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + +
+Field Summary
+ floatx + +
+          The x component of the vector.
+ floaty + +
+          The y component of the vector.
+ floatz + +
+          The z component of the vector.
+  + + + + + + + + + + + + + + + + +
+Constructor Summary
PVector() + +
+          Constructor for an empty vector: x, y, and z are set to 0.
PVector(float x, + float y) + +
+          Constructor for a 2D vector: z coordinate is set to 0.
PVector(float x, + float y, + float z) + +
+          Constructor for a 3D vector.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(float x, + float y, + float z) + +
+           
+ voidadd(PVector v) + +
+          Add a vector to this vector
+static PVectoradd(PVector v1, + PVector v2) + +
+          Add two vectors
+static PVectoradd(PVector v1, + PVector v2, + PVector target) + +
+          Add two vectors into a target vector
+static floatangleBetween(PVector v1, + PVector v2) + +
+          Calculate the angle between two vectors, using the dot product
+ float[]array() + +
+          Return a representation of this vector as a float array.
+ PVectorcross(PVector v) + +
+          Return a vector composed of the cross product between this and another.
+ PVectorcross(PVector v, + PVector target) + +
+          Perform cross product between this and another vector, and store the + result in 'target'.
+static PVectorcross(PVector v1, + PVector v2, + PVector target) + +
+           
+ floatdist(PVector v) + +
+          Calculate the Euclidean distance between two points (considering a point as a vector object)
+static floatdist(PVector v1, + PVector v2) + +
+          Calculate the Euclidean distance between two points (considering a point as a vector object)
+ voiddiv(float n) + +
+          Divide this vector by a scalar
+ voiddiv(PVector v) + +
+          Divide each element of one vector by the elements of another vector.
+static PVectordiv(PVector v, + float n) + +
+          Divide a vector by a scalar and return the result in a new vector.
+static PVectordiv(PVector v, + float n, + PVector target) + +
+           
+static PVectordiv(PVector v1, + PVector v2) + +
+          Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector.
+static PVectordiv(PVector v1, + PVector v2, + PVector target) + +
+          Divide each element of one vector by the individual elements of another + vector, and write the result into a target vector.
+ floatdot(float x, + float y, + float z) + +
+           
+ floatdot(PVector v) + +
+          Calculate the dot product with another vector
+ PVectorget() + +
+          Get a copy of this vector.
+ float[]get(float[] target) + +
+           
+ floatheading2D() + +
+          Calculate the angle of rotation for this vector (only 2D vectors)
+ voidlimit(float max) + +
+          Limit the magnitude of this vector
+ floatmag() + +
+          Calculate the magnitude (length) of the vector
+ voidmult(float n) + +
+          Multiply this vector by a scalar
+ voidmult(PVector v) + +
+          Multiply each element of one vector by the elements of another vector.
+static PVectormult(PVector v, + float n) + +
+          Multiply a vector by a scalar
+static PVectormult(PVector v, + float n, + PVector target) + +
+          Multiply a vector by a scalar, and write the result into a target PVector.
+static PVectormult(PVector v1, + PVector v2) + +
+          Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector.
+static PVectormult(PVector v1, + PVector v2, + PVector target) + +
+          Multiply each element of one vector by the individual elements of another + vector, and write the result into a target vector.
+ voidnormalize() + +
+          Normalize the vector to length 1 (make it a unit vector)
+ PVectornormalize(PVector target) + +
+          Normalize this vector, storing the result in another vector.
+ voidset(float[] source) + +
+          Set the x, y (and maybe z) coordinates using a float[] array as the source.
+ voidset(float x, + float y, + float z) + +
+          Set x, y, and z coordinates.
+ voidset(PVector v) + +
+          Set x, y, and z coordinates from a Vector3D object.
+ voidsub(float x, + float y, + float z) + +
+           
+ voidsub(PVector v) + +
+          Subtract a vector from this vector
+static PVectorsub(PVector v1, + PVector v2) + +
+          Subtract one vector from another
+static PVectorsub(PVector v1, + PVector v2, + PVector target) + +
+           
+ java.lang.StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+x

+
+public float x
+
+
The x component of the vector. +

+

+
+
+
+ +

+y

+
+public float y
+
+
The y component of the vector. +

+

+
+
+
+ +

+z

+
+public float z
+
+
The z component of the vector. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PVector

+
+public PVector()
+
+
Constructor for an empty vector: x, y, and z are set to 0. +

+

+
+ +

+PVector

+
+public PVector(float x,
+               float y,
+               float z)
+
+
Constructor for a 3D vector. +

+

+
Parameters:
x - the x coordinate.
y - the y coordinate.
z - the y coordinate.
+
+
+ +

+PVector

+
+public PVector(float x,
+               float y)
+
+
Constructor for a 2D vector: z coordinate is set to 0. +

+

+
Parameters:
x - the x coordinate.
y - the y coordinate.
+
+ + + + + + + + +
+Method Detail
+ +

+set

+
+public void set(float x,
+                float y,
+                float z)
+
+
Set x, y, and z coordinates. +

+

+
Parameters:
x - the x coordinate.
y - the y coordinate.
z - the z coordinate.
+
+
+
+ +

+set

+
+public void set(PVector v)
+
+
Set x, y, and z coordinates from a Vector3D object. +

+

+
Parameters:
v - the PVector object to be copied
+
+
+
+ +

+set

+
+public void set(float[] source)
+
+
Set the x, y (and maybe z) coordinates using a float[] array as the source. +

+

+
Parameters:
source - array to copy from
+
+
+
+ +

+get

+
+public PVector get()
+
+
Get a copy of this vector. +

+

+
+
+
+
+ +

+get

+
+public float[] get(float[] target)
+
+
+
+
+
+
+ +

+mag

+
+public float mag()
+
+
Calculate the magnitude (length) of the vector +

+

+ +
Returns:
the magnitude of the vector
+
+
+
+ +

+add

+
+public void add(PVector v)
+
+
Add a vector to this vector +

+

+
Parameters:
v - the vector to be added
+
+
+
+ +

+add

+
+public void add(float x,
+                float y,
+                float z)
+
+
+
+
+
+
+ +

+add

+
+public static PVector add(PVector v1,
+                          PVector v2)
+
+
Add two vectors +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
a new vector that is the sum of v1 and v2
+
+
+
+ +

+add

+
+public static PVector add(PVector v1,
+                          PVector v2,
+                          PVector target)
+
+
Add two vectors into a target vector +

+

+
Parameters:
v1 - a vector
v2 - another vector
target - the target vector (if null, a new vector will be created) +
Returns:
a new vector that is the sum of v1 and v2
+
+
+
+ +

+sub

+
+public void sub(PVector v)
+
+
Subtract a vector from this vector +

+

+
Parameters:
v - the vector to be subtracted
+
+
+
+ +

+sub

+
+public void sub(float x,
+                float y,
+                float z)
+
+
+
+
+
+
+ +

+sub

+
+public static PVector sub(PVector v1,
+                          PVector v2)
+
+
Subtract one vector from another +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
a new vector that is v1 - v2
+
+
+
+ +

+sub

+
+public static PVector sub(PVector v1,
+                          PVector v2,
+                          PVector target)
+
+
+
+
+
+
+ +

+mult

+
+public void mult(float n)
+
+
Multiply this vector by a scalar +

+

+
Parameters:
n - the value to multiply by
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v,
+                           float n)
+
+
Multiply a vector by a scalar +

+

+
Parameters:
v - a vector
n - scalar +
Returns:
a new vector that is v1 * n
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v,
+                           float n,
+                           PVector target)
+
+
Multiply a vector by a scalar, and write the result into a target PVector. +

+

+
Parameters:
v - a vector
n - scalar
target - PVector to store the result +
Returns:
the target vector, now set to v1 * n
+
+
+
+ +

+mult

+
+public void mult(PVector v)
+
+
Multiply each element of one vector by the elements of another vector. +

+

+
Parameters:
v - the vector to multiply by
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v1,
+                           PVector v2)
+
+
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +

+

+
+
+
+
+ +

+mult

+
+public static PVector mult(PVector v1,
+                           PVector v2,
+                           PVector target)
+
+
Multiply each element of one vector by the individual elements of another + vector, and write the result into a target vector. +

+

+
Parameters:
v1 - the first vector
v2 - the second vector
target - PVector to store the result
+
+
+
+ +

+div

+
+public void div(float n)
+
+
Divide this vector by a scalar +

+

+
Parameters:
n - the value to divide by
+
+
+
+ +

+div

+
+public static PVector div(PVector v,
+                          float n)
+
+
Divide a vector by a scalar and return the result in a new vector. +

+

+
Parameters:
v - a vector
n - scalar +
Returns:
a new vector that is v1 / n
+
+
+
+ +

+div

+
+public static PVector div(PVector v,
+                          float n,
+                          PVector target)
+
+
+
+
+
+
+ +

+div

+
+public void div(PVector v)
+
+
Divide each element of one vector by the elements of another vector. +

+

+
+
+
+
+ +

+div

+
+public static PVector div(PVector v1,
+                          PVector v2)
+
+
Multiply each element of one vector by the individual elements of another + vector, and return the result as a new PVector. +

+

+
+
+
+
+ +

+div

+
+public static PVector div(PVector v1,
+                          PVector v2,
+                          PVector target)
+
+
Divide each element of one vector by the individual elements of another + vector, and write the result into a target vector. +

+

+
Parameters:
v1 - the first vector
v2 - the second vector
target - PVector to store the result
+
+
+
+ +

+dist

+
+public float dist(PVector v)
+
+
Calculate the Euclidean distance between two points (considering a point as a vector object) +

+

+
Parameters:
v - another vector +
Returns:
the Euclidean distance between
+
+
+
+ +

+dist

+
+public static float dist(PVector v1,
+                         PVector v2)
+
+
Calculate the Euclidean distance between two points (considering a point as a vector object) +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
the Euclidean distance between v1 and v2
+
+
+
+ +

+dot

+
+public float dot(PVector v)
+
+
Calculate the dot product with another vector +

+

+ +
Returns:
the dot product
+
+
+
+ +

+dot

+
+public float dot(float x,
+                 float y,
+                 float z)
+
+
+
+
+
+
+ +

+cross

+
+public PVector cross(PVector v)
+
+
Return a vector composed of the cross product between this and another. +

+

+
+
+
+
+ +

+cross

+
+public PVector cross(PVector v,
+                     PVector target)
+
+
Perform cross product between this and another vector, and store the + result in 'target'. If target is null, a new vector is created. +

+

+
+
+
+
+ +

+cross

+
+public static PVector cross(PVector v1,
+                            PVector v2,
+                            PVector target)
+
+
+
+
+
+
+ +

+normalize

+
+public void normalize()
+
+
Normalize the vector to length 1 (make it a unit vector) +

+

+
+
+
+
+ +

+normalize

+
+public PVector normalize(PVector target)
+
+
Normalize this vector, storing the result in another vector. +

+

+
Parameters:
target - Set to null to create a new vector +
Returns:
a new vector (if target was null), or target
+
+
+
+ +

+limit

+
+public void limit(float max)
+
+
Limit the magnitude of this vector +

+

+
Parameters:
max - the maximum length to limit this vector
+
+
+
+ +

+heading2D

+
+public float heading2D()
+
+
Calculate the angle of rotation for this vector (only 2D vectors) +

+

+ +
Returns:
the angle of rotation
+
+
+
+ +

+angleBetween

+
+public static float angleBetween(PVector v1,
+                                 PVector v2)
+
+
Calculate the angle between two vectors, using the dot product +

+

+
Parameters:
v1 - a vector
v2 - another vector +
Returns:
the angle between the vectors
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+
+ +

+array

+
+public float[] array()
+
+
Return a representation of this vector as a float array. This is only for + temporary use. If used in any other fashion, the contents should be copied + by using the get() command to copy into your own array. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/package-frame.html b/build/javadoc/everything/processing/core/package-frame.html new file mode 100644 index 000000000..9903befa9 --- /dev/null +++ b/build/javadoc/everything/processing/core/package-frame.html @@ -0,0 +1,87 @@ + + + + + +processing.core + + + + + + + + + + + +processing.core + + + + +
+Interfaces  + +
+PConstants +
+PMatrix
+ + + + + + +
+Classes  + +
+PApplet +
+PFont +
+PGraphics +
+PGraphics2D +
+PGraphics3D +
+PGraphicsJava2D +
+PImage +
+PLine +
+PMatrix2D +
+PMatrix3D +
+PPolygon +
+PShape +
+PShapeSVG +
+PSmoothTriangle +
+PStyle +
+PTriangle +
+PVector
+ + + + + + +
+Exceptions  + +
+PApplet.RendererChangeException
+ + + + diff --git a/build/javadoc/everything/processing/core/package-summary.html b/build/javadoc/everything/processing/core/package-summary.html new file mode 100644 index 000000000..02c6f9d9b --- /dev/null +++ b/build/javadoc/everything/processing/core/package-summary.html @@ -0,0 +1,249 @@ + + + + + +processing.core + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.core +

+ + + + + + + + + + + + + +
+Interface Summary
PConstantsNumbers shared throughout processing.core.
PMatrix 
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
PAppletBase class for all sketches that use processing.core.
PFontGrayscale bitmap font class used by Processing.
PGraphicsMain graphics and rendering context, as well as the base API implementation.
PGraphics2DSubclass of PGraphics that handles fast 2D rendering using a + MemoryImageSource.
PGraphics3DSubclass of PGraphics that handles 3D rendering.
PGraphicsJava2DSubclass for PGraphics that implements the graphics API using Java2D.
PImageStorage class for pixel data.
PLineCode for rendering lines with P2D and P3D.
PMatrix2D3x2 affine matrix implementation.
PMatrix3D4x4 matrix implementation.
PPolygonZ-buffer polygon rendering object used by PGraphics2D.
PShapeIn-progress class to handle shape data, currently to be considered of + alpha or beta quality.
PShapeSVGSVG stands for Scalable Vector Graphics, a portable graphics format.
PSmoothTriangleSmoothed triangle renderer for P3D.
PStyle 
PTriangleHandles rendering of single (tesselated) triangles in 3D.
PVectorA class to describe a two or three dimensional vector.
+  + +

+ + + + + + + + + +
+Exception Summary
PApplet.RendererChangeExceptionException thrown when size() is called the first time.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/core/package-tree.html b/build/javadoc/everything/processing/core/package-tree.html new file mode 100644 index 000000000..ea06426b2 --- /dev/null +++ b/build/javadoc/everything/processing/core/package-tree.html @@ -0,0 +1,186 @@ + + + + + +processing.core Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.core +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/dxf/RawDXF.html b/build/javadoc/everything/processing/dxf/RawDXF.html new file mode 100644 index 000000000..6be4db545 --- /dev/null +++ b/build/javadoc/everything/processing/dxf/RawDXF.html @@ -0,0 +1,714 @@ + + + + + +RawDXF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.dxf +
+Class RawDXF

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphics3D
+              extended by processing.dxf.RawDXF
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class RawDXF
extends PGraphics3D
+ + +

+A simple library to write DXF files with Processing. + Because this is used with beginRaw() and endRaw(), only individual + triangles and (discontinuous) line segments will be written to the file. +

+ Use something like a keyPressed() in PApplet to trigger it, + to avoid writing a bazillion .dxf files. +

+ Usually, the file will be saved to the sketch's folder. + Use Sketch → Show Sketch Folder to see it from the PDE. +

+ A simple example of how to use: +

+ import processing.dxf.*;
+
+ boolean record;
+
+ void setup() {
+   size(500, 500, P3D);
+ }
+
+ void keyPressed() {
+   // use a key press so that it doesn't make a million files
+   if (key == 'r') record = true;
+ }
+
+ void draw() {
+   if (record) {
+     beginRaw(DXF, "output.dxf");
+   }
+
+   // do all your drawing here
+
+   if (record) {
+     endRaw();
+     record = false;
+   }
+ }
+ 
+ or to use it and be able to control the current layer: +
+ import processing.dxf.*;
+
+ boolean record;
+ RawDXF dxf;
+
+ void setup() {
+   size(500, 500, P3D);
+ }
+
+ void keyPressed() {
+   // use a key press so that it doesn't make a million files
+   if (key == 'r') record = true;
+ }
+
+ void draw() {
+   if (record) {
+     dxf = (RawDXF) createGraphics(width, height, DXF, "output.dxf");
+     beginRaw(dxf);
+   }
+
+   // do all your drawing here, and to set the layer, call:
+   // if (record) {
+   //   dxf.setLayer(num);
+   // }
+   // where 'num' is an integer.
+   // the default is zero, or you can set it to whatever.
+
+   if (record) {
+     endRaw();
+     record = false;
+     dxf = null;
+   }
+ }
+ 
+ Note that even though this class is a subclass of PGraphics, it only + implements the parts of the API that are necessary for beginRaw/endRaw. +

+ Based on the original DXF writer from Simon Greenwold, February 2004. + Updated for Processing 0070 by Ben Fry in September 2004, + and again for Processing beta in April 2005. + Rewritten to support beginRaw/endRaw by Ben Fry in February 2006. + Updated again for inclusion as a core library in March 2006. + Constructor modifications in September 2008 as we approach 1.0. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PGraphics3D
camera, cameraAspect, cameraFar, cameraFOV, cameraNear, cameraX, cameraY, cameraZ, currentLightFalloffConstant, currentLightFalloffLinear, currentLightFalloffQuadratic, currentLightSpecular, lightCount, lightDiffuse, lightFalloffConstant, lightFalloffLinear, lightFalloffQuadratic, lightNormal, lightPosition, lightSpecular, lightSpotAngle, lightSpotAngleCos, lightSpotConcentration, lightType, line, MAX_LIGHTS, modelview, modelviewInv, projection, smoothTriangle, TRI_COLOR_COUNT, TRI_DIFFUSE_A, TRI_DIFFUSE_B, TRI_DIFFUSE_G, TRI_DIFFUSE_R, TRI_SPECULAR_B, TRI_SPECULAR_G, TRI_SPECULAR_R, triangle, zbuffer
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
RawDXF() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidbeginShape(int kind) + +
+          Start a new shape.
+ booleandisplayable() + +
+          Return true if this renderer should be drawn to the screen.
+ voiddispose() + +
+          Handle any takedown for this graphics context.
+ voidendDraw() + +
+          See notes in PGraphics.
+ voidendShape(int mode) + +
+           
+ voidprintln(java.lang.String what) + +
+          Write a line to the dxf file.
+ voidsetLayer(int layer) + +
+          Set the current layer being used in the DXF file.
+ voidsetPath(java.lang.String path) + +
+           
+ voidvertex(float x, + float y) + +
+           
+ voidvertex(float x, + float y, + float z) + +
+           
+ voidwrite(java.lang.String cmd, + float val) + +
+          Write a command on one line (as a String), then start a new line + and write out a formatted float.
+ + + + + + + +
Methods inherited from class processing.core.PGraphics3D
ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, applyMatrix, beginCamera, box, camera, camera, directionalLight, endCamera, flush, frustum, getMatrix, getMatrix, hint, is2D, is3D, lightFalloff, lights, lightSpecular, modelX, modelY, modelZ, noLights, noSmooth, ortho, ortho, perspective, perspective, pointLight, popMatrix, printCamera, printMatrix, printProjection, pushMatrix, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, setMatrix, setMatrix, setSize, smooth, sphere, spotLight, strokeCap, strokeJoin, texture, translate, translate, vertex
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, applyMatrix, arc, background, background, background, background, background, background, background, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, box, breakShape, brightness, canDraw, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, edge, ellipse, ellipseMode, emissive, emissive, emissive, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getStyle, getStyle, green, hue, image, image, image, imageMode, lerpColor, lerpColor, line, line, noFill, normal, noStroke, noTint, point, point, popStyle, pushStyle, quad, rect, rectMode, red, saturation, setMatrix, setParent, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, stroke, stroke, stroke, stroke, stroke, stroke, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+RawDXF

+
+public RawDXF()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setPath

+
+public void setPath(java.lang.String path)
+
+
+
Overrides:
setPath in class PGraphics
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Description copied from class: PGraphics
+
Handle any takedown for this graphics context. +

+ This is called when a sketch is shut down and this renderer was + specified using the size() command, or inside endRecord() and + endRaw(), in order to shut things off. +

+

+
Overrides:
dispose in class PGraphics
+
+
+
+
+
+
+ +

+displayable

+
+public boolean displayable()
+
+
Description copied from class: PGraphics
+
Return true if this renderer should be drawn to the screen. Defaults to + returning true, since nearly all renderers are on-screen beasts. But can + be overridden for subclasses like PDF so that a window doesn't open up. +

+ A better name? showFrame, displayable, isVisible, visible, shouldDisplay, + what to call this? +

+

+
Overrides:
displayable in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics3D
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics3D
+
See notes in PGraphics. + If z-sorting has been turned on, then the triangles will + all be quicksorted here (to make alpha work more properly) + and then blit to the screen. +

+

+
Overrides:
endDraw in class PGraphics3D
+
+
+
+
+
+
+ +

+setLayer

+
+public void setLayer(int layer)
+
+
Set the current layer being used in the DXF file. + The default is zero. +

+

+
+
+
+
+ +

+write

+
+public void write(java.lang.String cmd,
+                  float val)
+
+
Write a command on one line (as a String), then start a new line + and write out a formatted float. Available for anyone who wants to + insert additional commands into the DXF stream. +

+

+
+
+
+
+ +

+println

+
+public void println(java.lang.String what)
+
+
Write a line to the dxf file. Available for anyone who wants to + insert additional commands into the DXF stream. +

+

+
+
+
+
+ +

+beginShape

+
+public void beginShape(int kind)
+
+
Description copied from class: PGraphics
+
Start a new shape. +

+ Differences between beginShape() and line() and point() methods. +

+ beginShape() is intended to be more flexible at the expense of being + a little more complicated to use. it handles more complicated shapes + that can consist of many connected lines (so you get joins) or lines + mixed with curves. +

+ The line() and point() command are for the far more common cases + (particularly for our audience) that simply need to draw a line + or a point on the screen. +

+ From the code side of things, line() may or may not call beginShape() + to do the drawing. In the beta code, they do, but in the alpha code, + they did not. they might be implemented one way or the other depending + on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + meaning the speed that things run at vs. the speed it takes me to write + the code and maintain it. for beta, the latter is most important so + that's how things are implemented. +

+

+
Overrides:
beginShape in class PGraphics3D
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y)
+
+
+
Overrides:
vertex in class PGraphics3D
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(float x,
+                   float y,
+                   float z)
+
+
+
Overrides:
vertex in class PGraphics
+
+
+
+
+
+
+ +

+endShape

+
+public void endShape(int mode)
+
+
+
Overrides:
endShape in class PGraphics3D
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/dxf/package-frame.html b/build/javadoc/everything/processing/dxf/package-frame.html new file mode 100644 index 000000000..f141fe6d4 --- /dev/null +++ b/build/javadoc/everything/processing/dxf/package-frame.html @@ -0,0 +1,31 @@ + + + + + +processing.dxf + + + + + + + + + + + +processing.dxf + + + + +
+Classes  + +
+RawDXF
+ + + + diff --git a/build/javadoc/everything/processing/dxf/package-summary.html b/build/javadoc/everything/processing/dxf/package-summary.html new file mode 100644 index 000000000..ea6460f5e --- /dev/null +++ b/build/javadoc/everything/processing/dxf/package-summary.html @@ -0,0 +1,151 @@ + + + + + +processing.dxf + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.dxf +

+ + + + + + + + + +
+Class Summary
RawDXFA simple library to write DXF files with Processing.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/dxf/package-tree.html b/build/javadoc/everything/processing/dxf/package-tree.html new file mode 100644 index 000000000..36e4e917b --- /dev/null +++ b/build/javadoc/everything/processing/dxf/package-tree.html @@ -0,0 +1,154 @@ + + + + + +processing.dxf Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.dxf +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/net/Client.html b/build/javadoc/everything/processing/net/Client.html new file mode 100644 index 000000000..df8a8204b --- /dev/null +++ b/build/javadoc/everything/processing/net/Client.html @@ -0,0 +1,800 @@ + + + + + +Client + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.net +
+Class Client

+
+java.lang.Object
+  extended by processing.net.Client
+
+
+
All Implemented Interfaces:
java.lang.Runnable
+
+
+
+
public class Client
extends java.lang.Object
implements java.lang.Runnable
+ + +

+


+ +

+ + + + + + + + + + + + + + + +
+Field Summary
+ java.io.InputStreaminput + +
+           
+ java.io.OutputStreamoutput + +
+           
+  + + + + + + + + + + + + + +
+Constructor Summary
Client(PApplet parent, + java.net.Socket socket) + +
+           
Client(PApplet parent, + java.lang.String host, + int port) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanactive() + +
+          Return true if this client is still active and hasn't run + into any trouble.
+ intavailable() + +
+          Returns the number of bytes that have been read from serial + and are waiting to be dealt with by the user.
+ voidclear() + +
+          Ignore all the bytes read so far and empty the buffer.
+ voiddispose() + +
+          Disconnect from the server: internal use only.
+ java.lang.Stringip() + +
+          Returns the ip address of this feller as a String.
+ intread() + +
+          Returns a number between 0 and 255 for the next byte that's + waiting in the buffer.
+ byte[]readBytes() + +
+          Return a byte array of anything that's in the serial buffer.
+ intreadBytes(byte[] outgoing) + +
+          Grab whatever is in the serial buffer, and stuff it into a + byte buffer passed in by the user.
+ byte[]readBytesUntil(int interesting) + +
+          Reads from the serial port into a buffer of bytes up to and + including a particular character.
+ intreadBytesUntil(int interesting, + byte[] outgoing) + +
+          Reads from the serial port into a buffer of bytes until a + particular character.
+ charreadChar() + +
+          Returns the next byte in the buffer as a char.
+ java.lang.StringreadString() + +
+          Return whatever has been read from the serial port so far + as a String.
+ java.lang.StringreadStringUntil(int interesting) + +
+          Combination of readBytesUntil and readString.
+ voidrun() + +
+           
+ voidstop() + +
+          Disconnect from the server and calls disconnectEvent(Client c) + in the host PApplet.
+ voidwrite(byte[] bytes) + +
+           
+ voidwrite(int what) + +
+          This will handle ints, bytes and chars transparently.
+ voidwrite(java.lang.String what) + +
+          Write a String to the output.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+input

+
+public java.io.InputStream input
+
+
+
+
+
+ +

+output

+
+public java.io.OutputStream output
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Client

+
+public Client(PApplet parent,
+              java.lang.String host,
+              int port)
+
+
+
+ +

+Client

+
+public Client(PApplet parent,
+              java.net.Socket socket)
+       throws java.io.IOException
+
+
+ +
Throws: +
java.io.IOException
+
+ + + + + + + + +
+Method Detail
+ +

+stop

+
+public void stop()
+
+
Disconnect from the server and calls disconnectEvent(Client c) + in the host PApplet. +

+ Use this to shut the connection if you're finished with it + while your applet is still running. Otherwise, it will be + automatically be shut down by the host PApplet + (using dispose, which is identical) +

+

+
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Disconnect from the server: internal use only. +

+ This should only be called by the internal functions in PApplet, + use stop() instead from within your own applets. +

+

+
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+active

+
+public boolean active()
+
+
Return true if this client is still active and hasn't run + into any trouble. +

+

+
+
+
+
+
+
+
+ +

+ip

+
+public java.lang.String ip()
+
+
Returns the ip address of this feller as a String. +

+

+
+
+
+
+
+
+
+ +

+available

+
+public int available()
+
+
Returns the number of bytes that have been read from serial + and are waiting to be dealt with by the user. +

+

+
+
+
+
+
+
+
+ +

+clear

+
+public void clear()
+
+
Ignore all the bytes read so far and empty the buffer. +

+

+
+
+
+
+
+
+
+ +

+read

+
+public int read()
+
+
Returns a number between 0 and 255 for the next byte that's + waiting in the buffer. + Returns -1 if there was no byte (although the user should + first check available() to see if things are ready to avoid this) +

+

+
+
+
+
+
+
+
+ +

+readChar

+
+public char readChar()
+
+
Returns the next byte in the buffer as a char. + Returns -1, or 0xffff, if nothing is there. +

+

+
+
+
+
+
+
+
+ +

+readBytes

+
+public byte[] readBytes()
+
+
Return a byte array of anything that's in the serial buffer. + Not particularly memory/speed efficient, because it creates + a byte array on each read, but it's easier to use than + readBytes(byte b[]) (see below). +

+

+
+
+
+
+
+
+
+ +

+readBytes

+
+public int readBytes(byte[] outgoing)
+
+
Grab whatever is in the serial buffer, and stuff it into a + byte buffer passed in by the user. This is more memory/time + efficient than readBytes() returning a byte[] array. + + Returns an int for how many bytes were read. If more bytes + are available than can fit into the byte array, only those + that will fit are read. +

+

+
+
+
+
+
+
+
+ +

+readBytesUntil

+
+public byte[] readBytesUntil(int interesting)
+
+
Reads from the serial port into a buffer of bytes up to and + including a particular character. If the character isn't in + the serial buffer, then 'null' is returned. +

+

+
+
+
+
+
+
+
+ +

+readBytesUntil

+
+public int readBytesUntil(int interesting,
+                          byte[] outgoing)
+
+
Reads from the serial port into a buffer of bytes until a + particular character. If the character isn't in the serial + buffer, then 'null' is returned. + + If outgoing[] is not big enough, then -1 is returned, + and an error message is printed on the console. + If nothing is in the buffer, zero is returned. + If 'interesting' byte is not in the buffer, then 0 is returned. +

+

+
+
+
+
+
+
+
+ +

+readString

+
+public java.lang.String readString()
+
+
Return whatever has been read from the serial port so far + as a String. It assumes that the incoming characters are ASCII. + + If you want to move Unicode data, you can first convert the + String to a byte stream in the representation of your choice + (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. +

+

+
+
+
+
+
+
+
+ +

+readStringUntil

+
+public java.lang.String readStringUntil(int interesting)
+
+
Combination of readBytesUntil and readString. See caveats in + each function. Returns null if it still hasn't found what + you're looking for. +

+ If you want to move Unicode data, you can first convert the + String to a byte stream in the representation of your choice + (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. +

+

+
+
+
+
+
+
+
+ +

+write

+
+public void write(int what)
+
+
This will handle ints, bytes and chars transparently. +

+

+
+
+
+
+
+
+
+ +

+write

+
+public void write(byte[] bytes)
+
+
+
+
+
+
+
+
+
+ +

+write

+
+public void write(java.lang.String what)
+
+
Write a String to the output. Note that this doesn't account + for Unicode (two bytes per char), nor will it send UTF8 + characters.. It assumes that you mean to send a byte buffer + (most often the case for networking and serial i/o) and + will only use the bottom 8 bits of each char in the string. + (Meaning that internally it uses String.getBytes) + + If you want to move Unicode data, you can first convert the + String to a byte stream in the representation of your choice + (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/net/Server.html b/build/javadoc/everything/processing/net/Server.html new file mode 100644 index 000000000..6faaca545 --- /dev/null +++ b/build/javadoc/everything/processing/net/Server.html @@ -0,0 +1,487 @@ + + + + + +Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.net +
+Class Server

+
+java.lang.Object
+  extended by processing.net.Server
+
+
+
All Implemented Interfaces:
java.lang.Runnable
+
+
+
+
public class Server
extends java.lang.Object
implements java.lang.Runnable
+ + +

+


+ +

+ + + + + + + + + + + + + + + +
+Field Summary
+ intclientCount + +
+          Number of clients currently connected.
+ Client[]clients + +
+          Array of client objects, useful length is determined by clientCount.
+  + + + + + + + + + + +
+Constructor Summary
Server(PApplet parent, + int port) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ Clientavailable() + +
+          Returns the next client in line that has something to say.
+ voiddisconnect(Client client) + +
+          Disconnect a particular client.
+ voiddispose() + +
+          Disconnect all clients and stop the server: internal use only.
+ voidrun() + +
+           
+ voidstop() + +
+          Disconnect all clients and stop the server.
+ voidwrite(byte[] what) + +
+          Write a byte array to all the connected clients.
+ voidwrite(int what) + +
+          Write a value to all the connected clients.
+ voidwrite(java.lang.String what) + +
+          Write a String to all the connected clients.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+clientCount

+
+public int clientCount
+
+
Number of clients currently connected. +

+

+
+
+
+ +

+clients

+
+public Client[] clients
+
+
Array of client objects, useful length is determined by clientCount. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Server

+
+public Server(PApplet parent,
+              int port)
+
+
+ + + + + + + + +
+Method Detail
+ +

+disconnect

+
+public void disconnect(Client client)
+
+
Disconnect a particular client. +

+

+
+
+
+
+
+
+
+ +

+available

+
+public Client available()
+
+
Returns the next client in line that has something to say. +

+

+
+
+
+
+
+
+
+ +

+stop

+
+public void stop()
+
+
Disconnect all clients and stop the server. +

+ Use this to shut down the server if you finish using it while your applet + is still running. Otherwise, it will be automatically be shut down by the + host PApplet using dispose(), which is identical. +

+

+
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Disconnect all clients and stop the server: internal use only. +

+

+
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+write

+
+public void write(int what)
+
+
Write a value to all the connected clients. + See Client.write() for operational details. +

+

+
+
+
+
+
+
+
+ +

+write

+
+public void write(byte[] what)
+
+
Write a byte array to all the connected clients. + See Client.write() for operational details. +

+

+
+
+
+
+
+
+
+ +

+write

+
+public void write(java.lang.String what)
+
+
Write a String to all the connected clients. + See Client.write() for operational details. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/net/package-frame.html b/build/javadoc/everything/processing/net/package-frame.html new file mode 100644 index 000000000..15fcd9ea4 --- /dev/null +++ b/build/javadoc/everything/processing/net/package-frame.html @@ -0,0 +1,33 @@ + + + + + +processing.net + + + + + + + + + + + +processing.net + + + + +
+Classes  + +
+Client +
+Server
+ + + + diff --git a/build/javadoc/everything/processing/net/package-summary.html b/build/javadoc/everything/processing/net/package-summary.html new file mode 100644 index 000000000..37060612c --- /dev/null +++ b/build/javadoc/everything/processing/net/package-summary.html @@ -0,0 +1,155 @@ + + + + + +processing.net + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.net +

+ + + + + + + + + + + + + +
+Class Summary
Client 
Server 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/net/package-tree.html b/build/javadoc/everything/processing/net/package-tree.html new file mode 100644 index 000000000..986736f6b --- /dev/null +++ b/build/javadoc/everything/processing/net/package-tree.html @@ -0,0 +1,148 @@ + + + + + +processing.net Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.net +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • processing.net.Client (implements java.lang.Runnable) +
    • processing.net.Server (implements java.lang.Runnable) +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.TessCallback.html b/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.TessCallback.html new file mode 100644 index 000000000..736054525 --- /dev/null +++ b/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.TessCallback.html @@ -0,0 +1,396 @@ + + + + + +PGraphicsOpenGL.TessCallback + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.opengl +
+Class PGraphicsOpenGL.TessCallback

+
+java.lang.Object
+  extended by javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+      extended by processing.opengl.PGraphicsOpenGL.TessCallback
+
+
+
All Implemented Interfaces:
javax.media.opengl.glu.GLUtessellatorCallback
+
+
+
Enclosing class:
PGraphicsOpenGL
+
+
+
+
public class PGraphicsOpenGL.TessCallback
extends javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+ + +

+There must be a better way to do this, but I'm having a brain fart + with all the inner class crap. Fix it later once this stuff is debugged. +

+ The method "void vertex(float $1, float $2, float $3);" contained in + the enclosing type "processing.core.PGraphics3" is a perfect match for + this method call. However, it is not visible in this nested class because + a method with the same name in an intervening class is hiding it. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
PGraphicsOpenGL.TessCallback() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidbegin(int type) + +
+           
+ voidcombine(double[] coords, + java.lang.Object[] data, + float[] weight, + java.lang.Object[] outData) + +
+          Implementation of the GLU_TESS_COMBINE callback.
+ voidedge(boolean e) + +
+           
+ voidend() + +
+           
+ voiderror(int errnum) + +
+           
+ voidvertex(java.lang.Object data) + +
+           
+ + + + + + + +
Methods inherited from class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
beginData, combineData, edgeFlag, edgeFlagData, endData, errorData, vertexData
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PGraphicsOpenGL.TessCallback

+
+public PGraphicsOpenGL.TessCallback()
+
+
+ + + + + + + + +
+Method Detail
+ +

+begin

+
+public void begin(int type)
+
+
+
Specified by:
begin in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
begin in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+
+
+
+
+
+
+ +

+end

+
+public void end()
+
+
+
Specified by:
end in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
end in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+
+
+
+
+
+
+ +

+edge

+
+public void edge(boolean e)
+
+
+
+
+
+
+ +

+vertex

+
+public void vertex(java.lang.Object data)
+
+
+
Specified by:
vertex in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
vertex in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+
+
+
+
+
+
+ +

+error

+
+public void error(int errnum)
+
+
+
Specified by:
error in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
error in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+
+
+
+
+
+
+ +

+combine

+
+public void combine(double[] coords,
+                    java.lang.Object[] data,
+                    float[] weight,
+                    java.lang.Object[] outData)
+
+
Implementation of the GLU_TESS_COMBINE callback. +

+

+
Specified by:
combine in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
combine in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
+
+
+
Parameters:
coords - is the 3-vector of the new vertex
data - is the vertex data to be combined, up to four elements. + This is useful when mixing colors together or any other + user data that was passed in to gluTessVertex.
weight - is an array of weights, one for each element of "data" + that should be linearly combined for new values.
outData - is the set of new values of "data" after being + put back together based on the weights. it's passed back as a + single element Object[] array because that's the closest + that Java gets to a pointer.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.html b/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.html new file mode 100644 index 000000000..9b91f5549 --- /dev/null +++ b/build/javadoc/everything/processing/opengl/PGraphicsOpenGL.html @@ -0,0 +1,1405 @@ + + + + + +PGraphicsOpenGL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.opengl +
+Class PGraphicsOpenGL

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphics3D
+              extended by processing.opengl.PGraphicsOpenGL
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class PGraphicsOpenGL
extends PGraphics3D
+ + +

+Implementation of the PGraphics API that employs OpenGL rendering via JOGL. +

+ JOGL requires Java 1.4 or higher, so there are no restrictions on this + code to be compatible with Java 1.1 or Java 1.3. +

+ This code relies on PGraphics3D for all lighting and transformations. + Meaning that translate(), rotate(), and any lighting will be done in + PGraphics3D, and OpenGL is only used to blit lines and triangles as fast + as it possibly can. +

+ For this reason, OpenGL may not be accelerated as far as it could be, + but I don't have the time to maintain two separate versions of the + renderer. My development time must always be focused on implementation + and covering features first, and optimizing later. +

+ Further, the difference may be negligible, as the primary slowdown + in Java is moving pixels (i.e. a large frame buffer is nearly impossible + because Java just can't do a MemoryImageSource at screen resolution) + and the overhead from JNI tends to be significant. In the latter case, + we may even save time in some cases where a large number of calls to + OpenGL would otherwise be used, but that's probably a stretch. +

+ The code is also very messy, while features are being added and + removed rapidly as we head towards 1.0. Things got particularly ugly + as we approached beta while both Simon and I were working on it. + Relax, we'll get it fixed up later. +

+ When exporting applets, the JOGL Applet Launcher is used. More information + about the launcher can be found at its documentation page. +

+ +

+


+ +

+ + + + + + + + + + + +
+Nested Class Summary
+ classPGraphicsOpenGL.TessCallback + +
+          There must be a better way to do this, but I'm having a brain fart + with all the inner class crap.
+ + + + + + + + + + + + + + + + + + +
+Field Summary
+static booleanBIG_ENDIAN + +
+          Set to true if the host system is big endian (PowerPC, MIPS, SPARC), + false if little endian (x86 Intel for Mac or PC).
+ javax.media.opengl.GLgl + +
+           
+ javax.media.opengl.glu.GLUglu + +
+           
+ + + + + + + +
Fields inherited from class processing.core.PGraphics3D
camera, cameraAspect, cameraFar, cameraFOV, cameraNear, cameraX, cameraY, cameraZ, currentLightFalloffConstant, currentLightFalloffLinear, currentLightFalloffQuadratic, currentLightSpecular, lightCount, lightDiffuse, lightFalloffConstant, lightFalloffLinear, lightFalloffQuadratic, lightNormal, lightPosition, lightSpecular, lightSpotAngle, lightSpotAngleCos, lightSpotConcentration, lightType, line, MAX_LIGHTS, modelview, modelviewInv, projection, smoothTriangle, TRI_COLOR_COUNT, TRI_DIFFUSE_A, TRI_DIFFUSE_B, TRI_DIFFUSE_G, TRI_DIFFUSE_R, TRI_SPECULAR_B, TRI_SPECULAR_G, TRI_SPECULAR_R, triangle, zbuffer
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphicsOpenGL() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidambientLight(float r, + float g, + float b) + +
+          Add an ambient light based on the current color mode.
+ voidambientLight(float r, + float g, + float b, + float x, + float y, + float z) + +
+          Add an ambient light based on the current color mode.
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ javax.media.opengl.GLbeginGL() + +
+           
+ booleancanDraw() + +
+          OpenGL cannot draw until a proper native peer is available, so this + returns the value of PApplet.isDisplayable() (inherited from Component).
+ voiddirectionalLight(float r, + float g, + float b, + float nx, + float ny, + float nz) + +
+           
+ voidendDraw() + +
+          See notes in PGraphics.
+ voidendGL() + +
+           
+ voidfilter(int kind) + +
+          This is really inefficient and not a good idea in OpenGL.
+ voidfilter(int kind, + float param) + +
+          This is really inefficient and not a good idea in OpenGL.
+ PImageget() + +
+          Returns a copy of this PImage.
+ intget(int x, + int y) + +
+          Returns an ARGB "color" type (a packed 32 bit int with the color.
+ javax.media.opengl.GLContextgetContext() + +
+          Get the current context, for use by libraries that need to talk to it.
+ voidhint(int which) + +
+          Enable a hint option.
+ voidlightFalloff(float constant, + float linear, + float quadratic) + +
+          Set the light falloff rates for the last light that was created.
+ voidlightSpecular(float x, + float y, + float z) + +
+          Set the specular color of the last light created.
+ voidloadPixels() + +
+          Call this when you want to mess with the pixels[] array.
+ voidmask(int[] alpha) + +
+          Set alpha channel for an image.
+ voidmask(PImage alpha) + +
+          Set alpha channel for an image using another image as the source.
+ voidnoSmooth() + +
+          Disable smoothing.
+ voidpointLight(float r, + float g, + float b, + float x, + float y, + float z) + +
+           
+ voidreport(java.lang.String where) + +
+          Report on anything from glError().
+ voidresize(int wide, + int high) + +
+          Resize this image to a new width and height.
+ voidset(int x, + int y, + int argb) + +
+          Set a single pixel to the specified color.
+ voidset(int x, + int y, + PImage source) + +
+          Set an image directly to the screen.
+ voidshininess(float shine) + +
+           
+ voidsmooth() + +
+          If true in PImage, use bilinear interpolation for copy() + operations.
+ voidspotLight(float r, + float g, + float b, + float x, + float y, + float z, + float nx, + float ny, + float nz, + float angle, + float concentration) + +
+           
+ voidstrokeCap(int cap) + +
+           
+ voidstrokeJoin(int join) + +
+           
+ voidstrokeWeight(float weight) + +
+           
+ floattextAscent() + +
+          Returns the ascent of the current font at the current size.
+ floattextDescent() + +
+          Returns the descent of the current font at the current size.
+ voidtextFont(PFont which) + +
+          Sets the current font.
+ voidupdatePixels() + +
+          Call this when finished messing with the pixels[] array.
+ + + + + + + +
Methods inherited from class processing.core.PGraphics3D
applyMatrix, applyMatrix, applyMatrix, applyMatrix, beginCamera, beginShape, box, camera, camera, endCamera, endShape, flush, frustum, getMatrix, getMatrix, is2D, is3D, lights, modelX, modelY, modelZ, noLights, ortho, ortho, perspective, perspective, popMatrix, printCamera, printMatrix, printProjection, pushMatrix, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, setMatrix, setMatrix, setSize, sphere, texture, translate, translate, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, applyMatrix, arc, background, background, background, background, background, background, background, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, box, breakShape, brightness, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getStyle, getStyle, green, hue, image, image, image, imageMode, lerpColor, lerpColor, line, line, noFill, normal, noStroke, noTint, point, point, popStyle, pushStyle, quad, rect, rectMode, red, saturation, setMatrix, setParent, setPath, setPrimary, shape, shape, shape, shapeMode, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textLeading, textMode, textSize, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, get, getCache, getImage, init, isModified, removeCache, save, setCache, setModified, setModified, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+gl

+
+public javax.media.opengl.GL gl
+
+
+
+
+
+ +

+glu

+
+public javax.media.opengl.glu.GLU glu
+
+
+
+
+
+ +

+BIG_ENDIAN

+
+public static boolean BIG_ENDIAN
+
+
Set to true if the host system is big endian (PowerPC, MIPS, SPARC), + false if little endian (x86 Intel for Mac or PC). +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PGraphicsOpenGL

+
+public PGraphicsOpenGL()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getContext

+
+public javax.media.opengl.GLContext getContext()
+
+
Get the current context, for use by libraries that need to talk to it. +

+

+
+
+
+
+ +

+canDraw

+
+public boolean canDraw()
+
+
OpenGL cannot draw until a proper native peer is available, so this + returns the value of PApplet.isDisplayable() (inherited from Component). +

+

+
Overrides:
canDraw in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphics3D
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics3D
+
See notes in PGraphics. + If z-sorting has been turned on, then the triangles will + all be quicksorted here (to make alpha work more properly) + and then blit to the screen. +

+

+
Overrides:
endDraw in class PGraphics3D
+
+
+
+
+
+
+ +

+beginGL

+
+public javax.media.opengl.GL beginGL()
+
+
+
+
+
+
+ +

+endGL

+
+public void endGL()
+
+
+
+
+
+
+ +

+hint

+
+public void hint(int which)
+
+
Description copied from class: PGraphics
+
Enable a hint option. +

+ For the most part, hints are temporary api quirks, + for which a proper api hasn't been properly worked out. + for instance SMOOTH_IMAGES existed because smooth() + wasn't yet implemented, but it will soon go away. +

+ They also exist for obscure features in the graphics + engine, like enabling/disabling single pixel lines + that ignore the zbuffer, the way they do in alphabot. +

+ Current hint options: +

    +
  • DISABLE_DEPTH_TEST - + turns off the z-buffer in the P3D or OPENGL renderers. +
+

+

+
Overrides:
hint in class PGraphics3D
+
+
+
+
+
+
+ +

+smooth

+
+public void smooth()
+
+
Description copied from class: PGraphics
+
If true in PImage, use bilinear interpolation for copy() + operations. When inherited by PGraphics, also controls shapes. +

+

+
Overrides:
smooth in class PGraphics3D
+
+
+
+
+
+
+ +

+noSmooth

+
+public void noSmooth()
+
+
Description copied from class: PGraphics
+
Disable smoothing. See smooth(). +

+

+
Overrides:
noSmooth in class PGraphics3D
+
+
+
+
+
+
+ +

+textAscent

+
+public float textAscent()
+
+
Description copied from class: PGraphics
+
Returns the ascent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
Overrides:
textAscent in class PGraphics
+
+
+
+
+
+
+ +

+textDescent

+
+public float textDescent()
+
+
Description copied from class: PGraphics
+
Returns the descent of the current font at the current size. + This is a method, rather than a variable inside the PGraphics object + because it requires calculation. +

+

+
Overrides:
textDescent in class PGraphics
+
+
+
+
+
+
+ +

+textFont

+
+public void textFont(PFont which)
+
+
Description copied from class: PGraphics
+
Sets the current font. The font's size will be the "natural" + size of this font (the size that was set when using "Create Font"). + The leading will also be reset. +

+

+
Overrides:
textFont in class PGraphics
+
+
+
+
+
+
+ +

+strokeWeight

+
+public void strokeWeight(float weight)
+
+
+
Overrides:
strokeWeight in class PGraphics
+
+
+
+
+
+
+ +

+strokeJoin

+
+public void strokeJoin(int join)
+
+
+
Overrides:
strokeJoin in class PGraphics3D
+
+
+
+
+
+
+ +

+strokeCap

+
+public void strokeCap(int cap)
+
+
+
Overrides:
strokeCap in class PGraphics3D
+
+
+
+
+
+
+ +

+shininess

+
+public void shininess(float shine)
+
+
+
Overrides:
shininess in class PGraphics
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float r,
+                         float g,
+                         float b)
+
+
Description copied from class: PGraphics3D
+
Add an ambient light based on the current color mode. +

+

+
Overrides:
ambientLight in class PGraphics3D
+
+
+
+
+
+
+ +

+ambientLight

+
+public void ambientLight(float r,
+                         float g,
+                         float b,
+                         float x,
+                         float y,
+                         float z)
+
+
Description copied from class: PGraphics3D
+
Add an ambient light based on the current color mode. + This version includes an (x, y, z) position for situations + where the falloff distance is used. +

+

+
Overrides:
ambientLight in class PGraphics3D
+
+
+
+
+
+
+ +

+directionalLight

+
+public void directionalLight(float r,
+                             float g,
+                             float b,
+                             float nx,
+                             float ny,
+                             float nz)
+
+
+
Overrides:
directionalLight in class PGraphics3D
+
+
+
+
+
+
+ +

+pointLight

+
+public void pointLight(float r,
+                       float g,
+                       float b,
+                       float x,
+                       float y,
+                       float z)
+
+
+
Overrides:
pointLight in class PGraphics3D
+
+
+
+
+
+
+ +

+spotLight

+
+public void spotLight(float r,
+                      float g,
+                      float b,
+                      float x,
+                      float y,
+                      float z,
+                      float nx,
+                      float ny,
+                      float nz,
+                      float angle,
+                      float concentration)
+
+
+
Overrides:
spotLight in class PGraphics3D
+
+
+
+
+
+
+ +

+lightFalloff

+
+public void lightFalloff(float constant,
+                         float linear,
+                         float quadratic)
+
+
Description copied from class: PGraphics3D
+
Set the light falloff rates for the last light that was created. + Default is lightFalloff(1, 0, 0). +

+

+
Overrides:
lightFalloff in class PGraphics3D
+
+
+
+
+
+
+ +

+lightSpecular

+
+public void lightSpecular(float x,
+                          float y,
+                          float z)
+
+
Description copied from class: PGraphics3D
+
Set the specular color of the last light created. +

+

+
Overrides:
lightSpecular in class PGraphics3D
+
+
+
+
+
+
+ +

+report

+
+public void report(java.lang.String where)
+
+
Report on anything from glError(). + Don't use this inside glBegin/glEnd otherwise it'll + throw an GL_INVALID_OPERATION error. +

+

+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Description copied from class: PImage
+
Call this when you want to mess with the pixels[] array. +

+ For subclasses where the pixels[] buffer isn't set by default, + this should copy all data into the pixels[] array +

+

+
Overrides:
loadPixels in class PImage
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
Description copied from class: PImage
+
Call this when finished messing with the pixels[] array. +

+ Mark all pixels as needing update. +

+

+
Overrides:
updatePixels in class PImage
+
+
+
+
+
+
+ +

+resize

+
+public void resize(int wide,
+                   int high)
+
+
Description copied from class: PImage
+
Resize this image to a new width and height. + Use 0 for wide or high to make that dimension scale proportionally. +

+

+
Overrides:
resize in class PImage
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
Description copied from class: PImage
+
Returns an ARGB "color" type (a packed 32 bit int with the color. + If the coordinate is outside the image, zero is returned + (black, but completely transparent). +

+ If the image is in RGB format (i.e. on a PVideo object), + the value will get its high bits set, just to avoid cases where + they haven't been set already. +

+ If the image is in ALPHA format, this returns a white with its + alpha value set. +

+ This function is included primarily for beginners. It is quite + slow because it has to check to see if the x, y that was provided + is inside the bounds, and then has to check to see what image + type it is. If you want things to be more efficient, access the + pixels[] array directly. +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
Description copied from class: PImage
+
Returns a copy of this PImage. Equivalent to get(0, 0, width, height). +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int argb)
+
+
Description copied from class: PImage
+
Set a single pixel to the specified color. +

+

+
Overrides:
set in class PImage
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                PImage source)
+
+
Set an image directly to the screen. +

+ TODO not optimized properly, creates multiple temporary buffers + the size of the image. Needs to instead use image cache, but that + requires two types of image cache. One for power of 2 textures + and another for glReadPixels/glDrawPixels data that's flipped + vertically. Both have their components all swapped to native. +

+

+
Overrides:
set in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image. Black colors in the source + image will make the destination image completely transparent, + and white will make things fully opaque. Gray values will + be in-between steps. +

+ Strictly speaking the "blue" value from the source image is + used as the alpha color. For a fully grayscale image, this + is correct, but for a color image it's not 100% accurate. + For a more accurate conversion, first use filter(GRAY) + which will make the image into a "correct" grayscake by + performing a proper luminance-based conversion. +

+

+
Overrides:
mask in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image using another image as the source. +

+

+
Overrides:
mask in class PImage
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind)
+
+
This is really inefficient and not a good idea in OpenGL. + Use get() and set() with a smaller image area, or call the + filter on an image instead, and then draw that. +

+

+
Overrides:
filter in class PImage
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind,
+                   float param)
+
+
This is really inefficient and not a good idea in OpenGL. + Use get() and set() with a smaller image area, or call the + filter on an image instead, and then draw that. +

+

+
Overrides:
filter in class PImage
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/opengl/package-frame.html b/build/javadoc/everything/processing/opengl/package-frame.html new file mode 100644 index 000000000..4d3581657 --- /dev/null +++ b/build/javadoc/everything/processing/opengl/package-frame.html @@ -0,0 +1,31 @@ + + + + + +processing.opengl + + + + + + + + + + + +processing.opengl + + + + +
+Classes  + +
+PGraphicsOpenGL
+ + + + diff --git a/build/javadoc/everything/processing/opengl/package-summary.html b/build/javadoc/everything/processing/opengl/package-summary.html new file mode 100644 index 000000000..678819590 --- /dev/null +++ b/build/javadoc/everything/processing/opengl/package-summary.html @@ -0,0 +1,151 @@ + + + + + +processing.opengl + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.opengl +

+ + + + + + + + + +
+Class Summary
PGraphicsOpenGLImplementation of the PGraphics API that employs OpenGL rendering via JOGL.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/opengl/package-tree.html b/build/javadoc/everything/processing/opengl/package-tree.html new file mode 100644 index 000000000..0f393a481 --- /dev/null +++ b/build/javadoc/everything/processing/opengl/package-tree.html @@ -0,0 +1,157 @@ + + + + + +processing.opengl Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.opengl +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/pdf/PGraphicsPDF.html b/build/javadoc/everything/processing/pdf/PGraphicsPDF.html new file mode 100644 index 000000000..ac5f17312 --- /dev/null +++ b/build/javadoc/everything/processing/pdf/PGraphicsPDF.html @@ -0,0 +1,1200 @@ + + + + + +PGraphicsPDF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.pdf +
+Class PGraphicsPDF

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.core.PGraphics
+          extended by processing.core.PGraphicsJava2D
+              extended by processing.pdf.PGraphicsPDF
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, PConstants
+
+
+
+
public class PGraphicsPDF
extends PGraphicsJava2D
+ + +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class processing.core.PGraphicsJava2D
fillGradient, fillGradientObject, g2, strokeGradient, strokeGradientObject
+ + + + + + + +
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + +
+Constructor Summary
PGraphicsPDF() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddFonts(java.lang.String directory) + +
+          Add a directory that should be searched for font data.
+ voidbeginDraw() + +
+          Prepares the PGraphics for drawing.
+ voidblend(int sx, + int sy, + int dx, + int dy, + int mode) + +
+           
+ voidblend(int sx1, + int sy1, + int sx2, + int sy2, + int dx1, + int dy1, + int dx2, + int dy2, + int mode) + +
+          Blends one area of this image to another area.
+ voidblend(PImage src, + int sx, + int sy, + int dx, + int dy, + int mode) + +
+           
+ voidblend(PImage src, + int sx1, + int sy1, + int sx2, + int sy2, + int dx1, + int dy1, + int dx2, + int dy2, + int mode) + +
+          Copies area of one image into another PImage object.
+ voidcopy(int sx1, + int sy1, + int sx2, + int sy2, + int dx1, + int dy1, + int dx2, + int dy2) + +
+          Copy things from one area of this image + to another area in the same image.
+ voidcopy(PImage src, + int sx1, + int sy1, + int sx2, + int sy2, + int dx1, + int dy1, + int dx2, + int dy2) + +
+          Copies area of one image into another PImage object.
+ booleandisplayable() + +
+          Don't open a window for this renderer, it won't be used.
+ voiddispose() + +
+          Handle any takedown for this graphics context.
+ voidendDraw() + +
+          This will finalize rendering so that it can be shown on-screen.
+ voidfilter(int kind) + +
+          Method to apply a variety of basic filters to this image.
+ voidfilter(int kind, + float param) + +
+          Method to apply a variety of basic filters to this image.
+ PImageget() + +
+          Returns a copy of this PImage.
+ intget(int x, + int y) + +
+          Returns an ARGB "color" type (a packed 32 bit int with the color.
+ PImageget(int x, + int y, + int c, + int d) + +
+          Grab a subsection of a PImage, and copy it into a fresh PImage.
+ java.lang.String[]listFonts() + +
+          List the fonts known to the PDF renderer.
+ voidloadPixels() + +
+          Call this when you want to mess with the pixels[] array.
+ voidmask(int[] alpha) + +
+          Set alpha channel for an image.
+ voidmask(PImage alpha) + +
+          Set alpha channel for an image using another image as the source.
+ voidnextPage() + +
+          Call to explicitly go to the next page from within a single draw().
+ voidsave(java.lang.String filename) + +
+          Save this image to disk.
+ voidset(int x, + int y, + int argb) + +
+          Set a single pixel to the specified color.
+ voidset(int x, + int y, + PImage image) + +
+          Efficient method of drawing an image's pixels directly to this surface.
+ voidsetPath(java.lang.String path) + +
+           
+ voidtextMode(int mode) + +
+          Change the textMode() to either SHAPE or MODEL.
+ voidupdatePixels() + +
+          Update the pixels[] buffer to the PGraphics image.
+ voidupdatePixels(int x, + int y, + int c, + int d) + +
+          Update the pixels[] buffer to the PGraphics image.
+ + + + + + + +
Methods inherited from class processing.core.PGraphicsJava2D
applyMatrix, applyMatrix, backgroundImpl, beginRaw, beginShape, bezierDetail, bezierVertex, bezierVertex, box, breakShape, canDraw, curveDetail, curveVertex, endRaw, endShape, getImpl, getMatrix, getMatrix, getMatrix, line, noSmooth, point, popMatrix, printMatrix, pushMatrix, quad, resetMatrix, resize, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, setMatrix, setMatrix, setSize, smooth, sphere, strokeCap, strokeJoin, strokeWeight, textAscent, textDescent, textSize, texture, translate, triangle, vertex, vertex, vertex, vertex
+ + + + + + + +
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, background, background, background, background, background, background, background, beginCamera, beginShape, bezier, bezier, bezierPoint, bezierTangent, blue, box, brightness, camera, camera, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endShape, fill, fill, fill, fill, fill, fill, flush, frustum, getStyle, getStyle, green, hint, hue, image, image, image, imageMode, is2D, is3D, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, modelX, modelY, modelZ, noFill, noLights, normal, noStroke, noTint, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, rect, rectMode, red, saturation, setMatrix, setParent, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, vertex
+ + + + + + + +
Methods inherited from class processing.core.PImage
blendColor, clone, getCache, getImage, init, isModified, removeCache, setCache, setModified, setModified
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PGraphicsPDF

+
+public PGraphicsPDF()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setPath

+
+public void setPath(java.lang.String path)
+
+
+
Overrides:
setPath in class PGraphics
+
+
+
+
+
+
+ +

+beginDraw

+
+public void beginDraw()
+
+
Description copied from class: PGraphics
+
Prepares the PGraphics for drawing. +

+ When creating your own PGraphics, you should call this before + drawing anything. +

+

+
Overrides:
beginDraw in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+endDraw

+
+public void endDraw()
+
+
Description copied from class: PGraphics
+
This will finalize rendering so that it can be shown on-screen. +

+ When creating your own PGraphics, you should call this when + you're finished drawing. +

+

+
Overrides:
endDraw in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+textMode

+
+public void textMode(int mode)
+
+
Change the textMode() to either SHAPE or MODEL. +
+ This resets all renderer settings, and should therefore + be called before any other commands that set the fill() + or the textFont() or anything. Unlike other renderers, + use textMode() directly after the size() command. +

+

+
Overrides:
textMode in class PGraphics
+
+
+
+
+
+
+ +

+nextPage

+
+public void nextPage()
+
+
Call to explicitly go to the next page from within a single draw(). +

+

+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Description copied from class: PGraphics
+
Handle any takedown for this graphics context. +

+ This is called when a sketch is shut down and this renderer was + specified using the size() command, or inside endRecord() and + endRaw(), in order to shut things off. +

+

+
Overrides:
dispose in class PGraphics
+
+
+
+
+
+
+ +

+displayable

+
+public boolean displayable()
+
+
Don't open a window for this renderer, it won't be used. +

+

+
Overrides:
displayable in class PGraphics
+
+
+
+
+
+
+ +

+loadPixels

+
+public void loadPixels()
+
+
Description copied from class: PImage
+
Call this when you want to mess with the pixels[] array. +

+ For subclasses where the pixels[] buffer isn't set by default, + this should copy all data into the pixels[] array +

+

+
Overrides:
loadPixels in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels()
+
+
Description copied from class: PGraphicsJava2D
+
Update the pixels[] buffer to the PGraphics image. +

+ Unlike in PImage, where updatePixels() only requests that the + update happens, in PGraphicsJava2D, this will happen immediately. +

+

+
Overrides:
updatePixels in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+updatePixels

+
+public void updatePixels(int x,
+                         int y,
+                         int c,
+                         int d)
+
+
Description copied from class: PGraphicsJava2D
+
Update the pixels[] buffer to the PGraphics image. +

+ Unlike in PImage, where updatePixels() only requests that the + update happens, in PGraphicsJava2D, this will happen immediately. +

+

+
Overrides:
updatePixels in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+get

+
+public int get(int x,
+               int y)
+
+
Description copied from class: PImage
+
Returns an ARGB "color" type (a packed 32 bit int with the color. + If the coordinate is outside the image, zero is returned + (black, but completely transparent). +

+ If the image is in RGB format (i.e. on a PVideo object), + the value will get its high bits set, just to avoid cases where + they haven't been set already. +

+ If the image is in ALPHA format, this returns a white with its + alpha value set. +

+ This function is included primarily for beginners. It is quite + slow because it has to check to see if the x, y that was provided + is inside the bounds, and then has to check to see what image + type it is. If you want things to be more efficient, access the + pixels[] array directly. +

+

+
Overrides:
get in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+get

+
+public PImage get(int x,
+                  int y,
+                  int c,
+                  int d)
+
+
Description copied from class: PImage
+
Grab a subsection of a PImage, and copy it into a fresh PImage. + As of release 0149, no longer honors imageMode() for the coordinates. +

+

+
Overrides:
get in class PImage
+
+
+
+
+
+
+ +

+get

+
+public PImage get()
+
+
Description copied from class: PImage
+
Returns a copy of this PImage. Equivalent to get(0, 0, width, height). +

+

+
Overrides:
get in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                int argb)
+
+
Description copied from class: PImage
+
Set a single pixel to the specified color. +

+

+
Overrides:
set in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+set

+
+public void set(int x,
+                int y,
+                PImage image)
+
+
Description copied from class: PImage
+
Efficient method of drawing an image's pixels directly to this surface. + No variations are employed, meaning that any scale, tint, or imageMode + settings will be ignored. +

+

+
Overrides:
set in class PImage
+
+
+
+
+
+
+ +

+mask

+
+public void mask(int[] alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image. Black colors in the source + image will make the destination image completely transparent, + and white will make things fully opaque. Gray values will + be in-between steps. +

+ Strictly speaking the "blue" value from the source image is + used as the alpha color. For a fully grayscale image, this + is correct, but for a color image it's not 100% accurate. + For a more accurate conversion, first use filter(GRAY) + which will make the image into a "correct" grayscake by + performing a proper luminance-based conversion. +

+

+
Overrides:
mask in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+mask

+
+public void mask(PImage alpha)
+
+
Description copied from class: PImage
+
Set alpha channel for an image using another image as the source. +

+

+
Overrides:
mask in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind)
+
+
Description copied from class: PImage
+
Method to apply a variety of basic filters to this image. +

+

    +
  • filter(BLUR) provides a basic blur. +
  • filter(GRAY) converts the image to grayscale based on luminance. +
  • filter(INVERT) will invert the color components in the image. +
  • filter(OPAQUE) set all the high bits in the image to opaque +
  • filter(THRESHOLD) converts the image to black and white. +
  • filter(DILATE) grow white/light areas +
  • filter(ERODE) shrink white/light areas +
+ Luminance conversion code contributed by + toxi +

+ Gaussian blur code contributed by + Mario Klingemann +

+

+
Overrides:
filter in class PImage
+
+
+
+
+
+
+ +

+filter

+
+public void filter(int kind,
+                   float param)
+
+
Description copied from class: PImage
+
Method to apply a variety of basic filters to this image. + These filters all take a parameter. +

+

    +
  • filter(BLUR, int radius) performs a gaussian blur of the + specified radius. +
  • filter(POSTERIZE, int levels) will posterize the image to + between 2 and 255 levels. +
  • filter(THRESHOLD, float center) allows you to set the + center point for the threshold. It takes a value from 0 to 1.0. +
+ Gaussian blur code contributed by + Mario Klingemann + and later updated by toxi for better speed. +

+

+
Overrides:
filter in class PImage
+
+
+
+
+
+
+ +

+copy

+
+public void copy(int sx1,
+                 int sy1,
+                 int sx2,
+                 int sy2,
+                 int dx1,
+                 int dy1,
+                 int dx2,
+                 int dy2)
+
+
Description copied from class: PImage
+
Copy things from one area of this image + to another area in the same image. +

+

+
Overrides:
copy in class PGraphicsJava2D
+
+
+
+
+
+
+ +

+copy

+
+public void copy(PImage src,
+                 int sx1,
+                 int sy1,
+                 int sx2,
+                 int sy2,
+                 int dx1,
+                 int dy1,
+                 int dx2,
+                 int dy2)
+
+
Description copied from class: PImage
+
Copies area of one image into another PImage object. +

+

+
Overrides:
copy in class PImage
+
+
+
+
+
+
+ +

+blend

+
+public void blend(int sx,
+                  int sy,
+                  int dx,
+                  int dy,
+                  int mode)
+
+
+
+
+
+
+ +

+blend

+
+public void blend(PImage src,
+                  int sx,
+                  int sy,
+                  int dx,
+                  int dy,
+                  int mode)
+
+
+
+
+
+
+ +

+blend

+
+public void blend(int sx1,
+                  int sy1,
+                  int sx2,
+                  int sy2,
+                  int dx1,
+                  int dy1,
+                  int dx2,
+                  int dy2,
+                  int mode)
+
+
Description copied from class: PImage
+
Blends one area of this image to another area. +

+

+
Overrides:
blend in class PImage
+
+
+
See Also:
PImage.blendColor(int,int,int)
+
+
+
+ +

+blend

+
+public void blend(PImage src,
+                  int sx1,
+                  int sy1,
+                  int sx2,
+                  int sy2,
+                  int dx1,
+                  int dy1,
+                  int dx2,
+                  int dy2,
+                  int mode)
+
+
Description copied from class: PImage
+
Copies area of one image into another PImage object. +

+

+
Overrides:
blend in class PImage
+
+
+
See Also:
PImage.blendColor(int,int,int)
+
+
+
+ +

+save

+
+public void save(java.lang.String filename)
+
+
Description copied from class: PImage
+
Save this image to disk. +

+ As of revision 0100, this function requires an absolute path, + in order to avoid confusion. To save inside the sketch folder, + use the function savePath() from PApplet, or use saveFrame() instead. + As of revision 0116, savePath() is not needed if this object has been + created (as recommended) via createImage() or createGraphics() or + one of its neighbors. +

+ As of revision 0115, when using Java 1.4 and later, you can write + to several formats besides tga and tiff. If Java 1.4 is installed + and the extension used is supported (usually png, jpg, jpeg, bmp, + and tiff), then those methods will be used to write the image. + To get a list of the supported formats for writing, use:
+ println(javax.imageio.ImageIO.getReaderFormatNames()) +

+ To use the original built-in image writers, use .tga or .tif as the + extension, or don't include an extension. When no extension is used, + the extension .tif will be added to the file name. +

+ The ImageIO API claims to support wbmp files, however they probably + require a black and white image. Basic testing produced a zero-length + file with no error. +

+

+
Overrides:
save in class PImage
+
+
+
+
+
+
+ +

+addFonts

+
+public void addFonts(java.lang.String directory)
+
+
Add a directory that should be searched for font data. +
+ On Mac OS X, the following directories are added by default: +
    +
  • /System/Library/Fonts +
  • /Library/Fonts +
  • ~/Library/Fonts +
+ On Windows, all drive letters are searched for WINDOWS\Fonts + or WINNT\Fonts, any that exists is added. +

+ 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) +

+

+
+
+
+
+ +

+listFonts

+
+public java.lang.String[] listFonts()
+
+
List the fonts known to the PDF renderer. This is like PFont.list(), + however not all those fonts are available by default. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/pdf/package-frame.html b/build/javadoc/everything/processing/pdf/package-frame.html new file mode 100644 index 000000000..2974dba82 --- /dev/null +++ b/build/javadoc/everything/processing/pdf/package-frame.html @@ -0,0 +1,31 @@ + + + + + +processing.pdf + + + + + + + + + + + +processing.pdf + + + + +
+Classes  + +
+PGraphicsPDF
+ + + + diff --git a/build/javadoc/everything/processing/pdf/package-summary.html b/build/javadoc/everything/processing/pdf/package-summary.html new file mode 100644 index 000000000..c314ca2b8 --- /dev/null +++ b/build/javadoc/everything/processing/pdf/package-summary.html @@ -0,0 +1,151 @@ + + + + + +processing.pdf + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.pdf +

+ + + + + + + + + +
+Class Summary
PGraphicsPDF 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/pdf/package-tree.html b/build/javadoc/everything/processing/pdf/package-tree.html new file mode 100644 index 000000000..2cfb2d1c7 --- /dev/null +++ b/build/javadoc/everything/processing/pdf/package-tree.html @@ -0,0 +1,154 @@ + + + + + +processing.pdf Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.pdf +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/serial/Serial.html b/build/javadoc/everything/processing/serial/Serial.html new file mode 100644 index 000000000..11ea4c18e --- /dev/null +++ b/build/javadoc/everything/processing/serial/Serial.html @@ -0,0 +1,1089 @@ + + + + + +Serial + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.serial +
+Class Serial

+
+java.lang.Object
+  extended by processing.serial.Serial
+
+
+
All Implemented Interfaces:
gnu.io.SerialPortEventListener, java.util.EventListener
+
+
+
+
public class Serial
extends java.lang.Object
implements gnu.io.SerialPortEventListener
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ intdatabits + +
+           
+ java.io.InputStreaminput + +
+           
+ java.io.OutputStreamoutput + +
+           
+ intparity + +
+           
+ gnu.io.SerialPortport + +
+           
+ intrate + +
+           
+ intstopbits + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
Serial(PApplet parent) + +
+           
Serial(PApplet parent, + int irate) + +
+           
Serial(PApplet parent, + java.lang.String iname) + +
+           
Serial(PApplet parent, + java.lang.String iname, + int irate) + +
+           
Serial(PApplet parent, + java.lang.String iname, + int irate, + char iparity, + int idatabits, + float istopbits) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ intavailable() + +
+          Returns the number of bytes that have been read from serial + and are waiting to be dealt with by the user.
+ voidbuffer(int count) + +
+          Set number of bytes to buffer before calling serialEvent() + in the host applet.
+ voidbufferUntil(int what) + +
+          Set a specific byte to buffer until before calling + serialEvent() in the host applet.
+ voidclear() + +
+          Ignore all the bytes read so far and empty the buffer.
+ voiddispose() + +
+          Used by PApplet to shut things down.
+static voiderrorMessage(java.lang.String where, + java.lang.Throwable e) + +
+          General error reporting, all corraled here just in case + I think of something slightly more intelligent to do.
+ intlast() + +
+          Same as read() but returns the very last value received + and clears the buffer.
+ charlastChar() + +
+          Just like last() and readChar().
+static java.lang.String[]list() + +
+          If this just hangs and never completes on Windows, + it may be because the DLL doesn't have its exec bit set.
+ intread() + +
+          Returns a number between 0 and 255 for the next byte that's + waiting in the buffer.
+ byte[]readBytes() + +
+          Return a byte array of anything that's in the serial buffer.
+ intreadBytes(byte[] outgoing) + +
+          Grab whatever is in the serial buffer, and stuff it into a + byte buffer passed in by the user.
+ byte[]readBytesUntil(int interesting) + +
+          Reads from the serial port into a buffer of bytes up to and + including a particular character.
+ intreadBytesUntil(int interesting, + byte[] outgoing) + +
+          Reads from the serial port into a buffer of bytes until a + particular character.
+ charreadChar() + +
+          Returns the next byte in the buffer as a char.
+ java.lang.StringreadString() + +
+          Return whatever has been read from the serial port so far + as a String.
+ java.lang.StringreadStringUntil(int interesting) + +
+          Combination of readBytesUntil and readString.
+ voidserialEvent(gnu.io.SerialPortEvent serialEvent) + +
+           
+ voidsetDTR(boolean state) + +
+          Set the DTR line.
+ voidsetProperties(java.util.Properties props) + +
+           
+ voidstop() + +
+          Stop talking to serial and shut things down.
+ voidwrite(byte[] bytes) + +
+           
+ voidwrite(int what) + +
+          This will handle both ints, bytes and chars transparently.
+ voidwrite(java.lang.String what) + +
+          Write a String to the output.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+port

+
+public gnu.io.SerialPort port
+
+
+
+
+
+ +

+rate

+
+public int rate
+
+
+
+
+
+ +

+parity

+
+public int parity
+
+
+
+
+
+ +

+databits

+
+public int databits
+
+
+
+
+
+ +

+stopbits

+
+public int stopbits
+
+
+
+
+
+ +

+input

+
+public java.io.InputStream input
+
+
+
+
+
+ +

+output

+
+public java.io.OutputStream output
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Serial

+
+public Serial(PApplet parent)
+
+
+
+ +

+Serial

+
+public Serial(PApplet parent,
+              int irate)
+
+
+
+ +

+Serial

+
+public Serial(PApplet parent,
+              java.lang.String iname,
+              int irate)
+
+
+
+ +

+Serial

+
+public Serial(PApplet parent,
+              java.lang.String iname)
+
+
+
+ +

+Serial

+
+public Serial(PApplet parent,
+              java.lang.String iname,
+              int irate,
+              char iparity,
+              int idatabits,
+              float istopbits)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setProperties

+
+public void setProperties(java.util.Properties props)
+
+
+
+
+
+
+
+
+
+ +

+stop

+
+public void stop()
+
+
Stop talking to serial and shut things down. +

+ Basically just a user-accessible version of dispose(). + For now, it just calls dispose(), but dispose shouldn't + be called from applets, because in some libraries, + dispose() blows shit up if it's called by a user who + doesn't know what they're doing. +

+

+
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Used by PApplet to shut things down. +

+

+
+
+
+
+
+
+
+ +

+setDTR

+
+public void setDTR(boolean state)
+
+
Set the DTR line. Addition from Tom Hulbert. +

+

+
+
+
+
+
+
+
+ +

+serialEvent

+
+public void serialEvent(gnu.io.SerialPortEvent serialEvent)
+
+
+
Specified by:
serialEvent in interface gnu.io.SerialPortEventListener
+
+
+
+
+
+
+ +

+buffer

+
+public void buffer(int count)
+
+
Set number of bytes to buffer before calling serialEvent() + in the host applet. +

+

+
+
+
+
+
+
+
+ +

+bufferUntil

+
+public void bufferUntil(int what)
+
+
Set a specific byte to buffer until before calling + serialEvent() in the host applet. +

+

+
+
+
+
+
+
+
+ +

+available

+
+public int available()
+
+
Returns the number of bytes that have been read from serial + and are waiting to be dealt with by the user. +

+

+
+
+
+
+
+
+
+ +

+clear

+
+public void clear()
+
+
Ignore all the bytes read so far and empty the buffer. +

+

+
+
+
+
+
+
+
+ +

+read

+
+public int read()
+
+
Returns a number between 0 and 255 for the next byte that's + waiting in the buffer. + Returns -1 if there was no byte (although the user should + first check available() to see if things are ready to avoid this) +

+

+
+
+
+
+
+
+
+ +

+last

+
+public int last()
+
+
Same as read() but returns the very last value received + and clears the buffer. Useful when you just want the most + recent value sent over the port. +

+

+
+
+
+
+
+
+
+ +

+readChar

+
+public char readChar()
+
+
Returns the next byte in the buffer as a char. + Returns -1, or 0xffff, if nothing is there. +

+

+
+
+
+
+
+
+
+ +

+lastChar

+
+public char lastChar()
+
+
Just like last() and readChar(). +

+

+
+
+
+
+
+
+
+ +

+readBytes

+
+public byte[] readBytes()
+
+
Return a byte array of anything that's in the serial buffer. + Not particularly memory/speed efficient, because it creates + a byte array on each read, but it's easier to use than + readBytes(byte b[]) (see below). +

+

+
+
+
+
+
+
+
+ +

+readBytes

+
+public int readBytes(byte[] outgoing)
+
+
Grab whatever is in the serial buffer, and stuff it into a + byte buffer passed in by the user. This is more memory/time + efficient than readBytes() returning a byte[] array. + + Returns an int for how many bytes were read. If more bytes + are available than can fit into the byte array, only those + that will fit are read. +

+

+
+
+
+
+
+
+
+ +

+readBytesUntil

+
+public byte[] readBytesUntil(int interesting)
+
+
Reads from the serial port into a buffer of bytes up to and + including a particular character. If the character isn't in + the serial buffer, then 'null' is returned. +

+

+
+
+
+
+
+
+
+ +

+readBytesUntil

+
+public int readBytesUntil(int interesting,
+                          byte[] outgoing)
+
+
Reads from the serial port into a buffer of bytes until a + particular character. If the character isn't in the serial + buffer, then 'null' is returned. + + If outgoing[] is not big enough, then -1 is returned, + and an error message is printed on the console. + If nothing is in the buffer, zero is returned. + If 'interesting' byte is not in the buffer, then 0 is returned. +

+

+
+
+
+
+
+
+
+ +

+readString

+
+public java.lang.String readString()
+
+
Return whatever has been read from the serial port so far + as a String. It assumes that the incoming characters are ASCII. + + If you want to move Unicode data, you can first convert the + String to a byte stream in the representation of your choice + (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. +

+

+
+
+
+
+
+
+
+ +

+readStringUntil

+
+public java.lang.String readStringUntil(int interesting)
+
+
Combination of readBytesUntil and readString. See caveats in + each function. Returns null if it still hasn't found what + you're looking for. + + If you want to move Unicode data, you can first convert the + String to a byte stream in the representation of your choice + (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. +

+

+
+
+
+
+
+
+
+ +

+write

+
+public void write(int what)
+
+
This will handle both ints, bytes and chars transparently. +

+

+
+
+
+
+
+
+
+ +

+write

+
+public void write(byte[] bytes)
+
+
+
+
+
+
+
+
+
+ +

+write

+
+public void write(java.lang.String what)
+
+
Write a String to the output. Note that this doesn't account + for Unicode (two bytes per char), nor will it send UTF8 + characters.. It assumes that you mean to send a byte buffer + (most often the case for networking and serial i/o) and + will only use the bottom 8 bits of each char in the string. + (Meaning that internally it uses String.getBytes) + + If you want to move Unicode data, you can first convert the + String to a byte stream in the representation of your choice + (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. +

+

+
+
+
+
+
+
+
+ +

+list

+
+public static java.lang.String[] list()
+
+
If this just hangs and never completes on Windows, + it may be because the DLL doesn't have its exec bit set. + Why the hell that'd be the case, who knows. +

+

+
+
+
+
+
+
+
+ +

+errorMessage

+
+public static void errorMessage(java.lang.String where,
+                                java.lang.Throwable e)
+
+
General error reporting, all corraled here just in case + I think of something slightly more intelligent to do. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/serial/package-frame.html b/build/javadoc/everything/processing/serial/package-frame.html new file mode 100644 index 000000000..9212c04d1 --- /dev/null +++ b/build/javadoc/everything/processing/serial/package-frame.html @@ -0,0 +1,31 @@ + + + + + +processing.serial + + + + + + + + + + + +processing.serial + + + + +
+Classes  + +
+Serial
+ + + + diff --git a/build/javadoc/everything/processing/serial/package-summary.html b/build/javadoc/everything/processing/serial/package-summary.html new file mode 100644 index 000000000..e59a4f0c3 --- /dev/null +++ b/build/javadoc/everything/processing/serial/package-summary.html @@ -0,0 +1,151 @@ + + + + + +processing.serial + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.serial +

+ + + + + + + + + +
+Class Summary
Serial 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/serial/package-tree.html b/build/javadoc/everything/processing/serial/package-tree.html new file mode 100644 index 000000000..bc20de8e5 --- /dev/null +++ b/build/javadoc/everything/processing/serial/package-tree.html @@ -0,0 +1,147 @@ + + + + + +processing.serial Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.serial +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • processing.serial.Serial (implements gnu.io.SerialPortEventListener) +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/video/Capture.html b/build/javadoc/everything/processing/video/Capture.html new file mode 100644 index 000000000..044ad81db --- /dev/null +++ b/build/javadoc/everything/processing/video/Capture.html @@ -0,0 +1,1092 @@ + + + + + +Capture + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.video +
+Class Capture

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.video.Capture
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Runnable, PConstants
+
+
+
+
public class Capture
extends PImage
implements java.lang.Runnable
+ + +

+Watchin' shit on the telly. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ quicktime.std.sg.SequenceGrabbercapture + +
+           
+ quicktime.std.sg.SGVideoChannelchannel + +
+          the guy who's doing all the work
+static intCOMPONENT + +
+           
+static intCOMPOSITE + +
+           
+ booleancrop + +
+          True if this image is currently being cropped
+ intcropH + +
+           
+ intcropW + +
+           
+ intcropX + +
+           
+ intcropY + +
+           
+ int[]data + +
+          Temporary storage for the raw image + data read directly from the capture device
+ intdataHeight + +
+           
+ intdataRowBytes + +
+           
+ intdataWidth + +
+           
+ intframeRate + +
+           
+static intNTSC + +
+           
+static intPAL + +
+           
+ quicktime.util.RawEncodedImageraw + +
+           
+static intSECAM + +
+           
+static intSVIDEO + +
+           
+static intTUNER + +
+           
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
Capture(PApplet parent, + int requestWidth, + int requestHeight) + +
+           
Capture(PApplet parent, + int reqWidth, + int reqHeight, + int frameRate) + +
+           
Capture(PApplet parent, + int reqWidth, + int reqHeight, + java.lang.String name) + +
+           
Capture(PApplet parent, + int requestWidth, + int requestHeight, + java.lang.String name, + int frameRate) + +
+          If 'name' is null or the empty string, it won't set a specific + device, which means that QuickTime will use that last device + used by a QuickTime application.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanavailable() + +
+          True if a frame is ready to be read.
+ voidcrop(int x, + int y, + int w, + int h) + +
+          Set the video to crop from its original.
+ voiddispose() + +
+          Called by PApplet to shut down video so that QuickTime + can be used later by another applet.
+ voidformat(int which) + +
+          Set the video format standard to use on the + video digitizer: NTSC, PAL, or SECAM.
+ voidframeRate(int iframeRate) + +
+          Set the frameRate for how quickly new frames are read + from the capture device.
+ voidinit(PApplet parent, + int requestWidth, + int requestHeight, + java.lang.String name, + int frameRate) + +
+           
+static java.lang.String[]list() + +
+          Get a list of all available captures as a String array.
+ voidnoCrop() + +
+          Remove the cropping (if any) of the image.
+ voidread() + +
+           
+ voidrun() + +
+           
+ voidsettings() + +
+          Show the settings dialog for this input device.
+ voidsource(int which) + +
+          Set the format to ask for from the video digitizer: + TUNER, COMPOSITE, SVIDEO, or COMPONENT.
+ voidstop() + +
+          Called by applets to stop capturing video.
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+COMPOSITE

+
+public static final int COMPOSITE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SVIDEO

+
+public static final int SVIDEO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMPONENT

+
+public static final int COMPONENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TUNER

+
+public static final int TUNER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NTSC

+
+public static final int NTSC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PAL

+
+public static final int PAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SECAM

+
+public static final int SECAM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+data

+
+public int[] data
+
+
Temporary storage for the raw image + data read directly from the capture device +

+

+
+
+
+ +

+dataWidth

+
+public int dataWidth
+
+
+
+
+
+ +

+dataHeight

+
+public int dataHeight
+
+
+
+
+
+ +

+dataRowBytes

+
+public int dataRowBytes
+
+
+
+
+
+ +

+crop

+
+public boolean crop
+
+
True if this image is currently being cropped +

+

+
+
+
+ +

+cropX

+
+public int cropX
+
+
+
+
+
+ +

+cropY

+
+public int cropY
+
+
+
+
+
+ +

+cropW

+
+public int cropW
+
+
+
+
+
+ +

+cropH

+
+public int cropH
+
+
+
+
+
+ +

+frameRate

+
+public int frameRate
+
+
+
+
+
+ +

+raw

+
+public quicktime.util.RawEncodedImage raw
+
+
+
+
+
+ +

+capture

+
+public quicktime.std.sg.SequenceGrabber capture
+
+
+
+
+
+ +

+channel

+
+public quicktime.std.sg.SGVideoChannel channel
+
+
the guy who's doing all the work +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Capture

+
+public Capture(PApplet parent,
+               int requestWidth,
+               int requestHeight)
+
+
+
+ +

+Capture

+
+public Capture(PApplet parent,
+               int reqWidth,
+               int reqHeight,
+               int frameRate)
+
+
+
+ +

+Capture

+
+public Capture(PApplet parent,
+               int reqWidth,
+               int reqHeight,
+               java.lang.String name)
+
+
+
+ +

+Capture

+
+public Capture(PApplet parent,
+               int requestWidth,
+               int requestHeight,
+               java.lang.String name,
+               int frameRate)
+
+
If 'name' is null or the empty string, it won't set a specific + device, which means that QuickTime will use that last device + used by a QuickTime application. +

+ Unfortunately, Apple's QuickTime API uses the name to select devices, + and in some cases there might be cameras with the same name on a machine. + If you ask for a camera of the same name in sequence, you might see if it + just does the right thing and grabs each separate camera in succession. + If that doesn't work, you might try calling settings() which will + bring up the prompt where you can select a capture device. +

+ If the following function: +

public void captureEvent(Capture c)
+ is defined in the host PApplet, then it will be called every + time a new frame is available from the capture device. +

+

+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init(PApplet parent,
+                 int requestWidth,
+                 int requestHeight,
+                 java.lang.String name,
+                 int frameRate)
+
+
+
+
+
+
+
+
+
+ +

+available

+
+public boolean available()
+
+
True if a frame is ready to be read. +
+ // put this somewhere inside draw
+ if (capture.available()) capture.read();
+ 
+ Alternatively, you can use captureEvent(Capture c) to notify you + whenever available() is set to true. In which case, things might + look like this: +
+ public void captureEvent(Capture c) {
+   c.read();
+   // do something exciting now that c has been updated
+ }
+ 
+

+

+
+
+
+
+
+
+
+ +

+crop

+
+public void crop(int x,
+                 int y,
+                 int w,
+                 int h)
+
+
Set the video to crop from its original. +

+ It seems common that captures add lines to the top or bottom + of an image, so this can be useful for removing them. + Internally, the pixel buffer size returned from QuickTime is + often a different size than requested, so crop will be set + more often than not. +

+

+
+
+
+
+
+
+
+ +

+noCrop

+
+public void noCrop()
+
+
Remove the cropping (if any) of the image. +

+ By default, cropping is often enabled to trim out black pixels. + But if you'd rather deal with them yourself (so as to avoid + an extra lag while the data is moved around) you can shut it off. +

+

+
+
+
+
+
+
+
+ +

+read

+
+public void read()
+
+
+
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+frameRate

+
+public void frameRate(int iframeRate)
+
+
Set the frameRate for how quickly new frames are read + from the capture device. +

+

+
+
+
+
+
+
+
+ +

+stop

+
+public void stop()
+
+
Called by applets to stop capturing video. +

+

+
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Called by PApplet to shut down video so that QuickTime + can be used later by another applet. +

+

+
+
+
+
+
+
+
+ +

+source

+
+public void source(int which)
+
+
Set the format to ask for from the video digitizer: + TUNER, COMPOSITE, SVIDEO, or COMPONENT. +

+ The constants are just aliases to the constants returned from + QuickTime's getInputFormat() function, so any valid constant from + that will work just fine. +

+

+
+
+
+
+
+
+
+ +

+format

+
+public void format(int which)
+
+
Set the video format standard to use on the + video digitizer: NTSC, PAL, or SECAM. +

+ The constants are just aliases to the constants used for + QuickTime's setInputStandard() function, so any valid + constant from that will work just fine. +

+

+
+
+
+
+
+
+
+ +

+settings

+
+public void settings()
+
+
Show the settings dialog for this input device. +

+

+
+
+
+
+
+
+
+ +

+list

+
+public static java.lang.String[] list()
+
+
Get a list of all available captures as a String array. + i.e. println(Capture.list()) will show you the goodies. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/video/Movie.html b/build/javadoc/everything/processing/video/Movie.html new file mode 100644 index 000000000..71ed3416f --- /dev/null +++ b/build/javadoc/everything/processing/video/Movie.html @@ -0,0 +1,684 @@ + + + + + +Movie + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.video +
+Class Movie

+
+java.lang.Object
+  extended by processing.core.PImage
+      extended by processing.video.Movie
+
+
+
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Runnable, PConstants
+
+
+
+
public class Movie
extends PImage
implements PConstants, java.lang.Runnable
+ + +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+ quicktime.std.movies.Moviemovie + +
+          The QuickTime for Java "Movie" object, made public + in case anyone wants to play with it.
+ + + + + + + +
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
+ + + + + + + +
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
+  + + + + + + + + + + + + + +
+Constructor Summary
Movie(PApplet parent, + java.lang.String filename) + +
+           
Movie(PApplet parent, + java.lang.String filename, + int ifps) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanavailable() + +
+           
+ voiddispose() + +
+          Call this to halt the movie from running, and stop its thread.
+ floatduration() + +
+          Get the full length of this movie (in seconds).
+ voidframeRate(int ifps) + +
+          Set how often new frames are to be read from the movie.
+ voidinit(PApplet parent, + java.lang.String filename, + int fps) + +
+           
+ voidjump(float where) + +
+          Jump to a specific location (in seconds).
+ voidloop() + +
+          Begin playing the movie, with repeat.
+ voidnoLoop() + +
+          Shut off the repeating loop.
+ voidpause() + +
+          Pause the movie at its current time.
+ voidplay() + +
+          Begin playing the movie, with no repeat.
+ voidread() + +
+           
+ voidrun() + +
+           
+ voidspeed(float rate) + +
+          Set a multiplier for how fast/slow the movie should be run.
+ voidstop() + +
+          Stop the movie, and rewind.
+ floattime() + +
+          Return the current time in seconds.
+ + + + + + + +
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+movie

+
+public quicktime.std.movies.Movie movie
+
+
The QuickTime for Java "Movie" object, made public + in case anyone wants to play with it. +

+

+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Movie

+
+public Movie(PApplet parent,
+             java.lang.String filename)
+
+
+
+ +

+Movie

+
+public Movie(PApplet parent,
+             java.lang.String filename,
+             int ifps)
+
+
+ + + + + + + + +
+Method Detail
+ +

+init

+
+public void init(PApplet parent,
+                 java.lang.String filename,
+                 int fps)
+
+
+
+
+
+
+
+
+
+ +

+available

+
+public boolean available()
+
+
+
+
+
+
+
+
+
+ +

+read

+
+public void read()
+
+
+
+
+
+
+
+
+
+ +

+play

+
+public void play()
+
+
Begin playing the movie, with no repeat. +

+

+
+
+
+
+
+
+
+ +

+loop

+
+public void loop()
+
+
Begin playing the movie, with repeat. +

+

+
+
+
+
+
+
+
+ +

+noLoop

+
+public void noLoop()
+
+
Shut off the repeating loop. +

+

+
+
+
+
+
+
+
+ +

+pause

+
+public void pause()
+
+
Pause the movie at its current time. +

+

+
+
+
+
+
+
+
+ +

+stop

+
+public void stop()
+
+
Stop the movie, and rewind. +

+

+
+
+
+
+
+
+
+ +

+frameRate

+
+public void frameRate(int ifps)
+
+
Set how often new frames are to be read from the movie. + Does not actually set the speed of the movie playback, + that's handled by the speed() method. +

+

+
+
+
+
+
+
+
+ +

+speed

+
+public void speed(float rate)
+
+
Set a multiplier for how fast/slow the movie should be run. + The default is 1.0. +
    +
  • speed(2) will play the movie at double speed (2x). +
  • speed(0.5) will play at half speed. +
  • speed(-1) will play backwards at regular speed. +
+

+

+
+
+
+
+
+
+
+ +

+time

+
+public float time()
+
+
Return the current time in seconds. + The number is a float so fractions of seconds can be used. +

+

+
+
+
+
+
+
+
+ +

+jump

+
+public void jump(float where)
+
+
Jump to a specific location (in seconds). + The number is a float so fractions of seconds can be used. +

+

+
+
+
+
+
+
+
+ +

+duration

+
+public float duration()
+
+
Get the full length of this movie (in seconds). +

+

+
+
+
+
+
+
+
+ +

+run

+
+public void run()
+
+
+
Specified by:
run in interface java.lang.Runnable
+
+
+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
Call this to halt the movie from running, and stop its thread. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/video/MovieMaker.html b/build/javadoc/everything/processing/video/MovieMaker.html new file mode 100644 index 000000000..6a6c8fdb3 --- /dev/null +++ b/build/javadoc/everything/processing/video/MovieMaker.html @@ -0,0 +1,899 @@ + + + + + +MovieMaker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.video +
+Class MovieMaker

+
+java.lang.Object
+  extended by processing.video.MovieMaker
+
+
+
+
public class MovieMaker
extends java.lang.Object
+ + +

+Library to create a QuickTime movie from a Processing pixel array. + Written by Daniel Shiffman. + Thanks to Dan O'Sullivan and Shawn Van Every. +

+ Please note that some constructors and variable names were altered + slightly when the library was added to the Processing distribution. +

+ // Declare MovieMaker object
+ MovieMaker mm;
+
+ void setup() {
+   size(320, 240);
+
+   // Create MovieMaker object with size, filename,
+   // compression codec and quality, framerate
+   mm = new MovieMaker(this, width, height, "drawing.mov", 30,
+                       MovieMaker.H263, MovieMaker.HIGH);
+   background(160, 32, 32);
+ }
+
+ void draw() {
+   stroke(7, 146, 168);
+   strokeWeight(4);
+
+   // Draw if mouse is pressed
+   if (mousePressed) {
+     line(pmouseX, pmouseY, mouseX, mouseY);
+   }
+
+   // Add window's pixels to movie
+   mm.addFrame();
+ }
+
+ void keyPressed() {
+   // Finish the movie if space bar is pressed!
+   if (key == ' ') {
+     mm.finish();
+   }
+ }
+ 
+

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intANIMATION + +
+           
+static intBASE + +
+           
+static intBEST + +
+           
+static intBMP + +
+           
+static intCINEPAK + +
+           
+static intCMYK + +
+           
+static intCOMPONENT + +
+           
+static intGIF + +
+           
+static intGRAPHICS + +
+           
+static intH261 + +
+           
+static intH263 + +
+           
+static intH264 + +
+           
+static intHIGH + +
+           
+static intJPEG + +
+           
+static intLOSSLESS + +
+           
+static intLOW + +
+           
+static intMEDIUM + +
+           
+static intMOTION_JPEG_A + +
+           
+static intMOTION_JPEG_B + +
+           
+static intMS_VIDEO + +
+           
+static intRAW + +
+           
+static intSORENSON + +
+           
+static intVIDEO + +
+           
+static intWORST + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
MovieMaker(PApplet p, + int _w, + int _h, + java.lang.String _filename) + +
+          Create a movie with the specified width, height, and filename.
MovieMaker(PApplet p, + int _w, + int _h, + java.lang.String _filename, + int _rate) + +
+          Create a movie with the specified width, height, filename, and frame rate.
MovieMaker(PApplet p, + int _w, + int _h, + java.lang.String _filename, + int _rate, + int _codecType, + int _codecQuality) + +
+          Create a movie with the specified width, height, filename, frame rate, + and codec type and quality.
MovieMaker(PApplet p, + int _w, + int _h, + java.lang.String _filename, + int _rate, + int _codecType, + int _codecQuality, + int _keyFrameRate) + +
+          Create a movie with the specified width, height, filename, frame rate, + codec type and quality, and key frame rate.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddFrame() + +
+           
+ voidaddFrame(int[] _pixels, + int w, + int h) + +
+           
+ voiddispose() + +
+           
+ voidfinish() + +
+          Close out and finish the movie file.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+RAW

+
+public static final int RAW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ANIMATION

+
+public static final int ANIMATION
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BASE

+
+public static final int BASE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BMP

+
+public static final int BMP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CINEPAK

+
+public static final int CINEPAK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+COMPONENT

+
+public static final int COMPONENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CMYK

+
+public static final int CMYK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GIF

+
+public static final int GIF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+GRAPHICS

+
+public static final int GRAPHICS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+H261

+
+public static final int H261
+
+
+
See Also:
Constant Field Values
+
+
+ +

+H263

+
+public static final int H263
+
+
+
See Also:
Constant Field Values
+
+
+ +

+H264

+
+public static final int H264
+
+
+
+
+
+ +

+JPEG

+
+public static final int JPEG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MS_VIDEO

+
+public static final int MS_VIDEO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOTION_JPEG_A

+
+public static final int MOTION_JPEG_A
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MOTION_JPEG_B

+
+public static final int MOTION_JPEG_B
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SORENSON

+
+public static final int SORENSON
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VIDEO

+
+public static final int VIDEO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+WORST

+
+public static final int WORST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LOW

+
+public static final int LOW
+
+
+
See Also:
Constant Field Values
+
+
+ +

+MEDIUM

+
+public static final int MEDIUM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HIGH

+
+public static final int HIGH
+
+
+
See Also:
Constant Field Values
+
+
+ +

+BEST

+
+public static final int BEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LOSSLESS

+
+public static final int LOSSLESS
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+MovieMaker

+
+public MovieMaker(PApplet p,
+                  int _w,
+                  int _h,
+                  java.lang.String _filename)
+
+
Create a movie with the specified width, height, and filename. + The movie will be created at 15 frames per second. + The codec will be set to RAW and quality set to HIGH. +

+

+
+ +

+MovieMaker

+
+public MovieMaker(PApplet p,
+                  int _w,
+                  int _h,
+                  java.lang.String _filename,
+                  int _rate)
+
+
Create a movie with the specified width, height, filename, and frame rate. + The codec will be set to RAW and quality set to HIGH. +

+

+
+ +

+MovieMaker

+
+public MovieMaker(PApplet p,
+                  int _w,
+                  int _h,
+                  java.lang.String _filename,
+                  int _rate,
+                  int _codecType,
+                  int _codecQuality)
+
+
Create a movie with the specified width, height, filename, frame rate, + and codec type and quality. Key frames will be set at 15 frames. +

+

+
+ +

+MovieMaker

+
+public MovieMaker(PApplet p,
+                  int _w,
+                  int _h,
+                  java.lang.String _filename,
+                  int _rate,
+                  int _codecType,
+                  int _codecQuality,
+                  int _keyFrameRate)
+
+
Create a movie with the specified width, height, filename, frame rate, + codec type and quality, and key frame rate. +

+

+ + + + + + + + +
+Method Detail
+ +

+addFrame

+
+public void addFrame()
+
+
+
+
+
+
+ +

+addFrame

+
+public void addFrame(int[] _pixels,
+                     int w,
+                     int h)
+
+
+
+
+
+
+ +

+finish

+
+public void finish()
+
+
Close out and finish the movie file. +

+

+
+
+
+
+ +

+dispose

+
+public void dispose()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/video/package-frame.html b/build/javadoc/everything/processing/video/package-frame.html new file mode 100644 index 000000000..b57fb8660 --- /dev/null +++ b/build/javadoc/everything/processing/video/package-frame.html @@ -0,0 +1,35 @@ + + + + + +processing.video + + + + + + + + + + + +processing.video + + + + +
+Classes  + +
+Capture +
+Movie +
+MovieMaker
+ + + + diff --git a/build/javadoc/everything/processing/video/package-summary.html b/build/javadoc/everything/processing/video/package-summary.html new file mode 100644 index 000000000..a8d30297a --- /dev/null +++ b/build/javadoc/everything/processing/video/package-summary.html @@ -0,0 +1,159 @@ + + + + + +processing.video + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.video +

+ + + + + + + + + + + + + + + + + +
+Class Summary
CaptureWatchin' shit on the telly.
Movie 
MovieMakerLibrary to create a QuickTime movie from a Processing pixel array.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/video/package-tree.html b/build/javadoc/everything/processing/video/package-tree.html new file mode 100644 index 000000000..ad4657d68 --- /dev/null +++ b/build/javadoc/everything/processing/video/package-tree.html @@ -0,0 +1,151 @@ + + + + + +processing.video Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.video +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • processing.video.MovieMaker
    • processing.core.PImage (implements java.lang.Cloneable, processing.core.PConstants) +
        +
      • processing.video.Capture (implements java.lang.Runnable) +
      • processing.video.Movie (implements processing.core.PConstants, java.lang.Runnable) +
      +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/StdXMLBuilder.html b/build/javadoc/everything/processing/xml/StdXMLBuilder.html new file mode 100644 index 000000000..e23c2a535 --- /dev/null +++ b/build/javadoc/everything/processing/xml/StdXMLBuilder.html @@ -0,0 +1,479 @@ + + + + + +StdXMLBuilder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class StdXMLBuilder

+
+java.lang.Object
+  extended by processing.xml.StdXMLBuilder
+
+
+
+
public class StdXMLBuilder
extends java.lang.Object
+ + +

+StdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + tree of IXMLElement from an XML data source. +

+ +

+

+
See Also:
XMLElement
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
StdXMLBuilder() + +
+          Creates the builder.
StdXMLBuilder(XMLElement parent) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddAttribute(java.lang.String key, + java.lang.String nsPrefix, + java.lang.String nsURI, + java.lang.String value, + java.lang.String type) + +
+          This method is called when a new attribute of an XML element is + encountered.
+ voidaddPCData(java.io.Reader reader, + java.lang.String systemID, + int lineNr) + +
+          This method is called when a PCDATA element is encountered.
+ voidelementAttributesProcessed(java.lang.String name, + java.lang.String nsPrefix, + java.lang.String nsURI) + +
+          This method is called when the attributes of an XML element have been + processed.
+ voidendElement(java.lang.String name, + java.lang.String nsPrefix, + java.lang.String nsURI) + +
+          This method is called when the end of an XML elemnt is encountered.
+ java.lang.ObjectgetResult() + +
+          Returns the result of the building process.
+ voidnewProcessingInstruction(java.lang.String target, + java.io.Reader reader) + +
+          This method is called when a processing instruction is encountered.
+ voidstartBuilding(java.lang.String systemID, + int lineNr) + +
+          This method is called before the parser starts processing its input.
+ voidstartElement(java.lang.String name, + java.lang.String nsPrefix, + java.lang.String nsURI, + java.lang.String systemID, + int lineNr) + +
+          This method is called when a new XML element is encountered.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StdXMLBuilder

+
+public StdXMLBuilder()
+
+
Creates the builder. +

+

+
+ +

+StdXMLBuilder

+
+public StdXMLBuilder(XMLElement parent)
+
+
+ + + + + + + + +
+Method Detail
+ +

+startBuilding

+
+public void startBuilding(java.lang.String systemID,
+                          int lineNr)
+
+
This method is called before the parser starts processing its input. +

+

+
Parameters:
systemID - the system ID of the XML data source.
lineNr - the line on which the parsing starts.
+
+
+
+ +

+newProcessingInstruction

+
+public void newProcessingInstruction(java.lang.String target,
+                                     java.io.Reader reader)
+
+
This method is called when a processing instruction is encountered. + PIs with target "xml" are handled by the parser. +

+

+
Parameters:
target - the PI target.
reader - to read the data from the PI.
+
+
+
+ +

+startElement

+
+public void startElement(java.lang.String name,
+                         java.lang.String nsPrefix,
+                         java.lang.String nsURI,
+                         java.lang.String systemID,
+                         int lineNr)
+
+
This method is called when a new XML element is encountered. +

+

+
Parameters:
name - the name of the element.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
systemID - the system ID of the XML data source.
lineNr - the line in the source where the element starts.
See Also:
endElement(java.lang.String, java.lang.String, java.lang.String)
+
+
+
+ +

+elementAttributesProcessed

+
+public void elementAttributesProcessed(java.lang.String name,
+                                       java.lang.String nsPrefix,
+                                       java.lang.String nsURI)
+
+
This method is called when the attributes of an XML element have been + processed. +

+

+
Parameters:
name - the name of the element.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
See Also:
startElement(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int), +addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+
+
+
+ +

+endElement

+
+public void endElement(java.lang.String name,
+                       java.lang.String nsPrefix,
+                       java.lang.String nsURI)
+
+
This method is called when the end of an XML elemnt is encountered. +

+

+
Parameters:
name - the name of the element.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
See Also:
startElement(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int)
+
+
+
+ +

+addAttribute

+
+public void addAttribute(java.lang.String key,
+                         java.lang.String nsPrefix,
+                         java.lang.String nsURI,
+                         java.lang.String value,
+                         java.lang.String type)
+                  throws java.lang.Exception
+
+
This method is called when a new attribute of an XML element is + encountered. +

+

+
Parameters:
key - the key (name) of the attribute.
nsPrefix - the prefix used to identify the namespace. If no + namespace has been specified, this parameter is null.
nsURI - the URI associated with the namespace. If no + namespace has been specified, or no URI is + associated with nsPrefix, this parameter is null.
value - the value of the attribute.
type - the type of the attribute. If no type is known, + "CDATA" is returned. +
Throws: +
java.lang.Exception - If an exception occurred while processing the event.
+
+
+
+ +

+addPCData

+
+public void addPCData(java.io.Reader reader,
+                      java.lang.String systemID,
+                      int lineNr)
+
+
This method is called when a PCDATA element is encountered. A Java + reader is supplied from which you can read the data. The reader will + only read the data of the element. You don't need to check for + boundaries. If you don't read the full element, the rest of the data + is skipped. You also don't have to care about entities; they are + resolved by the parser. +

+

+
Parameters:
reader - the Java reader from which you can retrieve the data.
systemID - the system ID of the XML data source.
lineNr - the line in the source where the element starts.
+
+
+
+ +

+getResult

+
+public java.lang.Object getResult()
+
+
Returns the result of the building process. This method is called just + before the parse method of StdXMLParser returns. +

+

+ +
Returns:
the result of the building process.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/StdXMLParser.html b/build/javadoc/everything/processing/xml/StdXMLParser.html new file mode 100644 index 000000000..4afb200b4 --- /dev/null +++ b/build/javadoc/everything/processing/xml/StdXMLParser.html @@ -0,0 +1,431 @@ + + + + + +StdXMLParser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class StdXMLParser

+
+java.lang.Object
+  extended by processing.xml.StdXMLParser
+
+
+
+
public class StdXMLParser
extends java.lang.Object
+ + +

+StdXMLParser is the core parser of NanoXML. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
StdXMLParser() + +
+          Creates a new parser.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ StdXMLBuildergetBuilder() + +
+          Returns the builder which creates the logical structure of the XML data.
+ StdXMLReadergetReader() + +
+          Returns the reader from which the parser retrieves its data.
+ XMLEntityResolvergetResolver() + +
+          Returns the entity resolver.
+ XMLValidatorgetValidator() + +
+          Returns the validator that validates the XML data.
+ java.lang.Objectparse() + +
+          Parses the data and lets the builder create the logical data structure.
+ voidsetBuilder(StdXMLBuilder builder) + +
+          Sets the builder which creates the logical structure of the XML data.
+ voidsetReader(StdXMLReader reader) + +
+          Sets the reader from which the parser retrieves its data.
+ voidsetResolver(XMLEntityResolver resolver) + +
+          Sets the entity resolver.
+ voidsetValidator(XMLValidator validator) + +
+          Sets the validator that validates the XML data.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StdXMLParser

+
+public StdXMLParser()
+
+
Creates a new parser. +

+

+ + + + + + + + +
+Method Detail
+ +

+setBuilder

+
+public void setBuilder(StdXMLBuilder builder)
+
+
Sets the builder which creates the logical structure of the XML data. +

+

+
Parameters:
builder - the non-null builder
+
+
+
+ +

+getBuilder

+
+public StdXMLBuilder getBuilder()
+
+
Returns the builder which creates the logical structure of the XML data. +

+

+ +
Returns:
the builder
+
+
+
+ +

+setValidator

+
+public void setValidator(XMLValidator validator)
+
+
Sets the validator that validates the XML data. +

+

+
Parameters:
validator - the non-null validator
+
+
+
+ +

+getValidator

+
+public XMLValidator getValidator()
+
+
Returns the validator that validates the XML data. +

+

+ +
Returns:
the validator
+
+
+
+ +

+setResolver

+
+public void setResolver(XMLEntityResolver resolver)
+
+
Sets the entity resolver. +

+

+
Parameters:
resolver - the non-null resolver
+
+
+
+ +

+getResolver

+
+public XMLEntityResolver getResolver()
+
+
Returns the entity resolver. +

+

+ +
Returns:
the non-null resolver
+
+
+
+ +

+setReader

+
+public void setReader(StdXMLReader reader)
+
+
Sets the reader from which the parser retrieves its data. +

+

+
Parameters:
reader - the reader
+
+
+
+ +

+getReader

+
+public StdXMLReader getReader()
+
+
Returns the reader from which the parser retrieves its data. +

+

+ +
Returns:
the reader
+
+
+
+ +

+parse

+
+public java.lang.Object parse()
+                       throws XMLException
+
+
Parses the data and lets the builder create the logical data structure. +

+

+ +
Returns:
the logical structure built by the builder +
Throws: +
net.n3.nanoxml.XMLException - if an error occurred reading or parsing the data +
XMLException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/StdXMLReader.html b/build/javadoc/everything/processing/xml/StdXMLReader.html new file mode 100644 index 000000000..0c0863b74 --- /dev/null +++ b/build/javadoc/everything/processing/xml/StdXMLReader.html @@ -0,0 +1,637 @@ + + + + + +StdXMLReader + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class StdXMLReader

+
+java.lang.Object
+  extended by processing.xml.StdXMLReader
+
+
+
+
public class StdXMLReader
extends java.lang.Object
+ + +

+StdXMLReader reads the data to be parsed. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
StdXMLReader(java.io.InputStream stream) + +
+          Initializes the XML reader.
StdXMLReader(java.io.Reader reader) + +
+          Initializes the XML reader.
StdXMLReader(java.lang.String publicID, + java.lang.String systemID) + +
+          Initializes the reader from a system and public ID.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanatEOF() + +
+          Returns true if there are no more characters left to be read.
+ booleanatEOFOfCurrentStream() + +
+          Returns true if the current stream has no more characters left to be + read.
+static StdXMLReaderfileReader(java.lang.String filename) + +
+          Creates a new reader using a file as input.
+ intgetLineNr() + +
+          Returns the line number of the data in the current stream.
+ java.lang.StringgetPublicID() + +
+          Returns the current public ID.
+ intgetStreamLevel() + +
+          Returns the current "level" of the stream on the stack of streams.
+ java.lang.StringgetSystemID() + +
+          Returns the current system ID.
+ java.io.ReaderopenStream(java.lang.String publicID, + java.lang.String systemID) + +
+          Opens a stream from a public and system ID.
+ charread() + +
+          Reads a character.
+ voidsetPublicID(java.lang.String publicID) + +
+          Sets the public ID of the current stream.
+ voidsetSystemID(java.lang.String systemID) + +
+          Sets the system ID of the current stream.
+ voidstartNewStream(java.io.Reader reader) + +
+          Starts a new stream from a Java reader.
+ voidstartNewStream(java.io.Reader reader, + boolean isInternalEntity) + +
+          Starts a new stream from a Java reader.
+static StdXMLReaderstringReader(java.lang.String str) + +
+          Creates a new reader using a string as input.
+ voidunread(char ch) + +
+          Pushes the last character read back to the stream.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StdXMLReader

+
+public StdXMLReader(java.lang.String publicID,
+                    java.lang.String systemID)
+             throws java.net.MalformedURLException,
+                    java.io.FileNotFoundException,
+                    java.io.IOException
+
+
Initializes the reader from a system and public ID. +

+

+
Parameters:
publicID - the public ID which may be null.
systemID - the non-null system ID. +
Throws: +
java.net.MalformedURLException - if the system ID does not contain a valid URL +
java.io.FileNotFoundException - if the system ID refers to a local file which does not exist +
java.io.IOException - if an error occurred opening the stream
+
+
+ +

+StdXMLReader

+
+public StdXMLReader(java.io.Reader reader)
+
+
Initializes the XML reader. +

+

+
Parameters:
reader - the input for the XML data.
+
+
+ +

+StdXMLReader

+
+public StdXMLReader(java.io.InputStream stream)
+             throws java.io.IOException
+
+
Initializes the XML reader. +

+

+
Parameters:
stream - the input for the XML data. +
Throws: +
java.io.IOException - if an I/O error occurred
+
+ + + + + + + + +
+Method Detail
+ +

+stringReader

+
+public static StdXMLReader stringReader(java.lang.String str)
+
+
Creates a new reader using a string as input. +

+

+
Parameters:
str - the string containing the XML data
+
+
+
+ +

+fileReader

+
+public static StdXMLReader fileReader(java.lang.String filename)
+                               throws java.io.FileNotFoundException,
+                                      java.io.IOException
+
+
Creates a new reader using a file as input. +

+

+
Parameters:
filename - the name of the file containing the XML data +
Throws: +
java.io.FileNotFoundException - if the file could not be found +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+read

+
+public char read()
+          throws java.io.IOException
+
+
Reads a character. +

+

+ +
Returns:
the character +
Throws: +
java.io.IOException - if no character could be read
+
+
+
+ +

+atEOFOfCurrentStream

+
+public boolean atEOFOfCurrentStream()
+                             throws java.io.IOException
+
+
Returns true if the current stream has no more characters left to be + read. +

+

+ +
Throws: +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+atEOF

+
+public boolean atEOF()
+              throws java.io.IOException
+
+
Returns true if there are no more characters left to be read. +

+

+ +
Throws: +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+unread

+
+public void unread(char ch)
+            throws java.io.IOException
+
+
Pushes the last character read back to the stream. +

+

+
Parameters:
ch - the character to push back. +
Throws: +
java.io.IOException - if an I/O error occurred
+
+
+
+ +

+openStream

+
+public java.io.Reader openStream(java.lang.String publicID,
+                                 java.lang.String systemID)
+                          throws java.net.MalformedURLException,
+                                 java.io.FileNotFoundException,
+                                 java.io.IOException
+
+
Opens a stream from a public and system ID. +

+

+
Parameters:
publicID - the public ID, which may be null
systemID - the system ID, which is never null +
Throws: +
java.net.MalformedURLException - if the system ID does not contain a valid URL +
java.io.FileNotFoundException - if the system ID refers to a local file which does not exist +
java.io.IOException - if an error occurred opening the stream
+
+
+
+ +

+startNewStream

+
+public void startNewStream(java.io.Reader reader)
+
+
Starts a new stream from a Java reader. The new stream is used + temporary to read data from. If that stream is exhausted, control + returns to the parent stream. +

+

+
Parameters:
reader - the non-null reader to read the new data from
+
+
+
+ +

+startNewStream

+
+public void startNewStream(java.io.Reader reader,
+                           boolean isInternalEntity)
+
+
Starts a new stream from a Java reader. The new stream is used + temporary to read data from. If that stream is exhausted, control + returns to the parent stream. +

+

+
Parameters:
reader - the non-null reader to read the new data from
isInternalEntity - true if the reader is produced by resolving + an internal entity
+
+
+
+ +

+getStreamLevel

+
+public int getStreamLevel()
+
+
Returns the current "level" of the stream on the stack of streams. +

+

+
+
+
+
+ +

+getLineNr

+
+public int getLineNr()
+
+
Returns the line number of the data in the current stream. +

+

+
+
+
+
+ +

+setSystemID

+
+public void setSystemID(java.lang.String systemID)
+                 throws java.net.MalformedURLException
+
+
Sets the system ID of the current stream. +

+

+
Parameters:
systemID - the system ID +
Throws: +
java.net.MalformedURLException - if the system ID does not contain a valid URL
+
+
+
+ +

+setPublicID

+
+public void setPublicID(java.lang.String publicID)
+
+
Sets the public ID of the current stream. +

+

+
Parameters:
publicID - the public ID
+
+
+
+ +

+getSystemID

+
+public java.lang.String getSystemID()
+
+
Returns the current system ID. +

+

+
+
+
+
+ +

+getPublicID

+
+public java.lang.String getPublicID()
+
+
Returns the current public ID. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLElement.html b/build/javadoc/everything/processing/xml/XMLElement.html new file mode 100644 index 000000000..c1d65ba73 --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLElement.html @@ -0,0 +1,1829 @@ + + + + + +XMLElement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLElement

+
+java.lang.Object
+  extended by processing.xml.XMLElement
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class XMLElement
extends java.lang.Object
implements java.io.Serializable
+ + +

+XMLElement is an XML element. This is the base class used for the + Processing XML library, representing a single node of an XML tree. + + This code is based on a modified version of NanoXML by Marc De Scheemaecker. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Field Summary
+static intNO_LINE + +
+          No line number defined.
+  + + + + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
XMLElement() + +
+          Creates an empty element to be used for #PCDATA content.
XMLElement(PApplet parent, + java.lang.String filename) + +
+          Begin parsing XML data passed in from a PApplet.
XMLElement(java.io.Reader r) + +
+           
XMLElement(java.lang.String xml) + +
+           
XMLElement(java.lang.String fullName, + java.lang.String namespace, + java.lang.String systemID, + int lineNr) + +
+          Creates an empty element.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddChild(XMLElement child) + +
+          Adds a child element.
+ XMLElementcreateElement(java.lang.String fullName, + java.lang.String namespace) + +
+          Creates an empty element.
+ XMLElementcreateElement(java.lang.String fullName, + java.lang.String namespace, + java.lang.String systemID, + int lineNr) + +
+          Creates an empty element.
+ XMLElementcreatePCDataElement() + +
+          Creates an element to be used for #PCDATA content.
+ java.util.Enumeration<java.lang.String>enumerateAttributeNames() + +
+          Returns an enumeration of all attribute names.
+ java.util.Enumeration<XMLElement>enumerateChildren() + +
+          Returns an enumeration of all child elements.
+ booleanequals(java.lang.Object rawElement) + +
+          Returns true if the element equals another element.
+ booleanequalsXMLElement(XMLElement rawElement) + +
+          Returns true if the element equals another element.
+ java.lang.StringgetAttribute(java.lang.String name) + +
+          Returns the value of an attribute.
+ java.lang.StringgetAttribute(java.lang.String name, + java.lang.String defaultValue) + +
+          Returns the value of an attribute.
+ java.lang.StringgetAttribute(java.lang.String name, + java.lang.String namespace, + java.lang.String defaultValue) + +
+          Returns the value of an attribute.
+ intgetAttributeCount() + +
+          Returns the number of attributes.
+ java.lang.StringgetAttributeNamespace(java.lang.String name) + +
+          Returns the namespace of an attribute.
+ java.util.PropertiesgetAttributes() + +
+          Returns all attributes as a Properties object.
+ java.util.PropertiesgetAttributesInNamespace(java.lang.String namespace) + +
+          Returns all attributes in a specific namespace as a Properties object.
+ java.lang.StringgetAttributeType(java.lang.String name) + +
+          Returns the type of an attribute.
+ java.lang.StringgetAttributeType(java.lang.String name, + java.lang.String namespace) + +
+          Returns the type of an attribute.
+ XMLElementgetChild(int which) + +
+          Quick accessor for an element at a particular index.
+ XMLElementgetChild(java.lang.String name) + +
+          Get a child by its name or path.
+ XMLElementgetChildAtIndex(int index) + +
+          Returns the child at a specific index.
+ intgetChildCount() + +
+          Returns the number of children.
+ XMLElement[]getChildren() + +
+          Returns an array containing all the child elements.
+ XMLElement[]getChildren(java.lang.String name) + +
+          Get any children that match this name or path.
+ java.lang.StringgetContent() + +
+          Return the #PCDATA content of the element.
+ doublegetDoubleAttribute(java.lang.String name) + +
+           
+ doublegetDoubleAttribute(java.lang.String name, + double defaultValue) + +
+          Returns the value of an attribute.
+ doublegetDoubleAttribute(java.lang.String name, + java.lang.String namespace, + double defaultValue) + +
+          Returns the value of an attribute.
+ floatgetFloatAttribute(java.lang.String name) + +
+           
+ floatgetFloatAttribute(java.lang.String name, + float defaultValue) + +
+          Returns the value of an attribute.
+ floatgetFloatAttribute(java.lang.String name, + java.lang.String namespace, + float defaultValue) + +
+          Returns the value of an attribute.
+ intgetIntAttribute(java.lang.String name) + +
+           
+ intgetIntAttribute(java.lang.String name, + int defaultValue) + +
+          Returns the value of an attribute.
+ intgetIntAttribute(java.lang.String name, + java.lang.String namespace, + int defaultValue) + +
+          Returns the value of an attribute.
+ intgetLineNr() + +
+          Returns the line number in the data where the element started.
+ java.lang.StringgetLocalName() + +
+          Returns the name of the element.
+ java.lang.StringgetName() + +
+          Returns the full name (i.e.
+ java.lang.StringgetNamespace() + +
+          Returns the namespace of the element.
+ XMLElementgetParent() + +
+          Returns the parent element.
+ java.lang.StringgetStringAttribute(java.lang.String name) + +
+           
+ java.lang.StringgetStringAttribute(java.lang.String name, + java.lang.String defaultValue) + +
+           
+ java.lang.StringgetStringAttribute(java.lang.String name, + java.lang.String namespace, + java.lang.String defaultValue) + +
+           
+ java.lang.StringgetSystemID() + +
+          Returns the system ID of the data where the element started.
+ booleanhasAttribute(java.lang.String name) + +
+          Returns whether an attribute exists.
+ booleanhasAttribute(java.lang.String name, + java.lang.String namespace) + +
+          Returns whether an attribute exists.
+ booleanhasChildren() + +
+          Returns whether the element has children.
+ voidinsertChild(XMLElement child, + int index) + +
+          Inserts a child element.
+ booleanisLeaf() + +
+          Returns whether the element is a leaf element.
+ java.lang.String[]listChildren() + +
+          Put the names of all children into an array.
+ voidremoveAttribute(java.lang.String name) + +
+          Removes an attribute.
+ voidremoveAttribute(java.lang.String name, + java.lang.String namespace) + +
+          Removes an attribute.
+ voidremoveChild(XMLElement child) + +
+          Removes a child element.
+ voidremoveChildAtIndex(int index) + +
+          Removes the child located at a certain index.
+ voidsetAttribute(java.lang.String name, + java.lang.String value) + +
+          Sets an attribute.
+ voidsetAttribute(java.lang.String fullName, + java.lang.String namespace, + java.lang.String value) + +
+          Sets an attribute.
+ voidsetContent(java.lang.String content) + +
+          Sets the #PCDATA content.
+ voidsetName(java.lang.String name) + +
+          Sets the full name.
+ voidsetName(java.lang.String fullName, + java.lang.String namespace) + +
+          Sets the name.
+ java.lang.StringtoString(boolean pretty) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+NO_LINE

+
+public static final int NO_LINE
+
+
No line number defined. +

+

+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+XMLElement

+
+public XMLElement()
+
+
Creates an empty element to be used for #PCDATA content. +

+

+
+ +

+XMLElement

+
+public XMLElement(java.lang.String fullName,
+                  java.lang.String namespace,
+                  java.lang.String systemID,
+                  int lineNr)
+
+
Creates an empty element. +

+

+
Parameters:
fullName - the full name of the element
namespace - the namespace URI.
systemID - the system ID of the XML data where the element starts.
lineNr - the line in the XML data where the element starts.
+
+
+ +

+XMLElement

+
+public XMLElement(PApplet parent,
+                  java.lang.String filename)
+
+
Begin parsing XML data passed in from a PApplet. This code + wraps exception handling, for more advanced exception handling, + use the constructor that takes a Reader or InputStream. +

+

+
Parameters:
filename -
parent -
+
+
+ +

+XMLElement

+
+public XMLElement(java.io.Reader r)
+
+
+
+ +

+XMLElement

+
+public XMLElement(java.lang.String xml)
+
+
+ + + + + + + + +
+Method Detail
+ +

+createPCDataElement

+
+public XMLElement createPCDataElement()
+
+
Creates an element to be used for #PCDATA content. +

+

+
+
+
+
+
+
+
+ +

+createElement

+
+public XMLElement createElement(java.lang.String fullName,
+                                java.lang.String namespace)
+
+
Creates an empty element. +

+

+
+
+
+
Parameters:
fullName - the full name of the element
namespace - the namespace URI.
+
+
+
+ +

+createElement

+
+public XMLElement createElement(java.lang.String fullName,
+                                java.lang.String namespace,
+                                java.lang.String systemID,
+                                int lineNr)
+
+
Creates an empty element. +

+

+
+
+
+
Parameters:
fullName - the full name of the element
namespace - the namespace URI.
systemID - the system ID of the XML data where the element starts.
lineNr - the line in the XML data where the element starts.
+
+
+
+ +

+getParent

+
+public XMLElement getParent()
+
+
Returns the parent element. This method returns null for the root + element. +

+

+
+
+
+
+
+
+
+ +

+getName

+
+public java.lang.String getName()
+
+
Returns the full name (i.e. the name including an eventual namespace + prefix) of the element. +

+

+
+
+
+ +
Returns:
the name, or null if the element only contains #PCDATA.
+
+
+
+ +

+getLocalName

+
+public java.lang.String getLocalName()
+
+
Returns the name of the element. +

+

+
+
+
+ +
Returns:
the name, or null if the element only contains #PCDATA.
+
+
+
+ +

+getNamespace

+
+public java.lang.String getNamespace()
+
+
Returns the namespace of the element. +

+

+
+
+
+ +
Returns:
the namespace, or null if no namespace is associated with the + element.
+
+
+
+ +

+setName

+
+public void setName(java.lang.String name)
+
+
Sets the full name. This method also sets the short name and clears the + namespace URI. +

+

+
+
+
+
Parameters:
name - the non-null name.
+
+
+
+ +

+setName

+
+public void setName(java.lang.String fullName,
+                    java.lang.String namespace)
+
+
Sets the name. +

+

+
+
+
+
Parameters:
fullName - the non-null full name.
namespace - the namespace URI, which may be null.
+
+
+
+ +

+addChild

+
+public void addChild(XMLElement child)
+
+
Adds a child element. +

+

+
+
+
+
Parameters:
child - the non-null child to add.
+
+
+
+ +

+insertChild

+
+public void insertChild(XMLElement child,
+                        int index)
+
+
Inserts a child element. +

+

+
+
+
+
Parameters:
child - the non-null child to add.
index - where to put the child.
+
+
+
+ +

+removeChild

+
+public void removeChild(XMLElement child)
+
+
Removes a child element. +

+

+
+
+
+
Parameters:
child - the non-null child to remove.
+
+
+
+ +

+removeChildAtIndex

+
+public void removeChildAtIndex(int index)
+
+
Removes the child located at a certain index. +

+

+
+
+
+
Parameters:
index - the index of the child, where the first child has index 0.
+
+
+
+ +

+enumerateChildren

+
+public java.util.Enumeration<XMLElement> enumerateChildren()
+
+
Returns an enumeration of all child elements. +

+

+
+
+
+ +
Returns:
the non-null enumeration
+
+
+
+ +

+isLeaf

+
+public boolean isLeaf()
+
+
Returns whether the element is a leaf element. +

+

+
+
+
+ +
Returns:
true if the element has no children.
+
+
+
+ +

+hasChildren

+
+public boolean hasChildren()
+
+
Returns whether the element has children. +

+

+
+
+
+ +
Returns:
true if the element has children.
+
+
+
+ +

+getChildCount

+
+public int getChildCount()
+
+
Returns the number of children. +

+

+
+
+
+ +
Returns:
the count.
+
+
+
+ +

+listChildren

+
+public java.lang.String[] listChildren()
+
+
Put the names of all children into an array. Same as looping through + each child and calling getName() on each XMLElement. +

+

+
+
+
+
+
+
+
+ +

+getChildren

+
+public XMLElement[] getChildren()
+
+
Returns an array containing all the child elements. +

+

+
+
+
+
+
+
+
+ +

+getChild

+
+public XMLElement getChild(int which)
+
+
Quick accessor for an element at a particular index. +

+

+
+
+
+
+
+
+
+ +

+getChild

+
+public XMLElement getChild(java.lang.String name)
+
+
Get a child by its name or path. +

+

+
+
+
+
Parameters:
name - element name or path/to/element +
Returns:
the element
+
+
+
+ +

+getChildAtIndex

+
+public XMLElement getChildAtIndex(int index)
+                           throws java.lang.ArrayIndexOutOfBoundsException
+
+
Returns the child at a specific index. +

+

+
+
+
+
Parameters:
index - the index of the child +
Returns:
the non-null child +
Throws: +
java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.
+
+
+
+ +

+getChildren

+
+public XMLElement[] getChildren(java.lang.String name)
+
+
Get any children that match this name or path. Similar to getChild(), + but will grab multiple matches rather than only the first. +

+

+
+
+
+
Parameters:
name - element name or path/to/element +
Returns:
array of child elements that match
+
+
+
+ +

+getAttributeCount

+
+public int getAttributeCount()
+
+
Returns the number of attributes. +

+

+
+
+
+
+
+
+
+ +

+getAttribute

+
+public java.lang.String getAttribute(java.lang.String name)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute. +
Returns:
the value, or null if the attribute does not exist.
+
+
+
+ +

+getAttribute

+
+public java.lang.String getAttribute(java.lang.String name,
+                                     java.lang.String defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getAttribute

+
+public java.lang.String getAttribute(java.lang.String name,
+                                     java.lang.String namespace,
+                                     java.lang.String defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getStringAttribute

+
+public java.lang.String getStringAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getStringAttribute

+
+public java.lang.String getStringAttribute(java.lang.String name,
+                                           java.lang.String defaultValue)
+
+
+
+
+
+
+
+
+
+ +

+getStringAttribute

+
+public java.lang.String getStringAttribute(java.lang.String name,
+                                           java.lang.String namespace,
+                                           java.lang.String defaultValue)
+
+
+
+
+
+
+
+
+
+ +

+getIntAttribute

+
+public int getIntAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getIntAttribute

+
+public int getIntAttribute(java.lang.String name,
+                           int defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getIntAttribute

+
+public int getIntAttribute(java.lang.String name,
+                           java.lang.String namespace,
+                           int defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getFloatAttribute

+
+public float getFloatAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getFloatAttribute

+
+public float getFloatAttribute(java.lang.String name,
+                               float defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getFloatAttribute

+
+public float getFloatAttribute(java.lang.String name,
+                               java.lang.String namespace,
+                               float defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getDoubleAttribute

+
+public double getDoubleAttribute(java.lang.String name)
+
+
+
+
+
+
+
+
+
+ +

+getDoubleAttribute

+
+public double getDoubleAttribute(java.lang.String name,
+                                 double defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getDoubleAttribute

+
+public double getDoubleAttribute(java.lang.String name,
+                                 java.lang.String namespace,
+                                 double defaultValue)
+
+
Returns the value of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute. +
Returns:
the value, or defaultValue if the attribute does not exist.
+
+
+
+ +

+getAttributeType

+
+public java.lang.String getAttributeType(java.lang.String name)
+
+
Returns the type of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute. +
Returns:
the type, or null if the attribute does not exist.
+
+
+
+ +

+getAttributeNamespace

+
+public java.lang.String getAttributeNamespace(java.lang.String name)
+
+
Returns the namespace of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute. +
Returns:
the namespace, or null if there is none associated.
+
+
+
+ +

+getAttributeType

+
+public java.lang.String getAttributeType(java.lang.String name,
+                                         java.lang.String namespace)
+
+
Returns the type of an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null. +
Returns:
the type, or null if the attribute does not exist.
+
+
+
+ +

+setAttribute

+
+public void setAttribute(java.lang.String name,
+                         java.lang.String value)
+
+
Sets an attribute. +

+

+
+
+
+
Parameters:
name - the non-null full name of the attribute.
value - the non-null value of the attribute.
+
+
+
+ +

+setAttribute

+
+public void setAttribute(java.lang.String fullName,
+                         java.lang.String namespace,
+                         java.lang.String value)
+
+
Sets an attribute. +

+

+
+
+
+
Parameters:
fullName - the non-null full name of the attribute.
namespace - the namespace URI of the attribute, which may be null.
value - the non-null value of the attribute.
+
+
+
+ +

+removeAttribute

+
+public void removeAttribute(java.lang.String name)
+
+
Removes an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
+
+
+
+ +

+removeAttribute

+
+public void removeAttribute(java.lang.String name,
+                            java.lang.String namespace)
+
+
Removes an attribute. +

+

+
+
+
+
Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI of the attribute, which may be null.
+
+
+
+ +

+enumerateAttributeNames

+
+public java.util.Enumeration<java.lang.String> enumerateAttributeNames()
+
+
Returns an enumeration of all attribute names. +

+

+
+
+
+ +
Returns:
the non-null enumeration.
+
+
+
+ +

+hasAttribute

+
+public boolean hasAttribute(java.lang.String name)
+
+
Returns whether an attribute exists. +

+

+
+
+
+ +
Returns:
true if the attribute exists.
+
+
+
+ +

+hasAttribute

+
+public boolean hasAttribute(java.lang.String name,
+                            java.lang.String namespace)
+
+
Returns whether an attribute exists. +

+

+
+
+
+ +
Returns:
true if the attribute exists.
+
+
+
+ +

+getAttributes

+
+public java.util.Properties getAttributes()
+
+
Returns all attributes as a Properties object. +

+

+
+
+
+ +
Returns:
the non-null set.
+
+
+
+ +

+getAttributesInNamespace

+
+public java.util.Properties getAttributesInNamespace(java.lang.String namespace)
+
+
Returns all attributes in a specific namespace as a Properties object. +

+

+
+
+
+
Parameters:
namespace - the namespace URI of the attributes, which may be null. +
Returns:
the non-null set.
+
+
+
+ +

+getSystemID

+
+public java.lang.String getSystemID()
+
+
Returns the system ID of the data where the element started. +

+

+
+
+
+ +
Returns:
the system ID, or null if unknown.
See Also:
getLineNr()
+
+
+
+ +

+getLineNr

+
+public int getLineNr()
+
+
Returns the line number in the data where the element started. +

+

+
+
+
+ +
Returns:
the line number, or NO_LINE if unknown.
See Also:
NO_LINE, +getSystemID()
+
+
+
+ +

+getContent

+
+public java.lang.String getContent()
+
+
Return the #PCDATA content of the element. If the element has a + combination of #PCDATA content and child elements, the #PCDATA + sections can be retrieved as unnamed child objects. In this case, + this method returns null. +

+

+
+
+
+ +
Returns:
the content.
+
+
+
+ +

+setContent

+
+public void setContent(java.lang.String content)
+
+
Sets the #PCDATA content. It is an error to call this method with a + non-null value if there are child objects. +

+

+
+
+
+
Parameters:
content - the (possibly null) content.
+
+
+
+ +

+equals

+
+public boolean equals(java.lang.Object rawElement)
+
+
Returns true if the element equals another element. +

+

+
Overrides:
equals in class java.lang.Object
+
+
+
Parameters:
rawElement - the element to compare to
+
+
+
+ +

+equalsXMLElement

+
+public boolean equalsXMLElement(XMLElement rawElement)
+
+
Returns true if the element equals another element. +

+

+
+
+
+
Parameters:
rawElement - the element to compare to
+
+
+
+ +

+toString

+
+public java.lang.String toString(boolean pretty)
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLEntityResolver.html b/build/javadoc/everything/processing/xml/XMLEntityResolver.html new file mode 100644 index 000000000..6dd8bf5b6 --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLEntityResolver.html @@ -0,0 +1,329 @@ + + + + + +XMLEntityResolver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLEntityResolver

+
+java.lang.Object
+  extended by processing.xml.XMLEntityResolver
+
+
+
+
public class XMLEntityResolver
extends java.lang.Object
+ + +

+An XMLEntityResolver resolves entities. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
XMLEntityResolver() + +
+          Initializes the resolver.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddExternalEntity(java.lang.String name, + java.lang.String publicID, + java.lang.String systemID) + +
+          Adds an external entity.
+ voidaddInternalEntity(java.lang.String name, + java.lang.String value) + +
+          Adds an internal entity.
+ java.io.ReadergetEntity(StdXMLReader xmlReader, + java.lang.String name) + +
+          Returns a Java reader containing the value of an entity.
+ booleanisExternalEntity(java.lang.String name) + +
+          Returns true if an entity is external.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLEntityResolver

+
+public XMLEntityResolver()
+
+
Initializes the resolver. +

+

+ + + + + + + + +
+Method Detail
+ +

+addInternalEntity

+
+public void addInternalEntity(java.lang.String name,
+                              java.lang.String value)
+
+
Adds an internal entity. +

+

+
Parameters:
name - the name of the entity.
value - the value of the entity.
+
+
+
+ +

+addExternalEntity

+
+public void addExternalEntity(java.lang.String name,
+                              java.lang.String publicID,
+                              java.lang.String systemID)
+
+
Adds an external entity. +

+

+
Parameters:
name - the name of the entity.
publicID - the public ID of the entity, which may be null.
systemID - the system ID of the entity.
+
+
+
+ +

+getEntity

+
+public java.io.Reader getEntity(StdXMLReader xmlReader,
+                                java.lang.String name)
+                         throws XMLParseException
+
+
Returns a Java reader containing the value of an entity. +

+

+
Parameters:
xmlReader - the current XML reader
name - the name of the entity. +
Returns:
the reader, or null if the entity could not be resolved. +
Throws: +
XMLParseException
+
+
+
+ +

+isExternalEntity

+
+public boolean isExternalEntity(java.lang.String name)
+
+
Returns true if an entity is external. +

+

+
Parameters:
name - the name of the entity.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLException.html b/build/javadoc/everything/processing/xml/XMLException.html new file mode 100644 index 000000000..48cdd0b2b --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLException.html @@ -0,0 +1,512 @@ + + + + + +XMLException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.xml.XMLException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
Direct Known Subclasses:
XMLParseException, XMLValidationException
+
+
+
+
public class XMLException
extends java.lang.Exception
+ + +

+An XMLException is thrown when an exception occurred while processing the + XML data. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
XMLException(java.lang.Exception e) + +
+          Creates a new exception.
XMLException(java.lang.String msg) + +
+          Creates a new exception.
XMLException(java.lang.String systemID, + int lineNr, + java.lang.Exception e) + +
+          Creates a new exception.
XMLException(java.lang.String systemID, + int lineNr, + java.lang.Exception e, + java.lang.String msg, + boolean reportParams) + +
+          Creates a new exception.
XMLException(java.lang.String systemID, + int lineNr, + java.lang.String msg) + +
+          Creates a new exception.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.ExceptiongetException() + +
+          Returns the encapsulated exception, or null if no exception is + encapsulated.
+ intgetLineNr() + +
+          Returns the line number in the XML data where the exception occurred.
+ java.lang.StringgetSystemID() + +
+          Returns the system ID of the XML data where the exception occurred.
+ voidprintStackTrace() + +
+          Dumps the exception stack to System.err.
+ voidprintStackTrace(java.io.PrintStream stream) + +
+          Dumps the exception stack to an output stream.
+ voidprintStackTrace(java.io.PrintWriter writer) + +
+          Dumps the exception stack to a print writer.
+ java.lang.StringtoString() + +
+          Returns a string representation of the exception.
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLException

+
+public XMLException(java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
msg - the message of the exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.Exception e)
+
+
Creates a new exception. +

+

+
Parameters:
e - the encapsulated exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.String systemID,
+                    int lineNr,
+                    java.lang.Exception e)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID of the XML data where the exception + occurred
lineNr - the line number in the XML data where the exception + occurred.
e - the encapsulated exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.String systemID,
+                    int lineNr,
+                    java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID of the XML data where the exception + occurred
lineNr - the line number in the XML data where the exception + occurred.
msg - the message of the exception.
+
+
+ +

+XMLException

+
+public XMLException(java.lang.String systemID,
+                    int lineNr,
+                    java.lang.Exception e,
+                    java.lang.String msg,
+                    boolean reportParams)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the exception + occurred.
e - the encapsulated exception.
msg - the message of the exception.
reportParams - true if the systemID, lineNr and e params need to be + appended to the message
+
+ + + + + + + + +
+Method Detail
+ +

+getSystemID

+
+public java.lang.String getSystemID()
+
+
Returns the system ID of the XML data where the exception occurred. + If there is no system ID known, null is returned. +

+

+
+
+
+
+ +

+getLineNr

+
+public int getLineNr()
+
+
Returns the line number in the XML data where the exception occurred. + If there is no line number known, -1 is returned. +

+

+
+
+
+
+ +

+getException

+
+public java.lang.Exception getException()
+
+
Returns the encapsulated exception, or null if no exception is + encapsulated. +

+

+
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace(java.io.PrintWriter writer)
+
+
Dumps the exception stack to a print writer. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
Parameters:
writer - the print writer
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace(java.io.PrintStream stream)
+
+
Dumps the exception stack to an output stream. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
Parameters:
stream - the output stream
+
+
+
+ +

+printStackTrace

+
+public void printStackTrace()
+
+
Dumps the exception stack to System.err. +

+

+
Overrides:
printStackTrace in class java.lang.Throwable
+
+
+
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
Returns a string representation of the exception. +

+

+
Overrides:
toString in class java.lang.Throwable
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLParseException.html b/build/javadoc/everything/processing/xml/XMLParseException.html new file mode 100644 index 000000000..2332c23bb --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLParseException.html @@ -0,0 +1,276 @@ + + + + + +XMLParseException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLParseException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.xml.XMLException
+              extended by processing.xml.XMLParseException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class XMLParseException
extends XMLException
+ + +

+An XMLParseException is thrown when the XML passed to the XML parser is not + well-formed. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
XMLParseException(java.lang.String msg) + +
+          Creates a new exception.
XMLParseException(java.lang.String systemID, + int lineNr, + java.lang.String msg) + +
+          Creates a new exception.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class processing.xml.XMLException
getException, getLineNr, getSystemID, printStackTrace, printStackTrace, printStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLParseException

+
+public XMLParseException(java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
msg - the message of the exception.
+
+
+ +

+XMLParseException

+
+public XMLParseException(java.lang.String systemID,
+                         int lineNr,
+                         java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the exception + occurred.
msg - the message of the exception.
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLValidationException.html b/build/javadoc/everything/processing/xml/XMLValidationException.html new file mode 100644 index 000000000..d73f6475c --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLValidationException.html @@ -0,0 +1,519 @@ + + + + + +XMLValidationException + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLValidationException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by processing.xml.XMLException
+              extended by processing.xml.XMLValidationException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class XMLValidationException
extends XMLException
+ + +

+An XMLValidationException is thrown when the XML passed to the XML parser is + well-formed but not valid. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intATTRIBUTE_WITH_INVALID_VALUE + +
+          An attribute has an invalid value.
+static intMISC_ERROR + +
+          Another error than those specified in this class was encountered.
+static intMISSING_ATTRIBUTE + +
+          An attribute was missing.
+static intMISSING_ELEMENT + +
+          An element was missing.
+static intMISSING_PCDATA + +
+          A PCDATA element was missing.
+static intUNEXPECTED_ATTRIBUTE + +
+          An unexpected attribute was encountered.
+static intUNEXPECTED_ELEMENT + +
+          An unexpected element was encountered.
+static intUNEXPECTED_PCDATA + +
+          An unexpected PCDATA element was encountered.
+  + + + + + + + + + + +
+Constructor Summary
XMLValidationException(int errorType, + java.lang.String systemID, + int lineNr, + java.lang.String elementName, + java.lang.String attributeName, + java.lang.String attributeValue, + java.lang.String msg) + +
+          Creates a new exception.
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetAttributeName() + +
+          Returns the name of the attribute in which the validation is violated.
+ java.lang.StringgetAttributeValue() + +
+          Returns the value of the attribute in which the validation is violated.
+ java.lang.StringgetElementName() + +
+          Returns the name of the element in which the validation is violated.
+ + + + + + + +
Methods inherited from class processing.xml.XMLException
getException, getLineNr, getSystemID, printStackTrace, printStackTrace, printStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+MISSING_ELEMENT

+
+public static final int MISSING_ELEMENT
+
+
An element was missing. +

+

+
See Also:
Constant Field Values
+
+
+ +

+UNEXPECTED_ELEMENT

+
+public static final int UNEXPECTED_ELEMENT
+
+
An unexpected element was encountered. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MISSING_ATTRIBUTE

+
+public static final int MISSING_ATTRIBUTE
+
+
An attribute was missing. +

+

+
See Also:
Constant Field Values
+
+
+ +

+UNEXPECTED_ATTRIBUTE

+
+public static final int UNEXPECTED_ATTRIBUTE
+
+
An unexpected attribute was encountered. +

+

+
See Also:
Constant Field Values
+
+
+ +

+ATTRIBUTE_WITH_INVALID_VALUE

+
+public static final int ATTRIBUTE_WITH_INVALID_VALUE
+
+
An attribute has an invalid value. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MISSING_PCDATA

+
+public static final int MISSING_PCDATA
+
+
A PCDATA element was missing. +

+

+
See Also:
Constant Field Values
+
+
+ +

+UNEXPECTED_PCDATA

+
+public static final int UNEXPECTED_PCDATA
+
+
An unexpected PCDATA element was encountered. +

+

+
See Also:
Constant Field Values
+
+
+ +

+MISC_ERROR

+
+public static final int MISC_ERROR
+
+
Another error than those specified in this class was encountered. +

+

+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+XMLValidationException

+
+public XMLValidationException(int errorType,
+                              java.lang.String systemID,
+                              int lineNr,
+                              java.lang.String elementName,
+                              java.lang.String attributeName,
+                              java.lang.String attributeValue,
+                              java.lang.String msg)
+
+
Creates a new exception. +

+

+
Parameters:
errorType - the type of validity error
systemID - the system ID from where the data came
lineNr - the line number in the XML data where the + exception occurred.
elementName - the name of the offending element
attributeName - the name of the offending attribute
attributeValue - the value of the offending attribute
msg - the message of the exception.
+
+ + + + + + + + +
+Method Detail
+ +

+getElementName

+
+public java.lang.String getElementName()
+
+
Returns the name of the element in which the validation is violated. + If there is no current element, null is returned. +

+

+
+
+
+
+ +

+getAttributeName

+
+public java.lang.String getAttributeName()
+
+
Returns the name of the attribute in which the validation is violated. + If there is no current attribute, null is returned. +

+

+
+
+
+
+ +

+getAttributeValue

+
+public java.lang.String getAttributeValue()
+
+
Returns the value of the attribute in which the validation is violated. + If there is no current attribute, null is returned. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLValidator.html b/build/javadoc/everything/processing/xml/XMLValidator.html new file mode 100644 index 000000000..9649cf9a1 --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLValidator.html @@ -0,0 +1,441 @@ + + + + + +XMLValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLValidator

+
+java.lang.Object
+  extended by processing.xml.XMLValidator
+
+
+
+
public class XMLValidator
extends java.lang.Object
+ + +

+XMLValidator implementation based on NonValidator (which implemented + IXMLValidator in the original NanoXML). + This implementation processes the DTD and handles entity definitions. + It does not do any validation itself. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
XMLValidator() + +
+          Creates the "validator".
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidattributeAdded(java.lang.String key, + java.lang.String value, + java.lang.String systemId, + int lineNr) + +
+          Indicates that an attribute has been added to the current element.
+ voidelementAttributesProcessed(java.lang.String name, + java.util.Properties extraAttributes, + java.lang.String systemId, + int lineNr) + +
+          This method is called when the attributes of an XML element have been + processed.
+ voidelementEnded(java.lang.String name, + java.lang.String systemId, + int lineNr) + +
+          Indicates that the current element has ended.
+ voidelementStarted(java.lang.String name, + java.lang.String systemId, + int lineNr) + +
+          Indicates that an element has been started.
+ XMLEntityResolvergetParameterEntityResolver() + +
+          Returns the parameter entity resolver.
+ voidparseDTD(java.lang.String publicID, + StdXMLReader reader, + XMLEntityResolver entityResolver, + boolean external) + +
+          Parses the DTD.
+ voidPCDataAdded(java.lang.String systemId, + int lineNr) + +
+          Indicates that a new #PCDATA element has been encountered.
+ voidsetParameterEntityResolver(XMLEntityResolver resolver) + +
+          Sets the parameter entity resolver.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLValidator

+
+public XMLValidator()
+
+
Creates the "validator". +

+

+ + + + + + + + +
+Method Detail
+ +

+setParameterEntityResolver

+
+public void setParameterEntityResolver(XMLEntityResolver resolver)
+
+
Sets the parameter entity resolver. +

+

+
Parameters:
resolver - the entity resolver.
+
+
+
+ +

+getParameterEntityResolver

+
+public XMLEntityResolver getParameterEntityResolver()
+
+
Returns the parameter entity resolver. +

+

+ +
Returns:
the entity resolver.
+
+
+
+ +

+parseDTD

+
+public void parseDTD(java.lang.String publicID,
+                     StdXMLReader reader,
+                     XMLEntityResolver entityResolver,
+                     boolean external)
+              throws java.lang.Exception
+
+
Parses the DTD. The validator object is responsible for reading the + full DTD. +

+

+
Parameters:
publicID - the public ID, which may be null.
reader - the reader to read the DTD from.
entityResolver - the entity resolver.
external - true if the DTD is external. +
Throws: +
java.lang.Exception - If something went wrong.
+
+
+
+ +

+elementStarted

+
+public void elementStarted(java.lang.String name,
+                           java.lang.String systemId,
+                           int lineNr)
+
+
Indicates that an element has been started. +

+

+
Parameters:
name - the name of the element.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+elementEnded

+
+public void elementEnded(java.lang.String name,
+                         java.lang.String systemId,
+                         int lineNr)
+
+
Indicates that the current element has ended. +

+

+
Parameters:
name - the name of the element.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+elementAttributesProcessed

+
+public void elementAttributesProcessed(java.lang.String name,
+                                       java.util.Properties extraAttributes,
+                                       java.lang.String systemId,
+                                       int lineNr)
+
+
This method is called when the attributes of an XML element have been + processed. + If there are attributes with a default value which have not been + specified yet, they have to be put into extraAttributes. +

+

+
Parameters:
name - the name of the element.
extraAttributes - where to put extra attributes.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+attributeAdded

+
+public void attributeAdded(java.lang.String key,
+                           java.lang.String value,
+                           java.lang.String systemId,
+                           int lineNr)
+
+
Indicates that an attribute has been added to the current element. +

+

+
Parameters:
key - the name of the attribute.
value - the value of the attribute.
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+
+ +

+PCDataAdded

+
+public void PCDataAdded(java.lang.String systemId,
+                        int lineNr)
+
+
Indicates that a new #PCDATA element has been encountered. +

+

+
Parameters:
systemId - the system ID of the XML data of the element.
lineNr - the line number in the XML data of the element.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/XMLWriter.html b/build/javadoc/everything/processing/xml/XMLWriter.html new file mode 100644 index 000000000..0f7242177 --- /dev/null +++ b/build/javadoc/everything/processing/xml/XMLWriter.html @@ -0,0 +1,364 @@ + + + + + +XMLWriter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +processing.xml +
+Class XMLWriter

+
+java.lang.Object
+  extended by processing.xml.XMLWriter
+
+
+
+
public class XMLWriter
extends java.lang.Object
+ + +

+An XMLWriter writes XML data to a stream. +

+ +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
XMLWriter(java.io.OutputStream stream) + +
+          Creates a new XML writer.
XMLWriter(java.io.Writer writer) + +
+          Creates a new XML writer.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidwrite(XMLElement xml) + +
+          Writes an XML element.
+ voidwrite(XMLElement xml, + boolean prettyPrint) + +
+          Writes an XML element.
+ voidwrite(XMLElement xml, + boolean prettyPrint, + int indent) + +
+          Writes an XML element.
+ voidwrite(XMLElement xml, + boolean prettyPrint, + int indent, + boolean collapseEmptyElements) + +
+          Writes an XML element.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+XMLWriter

+
+public XMLWriter(java.io.Writer writer)
+
+
Creates a new XML writer. +

+

+
Parameters:
writer - where to write the output to.
+
+
+ +

+XMLWriter

+
+public XMLWriter(java.io.OutputStream stream)
+
+
Creates a new XML writer. +

+

+
Parameters:
stream - where to write the output to.
+
+ + + + + + + + +
+Method Detail
+ +

+write

+
+public void write(XMLElement xml)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write. +
Throws: +
java.io.IOException
+
+
+
+ +

+write

+
+public void write(XMLElement xml,
+                  boolean prettyPrint)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write.
prettyPrint - if spaces need to be inserted to make the output more + readable +
Throws: +
java.io.IOException
+
+
+
+ +

+write

+
+public void write(XMLElement xml,
+                  boolean prettyPrint,
+                  int indent)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write.
prettyPrint - if spaces need to be inserted to make the output more + readable
indent - how many spaces to indent the element. +
Throws: +
java.io.IOException
+
+
+
+ +

+write

+
+public void write(XMLElement xml,
+                  boolean prettyPrint,
+                  int indent,
+                  boolean collapseEmptyElements)
+           throws java.io.IOException
+
+
Writes an XML element. +

+

+
Parameters:
xml - the non-null XML element to write.
prettyPrint - if spaces need to be inserted to make the output more + readable
indent - how many spaces to indent the element. +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/package-frame.html b/build/javadoc/everything/processing/xml/package-frame.html new file mode 100644 index 000000000..3e9262294 --- /dev/null +++ b/build/javadoc/everything/processing/xml/package-frame.html @@ -0,0 +1,58 @@ + + + + + +processing.xml + + + + + + + + + + + +processing.xml + + + + +
+Classes  + +
+StdXMLBuilder +
+StdXMLParser +
+StdXMLReader +
+XMLElement +
+XMLEntityResolver +
+XMLValidator +
+XMLWriter
+ + + + + + +
+Exceptions  + +
+XMLException +
+XMLParseException +
+XMLValidationException
+ + + + diff --git a/build/javadoc/everything/processing/xml/package-summary.html b/build/javadoc/everything/processing/xml/package-summary.html new file mode 100644 index 000000000..47a3cef6d --- /dev/null +++ b/build/javadoc/everything/processing/xml/package-summary.html @@ -0,0 +1,202 @@ + + + + + +processing.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package processing.xml +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
StdXMLBuilderStdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + tree of IXMLElement from an XML data source.
StdXMLParserStdXMLParser is the core parser of NanoXML.
StdXMLReaderStdXMLReader reads the data to be parsed.
XMLElementXMLElement is an XML element.
XMLEntityResolverAn XMLEntityResolver resolves entities.
XMLValidatorXMLValidator implementation based on NonValidator (which implemented + IXMLValidator in the original NanoXML).
XMLWriterAn XMLWriter writes XML data to a stream.
+  + +

+ + + + + + + + + + + + + + + + + +
+Exception Summary
XMLExceptionAn XMLException is thrown when an exception occurred while processing the + XML data.
XMLParseExceptionAn XMLParseException is thrown when the XML passed to the XML parser is not + well-formed.
XMLValidationExceptionAn XMLValidationException is thrown when the XML passed to the XML parser is + well-formed but not valid.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/processing/xml/package-tree.html b/build/javadoc/everything/processing/xml/package-tree.html new file mode 100644 index 000000000..77f4afaaa --- /dev/null +++ b/build/javadoc/everything/processing/xml/package-tree.html @@ -0,0 +1,154 @@ + + + + + +processing.xml Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package processing.xml +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/resources/inherit.gif b/build/javadoc/everything/resources/inherit.gif new file mode 100644 index 000000000..c814867a1 Binary files /dev/null and b/build/javadoc/everything/resources/inherit.gif differ diff --git a/build/javadoc/everything/serialized-form.html b/build/javadoc/everything/serialized-form.html new file mode 100644 index 000000000..d0744666b --- /dev/null +++ b/build/javadoc/everything/serialized-form.html @@ -0,0 +1,3741 @@ + + + + + +Serialized Form + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Serialized Form

+
+
+ + + + + +
+Package antlr
+ +

+ + + + + +
+Class antlr.ANTLRError extends java.lang.Error implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.ANTLRException extends java.lang.Exception implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.BaseAST extends java.lang.Object implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+down

+
+antlr.BaseAST down
+
+
+
+
+
+

+right

+
+antlr.BaseAST right
+
+
+
+
+ +

+ + + + + +
+Class antlr.CharStreamException extends antlr.ANTLRException implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.CharStreamIOException extends antlr.CharStreamException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+io

+
+java.io.IOException io
+
+
+
+
+ +

+ + + + + +
+Class antlr.CommonAST extends antlr.BaseAST implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+ttype

+
+int ttype
+
+
+
+
+
+

+text

+
+java.lang.String text
+
+
+
+
+ +

+ + + + + +
+Class antlr.CommonASTWithHiddenTokens extends antlr.CommonAST implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+hiddenBefore

+
+antlr.CommonHiddenStreamToken hiddenBefore
+
+
+
+
+
+

+hiddenAfter

+
+antlr.CommonHiddenStreamToken hiddenAfter
+
+
+
+
+ +

+ + + + + +
+Class antlr.ExtendedCommonASTWithHiddenTokens extends antlr.CommonASTWithHiddenTokens implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.MismatchedCharException extends antlr.RecognitionException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+mismatchType

+
+int mismatchType
+
+
+
+
+
+

+foundChar

+
+int foundChar
+
+
+
+
+
+

+expecting

+
+int expecting
+
+
+
+
+
+

+upper

+
+int upper
+
+
+
+
+
+

+set

+
+antlr.collections.impl.BitSet set
+
+
+
+
+
+

+scanner

+
+antlr.CharScanner scanner
+
+
+
+
+ +

+ + + + + +
+Class antlr.MismatchedTokenException extends antlr.RecognitionException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+tokenNames

+
+java.lang.String[] tokenNames
+
+
+
+
+
+

+token

+
+antlr.Token token
+
+
+
+
+
+

+node

+
+antlr.collections.AST node
+
+
+
+
+
+

+tokenText

+
+java.lang.String tokenText
+
+
+
+
+
+

+mismatchType

+
+int mismatchType
+
+
+
+
+
+

+expecting

+
+int expecting
+
+
+
+
+
+

+upper

+
+int upper
+
+
+
+
+
+

+set

+
+antlr.collections.impl.BitSet set
+
+
+
+
+ +

+ + + + + +
+Class antlr.NoViableAltException extends antlr.RecognitionException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+token

+
+antlr.Token token
+
+
+
+
+
+

+node

+
+antlr.collections.AST node
+
+
+
+
+ +

+ + + + + +
+Class antlr.NoViableAltForCharException extends antlr.RecognitionException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+foundChar

+
+char foundChar
+
+
+
+
+ +

+ + + + + +
+Class antlr.ParseTree extends antlr.BaseAST implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.ParseTreeRule extends antlr.ParseTree implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+ruleName

+
+java.lang.String ruleName
+
+
+
+
+
+

+altNumber

+
+int altNumber
+
+
+
+
+ +

+ + + + + +
+Class antlr.ParseTreeToken extends antlr.ParseTree implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+token

+
+antlr.Token token
+
+
+
+
+ +

+ + + + + +
+Class antlr.RecognitionException extends antlr.ANTLRException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+fileName

+
+java.lang.String fileName
+
+
+
+
+
+

+line

+
+int line
+
+
+
+
+
+

+column

+
+int column
+
+
+
+
+ +

+ + + + + +
+Class antlr.SemanticException extends antlr.RecognitionException implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.TokenStreamException extends antlr.ANTLRException implements Serializable
+ +

+ +

+ + + + + +
+Class antlr.TokenStreamIOException extends antlr.TokenStreamException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+io

+
+java.io.IOException io
+
+
+
+
+ +

+ + + + + +
+Class antlr.TokenStreamRecognitionException extends antlr.TokenStreamException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+recog

+
+antlr.RecognitionException recog
+
+
+
+
+ +

+ + + + + +
+Class antlr.TokenStreamRetryException extends antlr.TokenStreamException implements Serializable
+ +

+


+ + + + + +
+Package processing.app
+ +

+ + + + + +
+Class processing.app.Editor extends javax.swing.JFrame implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+base

+
+Base base
+
+
+
+
+
+

+untitled

+
+boolean untitled
+
+
true if this file has not yet been given a name by the user +

+

+
+
+
+

+pageFormat

+
+java.awt.print.PageFormat pageFormat
+
+
+
+
+
+

+printerJob

+
+java.awt.print.PrinterJob printerJob
+
+
+
+
+
+

+fileMenu

+
+javax.swing.JMenu fileMenu
+
+
+
+
+
+

+sketchMenu

+
+javax.swing.JMenu sketchMenu
+
+
+
+
+
+

+toolbar

+
+EditorToolbar toolbar
+
+
+
+
+
+

+header

+
+EditorHeader header
+
+
+
+
+
+

+status

+
+EditorStatus status
+
+
+
+
+
+

+console

+
+EditorConsole console
+
+
+
+
+
+

+splitPane

+
+javax.swing.JSplitPane splitPane
+
+
+
+
+
+

+consolePanel

+
+javax.swing.JPanel consolePanel
+
+
+
+
+
+

+lineNumberComponent

+
+javax.swing.JLabel lineNumberComponent
+
+
+
+
+
+

+sketch

+
+Sketch sketch
+
+
+
+
+
+

+lineStatus

+
+EditorLineStatus lineStatus
+
+
+
+
+
+

+textarea

+
+JEditTextArea textarea
+
+
+
+
+
+

+listener

+
+EditorListener listener
+
+
+
+
+
+

+sketchWindowLocation

+
+java.awt.Point sketchWindowLocation
+
+
+
+
+
+

+runtime

+
+Runner runtime
+
+
+
+
+
+

+exportAppItem

+
+javax.swing.JMenuItem exportAppItem
+
+
+
+
+
+

+saveMenuItem

+
+javax.swing.JMenuItem saveMenuItem
+
+
+
+
+
+

+saveAsMenuItem

+
+javax.swing.JMenuItem saveAsMenuItem
+
+
+
+
+
+

+running

+
+boolean running
+
+
+
+
+
+

+presenting

+
+boolean presenting
+
+
+
+
+
+

+undoItem

+
+javax.swing.JMenuItem undoItem
+
+
+
+
+
+

+redoItem

+
+javax.swing.JMenuItem redoItem
+
+
+
+
+
+

+undoAction

+
+processing.app.Editor.UndoAction undoAction
+
+
+
+
+
+

+redoAction

+
+processing.app.Editor.RedoAction redoAction
+
+
+
+
+
+

+undo

+
+javax.swing.undo.UndoManager undo
+
+
+
+
+
+

+compoundEdit

+
+javax.swing.undo.CompoundEdit compoundEdit
+
+
+
+
+
+

+find

+
+FindReplace find
+
+
+
+
+ +

+ + + + + +
+Class processing.app.EditorConsole extends javax.swing.JScrollPane implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editor

+
+Editor editor
+
+
+
+
+
+

+consoleTextPane

+
+javax.swing.JTextPane consoleTextPane
+
+
+
+
+
+

+consoleDoc

+
+processing.app.BufferedStyledDocument consoleDoc
+
+
+
+
+
+

+stdStyle

+
+javax.swing.text.MutableAttributeSet stdStyle
+
+
+
+
+
+

+errStyle

+
+javax.swing.text.MutableAttributeSet errStyle
+
+
+
+
+
+

+cerror

+
+boolean cerror
+
+
+
+
+
+

+maxLineCount

+
+int maxLineCount
+
+
+
+
+ +

+ + + + + +
+Class processing.app.EditorHeader extends javax.swing.JComponent implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editor

+
+Editor editor
+
+
+
+
+
+

+tabLeft

+
+int[] tabLeft
+
+
+
+
+
+

+tabRight

+
+int[] tabRight
+
+
+
+
+
+

+font

+
+java.awt.Font font
+
+
+
+
+
+

+metrics

+
+java.awt.FontMetrics metrics
+
+
+
+
+
+

+fontAscent

+
+int fontAscent
+
+
+
+
+
+

+menu

+
+javax.swing.JMenu menu
+
+
+
+
+
+

+popup

+
+javax.swing.JPopupMenu popup
+
+
+
+
+
+

+menuLeft

+
+int menuLeft
+
+
+
+
+
+

+menuRight

+
+int menuRight
+
+
+
+
+
+

+offscreen

+
+java.awt.Image offscreen
+
+
+
+
+
+

+sizeW

+
+int sizeW
+
+
+
+
+
+

+sizeH

+
+int sizeH
+
+
+
+
+
+

+imageW

+
+int imageW
+
+
+
+
+
+

+imageH

+
+int imageH
+
+
+
+
+ +

+ + + + + +
+Class processing.app.EditorLineStatus extends javax.swing.JComponent implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+textarea

+
+JEditTextArea textarea
+
+
+
+
+
+

+start

+
+int start
+
+
+
+
+
+

+stop

+
+int stop
+
+
+
+
+
+

+resize

+
+java.awt.Image resize
+
+
+
+
+
+

+foreground

+
+java.awt.Color foreground
+
+
+
+
+
+

+background

+
+java.awt.Color background
+
+
+
+
+
+

+font

+
+java.awt.Font font
+
+
+
+
+
+

+high

+
+int high
+
+
+
+
+
+

+text

+
+java.lang.String text
+
+
+
+
+ +

+ + + + + +
+Class processing.app.EditorStatus extends javax.swing.JPanel implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editor

+
+Editor editor
+
+
+
+
+
+

+mode

+
+int mode
+
+
+
+
+
+

+message

+
+java.lang.String message
+
+
+
+
+
+

+font

+
+java.awt.Font font
+
+
+
+
+
+

+metrics

+
+java.awt.FontMetrics metrics
+
+
+
+
+
+

+ascent

+
+int ascent
+
+
+
+
+
+

+offscreen

+
+java.awt.Image offscreen
+
+
+
+
+
+

+sizeW

+
+int sizeW
+
+
+
+
+
+

+sizeH

+
+int sizeH
+
+
+
+
+
+

+imageW

+
+int imageW
+
+
+
+
+
+

+imageH

+
+int imageH
+
+
+
+
+
+

+cancelButton

+
+javax.swing.JButton cancelButton
+
+
+
+
+
+

+okButton

+
+javax.swing.JButton okButton
+
+
+
+
+
+

+editField

+
+javax.swing.JTextField editField
+
+
+
+
+
+

+response

+
+int response
+
+
+
+
+ +

+ + + + + +
+Class processing.app.EditorToolbar extends javax.swing.JComponent implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editor

+
+Editor editor
+
+
+
+
+
+

+offscreen

+
+java.awt.Image offscreen
+
+
+
+
+
+

+width

+
+int width
+
+
+
+
+
+

+height

+
+int height
+
+
+
+
+
+

+bgcolor

+
+java.awt.Color bgcolor
+
+
+
+
+
+

+currentRollover

+
+int currentRollover
+
+
+
+
+
+

+popup

+
+javax.swing.JPopupMenu popup
+
+
+
+
+
+

+menu

+
+javax.swing.JMenu menu
+
+
+
+
+
+

+buttonCount

+
+int buttonCount
+
+
+
+
+
+

+state

+
+int[] state
+
+
+
+
+
+

+stateImage

+
+java.awt.Image[] stateImage
+
+
+
+
+
+

+which

+
+int[] which
+
+
+
+
+
+

+x1

+
+int[] x1
+
+
+
+
+
+

+x2

+
+int[] x2
+
+
+
+
+
+

+y1

+
+int y1
+
+
+
+
+
+

+y2

+
+int y2
+
+
+
+
+
+

+status

+
+java.lang.String status
+
+
+
+
+
+

+statusFont

+
+java.awt.Font statusFont
+
+
+
+
+
+

+statusColor

+
+java.awt.Color statusColor
+
+
+
+
+
+

+wasDown

+
+int wasDown
+
+
+
+
+ +

+ + + + + +
+Class processing.app.FindReplace extends javax.swing.JFrame implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editor

+
+Editor editor
+
+
+
+
+
+

+findField

+
+javax.swing.JTextField findField
+
+
+
+
+
+

+replaceField

+
+javax.swing.JTextField replaceField
+
+
+
+
+
+

+replaceButton

+
+javax.swing.JButton replaceButton
+
+
+
+
+
+

+replaceAllButton

+
+javax.swing.JButton replaceAllButton
+
+
+
+
+
+

+replaceFindButton

+
+javax.swing.JButton replaceFindButton
+
+
+
+
+
+

+findButton

+
+javax.swing.JButton findButton
+
+
+
+
+
+

+ignoreCaseBox

+
+javax.swing.JCheckBox ignoreCaseBox
+
+
+
+
+
+

+found

+
+boolean found
+
+
+
+
+
+ + + + + +
+Package processing.app.debug
+ +

+ + + + + +
+Class processing.app.debug.RunnerException extends java.lang.Exception implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+message

+
+java.lang.String message
+
+
+
+
+
+

+codeIndex

+
+int codeIndex
+
+
+
+
+
+

+codeLine

+
+int codeLine
+
+
+
+
+
+

+codeColumn

+
+int codeColumn
+
+
+
+
+
+

+showStackTrace

+
+boolean showStackTrace
+
+
+
+
+
+ + + + + +
+Package processing.app.syntax
+ +

+ + + + + +
+Class processing.app.syntax.JEditTextArea extends javax.swing.JComponent implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editorListener

+
+EditorListener editorListener
+
+
Forwards key events directly to the input handler. + This is slightly faster than using a KeyListener + because some Swing overhead is avoided. +

+

+
+
+
+

+editorLineStatus

+
+EditorLineStatus editorLineStatus
+
+
The component that tracks the current line number. +

+

+
+
+
+

+painter

+
+TextAreaPainter painter
+
+
+
+
+
+

+popup

+
+javax.swing.JPopupMenu popup
+
+
+
+
+
+

+eventListenerList

+
+javax.swing.event.EventListenerList eventListenerList
+
+
+
+
+
+

+caretEvent

+
+processing.app.syntax.JEditTextArea.MutableCaretEvent caretEvent
+
+
+
+
+
+

+caretBlinks

+
+boolean caretBlinks
+
+
+
+
+
+

+caretVisible

+
+boolean caretVisible
+
+
+
+
+
+

+blink

+
+boolean blink
+
+
+
+
+
+

+editable

+
+boolean editable
+
+
+
+
+
+

+firstLine

+
+int firstLine
+
+
+
+
+
+

+visibleLines

+
+int visibleLines
+
+
+
+
+
+

+electricScroll

+
+int electricScroll
+
+
+
+
+
+

+horizontalOffset

+
+int horizontalOffset
+
+
+
+
+
+

+vertical

+
+javax.swing.JScrollBar vertical
+
+
+
+
+
+

+horizontal

+
+javax.swing.JScrollBar horizontal
+
+
+
+
+
+

+scrollBarsInitialized

+
+boolean scrollBarsInitialized
+
+
+
+
+
+

+inputHandler

+
+InputHandler inputHandler
+
+
+
+
+
+

+document

+
+SyntaxDocument document
+
+
+
+
+
+

+documentHandler

+
+processing.app.syntax.JEditTextArea.DocumentHandler documentHandler
+
+
+
+
+
+

+lineSegment

+
+javax.swing.text.Segment lineSegment
+
+
+
+
+
+

+selectionStart

+
+int selectionStart
+
+
+
+
+
+

+selectionStartLine

+
+int selectionStartLine
+
+
+
+
+
+

+selectionEnd

+
+int selectionEnd
+
+
+
+
+
+

+selectionEndLine

+
+int selectionEndLine
+
+
+
+
+
+

+biasLeft

+
+boolean biasLeft
+
+
+
+
+
+

+bracketPosition

+
+int bracketPosition
+
+
+
+
+
+

+bracketLine

+
+int bracketLine
+
+
+
+
+
+

+magicCaret

+
+int magicCaret
+
+
+
+
+
+

+overwrite

+
+boolean overwrite
+
+
+
+
+
+

+rectSelect

+
+boolean rectSelect
+
+
+
+
+ +

+ + + + + +
+Class processing.app.syntax.SyntaxDocument extends javax.swing.text.PlainDocument implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+tokenMarker

+
+TokenMarker tokenMarker
+
+
+
+
+ +

+ + + + + +
+Class processing.app.syntax.TextAreaPainter extends javax.swing.JComponent implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+printing

+
+boolean printing
+
+
True if inside printing, will handle disabling the highlight +

+

+
+
+
+

+currentLineIndex

+
+int currentLineIndex
+
+
+
+
+
+

+currentLineTokens

+
+Token currentLineTokens
+
+
+
+
+
+

+currentLine

+
+javax.swing.text.Segment currentLine
+
+
+
+
+
+

+textArea

+
+JEditTextArea textArea
+
+
+
+
+
+

+styles

+
+SyntaxStyle[] styles
+
+
+
+
+
+

+caretColor

+
+java.awt.Color caretColor
+
+
+
+
+
+

+selectionColor

+
+java.awt.Color selectionColor
+
+
+
+
+
+

+lineHighlightColor

+
+java.awt.Color lineHighlightColor
+
+
+
+
+
+

+bracketHighlightColor

+
+java.awt.Color bracketHighlightColor
+
+
+
+
+
+

+eolMarkerColor

+
+java.awt.Color eolMarkerColor
+
+
+
+
+
+

+blockCaret

+
+boolean blockCaret
+
+
+
+
+
+

+lineHighlight

+
+boolean lineHighlight
+
+
+
+
+
+

+bracketHighlight

+
+boolean bracketHighlight
+
+
+
+
+
+

+paintInvalid

+
+boolean paintInvalid
+
+
+
+
+
+

+eolMarkers

+
+boolean eolMarkers
+
+
+
+
+
+

+cols

+
+int cols
+
+
+
+
+
+

+rows

+
+int rows
+
+
+
+
+
+

+tabSize

+
+int tabSize
+
+
+
+
+
+

+fm

+
+java.awt.FontMetrics fm
+
+
+
+
+
+

+highlights

+
+TextAreaPainter.Highlight highlights
+
+
+
+
+
+ + + + + +
+Package processing.app.tools
+ +

+ + + + + +
+Class processing.app.tools.ColorSelector.ColorRange extends PApplet implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+lastX

+
+int lastX
+
+
+
+
+
+

+lastY

+
+int lastY
+
+
+
+
+ +

+ + + + + +
+Class processing.app.tools.ColorSelector.ColorSlider extends PApplet implements Serializable
+ +

+ +

+ + + + + +
+Class processing.app.tools.CreateFont extends javax.swing.JFrame implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+editor

+
+Editor editor
+
+
+
+
+
+

+windowSize

+
+java.awt.Dimension windowSize
+
+
+
+
+
+

+fontSelector

+
+javax.swing.JList fontSelector
+
+
+
+
+
+

+sizeSelector

+
+javax.swing.JTextField sizeSelector
+
+
+
+
+
+

+allBox

+
+javax.swing.JCheckBox allBox
+
+
+
+
+
+

+smoothBox

+
+javax.swing.JCheckBox smoothBox
+
+
+
+
+
+

+sample

+
+javax.swing.JTextArea sample
+
+
+
+
+
+

+okButton

+
+javax.swing.JButton okButton
+
+
+
+
+
+

+filenameField

+
+javax.swing.JTextField filenameField
+
+
+
+
+
+

+table

+
+java.util.Hashtable<K,V> table
+
+
+
+
+
+

+smooth

+
+boolean smooth
+
+
+
+
+
+

+all

+
+boolean all
+
+
+
+
+
+

+font

+
+java.awt.Font font
+
+
+
+
+
+

+list

+
+java.lang.String[] list
+
+
+
+
+
+

+selection

+
+int selection
+
+
+
+
+
+ + + + + +
+Package processing.core
+ +

+ + + + + +
+Class processing.core.PApplet extends java.applet.Applet implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+g

+
+PGraphics g
+
+
The PGraphics renderer associated with this PApplet +

+

+
+
+
+

+frame

+
+java.awt.Frame frame
+
+
The frame containing this applet (if any) +

+

+
+
+
+

+screen

+
+java.awt.Dimension screen
+
+
The screen size when the applet was started. +

+ Access this via screen.width and screen.height. To make an applet + run at full screen, use size(screen.width, screen.height). +

+ If you have multiple displays, this will be the size of the main + display. Running full screen across multiple displays isn't + particularly supported, and requires more monkeying with the values. + This probably can't/won't be fixed until/unless I get a dual head + system. +

+ Note that this won't update if you change the resolution + of your screen once the the applet is running. +

+ This variable is not static, because future releases need to be better + at handling multiple displays. +

+

+
+
+
+

+recorder

+
+PGraphics recorder
+
+
A leech graphics object that is echoing all events. +

+

+
+
+
+

+args

+
+java.lang.String[] args
+
+
Command line options passed in from main(). +

+ This does not include the arguments passed in to PApplet itself. +

+

+
+
+
+

+sketchPath

+
+java.lang.String sketchPath
+
+
Path to sketch folder +

+

+
+
+
+

+defaultSize

+
+boolean defaultSize
+
+
true if no size() command has been executed. This is used to wait until + a size has been set before placing in the window and showing it. +

+

+
+
+
+

+resizeRequest

+
+boolean resizeRequest
+
+
+
+
+
+

+resizeWidth

+
+int resizeWidth
+
+
+
+
+
+

+resizeHeight

+
+int resizeHeight
+
+
+
+
+
+

+pixels

+
+int[] pixels
+
+
Pixel buffer from this applet's PGraphics. +

+ When used with OpenGL or Java2D, this value will + be null until loadPixels() has been called. +

+

+
+
+
+

+width

+
+int width
+
+
width of this applet's associated PGraphics +

+

+
+
+
+

+height

+
+int height
+
+
height of this applet's associated PGraphics +

+

+
+
+
+

+mouseX

+
+int mouseX
+
+
current x position of the mouse +

+

+
+
+
+

+mouseY

+
+int mouseY
+
+
current y position of the mouse +

+

+
+
+
+

+pmouseX

+
+int pmouseX
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+

+pmouseY

+
+int pmouseY
+
+
Previous x/y position of the mouse. This will be a different value + when inside a mouse handler (like the mouseMoved() method) versus + when inside draw(). Inside draw(), pmouseX is updated once each + frame, but inside mousePressed() and friends, it's updated each time + an event comes through. Be sure to use only one or the other type of + means for tracking pmouseX and pmouseY within your sketch, otherwise + you're gonna run into trouble. +

+

+
+
+
+

+dmouseX

+
+int dmouseX
+
+
previous mouseX/Y for the draw loop, separated out because this is + separate from the pmouseX/Y when inside the mouse event handlers. +

+

+
+
+
+

+dmouseY

+
+int dmouseY
+
+
previous mouseX/Y for the draw loop, separated out because this is + separate from the pmouseX/Y when inside the mouse event handlers. +

+

+
+
+
+

+emouseX

+
+int emouseX
+
+
pmouseX/Y for the event handlers (mousePressed(), mouseDragged() etc) + these are different because mouse events are queued to the end of + draw, so the previous position has to be updated on each event, + as opposed to the pmouseX/Y that's used inside draw, which is expected + to be updated once per trip through draw(). +

+

+
+
+
+

+emouseY

+
+int emouseY
+
+
pmouseX/Y for the event handlers (mousePressed(), mouseDragged() etc) + these are different because mouse events are queued to the end of + draw, so the previous position has to be updated on each event, + as opposed to the pmouseX/Y that's used inside draw, which is expected + to be updated once per trip through draw(). +

+

+
+
+
+

+firstMouse

+
+boolean firstMouse
+
+
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + otherwise pmouseX/Y are always zero, causing a nasty jump. +

+ Just using (frameCount == 0) won't work since mouseXxxxx() + may not be called until a couple frames into things. +

+

+
+
+
+

+mouseButton

+
+int mouseButton
+
+
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. +

+ If running on Mac OS, a ctrl-click will be interpreted as + the righthand mouse button (unlike Java, which reports it as + the left mouse). +

+

+
+
+
+

+mousePressed

+
+boolean mousePressed
+
+
+
+
+
+

+mouseEvent

+
+java.awt.event.MouseEvent mouseEvent
+
+
+
+
+
+

+key

+
+char key
+
+
Last key pressed. +

+ If it's a coded key, i.e. UP/DOWN/CTRL/SHIFT/ALT, + this will be set to CODED (0xffff or 65535). +

+

+
+
+
+

+keyCode

+
+int keyCode
+
+
When "key" is set to CODED, this will contain a Java key code. +

+ For the arrow keys, keyCode will be one of UP, DOWN, LEFT and RIGHT. + Also available are ALT, CONTROL and SHIFT. A full set of constants + can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables. +

+

+
+
+
+

+keyPressed

+
+boolean keyPressed
+
+
true if the mouse is currently pressed. +

+

+
+
+
+

+keyEvent

+
+java.awt.event.KeyEvent keyEvent
+
+
the last KeyEvent object passed into a mouse function. +

+

+
+
+
+

+focused

+
+boolean focused
+
+
Gets set to true/false as the applet gains/loses focus. +

+

+
+
+
+

+online

+
+boolean online
+
+
true if the applet is online. +

+ This can be used to test how the applet should behave + since online situations are different (no file writing, etc). +

+

+
+
+
+

+millisOffset

+
+long millisOffset
+
+
Time in milliseconds when the applet was started. +

+ Used by the millis() function. +

+

+
+
+
+

+frameRate

+
+float frameRate
+
+
The current value of frames per second. +

+ The initial value will be 10 fps, and will be updated with each + frame thereafter. The value is not instantaneous (since that + wouldn't be very useful since it would jump around so much), + but is instead averaged (integrated) over several frames. + As such, this value won't be valid until after 5-10 frames. +

+

+
+
+
+

+frameRateLastNanos

+
+long frameRateLastNanos
+
+
Last time in nanoseconds that frameRate was checked +

+

+
+
+
+

+frameRateTarget

+
+float frameRateTarget
+
+
As of release 0116, frameRate(60) is called as a default +

+

+
+
+
+

+frameRatePeriod

+
+long frameRatePeriod
+
+
+
+
+
+

+looping

+
+boolean looping
+
+
+
+
+
+

+redraw

+
+boolean redraw
+
+
flag set to true when a redraw is asked for by the user +

+

+
+
+
+

+frameCount

+
+int frameCount
+
+
How many frames have been displayed since the applet started. +

+ This value is read-only do not attempt to set it, + otherwise bad things will happen. +

+ Inside setup(), frameCount is 0. + For the first iteration of draw(), frameCount will equal 1. +

+

+
+
+
+

+finished

+
+boolean finished
+
+
true if this applet has had it. +

+

+
+
+
+

+exitCalled

+
+boolean exitCalled
+
+
true if exit() has been called so that things shut down + once the main thread kicks off. +

+

+
+
+
+

+thread

+
+java.lang.Thread thread
+
+
+
+
+
+

+sizeMethods

+
+PApplet.RegisteredMethods sizeMethods
+
+
+
+
+
+

+preMethods

+
+PApplet.RegisteredMethods preMethods
+
+
+
+
+
+

+drawMethods

+
+PApplet.RegisteredMethods drawMethods
+
+
+
+
+
+

+postMethods

+
+PApplet.RegisteredMethods postMethods
+
+
+
+
+
+

+mouseEventMethods

+
+PApplet.RegisteredMethods mouseEventMethods
+
+
+
+
+
+

+keyEventMethods

+
+PApplet.RegisteredMethods keyEventMethods
+
+
+
+
+
+

+disposeMethods

+
+PApplet.RegisteredMethods disposeMethods
+
+
+
+
+
+

+external

+
+boolean external
+
+
true if this sketch is being run by the PDE +

+

+
+
+
+

+mouseEventQueue

+
+java.awt.event.MouseEvent[] mouseEventQueue
+
+
+
+
+
+

+mouseEventCount

+
+int mouseEventCount
+
+
+
+
+
+

+keyEventQueue

+
+java.awt.event.KeyEvent[] keyEventQueue
+
+
+
+
+
+

+keyEventCount

+
+int keyEventCount
+
+
+
+
+
+

+cursorType

+
+int cursorType
+
+
+
+
+
+

+cursorVisible

+
+boolean cursorVisible
+
+
+
+
+
+

+invisibleCursor

+
+PImage invisibleCursor
+
+
+
+
+
+

+internalRandom

+
+java.util.Random internalRandom
+
+
+
+
+
+

+perlin_octaves

+
+int perlin_octaves
+
+
+
+
+
+

+perlin_amp_falloff

+
+float perlin_amp_falloff
+
+
+
+
+
+

+perlin_TWOPI

+
+int perlin_TWOPI
+
+
+
+
+
+

+perlin_PI

+
+int perlin_PI
+
+
+
+
+
+

+perlin_cosTable

+
+float[] perlin_cosTable
+
+
+
+
+
+

+perlin

+
+float[] perlin
+
+
+
+
+
+

+perlinRandom

+
+java.util.Random perlinRandom
+
+
+
+
+
+

+loadImageFormats

+
+java.lang.String[] loadImageFormats
+
+
+
+
+
+

+requestImageMax

+
+int requestImageMax
+
+
By trial and error, four image loading threads seem to work best when + loading images from online. This is consistent with the number of open + connections that web browsers will maintain. The variable is made public + (however no accessor has been added since it's esoteric) if you really + want to have control over the value used. For instance, when loading local + files, it might be better to only have a single thread (or two) loading + images so that you're disk isn't simply jumping around. +

+

+
+
+
+

+requestImageCount

+
+int requestImageCount
+
+
+
+
+
+

+selectedFile

+
+java.io.File selectedFile
+
+
+
+
+
+

+parentFrame

+
+java.awt.Frame parentFrame
+
+
+
+
+ +

+ + + + + +
+Class processing.core.PApplet.RendererChangeException extends java.lang.RuntimeException implements Serializable
+ +

+


+ + + + + +
+Package processing.xml
+ +

+ + + + + +
+Class processing.xml.XMLElement extends java.lang.Object implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+parent

+
+XMLElement parent
+
+
The parent element. +

+

+
+
+
+

+attributes

+
+java.util.Vector<E> attributes
+
+
The attributes of the element. +

+

+
+
+
+

+children

+
+java.util.Vector<E> children
+
+
The child elements. +

+

+
+
+
+

+name

+
+java.lang.String name
+
+
The name of the element. +

+

+
+
+
+

+fullName

+
+java.lang.String fullName
+
+
The full name of the element. +

+

+
+
+
+

+namespace

+
+java.lang.String namespace
+
+
The namespace URI. +

+

+
+
+
+

+content

+
+java.lang.String content
+
+
The content of the element. +

+

+
+
+
+

+systemID

+
+java.lang.String systemID
+
+
The system ID of the source data where this element is located. +

+

+
+
+
+

+lineNr

+
+int lineNr
+
+
The line in the source data where this element starts. +

+

+
+
+ +

+ + + + + +
+Class processing.xml.XMLException extends java.lang.Exception implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+msg

+
+java.lang.String msg
+
+
The message of the exception. +

+

+
+
+
+

+systemID

+
+java.lang.String systemID
+
+
The system ID of the XML data where the exception occurred. +

+

+
+
+
+

+lineNr

+
+int lineNr
+
+
The line number in the XML data where the exception occurred. +

+

+
+
+
+

+encapsulatedException

+
+java.lang.Exception encapsulatedException
+
+
Encapsulated exception. +

+

+
+
+ +

+ + + + + +
+Class processing.xml.XMLParseException extends XMLException implements Serializable
+ +

+ +

+ + + + + +
+Class processing.xml.XMLValidationException extends XMLException implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+elementName

+
+java.lang.String elementName
+
+
The name of the element where the exception occurred. +

+

+
+
+
+

+attributeName

+
+java.lang.String attributeName
+
+
The name of the attribute where the exception occurred. +

+

+
+
+
+

+attributeValue

+
+java.lang.String attributeValue
+
+
The value of the attribute where the exception occurred. +

+

+
+
+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/build/javadoc/everything/stylesheet.css b/build/javadoc/everything/stylesheet.css new file mode 100644 index 000000000..46c958625 --- /dev/null +++ b/build/javadoc/everything/stylesheet.css @@ -0,0 +1,185 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF } + +/* Headings */ +h1 { font-size: 145% } + + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ +.TableRowColor { background: #FFFFFF } /* White */ + + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } + + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ + +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} + + + +/* + * Processing - Styling + * + * fjenett - mail@florianjenett.de - 2005.08.14 + * + */ + + +/* first let's restyle what's there .. */ + +/* Table colors */ +.TableHeadingColor { + background: #CCCCBE; + color: #5A5A46; + } +.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ +.TableRowColor { background: #FFFFFF } /* White */ + + +/* Font used in left-hand frame lists */ +.FrameTitleFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif +} +.FrameHeadingFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #5A5A46; +} +.FrameItemFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif +} + + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#CCCCBE;} /* Light */ +.NavBarCell1Rev { background-color:#5A5A46;} /* Dark */ + +.NavBarFont1 { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color:#5A5A46; +} +.NavBarFont1Rev { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color:#FFFFFF; +} + +.NavBarCell2 { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +.NavBarCell3 { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color:#FFFFFF;} + + +/* try to style some more ... */ + +body, +html +{ + font-size: smaller; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #333333; + } + +h1, h2, h3, h4, h5, h6 { + + color: #5A5A46; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight: normal; + + line-height: normal; +} + +h1, h2, h3, h4 { + word-spacing: 0.2em; + font-weight: bold; +} + +h4, h5, h6 { + font-weight: bold; +} +/* Font Sizes */ +h1 { font-size: 1.5em; } +h2 { font-size: 1.4em; } +h3 { font-size: 1.3em; } +h4 { font-size: 1.2em; } +h5 { font-size: 1.1em; } +h6 { font-size: 1em; } +p { font-size: 1em; } + +dl, dd, dt, +dt > b +{ + color: #666666; + font-size: 1em; +} + +code, +pre +{ + font-size: 1.2em; + color:#333333; +} + +pre +{ + font-size: 1.2em; +} + +/* force the table-headers small .. */ +b +{ + font-size: small; +} + +tr, +td +{ + border-top: 0px solid; + border-left: 0px solid; + border-color: #999999; +} + +table +{ + border: 0px; +} + +img +{ + border: 0px solid #000000; +} + +a { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} + +a:hover +a:active { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} + +a:visited, +a:link:visited { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} \ No newline at end of file diff --git a/build/javadoc/make.sh b/build/javadoc/make.sh new file mode 100755 index 000000000..d0532e1c3 --- /dev/null +++ b/build/javadoc/make.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +javadoc -public -notimestamp -d core \ + ../../core/src/processing/core/*.java \ + ../../core/src/processing/xml/*.java + +# These have to be done in a certain order... Most classes need to know about +# core, and SVG needs to have the XML library opened earler. I'm probably not +# setting this up right, so if anyone knows how to do it without specifying +# all the directories like this, please let us know. +javadoc -public -notimestamp -d everything \ + -classpath ../../app/lib/antlr.jar:../../app/lib/jna.jar:../../serial/library/RXTXcomm.jar:../../opengl/library/jogl.jar:../../pdf/library/itext.jar:../../app/lib/ecj.jar \ + ../../core/src/processing/core/*.java \ + ../../core/src/processing/xml/*.java \ + ../../app/src/antlr/*.java \ + ../../app/src/antlr/java/*.java \ + ../../app/src/processing/app/*.java \ + ../../app/src/processing/app/debug/*.java \ + ../../app/src/processing/app/linux/*.java \ + ../../app/src/processing/app/macosx/*.java \ + ../../app/src/processing/app/preproc/*.java \ + ../../app/src/processing/app/syntax/*.java \ + ../../app/src/processing/app/tools/*.java \ + ../../app/src/processing/app/windows/*.java \ + ../../dxf/src/processing/dxf/*.java \ + ../../net/src/processing/net/*.java \ + ../../opengl/src/processing/opengl/*.java \ + ../../pdf/src/processing/pdf/*.java \ + ../../serial/src/processing/serial/*.java \ + ../../video/src/processing/video/*.java + +cp stylesheet.css core/ +cp stylesheet.css everything/ diff --git a/build/javadoc/stylesheet.css b/build/javadoc/stylesheet.css new file mode 100644 index 000000000..46c958625 --- /dev/null +++ b/build/javadoc/stylesheet.css @@ -0,0 +1,185 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF } + +/* Headings */ +h1 { font-size: 145% } + + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ +.TableRowColor { background: #FFFFFF } /* White */ + + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } + + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ + +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} + + + +/* + * Processing - Styling + * + * fjenett - mail@florianjenett.de - 2005.08.14 + * + */ + + +/* first let's restyle what's there .. */ + +/* Table colors */ +.TableHeadingColor { + background: #CCCCBE; + color: #5A5A46; + } +.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ +.TableRowColor { background: #FFFFFF } /* White */ + + +/* Font used in left-hand frame lists */ +.FrameTitleFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif +} +.FrameHeadingFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #5A5A46; +} +.FrameItemFont { + font-size: 0.9em; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif +} + + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#CCCCBE;} /* Light */ +.NavBarCell1Rev { background-color:#5A5A46;} /* Dark */ + +.NavBarFont1 { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color:#5A5A46; +} +.NavBarFont1Rev { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color:#FFFFFF; +} + +.NavBarCell2 { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +.NavBarCell3 { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color:#FFFFFF;} + + +/* try to style some more ... */ + +body, +html +{ + font-size: smaller; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #333333; + } + +h1, h2, h3, h4, h5, h6 { + + color: #5A5A46; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight: normal; + + line-height: normal; +} + +h1, h2, h3, h4 { + word-spacing: 0.2em; + font-weight: bold; +} + +h4, h5, h6 { + font-weight: bold; +} +/* Font Sizes */ +h1 { font-size: 1.5em; } +h2 { font-size: 1.4em; } +h3 { font-size: 1.3em; } +h4 { font-size: 1.2em; } +h5 { font-size: 1.1em; } +h6 { font-size: 1em; } +p { font-size: 1em; } + +dl, dd, dt, +dt > b +{ + color: #666666; + font-size: 1em; +} + +code, +pre +{ + font-size: 1.2em; + color:#333333; +} + +pre +{ + font-size: 1.2em; +} + +/* force the table-headers small .. */ +b +{ + font-size: small; +} + +tr, +td +{ + border-top: 0px solid; + border-left: 0px solid; + border-color: #999999; +} + +table +{ + border: 0px; +} + +img +{ + border: 0px solid #000000; +} + +a { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} + +a:hover +a:active { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} + +a:visited, +a:link:visited { + text-decoration: underline; + font-weight: normal; + color: #3399CC; +} \ No newline at end of file diff --git a/build/javadoc/upload.sh b/build/javadoc/upload.sh new file mode 100644 index 000000000..a2f71f0a7 --- /dev/null +++ b/build/javadoc/upload.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +rsync -avz --delete core/ fry@processing.org:dev/reference/core/javadoc/ +rsync -avz --delete everything/ fry@processing.org:dev/reference/everything/javadoc/ \ No newline at end of file diff --git a/build/linux/dist.sh b/build/linux/dist.sh new file mode 100755 index 000000000..1dd9533fb --- /dev/null +++ b/build/linux/dist.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +#REVISION=`head -c 4 ../../todo.txt` +REVISION=`head -1 ../../todo.txt | awk '{print $1}'` + +if [ $1 ] +then + RELEASE=$1 + echo Creating Processing release $RELEASE... +else + RELEASE=$REVISION + echo Creating Processing distribution for revision $REVISION... +fi + +ARCH=`uname -m` +if [ $ARCH != "i686" ] +then + echo At present, the Linux distribution can only be built on i686 \(32-bit\). + exit +fi + +./make.sh + +# remove any old boogers +rm -rf processing +rm -rf processing-* + +mkdir processing +cp -r ../shared/lib processing/ +cp -r ../shared/libraries processing/ +cp -r ../shared/tools processing/ +cp ../../app/lib/antlr.jar processing/lib/ +cp ../../app/lib/ecj.jar processing/lib/ +cp ../../app/lib/jna.jar processing/lib/ +cp ../shared/revisions.txt processing/ + +if [ $1 ] +then + # write the release version number into the output directory + echo $1 > processing/lib/version.txt +fi + +echo Extracting examples... +unzip -q -d processing/ ../shared/examples.zip + +echo Extracting reference... +unzip -q -d processing/ ../shared/reference.zip + +# add the libraries folder with source +cp -r ../../net processing/libraries/ +cp -r ../../opengl processing/libraries/ +cp -r ../../serial processing/libraries/ +cp -r ../../pdf processing/libraries/ +cp -r ../../dxf processing/libraries/ + +# add java (jre) files +tar --extract --file=jre.tgz --ungzip --directory=processing + +# grab pde.jar and export from the working dir +cp work/lib/pde.jar processing/lib/ +cp work/lib/core.jar processing/lib/ + +# get platform-specific goodies from the dist dir +install -m 755 dist/processing processing/processing + +# make sure notes.txt is unix LFs +# the 2> is because the app is a little chatty +dos2unix processing/revisions.txt 2> /dev/null +dos2unix processing/lib/preferences.txt 2> /dev/null + +# remove boogers +find processing -name "*~" -exec rm -f {} ';' +find processing -name ".DS_Store" -exec rm -f {} ';' +find processing -name "._*" -exec rm -f {} ';' +find processing -name "Thumbs.db" -exec rm -f {} ';' + +# clean out the cvs entries +find processing -name "CVS" -exec rm -rf {} ';' 2> /dev/null +find processing -name ".cvsignore" -exec rm -rf {} ';' +find processing -name ".svn" -exec rm -rf {} 2> /dev/null ';' + +# zip it all up for release +echo Creating tarball and finishing... +P5=processing-$RELEASE +mv processing $P5 + +tar cfz $P5.tgz $P5 +# nah, keep the new directory around +#rm -rf $P5 + +echo Done. diff --git a/build/linux/dist/.cvsignore b/build/linux/dist/.cvsignore new file mode 100644 index 000000000..e69de29bb diff --git a/build/linux/dist/processing b/build/linux/dist/processing new file mode 100755 index 000000000..e02e551a3 --- /dev/null +++ b/build/linux/dist/processing @@ -0,0 +1,17 @@ + #!/bin/sh + +APPDIR="$(dirname -- "${0}")" + +for LIB in \ + java/lib/rt.jar \ + java/lib/tools.jar \ + lib/*.jar \ + ; +do + CLASSPATH="${CLASSPATH}:${APPDIR}/${LIB}" +done +export CLASSPATH + +export PATH="${APPDIR}/java/bin:${PATH}" + +java processing.app.Base diff --git a/build/linux/jre.tgz b/build/linux/jre.tgz new file mode 100644 index 000000000..5c2d06f83 Binary files /dev/null and b/build/linux/jre.tgz differ diff --git a/build/linux/make.sh b/build/linux/make.sh new file mode 100755 index 000000000..cb4bbda71 --- /dev/null +++ b/build/linux/make.sh @@ -0,0 +1,234 @@ +#!/bin/sh + + +### -- SETUP WORK DIR ------------------------------------------- + +if test -d work +then + BUILD_PREPROC=false +else + echo Setting up directories to build for Linux... + BUILD_PREPROC=true + + mkdir work + cp -r ../shared/lib work/ + cp -r ../shared/libraries work/ + cp -r ../shared/tools work/ + + cp ../../app/lib/antlr.jar work/lib/ + cp ../../app/lib/ecj.jar work/lib/ + cp ../../app/lib/jna.jar work/lib/ + + echo Extracting examples... + unzip -q -d work/ ../shared/examples.zip + + echo Extracting reference... + unzip -q -d work/ ../shared/reference.zip + + cp -r ../../net work/libraries/ + cp -r ../../opengl work/libraries/ + cp -r ../../serial work/libraries/ + cp -r ../../video work/libraries/ + cp -r ../../pdf work/libraries/ + cp -r ../../dxf work/libraries/ + + install -m 755 dist/processing work/processing + + ARCH=`uname -m` + if [ $ARCH = "i686" ] + then + echo Extracting JRE... + tar --extract --file=jre.tgz --ungzip --directory=work + else +# echo This is not my beautiful house. +# if [ $ARCH = "x86_64" ] +# then +# echo You gots the 64. +# fi + echo " +The Java bundle that is included with Processing supports only i686 by default. +To build the code, you will need to install the Java 1.5.0_15 JDK (not a JRE, +and not any other version), and create a symlink to the directory where it is +installed. Create the symlink in the \"work\" directory, and named it \"java\": +ln -s /path/to/jdk1.5.0_15 `pwd`/work/java" + exit + fi +fi + +cd ../.. + + +### -- BUILD CORE ---------------------------------------------- + + +echo Building processing.core + +cd core + +#CLASSPATH="../build/linux/work/java/lib/rt.jar" +#export CLASSPATH + +perl preproc.pl +mkdir -p bin +../build/linux/work/java/bin/java \ + -cp ../build/linux/work/java/lib/tools.jar \ + com.sun.tools.javac.Main \ + -d bin -source 1.5 -target 1.5 \ + src/processing/core/*.java src/processing/xml/*.java +#find bin -name "*~" -exec rm -f {} ';' +rm -f ../build/linux/work/lib/core.jar +cd bin && zip -rq ../../build/linux/work/lib/core.jar \ + processing/core/*.class processing/xml/*.class && cd .. + +# back to base processing dir +cd .. + + +### -- BUILD PREPROC ------------------------------------------------ + +echo Building PDE for JDK 1.5... + +cd app + +# long path is to avoid requiring java to be in your PATH + echo Building antlr grammar code... + + # first build the default java goop +../build/linux/work/java/bin/java \ + -cp ../build/linux/work/lib/antlr.jar antlr.Tool \ + -o src/antlr/java \ + src/antlr/java/java.g + + # hack to get around path mess + cp src/antlr/java/JavaTokenTypes.txt src/processing/app/preproc/ + +# now build the pde stuff that extends the java classes +# this is totally ugly and needs to be fixed +# the problem is that -glib doesn't set the main path properly, +# so it's necessary to cd into the antlr/java folder, otherwise +# the JavaTokenTypes.txt file won't be found +cd src/antlr/java +../../../../build/linux/work/java/bin/java \ + -cp ../../../../build/linux/work/lib/antlr.jar antlr.Tool \ + -o ../../processing/app/preproc \ + -glib java.g \ + ../../processing/app/preproc/pde.g +cd ../../.. + +# return to the root of the p5 folder +cd .. + + +### -- BUILD PDE ------------------------------------------------ + +cd app + +rm -rf ../build/linux/work/classes +mkdir ../build/linux/work/classes + +../build/linux/work/java/bin/java \ + -cp ../build/linux/work/java/lib/tools.jar \ + com.sun.tools.javac.Main \ + -source 1.5 -target 1.5 \ + -classpath ../build/linux/work/lib/core.jar:../build/linux/work/lib/antlr.jar:../build/linux/work/lib/ecj.jar:../build/linux/work/lib/jna.jar:../build/linux/work/java/lib/tools.jar \ + -d ../build/linux/work/classes \ + src/processing/app/*.java \ + src/processing/app/debug/*.java \ + src/processing/app/linux/*.java \ + src/processing/app/preproc/*.java \ + src/processing/app/syntax/*.java \ + src/processing/app/tools/*.java \ + src/antlr/*.java \ + src/antlr/java/*.java + +cd ../build/linux/work/classes +rm -f ../lib/pde.jar +zip -0rq ../lib/pde.jar . +cd ../../../.. + + +### -- BUILD LIBRARIES ------------------------------------------------ + +cd build/linux + +PLATFORM=linux + +JAVAC="../build/linux/work/java/bin/java -cp ../build/linux/work/java/lib/tools.jar com.sun.tools.javac.Main -source 1.5 -target 1.5" +CORE=../build/$PLATFORM/work/lib/core.jar +LIBRARIES=../build/$PLATFORM/work/libraries + +# move to processing/build +cd .. + +# SERIAL LIBRARY +echo Building serial library... +cd ../serial +mkdir -p bin +$JAVAC \ + -classpath "library/RXTXcomm.jar:$CORE" \ + -d bin src/processing/serial/*.java +rm -f library/serial.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/serial.jar processing/serial/*.class && cd .. +mkdir -p $LIBRARIES/serial/library/ +cp library/serial.jar $LIBRARIES/serial/library/ + + +# NET LIBRARY +echo Building net library... +cd ../net +mkdir -p bin +$JAVAC \ + -classpath "$CORE" \ + -d bin src/processing/net/*.java +rm -f library/net.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/net.jar processing/net/*.class && cd .. +mkdir -p $LIBRARIES/net/library/ +cp library/net.jar $LIBRARIES/net/library/ + + +# OPENGL LIBRARY +echo Building OpenGL library... +cd ../opengl +mkdir -p bin +$JAVAC \ + -classpath "library/jogl.jar:$CORE" \ + -d bin src/processing/opengl/*.java +rm -f library/opengl.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/opengl.jar processing/opengl/*.class && cd .. +mkdir -p $LIBRARIES/opengl/library/ +cp library/opengl.jar $LIBRARIES/opengl/library/ + + +# PDF LIBRARY +echo Building PDF library... +cd ../pdf +mkdir -p bin +$JAVAC \ + -classpath "library/itext.jar:$CORE" \ + -d bin src/processing/pdf/*.java +rm -f library/pdf.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/pdf.jar processing/pdf/*.class && cd .. +mkdir -p $LIBRARIES/pdf/library/ +cp library/pdf.jar $LIBRARIES/pdf/library/ + + +# DXF LIBRARY +echo Building DXF library... +cd ../dxf +mkdir -p bin +$JAVAC \ + -classpath "$CORE" \ + -d bin src/processing/dxf/*.java +rm -f library/dxf.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/dxf.jar processing/dxf/*.class && cd .. +mkdir -p $LIBRARIES/dxf/library/ +cp library/dxf.jar $LIBRARIES/dxf/library/ + + +echo +echo Done. diff --git a/build/linux/run.sh b/build/linux/run.sh new file mode 100755 index 000000000..29ccd3aa9 --- /dev/null +++ b/build/linux/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cd work && ./processing && cd .. diff --git a/build/macosx/dist.sh b/build/macosx/dist.sh new file mode 100755 index 000000000..35b341f73 --- /dev/null +++ b/build/macosx/dist.sh @@ -0,0 +1,77 @@ +#!/bin/sh + + +REVISION=`head -1 ../../todo.txt | awk '{print $1}'` + +if [ $1 ] +then + RELEASE=$1 + echo Creating Processing release $RELEASE... +else + RELEASE=$REVISION + echo Creating Processing distribution for revision $REVISION... +fi + +VERSIONED=`cat ../../app/src/processing/app/Base.java | grep $REVISION` +if [ -z "$VERSIONED" ] +then + echo Fix the revision number in Base.java + exit +fi + +# remove any unfinished builds or old builds +rm -rf processing +rm -rf Processing* +rm -rf processing-* +rm -rf work + +./make.sh + +if [ $1 ] +then + # write the release version number into the output directory + echo $1 > work/Processing.app/Contents/Resources/Java/lib/version.txt +fi + +echo Cleaning file boogers... + +# remove boogers +find work -name "*~" -exec rm -f {} ';' +# need to leave ds store stuff cuz one of those is important +#find processing -name ".DS_Store" -exec rm -f {} ';' +find work -name "._*" -exec rm -f {} ';' +find work -name "Thumbs.db" -exec rm -f {} ';' + +# clean out the cvs entries +find work -name "CVS" -exec rm -rf {} ';' 2> /dev/null +find work -name ".cvsignore" -exec rm -rf {} ';' +find work -name ".svn" -exec rm -rf {} 2> /dev/null ';' + + +# the following was adopted from the makefile by Remko Troncon: +# http://el-tramo.be/guides/fancy-dmg + +echo Creating disk image... + +SOURCE_DIR="work" +SOURCE_FILES="Processing.app" +OUTPUT_DMG="processing-$RELEASE" +WORK_DMG="working.dmg" +WORK_DIR="working_dir" + +gzip -cd template.dmg.gz > "$WORK_DMG" +mkdir -p "$WORK_DIR" +hdiutil attach "$WORK_DMG" -noautoopen -quiet -mountpoint "$WORK_DIR" +for i in "$SOURCE_FILES"; do + rm -rf "$WORK_DIR/$i" + ditto -rsrc "$SOURCE_DIR/$i" "$WORK_DIR/$i" +done +WC_DEV=`hdiutil info | grep "$WORK_DIR" | awk '{print $1}'` && hdiutil detach $WC_DEV -quiet -force +hdiutil convert "$WORK_DMG" -quiet -format UDZO -imagekey zlib-level=9 -o "$OUTPUT_DMG" +rm -rf "$WORK_DIR" +rm -f "$WORK_DMG" + +# for later, if we need to resize, etc +#hdiutil resize -size 200mb -growonly -imageonly working.dmg + +echo Done. \ No newline at end of file diff --git a/build/macosx/dist/DS_Store b/build/macosx/dist/DS_Store new file mode 100755 index 000000000..f493597af Binary files /dev/null and b/build/macosx/dist/DS_Store differ diff --git a/build/macosx/dist/Processing.app/Contents/Info.plist b/build/macosx/dist/Processing.app/Contents/Info.plist new file mode 100755 index 000000000..410806e95 --- /dev/null +++ b/build/macosx/dist/Processing.app/Contents/Info.plist @@ -0,0 +1,111 @@ + + + + + CFBundleName + Processing + + + CFBundleGetInfoString + 1.0.1, Copyright © Ben Fry and Casey Reas + CFBundleVersion + 1.0.1 + CFBundleShortVersionString + 1.0.1 + + CFBundleAllowMixedLocalizations + true + CFBundleExecutable + JavaApplicationStub + CFBundleDevelopmentRegion + English + CFBundlePackageType + APPL + CFBundleSignature + Pde1 + CFBundleInfoDictionaryVersion + 6.0 + CFBundleIconFile + processing.icns + CFBundleIdentifier + org.processing.app + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + pde + java + + CFBundleTypeIconFile + pde.icns + CFBundleTypeName + Processing Source File + CFBundleTypeMIMETypes + + text/plain + + CFBundleTypeOSTypes + + TEXT + + CFBundleTypeRole + Editor + + + Java + + VMOptions + -Xms128M -Xmx256M + + MainClass + processing.app.Base + + JVMVersion + 1.5* + + ClassPath + + $JAVAROOT/pde.jar:$JAVAROOT/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/ecj.jar:$JAVAROOT/registry.jar:$JAVAROOT/quaqua.jar + + Properties + + + javaroot + $JAVAROOT + + + + + + JVMArchs + + + i386 + ppc + + + apple.awt.showGrowBox + false + com.apple.smallTabs + true + apple.awt.Antialiasing + false + apple.awt.TextAntialiasing + true + com.apple.hwaccel + true + apple.awt.use-file-dialog-packages + false + apple.awt.graphics.UseQuartz + true + + + + diff --git a/build/macosx/dist/Processing.app/Contents/MacOS/JavaApplicationStub b/build/macosx/dist/Processing.app/Contents/MacOS/JavaApplicationStub new file mode 100755 index 000000000..eeb8b5617 Binary files /dev/null and b/build/macosx/dist/Processing.app/Contents/MacOS/JavaApplicationStub differ diff --git a/build/macosx/dist/Processing.app/Contents/PkgInfo b/build/macosx/dist/Processing.app/Contents/PkgInfo new file mode 100755 index 000000000..3f338b4a0 --- /dev/null +++ b/build/macosx/dist/Processing.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLPde1 \ No newline at end of file diff --git a/build/macosx/dist/Processing.app/Contents/Resources/Java/libquaqua.jnilib b/build/macosx/dist/Processing.app/Contents/Resources/Java/libquaqua.jnilib new file mode 100755 index 000000000..8f6904bd9 Binary files /dev/null and b/build/macosx/dist/Processing.app/Contents/Resources/Java/libquaqua.jnilib differ diff --git a/build/macosx/dist/Processing.app/Contents/Resources/Java/libquaqua64.jnilib b/build/macosx/dist/Processing.app/Contents/Resources/Java/libquaqua64.jnilib new file mode 100755 index 000000000..7ec8e5097 Binary files /dev/null and b/build/macosx/dist/Processing.app/Contents/Resources/Java/libquaqua64.jnilib differ diff --git a/build/macosx/dist/Processing.app/Contents/Resources/Java/quaqua.jar b/build/macosx/dist/Processing.app/Contents/Resources/Java/quaqua.jar new file mode 100755 index 000000000..b1c9462a4 Binary files /dev/null and b/build/macosx/dist/Processing.app/Contents/Resources/Java/quaqua.jar differ diff --git a/build/macosx/dist/Processing.app/Contents/Resources/pde.icns b/build/macosx/dist/Processing.app/Contents/Resources/pde.icns new file mode 100644 index 000000000..214b19877 Binary files /dev/null and b/build/macosx/dist/Processing.app/Contents/Resources/pde.icns differ diff --git a/build/macosx/dist/Processing.app/Contents/Resources/processing.icns b/build/macosx/dist/Processing.app/Contents/Resources/processing.icns new file mode 100755 index 000000000..66f605274 Binary files /dev/null and b/build/macosx/dist/Processing.app/Contents/Resources/processing.icns differ diff --git a/build/macosx/dist/background.jpg b/build/macosx/dist/background.jpg new file mode 100644 index 000000000..fe0ba8394 Binary files /dev/null and b/build/macosx/dist/background.jpg differ diff --git a/build/macosx/make.sh b/build/macosx/make.sh new file mode 100755 index 000000000..bc9206ee7 --- /dev/null +++ b/build/macosx/make.sh @@ -0,0 +1,248 @@ +#!/bin/sh + + +### -- SETUP WORK DIR ------------------------------------------- + +RESOURCES=`pwd`/work/Processing.app/Contents/Resources/Java +#echo $RESOURCES +#exit + +if test -d work +then + BUILD_PREPROC=false +else + echo Setting up directories to build under Mac OS X + BUILD_PREPROC=true + + mkdir work + + # to have a copy of this guy around for messing with + echo Copying Processing.app... + #cp -a dist/Processing.app work/ # #@$(* bsd switches + #/sw/bin/cp -a dist/Processing.app work/ + cp -pRX dist/Processing.app work/ + # cvs doesn't seem to want to honor the +x bit + chmod +x work/Processing.app/Contents/MacOS/JavaApplicationStub + + cp -rX ../shared/lib "$RESOURCES/" + cp -rX ../shared/libraries "$RESOURCES/" + cp -rX ../shared/tools "$RESOURCES/" + + cp -X ../../app/lib/antlr.jar "$RESOURCES/" + cp -X ../../app/lib/ecj.jar "$RESOURCES/" + cp -X ../../app/lib/jna.jar "$RESOURCES/" + + echo Extracting examples... + unzip -q -d "$RESOURCES/" ../shared/examples.zip + + echo Extracting reference... + unzip -q -d "$RESOURCES/" ../shared/reference.zip + + LIBRARIES=$RESOURCES/libraries/ + cp -rX ../../net "$LIBRARIES" + cp -rX ../../opengl "$LIBRARIES" + cp -rX ../../serial "$LIBRARIES" + cp -rX ../../video "$LIBRARIES" + cp -rX ../../pdf "$LIBRARIES" + cp -rX ../../dxf "$LIBRARIES" +fi + + +### -- START BUILDING ------------------------------------------- + +# move to root 'processing' directory +cd ../.. + + +### -- BUILD CORE ---------------------------------------------- + +echo Building processing.core... + +cd core + +#CLASSPATH=/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Classes/ui.jar:/System/Library/Java/Extensions/QTJava.zip +#export CLASSPATH + +perl preproc.pl + +mkdir -p bin +javac -source 1.5 -target 1.5 -d bin \ + src/processing/core/*.java \ + src/processing/xml/*.java + +rm -f "$RESOURCES/core.jar" + +cd bin && \ + zip -rq "$RESOURCES/core.jar" \ + processing/core/*.class \ + processing/xml/*.class \ + && cd .. + +# head back to "processing/app" +cd ../app + + + +### -- BUILD PARSER --------------------------------------------- + +#BUILD_PREPROC=true + +if $BUILD_PREPROC +then + # build classes/grammar for preprocessor + echo Building antlr grammar code... + # first build the default java goop + java -cp "$RESOURCES/antlr.jar" antlr.Tool \ + -o src/antlr/java \ + src/antlr/java/java.g + + # hack to get around path mess + cp -X src/antlr/java/JavaTokenTypes.txt src/processing/app/preproc/ + + # now build the pde stuff that extends the java classes + java -cp "$RESOURCES/antlr.jar" antlr.Tool \ + -o src/processing/app/preproc \ + -glib src/antlr/java/java.g src/processing/app/preproc/pde.g +fi + +### -- BUILD PDE ------------------------------------------------ + +echo Building the PDE... + +# For some reason, javac really wants this folder to exist beforehand. +rm -rf ../build/macosx/work/classes +mkdir ../build/macosx/work/classes +# Intentionally keeping this separate from the 'bin' folder +# used by eclipse so that they don't cause conflicts. + +javac \ + -Xlint:deprecation \ + -source 1.5 -target 1.5 \ + -classpath "$RESOURCES/core.jar:$RESOURCES/antlr.jar:$RESOURCES/ecj.jar:$RESOURCES/jna.jar" \ + -d ../build/macosx/work/classes \ + src/processing/app/*.java \ + src/processing/app/debug/*.java \ + src/processing/app/macosx/*.java \ + src/processing/app/preproc/*.java \ + src/processing/app/syntax/*.java \ + src/processing/app/tools/*.java \ + src/antlr/*.java \ + src/antlr/java/*.java + +cd ../build/macosx/work/classes +rm -f "$RESOURCES/pde.jar" +zip -0rq "$RESOURCES/pde.jar" . +cd ../.. + +# get updated core.jar and pde.jar; also antlr.jar and others +#mkdir -p work/Processing.app/Contents/Resources/Java/ +#cp work/lib/*.jar work/Processing.app/Contents/Resources/Java/ + + +### -- BUILD LIBRARIES ------------------------------------------------ + +PLATFORM=macosx + + +CLASSPATH=$RESOURCES/core.jar +JAVAC="javac -source 1.5 -target 1.5" +LIBRARIES=$RESOURCES/libraries + +# move to processing/build +cd .. + + +# SERIAL LIBRARY +echo Building serial library... +cd ../serial +mkdir -p bin +$JAVAC \ + -classpath "library/RXTXcomm.jar:$CLASSPATH" \ + -d bin src/processing/serial/*.java +rm -f library/serial.jar +#find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/serial.jar processing/serial/*.class && cd .. +mkdir -p "$LIBRARIES/serial/library/" +cp library/serial.jar "$LIBRARIES/serial/library/" + + +# NET LIBRARY +echo Building net library... +cd ../net +mkdir -p bin +$JAVAC \ + -classpath "$CLASSPATH" \ + -d bin src/processing/net/*.java +rm -f library/net.jar +#find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/net.jar processing/net/*.class && cd .. +mkdir -p "$LIBRARIES/net/library/" +cp library/net.jar "$LIBRARIES/net/library/" + + +# VIDEO LIBRARY +echo Building video library... +QTJAVA=/System/Library/Java/Extensions/QTJava.zip +if test -f "${QTJAVA}" +then + echo "Found QuickTime for Java at $QTJAVA" +else + echo "QuickTime for Java must be installed before building." + exit 1; +fi +cd ../video +mkdir -p bin +$JAVAC \ + -classpath "$QTJAVA:$CLASSPATH" \ + -d bin src/processing/video/*.java +rm -f library/video.jar +#find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/video.jar processing/video/*.class && cd .. +mkdir -p "$LIBRARIES/video/library/" +cp library/video.jar "$LIBRARIES/video/library/" + + +# OPENGL LIBRARY +echo Building OpenGL library... +cd ../opengl +mkdir -p bin +$JAVAC \ + -classpath "library/jogl.jar:$CLASSPATH" \ + -d bin src/processing/opengl/*.java +rm -f library/opengl.jar +#find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/opengl.jar processing/opengl/*.class && cd .. +mkdir -p "$LIBRARIES/opengl/library/" +cp library/opengl.jar "$LIBRARIES/opengl/library/" + + +# PDF LIBRARY +echo Building PDF library... +cd ../pdf +mkdir -p bin +$JAVAC \ + -classpath "library/itext.jar:$CLASSPATH" \ + -d bin src/processing/pdf/*.java +rm -f library/pdf.jar +#find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/pdf.jar processing/pdf/*.class && cd .. +mkdir -p "$LIBRARIES/pdf/library/" +cp library/pdf.jar "$LIBRARIES/pdf/library/" + + +# DXF LIBRARY +echo Building DXF library... +cd ../dxf +mkdir -p bin +$JAVAC \ + -classpath "$CLASSPATH" \ + -d bin src/processing/dxf/*.java +rm -f library/dxf.jar +#find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/dxf.jar processing/dxf/*.class && cd .. +mkdir -p "$LIBRARIES/dxf/library/" +cp library/dxf.jar "$LIBRARIES/dxf/library/" + + +echo +echo Done. \ No newline at end of file diff --git a/build/macosx/mkdmg b/build/macosx/mkdmg new file mode 100755 index 000000000..500334bd0 --- /dev/null +++ b/build/macosx/mkdmg @@ -0,0 +1,107 @@ +#!/bin/sh + +# +FOLDER="$1" +if [ -z "$FOLDER" ]; then +echo +echo "usage: $0 " +echo +exit 1 +fi + +if [ ! -d "$FOLDER" ]; then +echo $FOLDER does not exist +exit 2 +fi + +SIZE=`du -s "$FOLDER" | awk '{ print $1 }'` +# allow space for partition map and directory structure +SIZE=`echo 1024 + $SIZE \* 1.1 / 1 | bc` +NAME=`basename "$FOLDER"` +FILE=$NAME.dmg +TMP=${TMP:-/tmp} + +if [ $SIZE -lt 9216 ]; then +SIZE=9216 +fi + +if [ -e "$FILE" ] ; then +echo $FILE already exists! +exit 3 +fi + +TMPFILE=$TMP/$$.dmg + +echo Creating $TMPFILE from $FOLDER, $SIZE sectors... +hdiutil create $TMPFILE -sectors $SIZE -ov +if [ $? -ne 0 ] ; then +rm -f $TMPFILE +exit 4 +fi +echo + +DEVICES=`hdid -nomount $TMPFILE` +DEVMASTER=`echo $DEVICES| awk '{ print $1 }'` + +# Different results on 10.4 vs 10.5. Yay! [fry] +#echo "devices as follows" +#echo $DEVICES +DARWINVERSION=`uname -r` +if [ $DARWINVERSION = "9.5.0" ] ; then + DEVHFS=`echo $DEVICES| awk '{ print $3 }'` +else + if [ $DARWINVERSION = "8.11.1" ] ; then + DEVHFS=`echo $DEVICES| awk '{ print $5 }'` + else + echo "This version of OS X not recognized." + exit; + fi +fi + +echo Creating HFS partition $NAME on $TMPFILE at $DEVHFS +newfs_hfs -v "$NAME" $DEVHFS +if [ $? -ne 0 ] ; then +rm -f $TMPFILE +exit 5 +fi +hdiutil eject $DEVMASTER +if [ $? -ne 0 ] ; then +rm -f $TMPFILE +exit 6 +fi +DEVICES=`hdid $TMPFILE` +if [ $? -ne 0 ] ; then +rm -f $TMPFILE +exit 7 +fi + +# These two lines removed when doing the 10.4 and 10.5 split above. +# They seem to be duplicates, so just rely on the earlier logic. [fry] +#DEVMASTER=`echo $DEVICES| awk '{ print $1 }'` +#DEVHFS=`echo $DEVICES| awk '{ print $5 }'` +echo Copying $FOLDER to /Volumes/$NAME on $DEVMASTER +#sudo ditto -rsrcFork "$FOLDER" "/Volumes/$NAME" +ditto -rsrcFork "$FOLDER" "/Volumes/$NAME" +if [ $? -ne 0 ]; then +hdiutil eject $DEVMASTER +rm -f $TMPFILE +exit 8 +fi + +hdiutil eject $DEVMASTER +if [ $? -ne 0 ]; then +#rm -f $TMPFILE +exit 9 +fi + +echo "Compressing $NAME to $FILE" +#hdiutil convert $TMPFILE -format UDZO -o "$FILE" +hdiutil convert $TMPFILE -format UDZO -imagekey zlib-level=9 -o "$FILE" +if [ $? -ne 0 ]; then +rm -f "$FILE" $TMPFILE +exit 10 +fi + +rm -f $TMPFILE + +# end \ No newline at end of file diff --git a/build/macosx/run.sh b/build/macosx/run.sh new file mode 100755 index 000000000..3a844d90e --- /dev/null +++ b/build/macosx/run.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# is qt java already included tho? +#CLASSPATH=/System/Library/Java/Extensions/QTJava.zip:lib:lib/build:lib/pde.jar:lib/core.jar:lib/antlr.jar:lib/oro.jar:lib/registry.jar + +#export CLASSPATH + +#cd work && /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java -Dapple.laf.useScreenMenuBar=true -Dapple.awt.showGrowBox=false processing.app.Base +#cd work && java -Dapple.laf.useScreenMenuBar=true -Dapple.awt.showGrowBox=false processing.app.Base + +# starting with work on release 0120, run directly from the .app +cd work && ./Processing.app/Contents/MacOS/JavaApplicationStub diff --git a/build/macosx/template.dmg.gz b/build/macosx/template.dmg.gz new file mode 100644 index 000000000..5c4fe0dfc Binary files /dev/null and b/build/macosx/template.dmg.gz differ diff --git a/build/shared/examples.zip b/build/shared/examples.zip new file mode 100644 index 000000000..097b2c646 Binary files /dev/null and b/build/shared/examples.zip differ diff --git a/build/shared/lib/about.jpg b/build/shared/lib/about.jpg new file mode 100755 index 000000000..205ff374c Binary files /dev/null and b/build/shared/lib/about.jpg differ diff --git a/build/shared/lib/export/applet-opengl.html b/build/shared/lib/export/applet-opengl.html new file mode 100644 index 000000000..18771e694 --- /dev/null +++ b/build/shared/lib/export/applet-opengl.html @@ -0,0 +1,113 @@ + + + + + + + @@sketch@@ : Built with Processing + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + This browser does not have a Java Plug-in. +
+ + Get the latest Java Plug-in here. + +
+

+ +
+ + +
+ + +
+ +

+ @@description@@ +

+ +

+ Source code: @@source@@ +

+ +

+ Built with Processing +

+
+ + diff --git a/build/shared/lib/export/applet.html b/build/shared/lib/export/applet.html new file mode 100644 index 000000000..fb51966f3 --- /dev/null +++ b/build/shared/lib/export/applet.html @@ -0,0 +1,104 @@ + + + + + + + @@sketch@@ : Built with Processing + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + This browser does not have a Java Plug-in. +
+ + Get the latest Java Plug-in here. + +
+

+ +
+ + +
+ + +
+ +

+ @@description@@ +

+ +

+ Source code: @@source@@ +

+ +

+ Built with Processing +

+
+ + diff --git a/build/shared/lib/export/application.exe b/build/shared/lib/export/application.exe new file mode 100755 index 000000000..ea70a3a2d Binary files /dev/null and b/build/shared/lib/export/application.exe differ diff --git a/build/shared/lib/export/loading.gif b/build/shared/lib/export/loading.gif new file mode 100755 index 000000000..1ddae5089 Binary files /dev/null and b/build/shared/lib/export/loading.gif differ diff --git a/build/shared/lib/export/skeleton.app/Contents/MacOS/JavaApplicationStub b/build/shared/lib/export/skeleton.app/Contents/MacOS/JavaApplicationStub new file mode 100755 index 000000000..eeb8b5617 Binary files /dev/null and b/build/shared/lib/export/skeleton.app/Contents/MacOS/JavaApplicationStub differ diff --git a/build/shared/lib/export/skeleton.app/Contents/PkgInfo b/build/shared/lib/export/skeleton.app/Contents/PkgInfo new file mode 100755 index 000000000..bd04210fb --- /dev/null +++ b/build/shared/lib/export/skeleton.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/build/shared/lib/export/skeleton.app/Contents/Resources/sketch.icns b/build/shared/lib/export/skeleton.app/Contents/Resources/sketch.icns new file mode 100644 index 000000000..8ffb8d7de Binary files /dev/null and b/build/shared/lib/export/skeleton.app/Contents/Resources/sketch.icns differ diff --git a/build/shared/lib/export/template.plist b/build/shared/lib/export/template.plist new file mode 100755 index 000000000..4b56a1170 --- /dev/null +++ b/build/shared/lib/export/template.plist @@ -0,0 +1,59 @@ + + + + + CFBundleName + @@sketch@@ + CFBundleVersion + 10.2 + CFBundleAllowMixedLocalizations + true + CFBundleExecutable + JavaApplicationStub + CFBundleDevelopmentRegion + English + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleInfoDictionaryVersion + 6.0 + CFBundleIconFile + sketch.icns + CFBundleIdentifier + @@sketch@@ + + LSUIPresentationMode + @@lsuipresentationmode@@ + Java + + VMOptions + @@vmoptions@@ + MainClass + @@sketch@@ + JVMVersion + 1.5* + ClassPath + @@classpath@@ + + Properties + + + apple.laf.useScreenMenuBar + true + apple.awt.showGrowBox + false + com.apple.smallTabs + true + apple.awt.Antialiasing + false + apple.awt.TextAntialiasing + true + com.apple.hwaccel + true + apple.awt.use-file-dialog-packages + false + + + + diff --git a/build/shared/lib/keywords.txt b/build/shared/lib/keywords.txt new file mode 100644 index 000000000..b2ed52bd0 --- /dev/null +++ b/build/shared/lib/keywords.txt @@ -0,0 +1,627 @@ +# LITERAL2 specifies constants + +ADD LITERAL2 +ALIGN_CENTER LITERAL2 +ALIGN_LEFT LITERAL2 +ALIGN_RIGHT LITERAL2 +ALPHA LITERAL2 +ALPHA_MASK LITERAL2 +ALT LITERAL2 +AMBIENT LITERAL2 +ARROW LITERAL2 +ARGB LITERAL2 +BACKSPACE LITERAL2 +BASELINE LITERAL2 +BEVEL LITERAL2 +BLEND LITERAL2 +BLUE_MASK LITERAL2 +BLUR LITERAL2 +BOTTOM LITERAL2 +BURN LITERAL2 +CENTER LITERAL2 +CHATTER LITERAL2 +CODED LITERAL2 +COMPLAINT LITERAL2 +COMPOSITE LITERAL2 +COMPONENT LITERAL2 +CONCAVE_POLYGON LITERAL2 +CONTROL LITERAL2 +CONVEX_POLYGON LITERAL2 +CORNER LITERAL2 +CORNERS LITERAL2 +CLOSE LITERAL2 +CMYK LITERAL2 +CODED LITERAL2 +COMPLAINT LITERAL2 +CONTROL LITERAL2 +CORNER LITERAL2 +CORNERS LITERAL2 +CROSS LITERAL2 +CUSTOM LITERAL2 +DARKEST LITERAL2 +DEGREES LITERAL2 +DEG_TO_RAD LITERAL2 +DELETE LITERAL2 +DIAMETER LITERAL2 +DIFFERENCE LITERAL2 +DIFFUSE LITERAL2 +DILATE LITERAL2 +DIRECTIONAL LITERAL2 +DISABLE_ACCURATE_TEXTURES LITERAL2 +DISABLE_DEPTH_SORT LITERAL2 +DISABLE_NATIVE_FONTS LITERAL2 +DISABLE_OPENGL_ERROR_REPORT LITERAL2 +DISABLE_TEXT_SMOOTH LITERAL2 +DISABLED LITERAL2 +DODGE LITERAL2 +DOWN LITERAL2 +DXF LITERAL2 +ENABLE_ACCURATE_TEXTURES LITERAL2 +ENABLE_DEPTH_SORT LITERAL2 +ENABLE_NATIVE_FONTS LITERAL2 +DISABLE_OPENGL_2X_SMOOTH LITERAL2 +ENABLE_OPENGL_4X_SMOOTH LITERAL2 +ENABLE_OPENGL_ERROR_REPORT LITERAL2 +ENTER LITERAL2 +EPSILON LITERAL2 +ERODE LITERAL2 +ESC LITERAL2 +EXCLUSION LITERAL2 +GIF LITERAL2 +GRAY LITERAL2 +GREEN_MASK LITERAL2 +GROUP LITERAL2 +HALF LITERAL2 +HALF_PI LITERAL2 +HAND LITERAL2 +HARD_LIGHT LITERAL2 +HINT_COUNT LITERAL2 +HSB LITERAL2 +IMAGE LITERAL2 +INVERT LITERAL2 +JAVA2D LITERAL2 +JPEG LITERAL2 +LEFT LITERAL2 +LIGHTEST LITERAL2 +LINES LITERAL2 +LINUX LITERAL2 +MACOSX LITERAL2 +MAX_FLOAT LITERAL2 +MAX_INT LITERAL2 +MITER LITERAL2 +MODEL LITERAL2 +MOVE LITERAL2 +MULTIPLY LITERAL2 +NORMAL LITERAL2 +NO_DEPTH_TEST LITERAL2 +NTSC LITERAL2 +ONE LITERAL2 +OPAQUE LITERAL2 +OPEN LITERAL2 +OPENGL LITERAL2 +ORTHOGRAPHIC LITERAL2 +OVERLAY LITERAL2 +PAL LITERAL2 +P2D LITERAL2 +P3D LITERAL2 +PERSPECTIVE LITERAL2 +PI LITERAL2 +PIXEL_CENTER LITERAL2 +POINT LITERAL2 +POINTS LITERAL2 +POSTERIZE LITERAL2 +PROBLEM LITERAL2 +PROJECT LITERAL2 +QUAD_STRIP LITERAL2 +QUADS LITERAL2 +QUARTER_PI LITERAL2 +RAD_TO_DEG LITERAL2 +RADIUS LITERAL2 +RADIANS LITERAL2 +RED_MASK LITERAL2 +REPLACE LITERAL2 +RETURN LITERAL2 +RGB LITERAL2 +RIGHT LITERAL2 +ROUND LITERAL2 +SCREEN LITERAL2 +SECAM LITERAL2 +SHIFT LITERAL2 +SPECULAR LITERAL2 +SOFT_LIGHT LITERAL2 +SQUARE LITERAL2 +SUBTRACT LITERAL2 +SVIDEO LITERAL2 +TAB LITERAL2 +TARGA LITERAL2 +TEXT LITERAL2 +TFF LITERAL2 +THIRD_PI LITERAL2 +THRESHOLD LITERAL2 +TIFF LITERAL2 +TOP LITERAL2 +TRIANGLE_FAN LITERAL2 +TRIANGLES LITERAL2 +TRIANGLE_STRIP LITERAL2 +TUNER LITERAL2 +TWO LITERAL2 +TWO_PI LITERAL2 +UP LITERAL2 +WAIT LITERAL2 +WHITESPACE LITERAL2 + + +# KEYWORD1 specifies datatypes and keywords + +ArrayList KEYWORD1 +Boolean KEYWORD1 +Byte KEYWORD1 +Character KEYWORD1 +Class KEYWORD1 +Double KEYWORD1 +Float KEYWORD1 +Integer KEYWORD1 +HashMap KEYWORD1 +String KEYWORD1 +StringBuffer KEYWORD1 +Thread KEYWORD1 +abstract KEYWORD1 +assert KEYWORD1 +boolean KEYWORD1 +break KEYWORD1 +byte KEYWORD1 +catch KEYWORD1 +char KEYWORD1 +class KEYWORD1 +continue KEYWORD1 +default KEYWORD1 +do KEYWORD1 +double KEYWORD1 +else KEYWORD1 +enum KEYWORD1 +extends KEYWORD1 +false KEYWORD1 +final KEYWORD1 +finally KEYWORD1 +for KEYWORD1 +float KEYWORD1 +if KEYWORD1 +implements KEYWORD1 +import KEYWORD1 +instanceof KEYWORD1 +int KEYWORD1 +interface KEYWORD1 +long KEYWORD1 +native KEYWORD1 +new KEYWORD1 +null KEYWORD1 +package KEYWORD1 +private KEYWORD1 +protected KEYWORD1 +public KEYWORD1 +return KEYWORD1 +short KEYWORD1 +static KEYWORD1 +strictfp KEYWORD1 +super KEYWORD1 +switch KEYWORD1 +synchronized KEYWORD1 +this KEYWORD1 +throw KEYWORD1 +throws KEYWORD1 +transient KEYWORD1 +true KEYWORD1 +try KEYWORD1 +void KEYWORD1 +volatile KEYWORD1 +while KEYWORD1 + +# Depricated API + +arraycopy KEYWORD2 arraycopy_ +openStream KEYWORD2 openStream_ + + +# KEYWORD2 specifies methods and functions + +cache KEYWORD2 + + +# THE TEXT ABOVE IS HAND-WRITTEN AND FOUND IN THE FILE "keywords_base.txt" +# THE TEXT BELOW IS AUTO-GENERATED + + +abs KEYWORD2 abs_ +acos KEYWORD2 acos_ ++= addassign ++ addition +alpha KEYWORD2 alpha_ +ambient KEYWORD2 ambient_ +ambientLight KEYWORD2 ambientLight_ +append KEYWORD2 append_ +applyMatrix KEYWORD2 applyMatrix_ +arc KEYWORD2 arc_ +Array KEYWORD1 Array +[] arrayaccess +arrayCopy KEYWORD2 arrayCopy_ +ArrayList KEYWORD1 ArrayList +asin KEYWORD2 asin_ += assign +atan KEYWORD2 atan_ +atan2 KEYWORD2 atan2_ +background KEYWORD2 background_ +beginCamera KEYWORD2 beginCamera_ +beginRaw KEYWORD2 beginRaw_ +beginRecord KEYWORD2 beginRecord_ +beginShape KEYWORD2 beginShape_ +bezier KEYWORD2 bezier_ +bezierDetail KEYWORD2 bezierDetail_ +bezierPoint KEYWORD2 bezierPoint_ +bezierTangent KEYWORD2 bezierTangent_ +bezierVertex KEYWORD2 bezierVertex_ +binary KEYWORD2 binary_ +binary KEYWORD2 bitwiseAND_ +| bitwiseOR +blend KEYWORD2 blend_ +blendColor KEYWORD2 blendColor_ +blue KEYWORD2 blue_ +boolean KEYWORD1 boolean +boolean KEYWORD2 boolean_ +box KEYWORD2 box_ +break KEYWORD1 break +brightness KEYWORD2 brightness_ +byte KEYWORD1 byte +byte KEYWORD2 byte_ +camera KEYWORD2 camera_ +case KEYWORD1 case +ceil KEYWORD2 ceil_ +char KEYWORD1 char +char KEYWORD2 char_ +char KEYWORD2 class_ +color KEYWORD2 color_ +color KEYWORD1 color_datatype +colorMode KEYWORD2 colorMode_ +, comma +// comment +concat KEYWORD2 concat_ +?: KEYWORD1 conditional_ +constrain KEYWORD2 constrain_ +continue KEYWORD1 continue +copy KEYWORD2 copy_ +cos KEYWORD2 cos_ +createFont KEYWORD2 createFont_ +createGraphics KEYWORD2 createGraphics_ +createImage KEYWORD2 createImage_ +createInput KEYWORD2 createInput_ +createOutput KEYWORD2 createOutput_ +createReader KEYWORD2 createReader_ +createWriter KEYWORD2 createWriter_ +{} curlybraces +cursor KEYWORD2 cursor_ +curve KEYWORD2 curve_ +curveDetail KEYWORD2 curveDetail_ +curvePoint KEYWORD2 curvePoint_ +curveTangent KEYWORD2 curveTangent_ +curveTightness KEYWORD2 curveTightness_ +curveVertex KEYWORD2 curveVertex_ +day KEYWORD2 day_ +-- decrement +default KEYWORD1 default +degrees KEYWORD2 degrees_ +delay KEYWORD2 delay_ +directionalLight KEYWORD2 directionalLight_ +dist KEYWORD2 dist_ +/ divide +/= divideassign +/** doccomment +. dot +double KEYWORD1 double +draw KEYWORD3 draw_ +ellipse KEYWORD2 ellipse_ +ellipseMode KEYWORD2 ellipseMode_ +else KEYWORD1 else +emissive KEYWORD2 emissive_ +endCamera KEYWORD2 endCamera_ +endRaw KEYWORD2 endRaw_ +endRecord KEYWORD2 endRecord_ +endShape KEYWORD2 endShape_ +== equality +exit KEYWORD2 exit_ +exp KEYWORD2 exp_ +expand KEYWORD2 expand_ +extends KEYWORD1 extends +false KEYWORD1 false +fill KEYWORD2 fill_ +filter KEYWORD2 filter_ +final KEYWORD1 final +float KEYWORD1 float +float KEYWORD2 float_ +floor KEYWORD2 floor_ +focused LITERAL2 focused +for KEYWORD1 for_ +frameCount LITERAL2 frameCount +frameRate KEYWORD2 frameRate_ +frameRate LITERAL2 frameRate +frustum KEYWORD2 frustum_ +get KEYWORD2 get_ +< greaterthan +<= greaterthanorequalto +green KEYWORD2 green_ +HALF_PI LITERAL2 HALF_PI +HashMap KEYWORD1 HashMap +height LITERAL2 height +hex KEYWORD2 hex_ +hint KEYWORD2 hint_ +hour KEYWORD2 hour_ +hue KEYWORD2 hue_ +if KEYWORD1 if_ +image KEYWORD2 image_ +imageMode KEYWORD2 imageMode_ +implements KEYWORD1 implements +import KEYWORD1 import +++ increment +!= inequality +int KEYWORD1 int +int KEYWORD2 int_ +join KEYWORD2 join_ +key LITERAL2 key +keyCode LITERAL2 keyCode +keyPressed KEYWORD2 keyPressed_ +keyPressed LITERAL2 keyPressed +keyReleased KEYWORD2 keyReleased_ +keyTyped KEYWORD2 keyTyped_ +<< leftshift +lerp KEYWORD2 lerp_ +lerpColor KEYWORD2 lerpColor_ +< lessthan +<= lessthanorequalto +lightFalloff KEYWORD2 lightFalloff_ +lights KEYWORD2 lights_ +lightSpecular KEYWORD2 lightSpecular_ +line KEYWORD2 line_ +link KEYWORD2 link_ +loadBytes KEYWORD2 loadBytes_ +loadFont KEYWORD2 loadFont_ +loadImage KEYWORD2 loadImage_ +loadPixels KEYWORD2 loadPixels_ +loadShape KEYWORD2 loadShape_ +loadStrings KEYWORD2 loadStrings_ +log KEYWORD2 log_ +&& logicalAND +! logicalNOT +|| logicalOR +long KEYWORD1 long +loop KEYWORD2 loop_ +mag KEYWORD2 mag_ +map KEYWORD2 map_ +match KEYWORD2 match_ +matchAll KEYWORD2 matchAll_ +max KEYWORD2 max_ +millis KEYWORD2 millis_ +min KEYWORD2 min_ +- minus +minute KEYWORD2 minute_ +modelX KEYWORD2 modelX_ +modelY KEYWORD2 modelY_ +modelZ KEYWORD2 modelZ_ +% modulo +month KEYWORD2 month_ +mouseButton LITERAL2 mouseButton +mouseClicked KEYWORD2 mouseClicked_ +mouseDragged KEYWORD2 mouseDragged_ +mouseMoved KEYWORD2 mouseMoved_ +mousePressed KEYWORD2 mousePressed_ +mousePressed LITERAL2 mousePressed +mouseReleased KEYWORD2 mouseReleased_ +mouseX LITERAL2 mouseX +mouseY LITERAL2 mouseY +/* multilinecomment +* multiply +*= multiplyassign +new KEYWORD1 new +nf KEYWORD2 nf_ +nfc KEYWORD2 nfc_ +nfp KEYWORD2 nfp_ +nfs KEYWORD2 nfs_ +noCursor KEYWORD2 noCursor_ +noFill KEYWORD2 noFill_ +noise KEYWORD2 noise_ +noiseDetail KEYWORD2 noiseDetail_ +noiseSeed KEYWORD2 noiseSeed_ +noLights KEYWORD2 noLights_ +noLoop KEYWORD2 noLoop_ +norm KEYWORD2 norm_ +normal KEYWORD2 normal_ +noSmooth KEYWORD2 noSmooth_ +noStroke KEYWORD2 noStroke_ +noTint KEYWORD2 noTint_ +null KEYWORD1 null +Object KEYWORD1 Object +online LITERAL2 online +open KEYWORD2 open_ +ortho KEYWORD2 ortho_ +param KEYWORD2 param_ +() parentheses +perspective KEYWORD2 perspective_ +PFont KEYWORD1 PFont +list KEYWORD2 PFont_list_ +PGraphics KEYWORD1 PGraphics +beginDraw KEYWORD2 PGraphics_beginDraw_ +endDraw KEYWORD2 PGraphics_endDraw_ +PI LITERAL2 PI +PImage KEYWORD1 PImage +alpha KEYWORD2 PImage_alpha_ +blend KEYWORD2 PImage_blend_ +copy KEYWORD2 PImage_copy_ +filter KEYWORD2 PImage_filter_ +get KEYWORD2 PImage_get_ +height LITERAL2 PImage_height +loadPixels KEYWORD2 PImage_loadPixels_ +mask KEYWORD2 PImage_mask_ +pixels LITERAL2 PImage_pixels +resize KEYWORD2 PImage_resize_ +save KEYWORD2 PImage_save_ +set KEYWORD2 PImage_set_ +updatePixels KEYWORD2 PImage_updatePixels_ +width LITERAL2 PImage_width +pixels LITERAL2 pixels +pmouseX LITERAL2 pmouseX +pmouseY LITERAL2 pmouseY +point KEYWORD2 point_ +point KEYWORD2 pointLight_ +popMatrix KEYWORD2 popMatrix_ +popStyle KEYWORD3 popStyle_ +pow KEYWORD2 pow_ +print KEYWORD2 print_ +printCamera KEYWORD2 printCamera_ +println KEYWORD2 println_ +printMatrix KEYWORD2 printMatrix_ +printProjection KEYWORD2 printProjection_ +PrintWriter KEYWORD1 PrintWriter +close KEYWORD2 PrintWriter_close_ +flush KEYWORD2 PrintWriter_flush_ +print KEYWORD2 PrintWriter_print_ +println KEYWORD2 PrintWriter_println_ +private KEYWORD1 private +PShape KEYWORD1 PShape +disableStyle KEYWORD2 PShape_disableStyle_ +enableStyle KEYWORD2 PShape_enableStyle_ +getChild KEYWORD2 PShape_getChild_ +getHeight KEYWORD2 PShape_getHeight_ +getWidth KEYWORD2 PShape_getWidth_ +isVisible KEYWORD2 PShape_isVisible_ +resetMatrix KEYWORD2 PShape_resetMatrix_ +rotate KEYWORD2 PShape_rotate_ +rotateX KEYWORD2 PShape_rotateX_ +rotateY KEYWORD2 PShape_rotateY_ +rotateZ KEYWORD2 PShape_rotateZ_ +scale KEYWORD2 PShape_scale_ +setVisible KEYWORD2 PShape_setVisible_ +translate KEYWORD2 PShape_translate_ +public KEYWORD1 public +pushMatrix KEYWORD2 pushMatrix_ +pushStyle KEYWORD3 pushStyle_ +PVector KEYWORD1 PVector +add KEYWORD2 PVector_add_ +angleBetween KEYWORD2 PVector_angleBetween_ +array KEYWORD2 PVector_array_ +copy KEYWORD2 PVector_copy_ +cross KEYWORD2 PVector_cross_ +dist KEYWORD2 PVector_dist_ +div KEYWORD2 PVector_div_ +dot KEYWORD2 PVector_dot_ +get KEYWORD2 PVector_get_ +limit KEYWORD2 PVector_limit_ +mag KEYWORD2 PVector_mag_ +mult KEYWORD2 PVector_mult_ +normalize KEYWORD2 PVector_normalize_ +set KEYWORD2 PVector_set_ +sub KEYWORD2 PVector_sub_ +quad KEYWORD2 quad_ +radians KEYWORD2 radians_ +random KEYWORD2 random_ +randomSeed KEYWORD2 randomSeed_ +rect KEYWORD2 rect_ +rectMode KEYWORD2 rectMode_ +red KEYWORD2 red_ +redraw KEYWORD2 redraw_ +requestImage KEYWORD2 requestImage_ +resetMatrix KEYWORD2 resetMatrix_ +return KEYWORD1 return +reverse KEYWORD2 reverse_ +<< rightshift +rotate KEYWORD2 rotate_ +rotateX KEYWORD2 rotateX_ +rotateY KEYWORD2 rotateY_ +rotateZ KEYWORD2 rotateZ_ +round KEYWORD2 round_ +saturation KEYWORD2 saturation_ +save KEYWORD2 save_ +saveBytes KEYWORD2 saveBytes_ +saveFrame KEYWORD2 saveFrame_ +saveStream KEYWORD2 saveStream_ +saveStrings KEYWORD2 saveStrings_ +scale KEYWORD2 scale_ +screen LITERAL2 screen +screenX KEYWORD2 screenX_ +screenY KEYWORD2 screenY_ +screenZ KEYWORD2 screenZ_ +second KEYWORD2 second_ +selectFolder KEYWORD2 selectFolder_ +selectInput KEYWORD2 selectInput_ +selectOutput KEYWORD2 selectOutput_ +; semicolon +set KEYWORD2 set_ +setup KEYWORD3 setup_ +shape KEYWORD2 shape_ +shapeMode KEYWORD2 shapeMode_ +shininess KEYWORD2 shininess_ +shorten KEYWORD2 shorten_ +sin KEYWORD2 sin_ +size KEYWORD2 size_ +smooth KEYWORD2 smooth_ +sort KEYWORD2 sort_ +specular KEYWORD2 specular_ +sphere KEYWORD2 sphere_ +sphereDetail KEYWORD2 sphereDetail_ +splice KEYWORD2 splice_ +split KEYWORD2 split_ +splitTokens KEYWORD2 splitTokens_ +spotLight KEYWORD2 spotLight_ +sq KEYWORD2 sq_ +sqrt KEYWORD2 sqrt_ +static KEYWORD1 static +status KEYWORD2 status_ +str KEYWORD2 str_ +String KEYWORD1 String +charAt KEYWORD2 String_charAt_ +equals KEYWORD2 String_equals_ +indexOf KEYWORD2 String_indexOf_ +length KEYWORD2 String_length_ +substring KEYWORD2 String_substring_ +toLowerCase KEYWORD2 String_toLowerCase_ +toUpperCase KEYWORD2 String_toUpperCase_ +stroke KEYWORD2 stroke_ +strokeCap KEYWORD2 strokeCap_ +strokeJoin KEYWORD2 strokeJoin_ +strokeWeight KEYWORD2 strokeWeight_ +subset KEYWORD2 subset_ +-= subtractassign +super KEYWORD1 super +switch KEYWORD2 switch_ +tan KEYWORD2 tan_ +text KEYWORD2 text_ +textAlign KEYWORD2 textAlign_ +textAscent KEYWORD2 textAscent_ +textDescent KEYWORD2 textDescent_ +textFont KEYWORD2 textFont_ +textLeading KEYWORD2 textLeading_ +textMode KEYWORD2 textMode_ +textSize KEYWORD2 textSize_ +texture KEYWORD2 texture_ +textureMode KEYWORD2 textureMode_ +textWidth KEYWORD2 textWidth_ +this KEYWORD1 this +tint KEYWORD2 tint_ +translate KEYWORD2 translate_ +triangle KEYWORD2 triangle_ +trim KEYWORD2 trim_ +true KEYWORD1 true +TWO_PI LITERAL2 TWO_PI +unbinary KEYWORD2 unbinary_ +unhex KEYWORD2 unhex_ +updatePixels KEYWORD2 updatePixels_ +vertex KEYWORD2 vertex_ +void KEYWORD1 void +while KEYWORD1 while_ +width LITERAL2 width +XMLElement KEYWORD1 XMLElement +getChild KEYWORD2 XMLElement_getChild_ +getChildCount KEYWORD2 XMLElement_getChildCount_ +getChildren KEYWORD2 XMLElement_getChildren_ +getContent KEYWORD2 XMLElement_getContent_ +getFloatAttribute KEYWORD2 XMLElement_getFloatAttribute_ +getIntAttribute KEYWORD2 XMLElement_getIntAttribute_ +getName KEYWORD2 XMLElement_getName_ +getStringAttribute KEYWORD2 XMLElement_getStringAttribute_ +year KEYWORD2 year_ diff --git a/build/shared/lib/preferences.txt b/build/shared/lib/preferences.txt new file mode 100755 index 000000000..c8fa1f840 --- /dev/null +++ b/build/shared/lib/preferences.txt @@ -0,0 +1,215 @@ +# !!!!!!!! UNLIKE PREVIOUS VERSIONS OF PROCESSING !!!!!!!!!! +# DO NOT MODIFY THIS FILE, OR DELETE SETTINGS FROM THIS FILE + +# These are the default preferences. If you want to modify +# them directly, use the per-user local version of the file: + +# Documents and Settings -> [username] -> Application Data -> +# Processing -> preferences.txt (on Windows XP) + +# Users -> [username] -> AppData -> Roaming -> +# Processing -> preferences.txt (on Windows Vista) + +# ~/Library -> Processing -> preferences.txt (on Mac OS X) + +# ~/.processing -> preferences.txt (on Linux) + +# The exact location of your preferences file can be found at +# the bottom of the Preferences window inside Processing. + +# Because AppData and Application Data may be considered +# hidden or system folders on Windows, you'll have to ensure +# that they're visible in order to get at preferences.txt + +# You'll have problems running Processing if you incorrectly +# modify lines in this file. + + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +# DEFAULT PATHS FOR SKETCHBOOK AND SETTINGS + +# relative paths will be relative to processing.exe or procesing.app. +# absolute paths may also be used. + +# note that this path should use forward slashes (like unix) +# instead of \ on windows or : on macos or whatever else + +# If you don't want users to have their sketchbook default to +# "My Documents/Processing" on Windows and "Documents/Processing" on OS X, +# set this to another path that will be used by default. +# Note that this path must exist already otherwise it won't see +# the sketchbook folder, and will instead assume the sketchbook +# has gone missing, and that it should instead use the default. +#sketchbook.path= + +# if you don't want settings to go into "application data" on windows +# and "library" on macosx, set this to the alternate location. +#settings.path=data + +# temporary build path, normally this goes into the default +# "temp" folder for that platform (as defined by java) +# but this can be used to set a specific file in case of problems +#build.path=build + +# By default, no sketches currently open +last.sketch.count=0 + + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +# by default, check the processing server for any updates +# (please avoid disabling, this also helps us know basic numbers +# on how many people are using Processing) +update.check = true + +# on windows, automatically associate .pde files with processing.exe +platform.auto_file_type_associations = true + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +# default size for the main window +default.window.width = 500 +default.window.height = 600 + +# font size for editor +editor.font=Monospaced,plain,12 +# Monaco is nicer on Mac OS X, so use that explicitly +editor.font.macosx = Monaco,plain,10 + +# anti-aliased text, turned off by default +editor.antialias=false + +# color to be used for background when 'external editor' enabled +editor.external=false + +# caret blinking +editor.caret.blink=true + +# area that's not in use by the text (replaced with tildes) +editor.invalid=false + +console = true +console.output.file = stdout.txt +console.error.file = stderr.txt +console.lines = 4 + +# set to false to disable automatically clearing the console +# each time 'run' is hit +console.auto_clear = true + +# set the maximum number of lines remembered by the console +# the default is 500, lengthen at your own peril +console.length = 500 + +# convert tabs to spaces? how many spaces? +editor.tabs.expand = true +editor.tabs.size = 2 + +# automatically indent each line +editor.indent = true + +# size of divider between editing area and the console +editor.divider.size = 0 +# the larger divider on windows is ugly with the little arrows +# this makes it large enough to see (mouse changes) and use, +# but keeps it from being annoyingly obtrusive +editor.divider.size.windows = 2 + +# any additional java options when running externally +# (for applets that are run external to the environment... +# those with a code folder, or using any libraries) +# if you hose this and can't run things, it's your own durn fault +run.options = + +# settings for the -XmsNNNm and -XmxNNNm command line option +run.options.memory = false +run.options.memory.initial = 64 +run.options.memory.maximum = 256 + +# example of increasing the memory size for applets run externally +#run.options = -Xms128m -Xmx1024m + +# index of the default display to use for present mode +# (this setting not yet completely implemented) +run.display = 1 + +# set internally +#run.window.bgcolor= + +# set to false to open a new untitled window when closing the last window +# (otherwise, the environment will quit) +# default to the relative norm for the different platforms, +# but the setting can be changed in the prefs dialog anyway +#sketchbook.closing_last_window_quits = true +#sketchbook.closing_last_window_quits.macosx = false + + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +#history.recording = true + +# for advanced users, enable option to export a library +#export.library = false + +# which platforms to export by default +export.application.platform.windows = true +export.application.platform.macosx = true +export.application.platform.linux = true + +# whether or not to export as full screen (present) mode +export.application.fullscreen = false + +# whether to show the stop button when exporting to application +export.application.stop = true + +# false will place all exported files into a single .jar +export.applet.separate_jar_files = false + +# set to false to no longer delete applet or application folders before export +export.delete_target_folder = true + +# may be useful when attempting to debug the preprocessor +preproc.save_build_files=false + +# allows various preprocessor features to be toggled +# in case they are causing problems + +# preprocessor: pde.g +preproc.color_datatype = true +preproc.web_colors = true +preproc.enhanced_casting = true + +# preprocessor: PdeEmitter.java +preproc.substitute_floats = true +#preproc.substitute_image = false +#preproc.substitute_font = false + +# auto-convert non-ascii chars to unicode escape sequences +preproc.substitute_unicode = true + +# PdePreproc.java +# writes out the parse tree as parseTree.xml, which can be usefully +# viewed in (at least) Mozilla or IE. useful when debugging the preprocessor. +preproc.output_parse_tree = false + +# imports to use by default (changed for 0149, some imports removed) +preproc.imports = java.applet,java.awt,java.awt.image,java.awt.event,java.io,java.net,java.text,java.util,java.util.zip,java.util.regex + +# set the browser to be used on linux +browser.linux = mozilla + +# set to the program to be used for launching apps on linux +#launcher.linux = gnome-open + +# FULL SCREEN (PRESENT MODE) +run.present.bgcolor = #666666 +run.present.stop.color = #cccccc +# starting in release 0159, don't use full screen exclusive anymore +run.present.exclusive = false +# use this by default to hide the menu bar and dock on osx +run.present.exclusive.macosx = true diff --git a/build/shared/lib/theme/buttons.gif b/build/shared/lib/theme/buttons.gif new file mode 100644 index 000000000..3d8facd00 Binary files /dev/null and b/build/shared/lib/theme/buttons.gif differ diff --git a/build/shared/lib/theme/resize.gif b/build/shared/lib/theme/resize.gif new file mode 100644 index 000000000..630be1e26 Binary files /dev/null and b/build/shared/lib/theme/resize.gif differ diff --git a/build/shared/lib/theme/tab-sel-left.gif b/build/shared/lib/theme/tab-sel-left.gif new file mode 100644 index 000000000..bdee43c25 Binary files /dev/null and b/build/shared/lib/theme/tab-sel-left.gif differ diff --git a/build/shared/lib/theme/tab-sel-menu.gif b/build/shared/lib/theme/tab-sel-menu.gif new file mode 100644 index 000000000..d926650e7 Binary files /dev/null and b/build/shared/lib/theme/tab-sel-menu.gif differ diff --git a/build/shared/lib/theme/tab-sel-mid.gif b/build/shared/lib/theme/tab-sel-mid.gif new file mode 100644 index 000000000..fa8ed45fc Binary files /dev/null and b/build/shared/lib/theme/tab-sel-mid.gif differ diff --git a/build/shared/lib/theme/tab-sel-right.gif b/build/shared/lib/theme/tab-sel-right.gif new file mode 100644 index 000000000..d901fdba4 Binary files /dev/null and b/build/shared/lib/theme/tab-sel-right.gif differ diff --git a/build/shared/lib/theme/tab-unsel-left.gif b/build/shared/lib/theme/tab-unsel-left.gif new file mode 100644 index 000000000..eea22d8d8 Binary files /dev/null and b/build/shared/lib/theme/tab-unsel-left.gif differ diff --git a/build/shared/lib/theme/tab-unsel-menu.gif b/build/shared/lib/theme/tab-unsel-menu.gif new file mode 100644 index 000000000..a1720a589 Binary files /dev/null and b/build/shared/lib/theme/tab-unsel-menu.gif differ diff --git a/build/shared/lib/theme/tab-unsel-mid.gif b/build/shared/lib/theme/tab-unsel-mid.gif new file mode 100644 index 000000000..a2c5497b8 Binary files /dev/null and b/build/shared/lib/theme/tab-unsel-mid.gif differ diff --git a/build/shared/lib/theme/tab-unsel-right.gif b/build/shared/lib/theme/tab-unsel-right.gif new file mode 100644 index 000000000..91c03f5a9 Binary files /dev/null and b/build/shared/lib/theme/tab-unsel-right.gif differ diff --git a/build/shared/lib/theme/theme.txt b/build/shared/lib/theme/theme.txt new file mode 100644 index 000000000..c6da56f0d --- /dev/null +++ b/build/shared/lib/theme/theme.txt @@ -0,0 +1,101 @@ +# GUI - STATUS +status.notice.fgcolor = #000000 +status.notice.bgcolor = #818b95 +status.error.fgcolor = #ffffff +status.error.bgcolor = #662000 +status.edit.fgcolor = #000000 +status.edit.bgcolor = #cc9900 +status.font = SansSerif,plain,12 + +# GUI - TABS +# settings for the tabs at the top +# (tab images are stored in the lib/theme folder) +header.bgcolor = #818b95 +header.text.selected.color = #1a1a00 +header.text.unselected.color = #ffffff +header.text.font = SansSerif,plain,12 + +# GUI - CONSOLE +console.font = Monospaced,plain,11 +console.font.macosx = Monaco,plain,10 +console.color = #000000 +console.output.color = #cccccc +console.error.color = #ff3000 + +# GUI - BUTTONS +buttons.bgcolor = #4a545e +buttons.status.font = SansSerif,plain,12 +buttons.status.color = #ffffff + +# GUI - LINESTATUS +linestatus.color = #ffffff +linestatus.bgcolor = #29333d + +# EDITOR - DETAILS + +# foreground and background colors +editor.fgcolor = #000000 +editor.bgcolor = #ffffff + +# highlight for the current line +editor.linehighlight.color=#e2e2e2 +# highlight for the current line +editor.linehighlight=true + +# caret blinking and caret color +editor.caret.color = #333300 + +# color to be used for background when 'external editor' enabled +editor.external.bgcolor = #c8d2dc + +# selection color +editor.selection.color = #ffcc00 + +# area that's not in use by the text (replaced with tildes) +editor.invalid.style = #7e7e7e,bold + +# little pooties at the end of lines that show where they finish +editor.eolmarkers = false +editor.eolmarkers.color = #999999 + +# bracket/brace highlighting +editor.brackethighlight = true +editor.brackethighlight.color = #006699 + + +# TEXT - KEYWORDS + +# e.g abstract, final, private +editor.keyword1.style = #cc6600,plain + +# e.g. beginShape, point, line +editor.keyword2.style = #cc6600,plain + +# e.g. byte, char, short, color +editor.keyword3.style = #cc6600,bold + + +# TEXT - LITERALS + +# constants: e.g. null, true, this, RGB, TWO_PI +editor.literal1.style = #006699,plain + +# p5 built in variables: e.g. mouseX, width, pixels +editor.literal2.style = #006699,plain + +# e.g. + - = / +editor.operator.style = #000000,plain + +# ?? maybe this is for words followed by a colon +# like in case statements or goto +editor.label.style = #7e7e7e,bold + + +# TEXT - COMMENTS +editor.comment1.style = #7e7e7e,plain +editor.comment2.style = #7e7e7e,plain + + +# LINE STATUS - editor line number status bar at the bottom of the screen +linestatus.font = SansSerif,plain,10 +linestatus.height = 20 diff --git a/build/shared/libraries/howto.txt b/build/shared/libraries/howto.txt new file mode 100644 index 000000000..9865ab19a --- /dev/null +++ b/build/shared/libraries/howto.txt @@ -0,0 +1,5 @@ +This file has been replaced by an entire section of dev.processing.org +dedicated to libraries, people who make libraries, and people who +love library development trivia. The new page can be found here: + +http://dev.processing.org/libraries/ diff --git a/build/shared/libraries/javascript/library/export.txt b/build/shared/libraries/javascript/library/export.txt new file mode 100644 index 000000000..a642bb596 --- /dev/null +++ b/build/shared/libraries/javascript/library/export.txt @@ -0,0 +1,6 @@ +# don't actually export anything.. this is only to link against +# inside of the p5 environment +applet= + +# for an application, export to prevent from breaking +application=javascript.jar \ No newline at end of file diff --git a/build/shared/libraries/javascript/library/javascript.jar b/build/shared/libraries/javascript/library/javascript.jar new file mode 100644 index 000000000..93c7b9251 Binary files /dev/null and b/build/shared/libraries/javascript/library/javascript.jar differ diff --git a/build/shared/libraries/minim/library/jl1.0.jar b/build/shared/libraries/minim/library/jl1.0.jar new file mode 100755 index 000000000..17f7c0aa7 Binary files /dev/null and b/build/shared/libraries/minim/library/jl1.0.jar differ diff --git a/build/shared/libraries/minim/library/jsminim.jar b/build/shared/libraries/minim/library/jsminim.jar new file mode 100755 index 000000000..4e6f6e564 Binary files /dev/null and b/build/shared/libraries/minim/library/jsminim.jar differ diff --git a/build/shared/libraries/minim/library/minim-spi.jar b/build/shared/libraries/minim/library/minim-spi.jar new file mode 100755 index 000000000..4760de485 Binary files /dev/null and b/build/shared/libraries/minim/library/minim-spi.jar differ diff --git a/build/shared/libraries/minim/library/minim.jar b/build/shared/libraries/minim/library/minim.jar new file mode 100755 index 000000000..eb053ccec Binary files /dev/null and b/build/shared/libraries/minim/library/minim.jar differ diff --git a/build/shared/libraries/minim/library/mp3spi1.9.4.jar b/build/shared/libraries/minim/library/mp3spi1.9.4.jar new file mode 100755 index 000000000..019b86c93 Binary files /dev/null and b/build/shared/libraries/minim/library/mp3spi1.9.4.jar differ diff --git a/build/shared/libraries/minim/library/tritonus_aos.jar b/build/shared/libraries/minim/library/tritonus_aos.jar new file mode 100755 index 000000000..4a02386d4 Binary files /dev/null and b/build/shared/libraries/minim/library/tritonus_aos.jar differ diff --git a/build/shared/libraries/minim/library/tritonus_share.jar b/build/shared/libraries/minim/library/tritonus_share.jar new file mode 100755 index 000000000..bb367d17e Binary files /dev/null and b/build/shared/libraries/minim/library/tritonus_share.jar differ diff --git a/build/shared/libraries/minim/license.txt b/build/shared/libraries/minim/license.txt new file mode 100755 index 000000000..d511905c1 --- /dev/null +++ b/build/shared/libraries/minim/license.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/build/shared/libraries/minim/version.txt b/build/shared/libraries/minim/version.txt new file mode 100755 index 000000000..10bf840ed --- /dev/null +++ b/build/shared/libraries/minim/version.txt @@ -0,0 +1 @@ +2.0.1 \ No newline at end of file diff --git a/build/shared/reference.zip b/build/shared/reference.zip new file mode 100755 index 000000000..baa5e4ee2 Binary files /dev/null and b/build/shared/reference.zip differ diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt new file mode 100644 index 000000000..f50448527 --- /dev/null +++ b/build/shared/revisions.txt @@ -0,0 +1,241 @@ +PROCESSING 1.0.3 (REV 0165) - 24 February 2009 + +Bug fix release to repair a couple of regressions caused by changes in 1.0.2, +as well as a couple other new problems encountered since. + +[ bug fixes ] + ++ endRecord or endRaw produces a RuntimeException with the PDF library + http://dev.processing.org/bugs/show_bug.cgi?id=1169 + ++ Problem with beginRaw/endRaw and OpenGL + http://dev.processing.org/bugs/show_bug.cgi?id=1171 + ++ Set strokeWeight on points and lines with begin/endRaw + http://dev.processing.org/bugs/show_bug.cgi?id=1172 + ++ Fix strokeWeight quirks with P3D when used with points and lines + ++ ArrayIndexOutOfBoundsException with point() + http://dev.processing.org/bugs/show_bug.cgi?id=1168 + +[ changes ] + ++ Update to iText 2.1.4 for the PDF library + + +PROCESSING 1.0.2 (REV 0164) - 21 February 2009 + +This release fixes many bugs and adds two minor functions to the XML library. + +[ bug fixes ] + ++ Empty "code" folder causing problems with Export + http://dev.processing.org/bugs/show_bug.cgi?id=1084 + ++ Sketches not loading when .pde file is opened from the Windows Explorer + on Asian Windows systems. + http://dev.processing.org/bugs/show_bug.cgi?id=1089 + ++ Disable copying of metadata and resource forks in OS X build + http://dev.processing.org/bugs/show_bug.cgi?id=1098 + ++ Suppress goofy Apple error message about JVMArchs + ++ StringIndexOutOfBoundsException caused by import statements with no dots + http://dev.processing.org/bugs/show_bug.cgi?id=1145 + ++ Pressing in "Are you sure you want to Quit?" dialog causes quit + http://dev.processing.org/bugs/show_bug.cgi?id=1134 + ++ Fix QUADS and QUAD_STRIP with P2D + http://dev.processing.org/bugs/show_bug.cgi?id=1162 + ++ ArrayIndexOutOfBoundsException when drawing curves in P3D and OPENGL + http://dev.processing.org/bugs/show_bug.cgi?id=1153 + ++ Problems with negatve arc() angles in OpenGL, P3D, other inconsistencies + http://dev.processing.org/bugs/show_bug.cgi?id=1095 + ++ requestImage() causing problems with JAVA2D + ++ Fix minor strokeWeight bug with OpenGL + ++ Minor bug fix to SVG files that weren't being resized properly + ++ OpenGL is rendering darker in 0149+ + http://dev.processing.org/bugs/show_bug.cgi?id=958 + Thanks to Dave Bollinger for tracking this down and providing a solution + ++ OutOfMemoryError with ellipse() in P3D and OPENGL + http://dev.processing.org/bugs/show_bug.cgi?id=1086 + ++ ArrayIndexOutOfBoundsException with P3D and OPENGL + http://dev.processing.org/bugs/show_bug.cgi?id=1117 + ++ point(x,y) ignores noStroke() in some renderers + http://dev.processing.org/bugs/show_bug.cgi?id=1090 + ++ Fix Windows startup problem when scheme coloring was odd + http://dev.processing.org/bugs/show_bug.cgi?id=1109 + Changes to the system theme could cause Processing to not launch + ++ Fix several point() problems with P3D + http://dev.processing.org/bugs/show_bug.cgi?id=1110 + ++ nextPage() not working properly with PDF as the renderer + http://dev.processing.org/bugs/show_bug.cgi?id=1131 + ++ Save style information when nextPage() is called in PDF renderer + ++ beginRaw() broken (no DXF, etc working) + http://dev.processing.org/bugs/show_bug.cgi?id=1099 + http://dev.processing.org/bugs/show_bug.cgi?id=1144 + ++ Fix algorithm for quadratic to cubic curve conversion + http://dev.processing.org/bugs/show_bug.cgi?id=1122 + Thanks to user bits.in.shambles for providing a fix. + ++ tint() not working in P2D + http://dev.processing.org/bugs/show_bug.cgi?id=1132 + ++ blend() y coordinates inverted when using OpenGL + http://dev.processing.org/bugs/show_bug.cgi?id=1137 + ++ Fix for getChild() and getChildren() with XML elements that have null names + +[ additions ] + ++ Added listChildren() method to XMLElement + ++ Added optional toString(boolean) parameter to enable/disable indents + in XMLElement + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 1.0.1 (REV 0163) - 29 November 2008 + +Processing 1.0 has arrived! You can read an overview of changes introduced +in the last few months here: http://processing.org/reference/changes.html + +Also see the "known issues" section of the troubleshooting page: +http://processing.org/reference/troubleshooting/#known + +This release (1.0.1) fixes a handful of issues that only showed up once we +had more testing, particularly with the wider audience we've received in the +past week following the announcement. + +[ bug fixes ] + ++ ArrayIndexOutOfBoundsException with File > New + http://dev.processing.org/bugs/show_bug.cgi?id=1067 + ++ "CallStaticVoidMethod() threw an exception" on some Mac OS X machines + http://dev.processing.org/bugs/show_bug.cgi?id=1063 + http://dev.processing.org/bugs/show_bug.cgi?id=1078 + ++ "editor.indent" preference setting does not work properly + http://dev.processing.org/bugs/show_bug.cgi?id=1073 + ++ Fixed some "An error occurred while starting the application" problems + ++ Added a note about the Minim library to the changes page. + ++ Disable parsing of regexps with the split() command + http://dev.processing.org/bugs/show_bug.cgi?id=1060 + ++ Fixed ArrayIndexOutOfBoundsException in ellipseImpl(). + http://dev.processing.org/bugs/show_bug.cgi?id=1068 + ++ Fixed problem where small ellipses weren't showing up. + +[ changes ] + ++ Implement multi-line tab via tab key (also outdent) + http://dev.processing.org/bugs/show_bug.cgi?id=1075 + ++ Code with 'import' and a space incorrectly parsed as an import statement + http://dev.processing.org/bugs/show_bug.cgi?id=1064 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +PROCESSING 1.0 (REV 0162) - 24 November 2008 + +Processing 1.0 has arrived! You can read an overview of changes introduced +in the last few months here: http://processing.org/reference/changes.html + +[ known issues ] + ++ Sketches that size(w, h, OPENGL) and do not clear the background on each + frame can cause major flickering or problems when the screen clears anyway. + There are several possible solutions: + + 1. You may need to disable the default 2x smoothing by using + hint(DISABLE_OPENGL_2X_SMOOTH). + + 2. Update the drivers for your graphics card. + + 3. Get a decent graphics card -- the OpenGL renderer is for advanced + use, we don't support using it with cheaper built-in graphics hardware + like the Intel GMA 950. + + 4. If you're running Windows Vista, try disabling the Aero theme. + + This flickering issue is being tracked here: + http://dev.processing.org/bugs/show_bug.cgi?id=1056 + ++ "An error occurred while starting the application" when launching + Processing.exe on Windows. This is a high priority however we cannot + reproduce it on any of our test machines, which has delayed a fix. + http://dev.processing.org/bugs/show_bug.cgi?id=986 + ++ With P2D, P3D, and OPENGL, series of connected lines (such as the stroke + around a polygon, triangle, or ellipse) produce unattractive results when + strokeWeight is set. + http://dev.processing.org/bugs/show_bug.cgi?id=955 + ++ Unlike most applications, the menu bar is inside the editor window when + Processing is used with Mac OS X 10.5. This is a workaround for an Apple + bug in Java 1.5 and 1.6 on Mac OS X 10.5 that causes the menu bar to be + so excessively slow that the application appears to have crashed. + http://dev.processing.org/bugs/show_bug.cgi?id=786 + + Please file a bug report with Apple at bugreporter.apple.com if you want + this fixed. The problem has existed since the spring, and we first filed + a bug with them in June, and we have received no indication that it when + it will be fixed, or if it will ever be fixed. + + Or if you want to take your chances with the slow menu bar, + you can change the default setting in the Preferences window. + ++ Sketches that use the video library plus OpenGL have a problem on some + OS X machines. The workaround is listed in Comment #16 of this bug: + http://dev.processing.org/bugs/show_bug.cgi?id=882#c16 + ++ Command line support arrived in a recent release, but is not working yet. + http://dev.processing.org/bugs/show_bug.cgi?id=1048 + ++ OpenGL rendering is more dim/darker in release 0149 and later. + http://dev.processing.org/bugs/show_bug.cgi?id=958 + Any help tracking this down would be most appreciated. + ++ The first few frames of OpenGL sketches on Windows run slowly. + http://dev.processing.org/bugs/show_bug.cgi?id=874 + ++ When used with P3D, strokeWeight does not interpolate the Z-coordinates + of the lines, which means that when rotated, these flat lines may + disappear. (Since, uh, lines are, you know, flat.) The OPENGL renderer + setting does not share this problem because it always draws lines + perpendicular to the screen (which we hope to do in a future release). + http://dev.processing.org/bugs/show_bug.cgi?id=956 + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +in spite of their historical feel good campiness, i've removed the +notes from earlier releases because this file was getting out of hand. diff --git a/build/shared/tools/Mangler/make.sh b/build/shared/tools/Mangler/make.sh new file mode 100755 index 000000000..e1c1ce37b --- /dev/null +++ b/build/shared/tools/Mangler/make.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# The pde.jar file may be buried inside the .app file on Mac OS X. +PDE=`find ../.. -name pde.jar` + +javac -target 1.5 \ + -cp "../../lib/core.jar:$PDE" \ + -d bin \ + src/Mangler.java + +cd bin && zip -r ../tool/mangler.jar * && cd .. diff --git a/build/shared/tools/Mangler/src/Mangler.java b/build/shared/tools/Mangler/src/Mangler.java new file mode 100644 index 000000000..cfd527954 --- /dev/null +++ b/build/shared/tools/Mangler/src/Mangler.java @@ -0,0 +1,94 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +package com.transformers.supermangletron; + + +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.JOptionPane; + +import processing.app.Editor; +import processing.app.tools.Tool; + + +/** + * Example Tools menu entry. + */ +public class Mangler implements Tool { + Editor editor; + + + public void init(Editor editor) { + this.editor = editor; + } + + + public String getMenuTitle() { + return "Mangle Selection"; + } + + + public void run() { + String sketchName = editor.getSketch().getName(); + + Object[] options = { "Yes, please", "No, thanks" }; + int result = JOptionPane.showOptionDialog(editor, + "Is " + sketchName + + " ready for destruction?", + "Super Mangle Tron", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[1]); + if (result == JOptionPane.YES_OPTION) { + mangleSelection(); + } + } + + + protected void mangleSelection() { + if (editor.isSelectionActive()) { + String selection = editor.getSelectedText(); + char[] stuff = selection.toCharArray(); + // Randomly swap a bunch of characters in the text + for (int i = 0; i < stuff.length / 10; i++) { + int a = (int) (Math.random() * stuff.length); + int b = (int) (Math.random() * stuff.length); + if (stuff[a] == '\n' || stuff[b] == '\n') { + continue; // skip newline characters + } + stuff[a] = selection.charAt(b); + stuff[b] = selection.charAt(a); + } + editor.startCompoundEdit(); + editor.setSelectedText(new String(stuff)); + editor.stopCompoundEdit(); + editor.statusNotice("Now that feels better, doesn't it?"); + + } else { + editor.statusError("No selection, no dice."); + } + } +} diff --git a/build/shared/tools/howto.txt b/build/shared/tools/howto.txt new file mode 100644 index 000000000..77df31c91 --- /dev/null +++ b/build/shared/tools/howto.txt @@ -0,0 +1,143 @@ +TOOLS IN PROCESSING + +With initial help from code contributed by fjen, Processing release 0147 and +later have a dynamically loading tools menu, which can be used to expand the +environment in fun and fantastic ways. + +A Tool is a chunk of code that runs from the Tools menu. Tools are a means +of building onto the Processing Development Environment without needing to +rebuild the beast from source. + +The interface (at least for now) is extremely simple: + + +package processing.app.tools.Tool; + +public interface Tool extends Runnable { + + public void init(Editor editor); + + public void run(); + + public String getMenuTitle(); +} + + +The init() method is called when an Editor window first opens. This means +you won't have access to a sketch object, or a GUI, and should only do minimal +setup. (However it'd be a good idea to stash the "Editor" object for later.) + +The run() method will be called by the main application when the tool is +selected from the menu. This is called using invokeLater(), so that the tool +can safely use Swing and any other GUI yackety yack. If you're using a Frame, +you'll need to detect whether the Frame is already open (and bring it to the +front) or whether to create a new window. + +Faceless tools also use the run() method. You should avail yourselves of the +statusNotice() and statusError() methods in Editor, to let the user know what's +happened. (As per p. 107 of the Processing Development Environment Tools +Reference User Interface Guide.) + +The getMenuTitle() method just returns the title for what should appear in the +Tools menu. Not doing shortcuts for now, because resolving them between tools +(and the rest of the interface) is fugly. We would also need additional +modifiers for shift and alt. It just gets messy quick. Ordering in the Tools +menu is alphabetical. + + +////////////////////////////////////////////////////////////// + + +Where to put Tools + +Core tools live inside the "tools" subfolder of the Processing distribution, +however users should install "contributed" tools in their sketchbook folder, +inside a subfolder named "tools". + +If a tool works only with a particular release of Processing, then it may make +sense for the user to put things into the Processing tools folder, however we'd +like to keep users out of there as much as possible. In fact, it may not be +visible in future releases of Processing (for instance, on Mac OS X, the tools +folder is hidden inside the .app bundle). + +Tools should be laid out similar to libraries, though the structure is a little +more flexible. The tool folder should be the name of the main class (without +its package name but using the same capitalization), and have a subfolder named +"tool" that contains the .jar and .zip files it uses. I'll use the included +"Mangler" tool as an example. + +(This Tool is not built by default, due to a lack of non-dubious arguments +regarding the usefulness of including (by default) a Tool that mangles code.) + +The folder should be called Mangler (note the capitalization), and contain: + +sketchbook/Mangler -> tool folder +sketchbook/Mangler/tool -> location for code +sketchbook/Mangler/tool/mangle.jar -> jar with one or more classes + +The naming of jar and zip files in the tool/* directory doesn't matter. + +When Processing loads, the jar and zip files will be searched for +Mangler.class. Even though this tool is found in package poos.shoe, +it will be sussed out. Package names are required. + +Loose .class files are not supported, use only jar and zip files. + + +////////////////////////////////////////////////////////////// + + +What You Can and Cannot Do + +The only API methods that are officially scrubbed and sanctioned by the +Commissioner on Fair API and Proper Manners for use by the Tools classes +are found in: + +processing.app.Base +processing.app.Editor +processing.app.Preferences +processing.app.Sketch +processing.app.SketchCode + +In fact, most of the API you should be talking to is inside Editor. +Full API documentation can be found on dev.processing.org: +http://dev.processing.org/reference/everything/ +(Keep in mind that this is not always perfectly up to date, but we'll try.) + +Of course, you're welcome to go spelunking through the rest of the API +(that's where all the fun stuff is anyway), but don't be upset when something +changes and breaks your tool and makes your users sad. + +Currently, native code is not supported with tools. This might be possible, +but it's another potentially messy thing to dynamically add native library +paths to running code. (See "Future Releases" below.) + + +////////////////////////////////////////////////////////////// + + +Future Releases + +In future releases, we are considering the following features: + +1. How shortcut keys are handled. + http://dev.processing.org/bugs/show_bug.cgi?id=140 + +2. Whether to allow tools to dock into the Preferences panel. + http://dev.processing.org/bugs/show_bug.cgi?id=883 + +3. A means to run native code from the Tools menu. + http://dev.processing.org/bugs/show_bug.cgi?id=884 + +4. Methods for reorganizing the Tools menu, or placing contributed + Tools inside other menus (such as Edit or Sketch). + http://dev.processing.org/bugs/show_bug.cgi?id=885 + +This is the first round of documentation for the Tools menu, we reserve the +right to update, clarify, and change our mind in future releases. + + +////////////////////////////////////////////////////////////// + + +Ben Fry, last updated 19 August 2008 diff --git a/build/windows/dist.sh b/build/windows/dist.sh new file mode 100755 index 000000000..12b6a4d0c --- /dev/null +++ b/build/windows/dist.sh @@ -0,0 +1,113 @@ +#!/bin/sh + +REVISION=`head -1 ../../todo.txt | awk '{print $1}'` + +if [ $1 ] +then + RELEASE=$1 + echo Creating Processing release $RELEASE... +else + RELEASE=$REVISION + echo Creating Processing distribution for revision $REVISION... +fi + +# check to see if the version number in the app is correct +# so that mikkel doesn't kick my ass +VERSIONED=`cat ../../app/src/processing/app/Base.java | grep $REVISION` +if [ -z "$VERSIONED" ] +then + echo Fix the revision number in Base.java + exit +fi + +./make.sh + +# remove any old boogers +rm -rf processing +rm -rf processing-* + +mkdir processing +cp -r ../shared/lib processing/ +cp -r ../shared/libraries processing/ +cp -r ../shared/tools processing/ + +if [ $1 ] +then + # write the release version number into the output directory + echo $1 > processing/lib/version.txt +fi + +cp ../../app/lib/antlr.jar processing/lib/ +cp ../../app/lib/ecj.jar processing/lib/ +cp ../../app/lib/jna.jar processing/lib/ + +cp ../shared/revisions.txt processing/ + +echo Extracting examples... +unzip -q -d processing/ ../shared/examples.zip + +echo Extracting reference... +unzip -q -d processing/ ../shared/reference.zip + +# add the libraries folder with source +cp -r ../../net processing/libraries/ +cp -r ../../opengl processing/libraries/ +cp -r ../../serial processing/libraries/ +cp -r ../../video processing/libraries/ +cp -r ../../pdf processing/libraries/ +cp -r ../../dxf processing/libraries/ + +# add java (jre) files +unzip -q -d processing jre.zip + +# get platform-specific goodies from the dist dir +cp launcher/processing.exe processing/ + +# grab pde.jar and export from the working dir +cp work/lib/pde.jar processing/lib/ +cp work/lib/core.jar processing/lib/ + +# convert revisions.txt to windows LFs +# the 2> is because the app is a little chatty +unix2dos processing/revisions.txt 2> /dev/null +unix2dos processing/lib/preferences.txt 2> /dev/null +unix2dos processing/lib/keywords.txt 2> /dev/null + +# remove boogers +find processing -name "*.bak" -exec rm -f {} ';' +find processing -name "*~" -exec rm -f {} ';' +find processing -name ".DS_Store" -exec rm -f {} ';' +find processing -name "._*" -exec rm -f {} ';' +find processing -name "Thumbs.db" -exec rm -f {} ';' + +# chmod +x the crew +find processing -name "*.html" -exec chmod +x {} ';' +find processing -name "*.dll" -exec chmod +x {} ';' +find processing -name "*.exe" -exec chmod +x {} ';' +find processing -name "*.html" -exec chmod +x {} ';' + +# clean out the cvs entries +find processing -name "CVS" -exec rm -rf {} ';' 2> /dev/null +find processing -name ".cvsignore" -exec rm -rf {} ';' +find processing -name ".svn" -exec rm -rf {} ';' 2> /dev/null + +# zip it all up for release +echo Packaging standard release... +echo +P5=processing-$RELEASE +mv processing $P5 +zip -rq $P5.zip $P5 +# nah, keep the new directory around +#rm -rf $P5 + +# zip up another for experts +#echo Expert release is disabled until further notice. +echo Packaging expert release... +echo +cp -a $P5 $P5-expert +# remove enormous java runtime +rm -rf $P5-expert/java +zip -rq $P5-expert.zip $P5-expert + +echo Done. + diff --git a/build/windows/export/Makefile b/build/windows/export/Makefile new file mode 100755 index 000000000..0273e5b1d --- /dev/null +++ b/build/windows/export/Makefile @@ -0,0 +1,22 @@ +CXXFLAGS = -mwindows -mno-cygwin -O2 -Wall +#POBJS = launcher.o launcher-rc.o +# don't want to include the p5 icons for the exported feller +AOBJS = launcher.o + +#processing.exe: $(POBJS) +# $(LINK.cc) $(CXXFLAGS) -o $@ $(POBJS) +# cp processing.exe ../work/ + +application.exe: $(AOBJS) + $(LINK.cc) $(CXXFLAGS) -DEXPORT -o $@ $(AOBJS) + cp application.exe ../work/lib/export/ + cp application.exe ../../shared/lib/export/ + +$(POBJS): Makefile + +#launcher-rc.o: launcher.rc +# windres -i $< -o $@ + +clean: + $(RM) $(OBJS) application.exe +# $(RM) $(OBJS) processing.exe application.exe diff --git a/build/windows/export/application.exe b/build/windows/export/application.exe new file mode 100755 index 000000000..ea70a3a2d Binary files /dev/null and b/build/windows/export/application.exe differ diff --git a/build/windows/export/launcher.cpp b/build/windows/export/launcher.cpp new file mode 100644 index 000000000..be6009d4b --- /dev/null +++ b/build/windows/export/launcher.cpp @@ -0,0 +1,451 @@ +// -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + +// if this code looks shitty, that's because it is. people are likely to have +// the durndest things in their CLASSPATH and QTJAVA environment variables. +// mostly because installers often mangle them without the user knowing. +// so who knows where and when the quotes will show up. the code below is +// based on a couple years of trial and error with processing releases. + +// For revision 0102, a lot of changes were made to deal with stripping +// the quotes from the PATH, CLASSPATH, and QTJAVA environment variables. +// Any elements of the PATH and CLASSPATH that don't exist (whether files +// or directories) are also stripped out before being set. +// (Bug 112) + +// The size of all of the strings was made sort of ambiguously large, since +// 1) nothing is hurt by allocating an extra few bytes temporarily and +// 2) if the user has a long path, and it gets copied five times over for the +// CLASSPATH, the program runs the risk of crashing. Bad bad. + +// TODO this code leaks memory all over the place because nothing has been +// done to properly handle creation/deletion of new strings. + +// TODO switch to unicode versions of all methods in order to better support +// running on non-English (non-Roman especially) versions of Windows. + +#define ARGS_FILE_PATH "\\lib\\args.txt" + +#include +#include +#include + + +void removeLineEndings(char *what); +char *scrubPath(char *incoming); +char *mallocChars(int count); +void removeQuotes(char *quoted); +void removeTrailingSlash(char *slashed); + +int STDCALL +WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) +{ + // command line that was passed to this application + char *incoming_cmd_line = (char *)malloc(strlen(lpCmd + 1) * sizeof(char)); + strcpy(incoming_cmd_line, lpCmd); + + // get the full path to the application that was launched, + // drop the app name but keep the path + char *exe_directory = (char *)malloc(MAX_PATH * sizeof(char)); + //*exe_directory = 0; + GetModuleFileName(NULL, exe_directory, MAX_PATH); + // remove the application name + *(strrchr(exe_directory, '\\')) = '\0'; + + + // open the file that contains the main class name and java args + + char *args_file_path = (char*) + malloc(strlen(exe_directory) * sizeof(char) + + strlen(ARGS_FILE_PATH) * sizeof(char) + 1); + strcpy(args_file_path, exe_directory); + strcat(args_file_path, ARGS_FILE_PATH); + + char java_args[512]; + char java_main_class[512]; + char jar_list[512]; + char *app_classpath = (char *)malloc(10 * strlen(exe_directory) + 4096); + + FILE *argsfile = fopen(args_file_path, "r"); + if (argsfile == NULL) { + sprintf(app_classpath, + "This program is missing the \"lib\" folder, " + "which should be located at\n%s", + exe_directory); + MessageBox(NULL, app_classpath, "Folder Missing", MB_OK); + return 0; + /* + sprintf(app_classpath, + "%s\\lib;" + "%s\\lib\\pde.jar;" + "%s\\lib\\core.jar;" + "%s\\lib\\jna.jar;" + "%s\\lib\\ecj.jar;" + "%s\\lib\\antlr.jar;", + exe_directory, + exe_directory, exe_directory, + exe_directory, exe_directory, exe_directory); + */ + + } else { + fgets(java_args, 511, argsfile); + removeLineEndings(java_args); + fgets(java_main_class, 511, argsfile); + removeLineEndings(java_main_class); + fgets(jar_list, 511, argsfile); + removeLineEndings(jar_list); + + //MessageBox(NULL, java_args, "args", MB_OK); + //MessageBox(NULL, java_main_class, "class", MB_OK); + //MessageBox(NULL, jar_list, "jarlist", MB_OK); + + app_classpath[0] = 0; + char *jar = (char*) strtok(jar_list, ","); + while (jar != NULL) { + char entry[1024]; + sprintf(entry, "%s\\lib\\%s;", exe_directory, jar); + strcat(app_classpath, entry); + jar = (char*) strtok(NULL, ","); + } + fclose(argsfile); + } + + // + + char *cp = (char *)malloc(10 * strlen(exe_directory) + 4096); + + // test to see if running with a java runtime nearby or not + char *testpath = (char *)malloc(MAX_PATH * sizeof(char)); + *testpath = 0; + strcpy(testpath, exe_directory); + strcat(testpath, "\\java\\bin\\java.exe"); + FILE *fp = fopen(testpath, "rb"); + int local_jre_installed = (fp != NULL); + //char *rt_jar = (fp == NULL) ? "" : "java\\lib\\rt.jar;"; + if (fp != NULL) fclose(fp); // argh! this was probably causing trouble + + //const char *envClasspath = getenv("CLASSPATH"); + //char *env_classpath = (char *)malloc(16384 * sizeof(char)); + + // ignoring CLASSPATH for now, because it's not needed + // and causes more trouble than it's worth [0060] + //env_classpath[0] = 0; + + /* + // keep this code around since may be re-enabled later + if (getenv("CLASSPATH") != NULL) { + strcpy(env_classpath, getenv("CLASSPATH")); + if (env_classpath[0] == '\"') { + // starting quote in classpath.. yech + env_classpath++; // shitty.. i know.. + + int len = strlen(env_classpath); + if (env_classpath[len-1] == '\"') { + env_classpath[len-1] = 0; + } else { + // a starting quote but no ending quote.. ugh + // maybe throw an error + } + } + int last = strlen(env_classpath); + env_classpath[last++] = ';'; + env_classpath[last] = 0; + } else { + env_classpath[0] = 0; + } + */ + + char *qtjava_path = (char *)malloc(16384 * sizeof(char)); + qtjava_path[0] = 0; + + if (getenv("QTJAVA") != NULL) { + //char *qtjava_temp = (char *)malloc(16384 * sizeof(char)); + strcpy(qtjava_path, getenv("QTJAVA")); + removeQuotes(qtjava_path); + + /* + //MessageBox(NULL, qtjava_temp, "QTJAVA", MB_OK); + if (qtjava_temp[0] == '\"') { // has quotes + // remove quotes by subsetting string by two + int qtjava_repaired_length = strlen(qtjava_temp) - 2; + strncpy(qtjava_path, &qtjava_temp[1], qtjava_repaired_length); + // terminate the string since strncpy ain't gonna do it + qtjava_path[qtjava_repaired_length] = 0; + //MessageBox(NULL, qtjava_path, "QTJAVA", MB_OK); + } else { + strcpy(qtjava_path, getenv("QTJAVA")); + } + */ + + FILE *fp = fopen(qtjava_path, "rb"); + if (fp != NULL) { + fclose(fp); // found it, all set + strcat(qtjava_path, ";"); // add path separator + //MessageBox(NULL, "found 1", "msg", MB_OK); + //MessageBox(NULL, qtjava_path, "QTJAVA after strcat", MB_OK); + } else { + qtjava_path[0] = 0; // not a valid path + } + //} else { + //MessageBox(NULL, "no qtjava set", "mess", MB_OK); + } + + if (qtjava_path[0] == 0) { // not set yet + //if (getenv("WINDIR") == NULL) { + // uh-oh.. serious problem.. gonna have to report this + // but hopefully WINDIR is set on win98 too + //} else { + + strcpy(qtjava_path, getenv("WINDIR")); + strcat(qtjava_path, "\\SYSTEM32\\QTJava.zip"); + + FILE *fp = fopen(qtjava_path, "rb"); + if (fp != NULL) { + fclose(fp); // found it, all set + strcat(qtjava_path, ";"); // add path separator + //MessageBox(NULL, "found 2", "msg", MB_OK); + } else { + qtjava_path[0] = 0; // not a valid path + } + } + + if (qtjava_path[0] == 0) { + strcpy(qtjava_path, getenv("WINDIR")); + strcat(qtjava_path, "\\SYSTEM\\QTJava.zip"); + + fp = fopen(qtjava_path, "rb"); + if (fp != NULL) { + fclose(fp); // found it, all set + strcat(qtjava_path, ";"); // add path separator + //MessageBox(NULL, "found 3", "msg", MB_OK); + } else { + // doesn't seem to be installed, which is a problem. + // but the error will be reported by the pde + qtjava_path[0] = 0; + } + } + + // don't put quotes around contents of cp, even though %s might have + // spaces in it. don't put quotes in it, because it's setting the + // environment variable for CLASSPATH, not being included on the + // command line. so setting the env var it's ok to have spaces, + // and the quotes prevent javax.comm.properties from being found. + + strcpy(cp, app_classpath); + if (local_jre_installed) { + char *local_jre = mallocChars(64 + strlen(exe_directory) * 2); + sprintf(local_jre, "%s\\java\\lib\\rt.jar;%s\\java\\lib\\tools.jar;", exe_directory, exe_directory); + strcat(cp, local_jre); + } + strcat(cp, qtjava_path); + + char *clean_cp = scrubPath(cp); + //if (!SetEnvironmentVariable("CLASSPATH", cp)) { + if (!SetEnvironmentVariable("CLASSPATH", clean_cp)) { + MessageBox(NULL, "Could not set CLASSPATH environment variable", + "Processing Error", MB_OK); + return 0; + } + + //MessageBox(NULL, "2", "checking", MB_OK); + + //char *env_path = (char *)malloc(strlen(getenv("PATH")) * sizeof(char)); + + int env_path_length = strlen(getenv("PATH")); + char *env_path = mallocChars(env_path_length); + strcpy(env_path, getenv("PATH")); + char *clean_path; + + // need to add the local jre to the path for 'java mode' in the env + if (local_jre_installed) { + char *path_to_clean = + mallocChars(env_path_length + strlen(exe_directory) + 30); + sprintf(path_to_clean, "%s\\java\\bin;%s", exe_directory, env_path); + clean_path = scrubPath(path_to_clean); + } else { + clean_path = scrubPath(getenv("PATH")); + } + + //MessageBox(NULL, clean_path, "after scrubbing PATH", MB_OK); + //MessageBox(NULL, "3", "checking", MB_OK); + + if (!SetEnvironmentVariable("PATH", clean_path)) { + MessageBox(NULL, "Could not set PATH environment variable", + "Processing Error", MB_OK); + return 0; + } + + // what gets put together to pass to jre + char *outgoing_cmd_line = (char *)malloc(16384 * sizeof(char)); + + // prepend the args for -mx and -ms + strcpy(outgoing_cmd_line, java_args); + strcat(outgoing_cmd_line, " "); + + // add the name of the class to execute and a space before the next arg + strcat(outgoing_cmd_line, java_main_class); + strcat(outgoing_cmd_line, " "); + + // append additional incoming stuff (document names), if any + strcat(outgoing_cmd_line, incoming_cmd_line); + + //MessageBox(NULL, outgoing_cmd_line, "cmd_line", MB_OK); + + char *executable = + (char *)malloc((strlen(exe_directory) + 256) * sizeof(char)); + // exe_directory is the name path to the current application + + if (local_jre_installed) { + strcpy(executable, exe_directory); + // copy in the path for javaw, relative to launcher.exe + strcat(executable, "\\java\\bin\\javaw.exe"); + } else { + strcpy(executable, "javaw.exe"); + } + + SHELLEXECUTEINFO ShExecInfo; + + // set up the execution info + ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); + ShExecInfo.fMask = 0; + ShExecInfo.hwnd = 0; + ShExecInfo.lpVerb = "open"; + ShExecInfo.lpFile = executable; + ShExecInfo.lpParameters = outgoing_cmd_line; + ShExecInfo.lpDirectory = exe_directory; + ShExecInfo.nShow = SW_SHOWNORMAL; + ShExecInfo.hInstApp = NULL; + + if (!ShellExecuteEx(&ShExecInfo)) { + MessageBox(NULL, "Error calling ShellExecuteEx()", + "Processing Error", MB_OK); + return 0; + } + + if (reinterpret_cast(ShExecInfo.hInstApp) <= 32) { + + // some type of error occurred + switch (reinterpret_cast(ShExecInfo.hInstApp)) { + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + MessageBox(NULL, "A required file could not be found. \n" + "You may need to install a Java runtime\n" + "or re-install Processing.", + "Processing Error", MB_OK); + break; + case 0: + case SE_ERR_OOM: + MessageBox(NULL, "Not enough memory or resources to run at" + " this time.", "Processing Error", MB_OK); + + break; + default: + MessageBox(NULL, "There is a problem with your installation.\n" + "If the problem persists, re-install the program.", + "Processing Error", MB_OK); + break; + } + } + return 0; +} + + +void removeLineEndings(char *what) { + int index = strlen(what) - 1; + while (index >= 0) { + if ((what[index] == 10) || (what[index] == 13)) { + what[index] = 0; + --index; + } else { + return; + } + } +} + + +// take a PATH environment variable, split on semicolons, +// remove extraneous quotes, perhaps even make 8.3 syntax if necessary +char *scrubPath(char *incoming) { + char *cleaned = mallocChars(strlen(incoming) * 2); + + int found_so_far = 0; + char *p = (char*) strtok(incoming, ";"); + while (p != NULL) { + char entry[1024]; + /* + if (*p == '\"') { + // if this segment of the path contains quotes, remove them + int fixed_length = strlen(p) - 2; + strncpy(entry, &p[1], fixed_length); + entry[fixed_length] = 0; + //MessageBox(NULL, entry, "clipped", MB_OK); + + // if it doesn't actually end with a quote, then the person + // is screwed anyway.. they can deal with that themselves + } else { + strcpy(entry, p); + } + */ + strcpy(entry, p); + removeQuotes(entry); + // a trailing slash will cause FindFirstFile to fail.. grr [0109] + removeTrailingSlash(entry); + //MessageBox(NULL, entry, "entry", MB_OK); + + // if this path doesn't exist, don't add it + WIN32_FIND_DATA find_file_data; + HANDLE hfind = FindFirstFile(entry, &find_file_data); + if (hfind != INVALID_HANDLE_VALUE) { + if (found_so_far) strcat(cleaned, ";"); + strcat(cleaned, entry); + //MessageBox(NULL, cleaned, "cleaned so far", MB_OK); + FindClose(hfind); + found_so_far = 1; + //} else { + //MessageBox(NULL, entry, "removing", MB_OK); + } + // grab the next entry + p = (char*) strtok(NULL, ";"); + } + //MessageBox(NULL, cleaned, "scrubPath", MB_OK); + return cleaned; +} + + +// eventually make this handle unicode +char *mallocChars(int count) { + // add one for the terminator + char *outgoing = (char*) malloc(count * sizeof(char) + 1); + outgoing[0] = 0; // for safety + return outgoing; +} + + +void removeQuotes(char *quoted) { + int len = strlen(quoted); + // remove quote at the front + if (quoted[0] == '\"') { + for (int i = 0; i < len - 1; i++) { + quoted[i] = quoted[i+1]; + } + len--; + quoted[len] = 0; + } + // remove quote at the end + if (len > 1) { + if (quoted[len - 1] == '\"') { + len--; + quoted[len] = 0; + } + } +} + + +void removeTrailingSlash(char *slashed) { + int len = strlen(slashed); + if (len > 1) { + if (slashed[len - 1] == '\\') { + len--; + slashed[len] = 0; + } + } +} diff --git a/build/windows/jre.zip b/build/windows/jre.zip new file mode 100644 index 000000000..a9522ec68 Binary files /dev/null and b/build/windows/jre.zip differ diff --git a/build/windows/launcher/about.bmp b/build/windows/launcher/about.bmp new file mode 100755 index 000000000..355293746 Binary files /dev/null and b/build/windows/launcher/about.bmp differ diff --git a/build/windows/launcher/application.ico b/build/windows/launcher/application.ico new file mode 100644 index 000000000..6989af611 Binary files /dev/null and b/build/windows/launcher/application.ico differ diff --git a/build/windows/launcher/config.xml b/build/windows/launcher/config.xml new file mode 100755 index 000000000..a33138186 --- /dev/null +++ b/build/windows/launcher/config.xml @@ -0,0 +1,44 @@ + + true + gui + lib + processing.exe + + + . + normal + http://java.sun.com/javase/downloads/ + + false + false + + application.ico + + processing.app.Base + lib/pde.jar + lib/core.jar + lib/jna.jar + lib/ecj.jar + lib/antlr.jar + + + java + 1.5.0 + + jdkOnly + -Xms128m -Xmx128m + + + about.bmp + true + 60 + true + + + An error occurred while starting the application. + This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted. + This application requires at least Java Development Kit + The registry refers to a nonexistent Java Development Kit installation or the runtime is corrupted. + An application instance is already running. + + diff --git a/build/windows/launcher/launch4j/.classpath b/build/windows/launcher/launch4j/.classpath new file mode 100755 index 000000000..734d175a6 --- /dev/null +++ b/build/windows/launcher/launch4j/.classpath @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/build/windows/launcher/launch4j/.project b/build/windows/launcher/launch4j/.project new file mode 100755 index 000000000..1c1309dfa --- /dev/null +++ b/build/windows/launcher/launch4j/.project @@ -0,0 +1,17 @@ + + + launch4j + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/build/windows/launcher/launch4j/.settings/org.eclipse.jdt.core.prefs b/build/windows/launcher/launch4j/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000..056498058 --- /dev/null +++ b/build/windows/launcher/launch4j/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Sun Jul 20 14:10:30 CEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +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=warning +org.eclipse.jdt.core.compiler.source=1.4 diff --git a/build/windows/launcher/launch4j/LICENSE.txt b/build/windows/launcher/launch4j/LICENSE.txt new file mode 100755 index 000000000..82223322f --- /dev/null +++ b/build/windows/launcher/launch4j/LICENSE.txt @@ -0,0 +1,30 @@ +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2008 Grzegorz Kowal + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/build/windows/launcher/launch4j/bin/COPYING b/build/windows/launcher/launch4j/bin/COPYING new file mode 100755 index 000000000..60549be51 --- /dev/null +++ b/build/windows/launcher/launch4j/bin/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/build/windows/launcher/launch4j/bin/ld.exe b/build/windows/launcher/launch4j/bin/ld.exe new file mode 100755 index 000000000..f388b9513 Binary files /dev/null and b/build/windows/launcher/launch4j/bin/ld.exe differ diff --git a/build/windows/launcher/launch4j/bin/windres.exe b/build/windows/launcher/launch4j/bin/windres.exe new file mode 100755 index 000000000..4ad2ae98a Binary files /dev/null and b/build/windows/launcher/launch4j/bin/windres.exe differ diff --git a/build/windows/launcher/launch4j/build.xml b/build/windows/launcher/launch4j/build.xml new file mode 100755 index 000000000..a7682ce0c --- /dev/null +++ b/build/windows/launcher/launch4j/build.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/ConsoleApp.exe b/build/windows/launcher/launch4j/demo/ConsoleApp/ConsoleApp.exe new file mode 100755 index 000000000..d8a8f75d0 Binary files /dev/null and b/build/windows/launcher/launch4j/demo/ConsoleApp/ConsoleApp.exe differ diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/ConsoleApp.jar b/build/windows/launcher/launch4j/demo/ConsoleApp/ConsoleApp.jar new file mode 100755 index 000000000..6d4b126e6 Binary files /dev/null and b/build/windows/launcher/launch4j/demo/ConsoleApp/ConsoleApp.jar differ diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/build.bat b/build/windows/launcher/launch4j/demo/ConsoleApp/build.bat new file mode 100755 index 000000000..ed5f704e3 --- /dev/null +++ b/build/windows/launcher/launch4j/demo/ConsoleApp/build.bat @@ -0,0 +1,14 @@ +@echo off +if "%ANT_HOME%"=="" goto noAntHome +if "%JAVA_HOME%"=="" goto noJavaHome +call "%ANT_HOME%\bin\ant.bat" exe +goto end + +:noAntHome +echo ANT_HOME environment variable is not set +goto end + +:noJavaHome +echo JAVA_HOME environment variable is not set + +:end diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/build.xml b/build/windows/launcher/launch4j/demo/ConsoleApp/build.xml new file mode 100755 index 000000000..5f3473da6 --- /dev/null +++ b/build/windows/launcher/launch4j/demo/ConsoleApp/build.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico b/build/windows/launcher/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico new file mode 100755 index 000000000..cc4c540e2 Binary files /dev/null and b/build/windows/launcher/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico differ diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/lib/readme.txt b/build/windows/launcher/launch4j/demo/ConsoleApp/lib/readme.txt new file mode 100755 index 000000000..ef44ded3a --- /dev/null +++ b/build/windows/launcher/launch4j/demo/ConsoleApp/lib/readme.txt @@ -0,0 +1,8 @@ +Put your jar libs here and the build script will include them +in the classpath stored inside the jar manifest. +In order to run your application move the output exe file from +the dist directory to the same level as lib. + +SimpleApp.exe +lib/ +lib/xml.jar diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/readme.txt b/build/windows/launcher/launch4j/demo/ConsoleApp/readme.txt new file mode 100755 index 000000000..fa38dc8bd --- /dev/null +++ b/build/windows/launcher/launch4j/demo/ConsoleApp/readme.txt @@ -0,0 +1 @@ +To build the example application set JAVA_HOME and ANT_HOME environment variables. diff --git a/build/windows/launcher/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java b/build/windows/launcher/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java new file mode 100755 index 000000000..eb1398c2c --- /dev/null +++ b/build/windows/launcher/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java @@ -0,0 +1,72 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.example; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConsoleApp { + public static void main(String[] args) { + StringBuffer sb = new StringBuffer("Hello World!\n\nJava version: "); + sb.append(System.getProperty("java.version")); + sb.append("\nJava home: "); + sb.append(System.getProperty("java.home")); + sb.append("\nCurrent dir: "); + sb.append(System.getProperty("user.dir")); + if (args.length > 0) { + sb.append("\nArgs: "); + for (int i = 0; i < args.length; i++) { + sb.append(args[i]); + sb.append(' '); + } + } + sb.append("\n\nEnter a line of text, Ctrl-C to stop.\n\n>"); + System.out.print(sb.toString()); + try { + BufferedReader is = new BufferedReader(new InputStreamReader(System.in)); + String line; + while ((line = is.readLine()) != null && !line.equalsIgnoreCase("quit")) { + System.out.print("You wrote: " + line + "\n\n>"); + } + is.close(); + System.exit(123); + } catch (IOException e) { + System.err.print(e); + } + } +} diff --git a/build/windows/launcher/launch4j/demo/LICENSE.txt b/build/windows/launcher/launch4j/demo/LICENSE.txt new file mode 100755 index 000000000..d6d6bb5ea --- /dev/null +++ b/build/windows/launcher/launch4j/demo/LICENSE.txt @@ -0,0 +1,30 @@ +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2007 Grzegorz Kowal + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/SimpleApp.exe b/build/windows/launcher/launch4j/demo/SimpleApp/SimpleApp.exe new file mode 100755 index 000000000..1a75fc298 Binary files /dev/null and b/build/windows/launcher/launch4j/demo/SimpleApp/SimpleApp.exe differ diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/SimpleApp.jar b/build/windows/launcher/launch4j/demo/SimpleApp/SimpleApp.jar new file mode 100755 index 000000000..f02c6133b Binary files /dev/null and b/build/windows/launcher/launch4j/demo/SimpleApp/SimpleApp.jar differ diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/build.bat b/build/windows/launcher/launch4j/demo/SimpleApp/build.bat new file mode 100755 index 000000000..ed5f704e3 --- /dev/null +++ b/build/windows/launcher/launch4j/demo/SimpleApp/build.bat @@ -0,0 +1,14 @@ +@echo off +if "%ANT_HOME%"=="" goto noAntHome +if "%JAVA_HOME%"=="" goto noJavaHome +call "%ANT_HOME%\bin\ant.bat" exe +goto end + +:noAntHome +echo ANT_HOME environment variable is not set +goto end + +:noJavaHome +echo JAVA_HOME environment variable is not set + +:end diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/build.xml b/build/windows/launcher/launch4j/demo/SimpleApp/build.xml new file mode 100755 index 000000000..82f4b4998 --- /dev/null +++ b/build/windows/launcher/launch4j/demo/SimpleApp/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/l4j/SimpleApp.ico b/build/windows/launcher/launch4j/demo/SimpleApp/l4j/SimpleApp.ico new file mode 100755 index 000000000..cc4c540e2 Binary files /dev/null and b/build/windows/launcher/launch4j/demo/SimpleApp/l4j/SimpleApp.ico differ diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/l4j/SimpleApp.xml b/build/windows/launcher/launch4j/demo/SimpleApp/l4j/SimpleApp.xml new file mode 100755 index 000000000..9a7dc940a --- /dev/null +++ b/build/windows/launcher/launch4j/demo/SimpleApp/l4j/SimpleApp.xml @@ -0,0 +1,18 @@ + + gui + ../SimpleApp.jar + ../SimpleApp.exe + SimpleApp + . + true + SimpleApp.ico + + 1.4.0 + + + splash.bmp + true + 60 + true + + \ No newline at end of file diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/l4j/splash.bmp b/build/windows/launcher/launch4j/demo/SimpleApp/l4j/splash.bmp new file mode 100755 index 000000000..88d7bbf10 Binary files /dev/null and b/build/windows/launcher/launch4j/demo/SimpleApp/l4j/splash.bmp differ diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/lib/readme.txt b/build/windows/launcher/launch4j/demo/SimpleApp/lib/readme.txt new file mode 100755 index 000000000..ef44ded3a --- /dev/null +++ b/build/windows/launcher/launch4j/demo/SimpleApp/lib/readme.txt @@ -0,0 +1,8 @@ +Put your jar libs here and the build script will include them +in the classpath stored inside the jar manifest. +In order to run your application move the output exe file from +the dist directory to the same level as lib. + +SimpleApp.exe +lib/ +lib/xml.jar diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/readme.txt b/build/windows/launcher/launch4j/demo/SimpleApp/readme.txt new file mode 100755 index 000000000..fa38dc8bd --- /dev/null +++ b/build/windows/launcher/launch4j/demo/SimpleApp/readme.txt @@ -0,0 +1 @@ +To build the example application set JAVA_HOME and ANT_HOME environment variables. diff --git a/build/windows/launcher/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java b/build/windows/launcher/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java new file mode 100755 index 000000000..8e87c5953 --- /dev/null +++ b/build/windows/launcher/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java @@ -0,0 +1,104 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.example; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.UIManager; + +public class SimpleApp extends JFrame { + public SimpleApp(String[] args) { + super("Java Application"); + final int inset = 100; + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + setBounds (inset, inset, + screenSize.width - inset * 2, screenSize.height - inset * 2); + + JMenu menu = new JMenu("File"); + menu.add(new JMenuItem("Open")); + menu.add(new JMenuItem("Save")); + JMenuBar mb = new JMenuBar(); + mb.setOpaque(true); + mb.add(menu); + setJMenuBar(mb); + + this.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(123); + }}); + setVisible(true); + + StringBuffer sb = new StringBuffer("Java version: "); + sb.append(System.getProperty("java.version")); + sb.append("\nJava home: "); + sb.append(System.getProperty("java.home")); + sb.append("\nCurrent dir: "); + sb.append(System.getProperty("user.dir")); + if (args.length > 0) { + sb.append("\nArgs: "); + for (int i = 0; i < args.length; i++) { + sb.append(args[i]); + sb.append(' '); + } + } + JOptionPane.showMessageDialog(this, + sb.toString(), + "Info", + JOptionPane.INFORMATION_MESSAGE); + } + + public static void setLAF() { + JFrame.setDefaultLookAndFeelDecorated(true); + Toolkit.getDefaultToolkit().setDynamicLayout(true); + System.setProperty("sun.awt.noerasebackground","true"); + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception e) { + System.err.println("Failed to set LookAndFeel"); + } + } + + public static void main(String[] args) { + setLAF(); + new SimpleApp(args); + } +} diff --git a/build/windows/launcher/launch4j/demo/readme.txt b/build/windows/launcher/launch4j/demo/readme.txt new file mode 100755 index 000000000..f59178214 --- /dev/null +++ b/build/windows/launcher/launch4j/demo/readme.txt @@ -0,0 +1,3 @@ +JRE/SDK 1.4.0 or higher must be installed on your system to run this demo. + +try running it with some command line arguments... diff --git a/build/windows/launcher/launch4j/head/LICENSE.txt b/build/windows/launcher/launch4j/head/LICENSE.txt new file mode 100755 index 000000000..536488e61 --- /dev/null +++ b/build/windows/launcher/launch4j/head/LICENSE.txt @@ -0,0 +1,23 @@ +Copyright (c) 2004, 2007 Grzegorz Kowal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/build/windows/launcher/launch4j/head_src/LICENSE.txt b/build/windows/launcher/launch4j/head_src/LICENSE.txt new file mode 100755 index 000000000..2805f412a --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/LICENSE.txt @@ -0,0 +1,23 @@ +Copyright (c) 2004, 2008 Grzegorz Kowal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/build/windows/launcher/launch4j/head_src/consolehead/Makefile.win b/build/windows/launcher/launch4j/head_src/consolehead/Makefile.win new file mode 100755 index 000000000..349e4c00f --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/consolehead/Makefile.win @@ -0,0 +1,33 @@ +# Project: consolehead +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = +OBJ = ../../head/consolehead.o ../../head/head.o $(RES) +LINKOBJ = ../../head/consolehead.o ../../head/head.o $(RES) +LIBS = -L"C:/Dev-Cpp/lib" -n -s +INCS = -I"C:/Dev-Cpp/include" +CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" +BIN = consolehead.exe +CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 +CFLAGS = $(INCS) -fexpensive-optimizations -O3 +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before consolehead.exe all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) +# $(CC) $(LINKOBJ) -o "consolehead.exe" $(LIBS) + +../../head/consolehead.o: consolehead.c + $(CC) -c consolehead.c -o ../../head/consolehead.o $(CFLAGS) + +../../head/head.o: ../head.c + $(CC) -c ../head.c -o ../../head/head.o $(CFLAGS) diff --git a/build/windows/launcher/launch4j/head_src/consolehead/consolehead.c b/build/windows/launcher/launch4j/head_src/consolehead/consolehead.c new file mode 100755 index 000000000..755a7673c --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/consolehead/consolehead.c @@ -0,0 +1,65 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include "../resource.h" +#include "../head.h" + +int main(int argc, char* argv[]) +{ + setConsoleFlag(); + LPTSTR cmdLine = GetCommandLine(); + if (*cmdLine == '"') { + if (*(cmdLine = strchr(cmdLine + 1, '"') + 1)) { + cmdLine++; + } + } else if ((cmdLine = strchr(cmdLine, ' ')) != NULL) { + cmdLine++; + } else { + cmdLine = ""; + } + int result = prepare(cmdLine); + if (result == ERROR_ALREADY_EXISTS) { + char errMsg[BIG_STR] = {0}; + loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg); + msgBox(errMsg); + closeLogFile(); + return 2; + } + if (result != TRUE) { + signalError(); + return 1; + } + + result = (int) execute(TRUE); + if (result == -1) { + signalError(); + } else { + return result; + } +} diff --git a/build/windows/launcher/launch4j/head_src/consolehead/consolehead.dev b/build/windows/launcher/launch4j/head_src/consolehead/consolehead.dev new file mode 100755 index 000000000..a309ec94f --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/consolehead/consolehead.dev @@ -0,0 +1,108 @@ +[Project] +FileName=consolehead.dev +Name=consolehead +UnitCount=4 +Type=1 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker=-n_@@_ +IsCpp=0 +Icon= +ExeOutput= +ObjectOutput=..\..\head +OverrideOutput=0 +OverrideOutputName=consolehead.exe +HostApplication= +Folders= +CommandLine= +UseCustomMakefile=0 +CustomMakefile=Makefile.win +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings=0000000001001000000100 + +[Unit1] +FileName=consolehead.c +CompileCpp=0 +Folder=consolehead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + +[Unit2] +FileName=..\resource.h +CompileCpp=0 +Folder=consolehead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\head.c +CompileCpp=0 +Folder=consolehead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\head.h +CompileCpp=0 +Folder=consolehead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\head.rc +Folder=consolehead +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\resid.h +CompileCpp=0 +Folder=consolehead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/build/windows/launcher/launch4j/head_src/guihead/Makefile.win b/build/windows/launcher/launch4j/head_src/guihead/Makefile.win new file mode 100755 index 000000000..3c642f8fc --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/guihead/Makefile.win @@ -0,0 +1,38 @@ +# Project: guihead +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = +OBJ = ../../head/guihead.o ../../head/head.o $(RES) +LINKOBJ = ../../head/guihead.o ../../head/head.o $(RES) + +# removed dev-cpp flags, replacing for cygwin/mingw [fry] +CXXFLAGS = -mwindows -mno-cygwin -O2 -Wall +CFLAGS = -mwindows -mno-cygwin -O2 -Wall +#CFLAGS = -I/cygdrive/c/cygwin/usr/include/mingw +#LIBS = -L"C:/Dev-Cpp/lib" -mwindows -n -s +#INCS = -I"C:/Dev-Cpp/include" +#CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" +BIN = guihead.exe +#CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 +#CFLAGS = $(INCS) -fexpensive-optimizations -O3 +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before guihead.exe all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) +# $(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS) + +../../head/guihead.o: guihead.c + $(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS) + +../../head/head.o: ../head.c + $(CC) -c ../head.c -o ../../head/head.o $(CFLAGS) diff --git a/build/windows/launcher/launch4j/head_src/guihead/guihead.c b/build/windows/launcher/launch4j/head_src/guihead/guihead.c new file mode 100755 index 000000000..508a5bdac --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/guihead/guihead.c @@ -0,0 +1,185 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + Sylvain Mina (single instance patch) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include "../resource.h" +#include "../head.h" +#include "guihead.h" + +extern FILE* hLog; +extern PROCESS_INFORMATION pi; + +HWND hWnd; +DWORD dwExitCode = 0; +BOOL stayAlive = FALSE; +BOOL splash = FALSE; +BOOL splashTimeoutErr; +BOOL waitForWindow; +int splashTimeout = DEFAULT_SPLASH_TIMEOUT; + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) { + int result = prepare(lpCmdLine); + if (result == ERROR_ALREADY_EXISTS) { + HWND handle = getInstanceWindow(); + ShowWindow(handle, SW_SHOW); + SetForegroundWindow(handle); + closeLogFile(); + return 2; + } + if (result != TRUE) { + signalError(); + return 1; + } + + splash = loadBool(SHOW_SPLASH) + && strstr(lpCmdLine, "--l4j-no-splash") == NULL; + stayAlive = loadBool(GUI_HEADER_STAYS_ALIVE) + && strstr(lpCmdLine, "--l4j-dont-wait") == NULL; + if (splash || stayAlive) { + hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "", + WS_POPUP | SS_BITMAP, + 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + if (splash) { + char timeout[10] = {0}; + if (loadString(SPLASH_TIMEOUT, timeout)) { + splashTimeout = atoi(timeout); + if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT) { + splashTimeout = DEFAULT_SPLASH_TIMEOUT; + } + } + splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR) + && strstr(lpCmdLine, "--l4j-no-splash-err") == NULL; + waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW); + HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image + MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image + IMAGE_BITMAP, // type of image + 0, // desired width + 0, // desired height + LR_DEFAULTSIZE); + if (hImage == NULL) { + signalError(); + return 1; + } + SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage); + RECT rect; + GetWindowRect(hWnd, &rect); + int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2; + int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; + SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); + ShowWindow(hWnd, nCmdShow); + UpdateWindow (hWnd); + } + if (!SetTimer (hWnd, ID_TIMER, 1000 /* 1s */, TimerProc)) { + signalError(); + return 1; + } + } + if (execute(FALSE) == -1) { + signalError(); + return 1; + } + if (!(splash || stayAlive)) { + debug("Exit code:\t0\n"); + closeHandles(); + return 0; + } + + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + debug("Exit code:\t%d\n", dwExitCode); + closeHandles(); + return dwExitCode; +} + +HWND getInstanceWindow() { + char windowTitle[STR]; + char instWindowTitle[STR] = {0}; + if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle)) { + HWND handle = FindWindowEx(NULL, NULL, NULL, NULL); + while (handle != NULL) { + GetWindowText(handle, windowTitle, STR - 1); + if (strstr(windowTitle, instWindowTitle) != NULL) { + return handle; + } else { + handle = FindWindowEx(NULL, handle, NULL, NULL); + } + } + } + return NULL; +} + +BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam) { + DWORD processId; + GetWindowThreadProcessId(hwnd, &processId); + if (pi.dwProcessId == processId) { + LONG styles = GetWindowLong(hwnd, GWL_STYLE); + if ((styles & WS_VISIBLE) != 0) { + splash = FALSE; + ShowWindow(hWnd, SW_HIDE); + return FALSE; + } + } + return TRUE; +} + +VOID CALLBACK TimerProc( + HWND hwnd, // handle of window for timer messages + UINT uMsg, // WM_TIMER message + UINT idEvent, // timer identifier + DWORD dwTime) { // current system time + + if (splash) { + if (splashTimeout == 0) { + splash = FALSE; + ShowWindow(hWnd, SW_HIDE); + if (waitForWindow && splashTimeoutErr) { + KillTimer(hwnd, ID_TIMER); + signalError(); + PostQuitMessage(0); + } + } else { + splashTimeout--; + if (waitForWindow) { + EnumWindows(enumwndfn, 0); + } + } + } + GetExitCodeProcess(pi.hProcess, &dwExitCode); + if (dwExitCode != STILL_ACTIVE + || !(splash || stayAlive)) { + KillTimer(hWnd, ID_TIMER); + PostQuitMessage(0); + } +} diff --git a/build/windows/launcher/launch4j/head_src/guihead/guihead.dev b/build/windows/launcher/launch4j/head_src/guihead/guihead.dev new file mode 100755 index 000000000..7c30088f1 --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/guihead/guihead.dev @@ -0,0 +1,109 @@ +[Project] +FileName=guihead.dev +Name=guihead +UnitCount=5 +Type=0 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker=-n_@@_ +IsCpp=0 +Icon= +ExeOutput= +ObjectOutput=..\..\head +OverrideOutput=0 +OverrideOutputName=guihead.exe +HostApplication= +Folders= +CommandLine= +UseCustomMakefile=1 +CustomMakefile=Makefile.win +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings=0000000001001000000100 + +[Unit1] +FileName=guihead.c +CompileCpp=0 +Folder=guihead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS) + +[Unit2] +FileName=guihead.h +CompileCpp=0 +Folder=guihead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + +[Unit4] +FileName=..\head.h +CompileCpp=0 +Folder=guihead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\resid.h +CompileCpp=0 +Folder=guihead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\head.c +CompileCpp=0 +Folder=guihead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\resource.h +CompileCpp=0 +Folder=guihead +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/build/windows/launcher/launch4j/head_src/guihead/guihead.h b/build/windows/launcher/launch4j/head_src/guihead/guihead.h new file mode 100755 index 000000000..2fc71e31f --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/guihead/guihead.h @@ -0,0 +1,43 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#define ID_TIMER 1 +#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */ +#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */ + +HWND getInstanceWindow(); + +BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam); + +VOID CALLBACK TimerProc( + HWND hwnd, // handle of window for timer messages + UINT uMsg, // WM_TIMER message + UINT idEvent, // timer identifier + DWORD dwTime // current system time +); diff --git a/build/windows/launcher/launch4j/head_src/head.c b/build/windows/launcher/launch4j/head_src/head.c new file mode 100755 index 000000000..1ff937694 --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/head.c @@ -0,0 +1,818 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2008 Grzegorz Kowal, + Ian Roberts (jdk preference patch) + Sylvain Mina (single instance patch) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include "resource.h" +#include "head.h" + +HMODULE hModule; +FILE* hLog; +BOOL console = FALSE; +BOOL wow64 = FALSE; +int foundJava = NO_JAVA_FOUND; + +struct _stat statBuf; +PROCESS_INFORMATION pi; +DWORD priority; + +char mutexName[STR] = {0}; + +char errUrl[256] = {0}; +char errTitle[STR] = "Launch4j"; +char errMsg[BIG_STR] = {0}; + +char javaMinVer[STR] = {0}; +char javaMaxVer[STR] = {0}; +char foundJavaVer[STR] = {0}; +char foundJavaKey[_MAX_PATH] = {0}; + +char oldPwd[_MAX_PATH] = {0}; +char workingDir[_MAX_PATH] = {0}; +char cmd[_MAX_PATH] = {0}; +char args[MAX_ARGS] = {0}; + +FILE* openLogFile(const char* exePath, const int pathLen) { + char path[_MAX_PATH] = {0}; + strncpy(path, exePath, pathLen); + strcat(path, "\\launch4j.log"); + return fopen(path, "a"); +} + +void closeLogFile() { + if (hLog != NULL) { + fclose(hLog); + } +} + +void setWow64Flag() { + LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( + GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); + + if (fnIsWow64Process != NULL) { + fnIsWow64Process(GetCurrentProcess(), &wow64); + } + debug("WOW64:\t\t%s\n", wow64 ? "yes" : "no"); +} + +void setConsoleFlag() { + console = TRUE; +} + +void msgBox(const char* text) { + if (console) { + printf("%s: %s\n", errTitle, text); + } else { + MessageBox(NULL, text, errTitle, MB_OK); + } +} + +void signalError() { + DWORD err = GetLastError(); + if (err) { + LPVOID lpMsgBuf; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL); + debug("Error:\t\t%s\n", (LPCTSTR) lpMsgBuf); + strcat(errMsg, "\n\n"); + strcat(errMsg, (LPCTSTR) lpMsgBuf); + msgBox(errMsg); + LocalFree(lpMsgBuf); + } else { + msgBox(errMsg); + } + if (*errUrl) { + debug("Open URL:\t%s\n", errUrl); + ShellExecute(NULL, "open", errUrl, NULL, NULL, SW_SHOWNORMAL); + } + closeLogFile(); +} + +BOOL loadString(const int resID, char* buffer) { + HRSRC hResource; + HGLOBAL hResourceLoaded; + LPBYTE lpBuffer; + + hResource = FindResourceEx(hModule, RT_RCDATA, MAKEINTRESOURCE(resID), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)); + if (NULL != hResource) { + hResourceLoaded = LoadResource(hModule, hResource); + if (NULL != hResourceLoaded) { + lpBuffer = (LPBYTE) LockResource(hResourceLoaded); + if (NULL != lpBuffer) { + int x = 0; + do { + buffer[x] = (char) lpBuffer[x]; + } while (buffer[x++] != 0); + // debug("Resource %d:\t%s\n", resID, buffer); + return TRUE; + } + } + } else { + SetLastError(0); + } + return FALSE; +} + +BOOL loadBool(const int resID) { + char boolStr[20] = {0}; + loadString(resID, boolStr); + return strcmp(boolStr, TRUE_STR) == 0; +} + +int loadInt(const int resID) { + char intStr[20] = {0}; + loadString(resID, intStr); + return atoi(intStr); +} + +BOOL regQueryValue(const char* regPath, unsigned char* buffer, + unsigned long bufferLength) { + HKEY hRootKey; + char* key; + char* value; + if (strstr(regPath, HKEY_CLASSES_ROOT_STR) == regPath) { + hRootKey = HKEY_CLASSES_ROOT; + } else if (strstr(regPath, HKEY_CURRENT_USER_STR) == regPath) { + hRootKey = HKEY_CURRENT_USER; + } else if (strstr(regPath, HKEY_LOCAL_MACHINE_STR) == regPath) { + hRootKey = HKEY_LOCAL_MACHINE; + } else if (strstr(regPath, HKEY_USERS_STR) == regPath) { + hRootKey = HKEY_USERS; + } else if (strstr(regPath, HKEY_CURRENT_CONFIG_STR) == regPath) { + hRootKey = HKEY_CURRENT_CONFIG; + } else { + return FALSE; + } + key = strchr(regPath, '\\') + 1; + value = strrchr(regPath, '\\') + 1; + *(value - 1) = 0; + + HKEY hKey; + unsigned long datatype; + BOOL result = FALSE; + if ((wow64 && RegOpenKeyEx(hRootKey, + key, + 0, + KEY_READ | KEY_WOW64_64KEY, + &hKey) == ERROR_SUCCESS) + || RegOpenKeyEx(hRootKey, + key, + 0, + KEY_READ, + &hKey) == ERROR_SUCCESS) { + result = RegQueryValueEx(hKey, value, NULL, &datatype, buffer, &bufferLength) + == ERROR_SUCCESS; + RegCloseKey(hKey); + } + *(value - 1) = '\\'; + return result; +} + +void regSearch(const HKEY hKey, const char* keyName, const int searchType) { + DWORD x = 0; + unsigned long size = BIG_STR; + FILETIME time; + char buffer[BIG_STR] = {0}; + while (RegEnumKeyEx( + hKey, // handle to key to enumerate + x++, // index of subkey to enumerate + buffer, // address of buffer for subkey name + &size, // address for size of subkey buffer + NULL, // reserved + NULL, // address of buffer for class string + NULL, // address for size of class buffer + &time) == ERROR_SUCCESS) { + + if (strcmp(buffer, javaMinVer) >= 0 + && (!*javaMaxVer || strcmp(buffer, javaMaxVer) <= 0) + && strcmp(buffer, foundJavaVer) > 0) { + strcpy(foundJavaVer, buffer); + strcpy(foundJavaKey, keyName); + appendPath(foundJavaKey, buffer); + foundJava = searchType; + debug("Match:\t\t%s\\%s\n", keyName, buffer); + } else { + debug("Ignore:\t\t%s\\%s\n", keyName, buffer); + } + size = BIG_STR; + } +} + +void regSearchWow(const char* keyName, const int searchType) { + HKEY hKey; + debug("64-bit search:\t%s...\n", keyName); + if (wow64 && RegOpenKeyEx(HKEY_LOCAL_MACHINE, + keyName, + 0, + KEY_READ | KEY_WOW64_64KEY, + &hKey) == ERROR_SUCCESS) { + + regSearch(hKey, keyName, searchType | KEY_WOW64_64KEY); + RegCloseKey(hKey); + if ((foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND) + { + debug("Using 64-bit runtime.\n"); + return; + } + } + debug("32-bit search:\t%s...\n", keyName); + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, + keyName, + 0, + KEY_READ, + &hKey) == ERROR_SUCCESS) { + regSearch(hKey, keyName, searchType); + RegCloseKey(hKey); + } +} + +void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName, + const int jdkPreference) { + if (jdkPreference == JDK_ONLY || jdkPreference == PREFER_JDK) { + regSearchWow(sdkKeyName, FOUND_SDK); + if (jdkPreference != JDK_ONLY) { + regSearchWow(jreKeyName, FOUND_JRE); + } + } else { // jdkPreference == JRE_ONLY or PREFER_JRE + regSearchWow(jreKeyName, FOUND_JRE); + if (jdkPreference != JRE_ONLY) { + regSearchWow(sdkKeyName, FOUND_SDK); + } + } +} + +BOOL findJavaHome(char* path, const int jdkPreference) { + regSearchJreSdk("SOFTWARE\\JavaSoft\\Java Runtime Environment", + "SOFTWARE\\JavaSoft\\Java Development Kit", + jdkPreference); + if (foundJava == NO_JAVA_FOUND) { + regSearchJreSdk("SOFTWARE\\IBM\\Java2 Runtime Environment", + "SOFTWARE\\IBM\\Java Development Kit", + jdkPreference); + } + if (foundJava != NO_JAVA_FOUND) { + HKEY hKey; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, + foundJavaKey, + 0, + KEY_READ | (foundJava & KEY_WOW64_64KEY), + &hKey) == ERROR_SUCCESS) { + unsigned char buffer[BIG_STR] = {0}; + unsigned long bufferlength = BIG_STR; + unsigned long datatype; + if (RegQueryValueEx(hKey, "JavaHome", NULL, &datatype, buffer, + &bufferlength) == ERROR_SUCCESS) { + int i = 0; + do { + path[i] = buffer[i]; + } while (path[i++] != 0); + // (foundJava & FOUND_SDK) { // removed by fry + // appendPath(path, "jre"); + // + RegCloseKey(hKey); + return TRUE; + } + RegCloseKey(hKey); + } + } + return FALSE; +} + +/* + * Extract the executable name, returns path length. + */ +int getExePath(char* exePath) { + if (GetModuleFileName(hModule, exePath, _MAX_PATH) == 0) { + return -1; + } + return strrchr(exePath, '\\') - exePath; +} + +void appendPath(char* basepath, const char* path) { + if (basepath[strlen(basepath) - 1] != '\\') { + strcat(basepath, "\\"); + } + strcat(basepath, path); +} + +void appendJavaw(char* jrePath) { + if (console) { + appendPath(jrePath, "bin\\java.exe"); + } else { + appendPath(jrePath, "bin\\javaw.exe"); + } +} + +void appendLauncher(const BOOL setProcName, char* exePath, + const int pathLen, char* cmd) { + if (setProcName) { + char tmpspec[_MAX_PATH]; + char tmpfile[_MAX_PATH]; + strcpy(tmpspec, cmd); + strcat(tmpspec, LAUNCH4J_TMP_DIR); + tmpspec[strlen(tmpspec) - 1] = 0; + if (_stat(tmpspec, &statBuf) == 0) { + // Remove temp launchers and manifests + struct _finddata_t c_file; + long hFile; + appendPath(tmpspec, "*.exe"); + strcpy(tmpfile, cmd); + strcat(tmpfile, LAUNCH4J_TMP_DIR); + char* filename = tmpfile + strlen(tmpfile); + if ((hFile = _findfirst(tmpspec, &c_file)) != -1L) { + do { + strcpy(filename, c_file.name); + debug("Unlink:\t\t%s\n", tmpfile); + _unlink(tmpfile); + strcat(tmpfile, MANIFEST); + debug("Unlink:\t\t%s\n", tmpfile); + _unlink(tmpfile); + } while (_findnext(hFile, &c_file) == 0); + } + _findclose(hFile); + } else { + if (_mkdir(tmpspec) != 0) { + debug("Mkdir failed:\t%s\n", tmpspec); + appendJavaw(cmd); + return; + } + } + char javaw[_MAX_PATH]; + strcpy(javaw, cmd); + appendJavaw(javaw); + strcpy(tmpfile, cmd); + strcat(tmpfile, LAUNCH4J_TMP_DIR); + char* tmpfilename = tmpfile + strlen(tmpfile); + char* exeFilePart = exePath + pathLen + 1; + + // Copy manifest + char manifest[_MAX_PATH] = {0}; + strcpy(manifest, exePath); + strcat(manifest, MANIFEST); + if (_stat(manifest, &statBuf) == 0) { + strcat(tmpfile, exeFilePart); + strcat(tmpfile, MANIFEST); + debug("Copy:\t\t%s -> %s\n", manifest, tmpfile); + CopyFile(manifest, tmpfile, FALSE); + } + + // Copy launcher + strcpy(tmpfilename, exeFilePart); + debug("Copy:\t\t%s -> %s\n", javaw, tmpfile); + if (CopyFile(javaw, tmpfile, FALSE)) { + strcpy(cmd, tmpfile); + return; + } else if (_stat(javaw, &statBuf) == 0) { + long fs = statBuf.st_size; + if (_stat(tmpfile, &statBuf) == 0 && fs == statBuf.st_size) { + debug("Reusing:\t\t%s\n", tmpfile); + strcpy(cmd, tmpfile); + return; + } + } + } + appendJavaw(cmd); +} + +void appendAppClasspath(char* dst, const char* src, const char* classpath) { + strcat(dst, src); + if (*classpath) { + strcat(dst, ";"); + } +} + +BOOL isJrePathOk(const char* path) { + char javaw[_MAX_PATH]; + BOOL result = FALSE; + if (*path) { + strcpy(javaw, path); + appendJavaw(javaw); + result = _stat(javaw, &statBuf) == 0; + } + debug("Check launcher:\t%s %s\n", javaw, result ? "(OK)" : "(n/a)"); + return result; +} + +/* + * Expand environment %variables% + */ +BOOL expandVars(char *dst, const char *src, const char *exePath, const int pathLen) { + char varName[STR]; + char varValue[MAX_VAR_SIZE]; + while (strlen(src) > 0) { + char *start = strchr(src, '%'); + if (start != NULL) { + char *end = strchr(start + 1, '%'); + if (end == NULL) { + return FALSE; + } + // Copy content up to %VAR% + strncat(dst, src, start - src); + // Insert value of %VAR% + *varName = 0; + strncat(varName, start + 1, end - start - 1); + // Remember value start for logging + char *varValue = dst + strlen(dst); + if (strcmp(varName, "EXEDIR") == 0) { + strncat(dst, exePath, pathLen); + } else if (strcmp(varName, "EXEFILE") == 0) { + strcat(dst, exePath); + } else if (strcmp(varName, "PWD") == 0) { + GetCurrentDirectory(_MAX_PATH, dst + strlen(dst)); + } else if (strcmp(varName, "OLDPWD") == 0) { + strcat(dst, oldPwd); + } else if (strstr(varName, HKEY_STR) == varName) { + regQueryValue(varName, dst + strlen(dst), BIG_STR); + } else if (GetEnvironmentVariable(varName, varValue, MAX_VAR_SIZE) > 0) { + strcat(dst, varValue); + } + debug("Substitute:\t%s = %s\n", varName, varValue); + src = end + 1; + } else { + // Copy remaining content + strcat(dst, src); + break; + } + } + return TRUE; +} + +void appendHeapSizes(char *dst) { + MEMORYSTATUS m; + memset(&m, 0, sizeof(m)); + GlobalMemoryStatus(&m); + + appendHeapSize(dst, INITIAL_HEAP_SIZE, INITIAL_HEAP_PERCENT, + m.dwAvailPhys, "-Xms"); + appendHeapSize(dst, MAX_HEAP_SIZE, MAX_HEAP_PERCENT, + m.dwAvailPhys, "-Xmx"); +} + +void appendHeapSize(char *dst, const int absID, const int percentID, + const DWORD freeMemory, const char *option) { + + const int mb = 1048576; // 1 MB + int abs = loadInt(absID); + int percent = loadInt(percentID); + int free = (long long) freeMemory * percent / (100 * mb); // 100% * 1 MB + int size = free > abs ? free : abs; + if (size > 0) { + debug("Heap %s:\t%d MB / %d%%, Free: %d MB, Heap size: %d MB\n", + option, abs, percent, freeMemory / mb, size); + strcat(dst, option); + _itoa(size, dst + strlen(dst), 10); // 10 -- radix + strcat(dst, "m "); + } +} + +int prepare(const char *lpCmdLine) { + char tmp[MAX_ARGS] = {0}; + hModule = GetModuleHandle(NULL); + if (hModule == NULL) { + return FALSE; + } + + // Get executable path + char exePath[_MAX_PATH] = {0}; + int pathLen = getExePath(exePath); + if (pathLen == -1) { + return FALSE; + } + + // Initialize logging + if (strstr(lpCmdLine, "--l4j-debug") != NULL) { + hLog = openLogFile(exePath, pathLen); + if (hLog == NULL) { + return FALSE; + } + debug("\n\nCmdLine:\t%s %s\n", exePath, lpCmdLine); + } + + setWow64Flag(); + + // Set default error message, title and optional support web site url. + loadString(SUPPORT_URL, errUrl); + loadString(ERR_TITLE, errTitle); + if (!loadString(STARTUP_ERR, errMsg)) { + return FALSE; + } + + // Single instance + loadString(MUTEX_NAME, mutexName); + if (*mutexName) { + SECURITY_ATTRIBUTES security; + security.nLength = sizeof(SECURITY_ATTRIBUTES); + security.bInheritHandle = TRUE; + security.lpSecurityDescriptor = NULL; + CreateMutexA(&security, FALSE, mutexName); + if (GetLastError() == ERROR_ALREADY_EXISTS) { + debug("Instance already exists."); + return ERROR_ALREADY_EXISTS; + } + } + + // Working dir + char tmp_path[_MAX_PATH] = {0}; + GetCurrentDirectory(_MAX_PATH, oldPwd); + if (loadString(CHDIR, tmp_path)) { + strncpy(workingDir, exePath, pathLen); + appendPath(workingDir, tmp_path); + _chdir(workingDir); + debug("Working dir:\t%s\n", workingDir); + } + + // Use bundled jre or find java + if (loadString(JRE_PATH, tmp_path)) { + char jrePath[MAX_ARGS] = {0}; + expandVars(jrePath, tmp_path, exePath, pathLen); + debug("Bundled JRE:\t%s\n", jrePath); + if (jrePath[0] == '\\' || jrePath[1] == ':') { + // Absolute + strcpy(cmd, jrePath); + } else { + // Relative + strncpy(cmd, exePath, pathLen); + appendPath(cmd, jrePath); + } + } + if (!isJrePathOk(cmd)) { + if (!loadString(JAVA_MIN_VER, javaMinVer)) { + loadString(BUNDLED_JRE_ERR, errMsg); + return FALSE; + } + loadString(JAVA_MAX_VER, javaMaxVer); + if (!findJavaHome(cmd, loadInt(JDK_PREFERENCE))) { + loadString(JRE_VERSION_ERR, errMsg); + strcat(errMsg, " "); + strcat(errMsg, javaMinVer); + if (*javaMaxVer) { + strcat(errMsg, " - "); + strcat(errMsg, javaMaxVer); + } + loadString(DOWNLOAD_URL, errUrl); + return FALSE; + } + if (!isJrePathOk(cmd)) { + loadString(LAUNCHER_ERR, errMsg); + return FALSE; + } + } + + // Append a path to the Path environment variable + char jreBinPath[_MAX_PATH]; + strcpy(jreBinPath, cmd); + strcat(jreBinPath, "\\bin"); + if (!appendToPathVar(jreBinPath)) { + return FALSE; + } + + // Set environment variables + char envVars[MAX_VAR_SIZE] = {0}; + loadString(ENV_VARIABLES, envVars); + char *var = strtok(envVars, "\t"); + while (var != NULL) { + char *varValue = strchr(var, '='); + *varValue++ = 0; + *tmp = 0; + expandVars(tmp, varValue, exePath, pathLen); + debug("Set var:\t%s = %s\n", var, tmp); + SetEnvironmentVariable(var, tmp); + var = strtok(NULL, "\t"); + } + *tmp = 0; + + // Process priority + priority = loadInt(PRIORITY_CLASS); + + // Custom process name + const BOOL setProcName = loadBool(SET_PROC_NAME) + && strstr(lpCmdLine, "--l4j-default-proc") == NULL; + const BOOL wrapper = loadBool(WRAPPER); + + char jdk_path[_MAX_PATH] = {0}; // fry + strcpy(jdk_path, cmd); + //msgBox(jdk_path); + + appendLauncher(setProcName, exePath, pathLen, cmd); + + // Heap sizes + appendHeapSizes(args); + + // JVM options + if (loadString(JVM_OPTIONS, tmp)) { + strcat(tmp, " "); + } else { + *tmp = 0; + } + /* + * Load additional JVM options from .l4j.ini file + * Options are separated by spaces or CRLF + * # starts an inline comment + */ + strncpy(tmp_path, exePath, strlen(exePath) - 3); + strcat(tmp_path, "l4j.ini"); + long hFile; + if ((hFile = _open(tmp_path, _O_RDONLY)) != -1) { + const int jvmOptLen = strlen(tmp); + char* src = tmp + jvmOptLen; + char* dst = src; + const int len = _read(hFile, src, MAX_ARGS - jvmOptLen - BIG_STR); + BOOL copy = TRUE; + int i; + for (i = 0; i < len; i++, src++) { + if (*src == '#') { + copy = FALSE; + } else if (*src == 13 || *src == 10) { + copy = TRUE; + if (dst > tmp && *(dst - 1) != ' ') { + *dst++ = ' '; + } + } else if (copy) { + *dst++ = *src; + } + } + *dst = 0; + if (len > 0 && *(dst - 1) != ' ') { + strcat(tmp, " "); + } + _close(hFile); + } + + // Expand environment %variables% + expandVars(args, tmp, exePath, pathLen); + + // MainClass + Classpath or Jar + char mainClass[STR] = {0}; + char jar[_MAX_PATH] = {0}; + loadString(JAR, jar); + if (loadString(MAIN_CLASS, mainClass)) { + if (!loadString(CLASSPATH, tmp)) { + return FALSE; + } + char exp[MAX_ARGS] = {0}; + expandVars(exp, tmp, exePath, pathLen); + strcat(args, "-classpath \""); + if (wrapper) { + appendAppClasspath(args, exePath, exp); + } else if (*jar) { + appendAppClasspath(args, jar, exp); + } + + // add tools.jar for JDK [fry] + char tools[_MAX_PATH] = { 0 }; + sprintf(tools, "%s\\lib\\tools.jar", jdk_path); + appendAppClasspath(args, tools, exp); + + // Deal with wildcards or >> strcat(args, exp); << + char* cp = strtok(exp, ";"); + while(cp != NULL) { + debug("Add classpath:\t%s\n", cp); + if (strpbrk(cp, "*?") != NULL) { + int len = strrchr(cp, '\\') - cp + 1; + strncpy(tmp_path, cp, len); + char* filename = tmp_path + len; + *filename = 0; + struct _finddata_t c_file; + long hFile; + if ((hFile = _findfirst(cp, &c_file)) != -1L) { + do { + strcpy(filename, c_file.name); + strcat(args, tmp_path); + strcat(args, ";"); + debug(" \" :\t%s\n", tmp_path); + } while (_findnext(hFile, &c_file) == 0); + } + _findclose(hFile); + } else { + strcat(args, cp); + strcat(args, ";"); + } + cp = strtok(NULL, ";"); + } + *(args + strlen(args) - 1) = 0; + + strcat(args, "\" "); + strcat(args, mainClass); + } else if (wrapper) { + strcat(args, "-jar \""); + strcat(args, exePath); + strcat(args, "\""); + } else { + strcat(args, "-jar \""); + strncat(args, exePath, pathLen); + appendPath(args, jar); + strcat(args, "\""); + } + + // Constant command line args + if (loadString(CMD_LINE, tmp)) { + strcat(args, " "); + strcat(args, tmp); + } + + // Command line args + if (*lpCmdLine) { + strcpy(tmp, lpCmdLine); + char* dst; + while ((dst = strstr(tmp, "--l4j-")) != NULL) { + char* src = strchr(dst, ' '); + if (src == NULL || *(src + 1) == 0) { + *dst = 0; + } else { + strcpy(dst, src + 1); + } + } + if (*tmp) { + strcat(args, " "); + strcat(args, tmp); + } + } + + debug("Launcher:\t%s\n", cmd); + debug("Launcher args:\t%s\n", args); + debug("Args length:\t%d/32768 chars\n", strlen(args)); + return TRUE; +} + +void closeHandles() { + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + closeLogFile(); +} + +/* + * Append a path to the Path environment variable + */ +BOOL appendToPathVar(const char* path) { + char chBuf[MAX_VAR_SIZE] = {0}; + + const int pathSize = GetEnvironmentVariable("Path", chBuf, MAX_VAR_SIZE); + if (MAX_VAR_SIZE - pathSize - 1 < strlen(path)) { + return FALSE; + } + strcat(chBuf, ";"); + strcat(chBuf, path); + return SetEnvironmentVariable("Path", chBuf); +} + +// may need to ignore STILL_ACTIVE (error code 259) here +// http://msdn.microsoft.com/en-us/library/ms683189(VS.85).aspx +DWORD execute(const BOOL wait) { + STARTUPINFO si; + memset(&pi, 0, sizeof(pi)); + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + + DWORD dwExitCode = -1; + char cmdline[MAX_ARGS]; + strcpy(cmdline, "\""); + strcat(cmdline, cmd); + strcat(cmdline, "\" "); + strcat(cmdline, args); + if (CreateProcess(NULL, cmdline, NULL, NULL, + TRUE, priority, NULL, NULL, &si, &pi)) { + if (wait) { + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &dwExitCode); + debug("Exit code:\t%d\n", dwExitCode); + closeHandles(); + } else { + dwExitCode = 0; + } + } + return dwExitCode; +} diff --git a/build/windows/launcher/launch4j/head_src/head.h b/build/windows/launcher/launch4j/head_src/head.h new file mode 100755 index 000000000..2e3bdb1d0 --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/head.h @@ -0,0 +1,113 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2008 Grzegorz Kowal, + Ian Roberts (jdk preference patch) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef _LAUNCH4J_HEAD__INCLUDED_ +#define _LAUNCH4J_HEAD__INCLUDED_ + +#define WIN32_LEAN_AND_MEAN // VC - Exclude rarely-used stuff from Windows headers + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NO_JAVA_FOUND 0 +#define FOUND_JRE 1 +#define FOUND_SDK 2 + +#define JRE_ONLY 0 +#define PREFER_JRE 1 +#define PREFER_JDK 2 +#define JDK_ONLY 3 + +#define LAUNCH4J_TMP_DIR "\\launch4j-tmp\\" +#define MANIFEST ".manifest" + +#define KEY_WOW64_64KEY 0x0100 + +#define HKEY_STR "HKEY" +#define HKEY_CLASSES_ROOT_STR "HKEY_CLASSES_ROOT" +#define HKEY_CURRENT_USER_STR "HKEY_CURRENT_USER" +#define HKEY_LOCAL_MACHINE_STR "HKEY_LOCAL_MACHINE" +#define HKEY_USERS_STR "HKEY_USERS" +#define HKEY_CURRENT_CONFIG_STR "HKEY_CURRENT_CONFIG" + +#define STR 128 +#define BIG_STR 1024 +#define MAX_VAR_SIZE 32767 +#define MAX_ARGS 32768 + +#define TRUE_STR "true" +#define FALSE_STR "false" + +#define debug(args...) if (hLog != NULL) fprintf(hLog, ## args); + +typedef void (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); + +FILE* openLogFile(const char* exePath, const int pathLen); +void closeLogFile(); +void msgBox(const char* text); +void signalError(); +BOOL loadString(const int resID, char* buffer); +BOOL loadBool(const int resID); +int loadInt(const int resID); +BOOL regQueryValue(const char* regPath, unsigned char* buffer, + unsigned long bufferLength); +void regSearch(const HKEY hKey, const char* keyName, const int searchType); +void regSearchWow(const char* keyName, const int searchType); +void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName, + const int jdkPreference); +BOOL findJavaHome(char* path, const int jdkPreference); +int getExePath(char* exePath); +void appendPath(char* basepath, const char* path); +void appendJavaw(char* jrePath); +void appendAppClasspath(char* dst, const char* src, const char* classpath); +BOOL isJrePathOk(const char* path); +BOOL expandVars(char *dst, const char *src, const char *exePath, const int pathLen); +void appendHeapSizes(char *dst); +void appendHeapSize(char *dst, const int absID, const int percentID, + const DWORD freeMemory, const char *option); +int prepare(const char *lpCmdLine); +void closeHandles(); +BOOL appendToPathVar(const char* path); +DWORD execute(const BOOL wait); + +#endif // _LAUNCH4J_HEAD__INCLUDED_ diff --git a/build/windows/launcher/launch4j/head_src/resource.h b/build/windows/launcher/launch4j/head_src/resource.h new file mode 100755 index 000000000..3c0f73cfc --- /dev/null +++ b/build/windows/launcher/launch4j/head_src/resource.h @@ -0,0 +1,71 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2008 Grzegorz Kowal + Ian Roberts (jdk preference patch) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +// ICON +#define APP_ICON 1 + +// BITMAP +#define SPLASH_BITMAP 1 + +// RCDATA +#define JRE_PATH 1 +#define JAVA_MIN_VER 2 +#define JAVA_MAX_VER 3 +#define SHOW_SPLASH 4 +#define SPLASH_WAITS_FOR_WINDOW 5 +#define SPLASH_TIMEOUT 6 +#define SPLASH_TIMEOUT_ERR 7 +#define CHDIR 8 +#define SET_PROC_NAME 9 +#define ERR_TITLE 10 +#define GUI_HEADER_STAYS_ALIVE 11 +#define JVM_OPTIONS 12 +#define CMD_LINE 13 +#define JAR 14 +#define MAIN_CLASS 15 +#define CLASSPATH 16 +#define WRAPPER 17 +#define JDK_PREFERENCE 18 +#define ENV_VARIABLES 19 +#define PRIORITY_CLASS 20 +#define DOWNLOAD_URL 21 +#define SUPPORT_URL 22 +#define MUTEX_NAME 23 +#define INSTANCE_WINDOW_TITLE 24 +#define INITIAL_HEAP_SIZE 25 +#define INITIAL_HEAP_PERCENT 26 +#define MAX_HEAP_SIZE 27 +#define MAX_HEAP_PERCENT 28 + +#define STARTUP_ERR 101 +#define BUNDLED_JRE_ERR 102 +#define JRE_VERSION_ERR 103 +#define LAUNCHER_ERR 104 +#define INSTANCE_ALREADY_EXISTS_MSG 105 diff --git a/build/windows/launcher/launch4j/launch4j.exe b/build/windows/launcher/launch4j/launch4j.exe new file mode 100755 index 000000000..0e2eb2ba5 Binary files /dev/null and b/build/windows/launcher/launch4j/launch4j.exe differ diff --git a/build/windows/launcher/launch4j/launch4j.jar b/build/windows/launcher/launch4j/launch4j.jar new file mode 100755 index 000000000..ec68ae48d Binary files /dev/null and b/build/windows/launcher/launch4j/launch4j.jar differ diff --git a/build/windows/launcher/launch4j/launch4j.jfpr b/build/windows/launcher/launch4j/launch4j.jfpr new file mode 100755 index 000000000..a2e63ebc5 Binary files /dev/null and b/build/windows/launcher/launch4j/launch4j.jfpr differ diff --git a/build/windows/launcher/launch4j/launch4jc.exe b/build/windows/launcher/launch4j/launch4jc.exe new file mode 100755 index 000000000..565cc2f07 Binary files /dev/null and b/build/windows/launcher/launch4j/launch4jc.exe differ diff --git a/build/windows/launcher/launch4j/lib/JGoodies.Forms.LICENSE.txt b/build/windows/launcher/launch4j/lib/JGoodies.Forms.LICENSE.txt new file mode 100755 index 000000000..9ba2419e7 --- /dev/null +++ b/build/windows/launcher/launch4j/lib/JGoodies.Forms.LICENSE.txt @@ -0,0 +1,31 @@ + + The BSD License for the JGoodies Forms + ====================================== + +Copyright (c) 2002-2004 JGoodies Karsten Lentzsch. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + o Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + o Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + o Neither the name of JGoodies Karsten Lentzsch nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/build/windows/launcher/launch4j/lib/JGoodies.Looks.LICENSE.txt b/build/windows/launcher/launch4j/lib/JGoodies.Looks.LICENSE.txt new file mode 100755 index 000000000..8bbefa2eb --- /dev/null +++ b/build/windows/launcher/launch4j/lib/JGoodies.Looks.LICENSE.txt @@ -0,0 +1,31 @@ + + The BSD License for the JGoodies Looks + ====================================== + +Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + o Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + o Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + o Neither the name of JGoodies Karsten Lentzsch nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/build/windows/launcher/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt b/build/windows/launcher/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt new file mode 100755 index 000000000..cbee875ba --- /dev/null +++ b/build/windows/launcher/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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 + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/build/windows/launcher/launch4j/lib/XStream.LICENSE.txt b/build/windows/launcher/launch4j/lib/XStream.LICENSE.txt new file mode 100755 index 000000000..5ccad8694 --- /dev/null +++ b/build/windows/launcher/launch4j/lib/XStream.LICENSE.txt @@ -0,0 +1,27 @@ +(BSD Style License) + +Copyright (c) 2003-2004, Joe Walnes +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of XStream nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. diff --git a/build/windows/launcher/launch4j/lib/commons-beanutils.jar b/build/windows/launcher/launch4j/lib/commons-beanutils.jar new file mode 100755 index 000000000..b1b89c9c9 Binary files /dev/null and b/build/windows/launcher/launch4j/lib/commons-beanutils.jar differ diff --git a/build/windows/launcher/launch4j/lib/commons-logging.jar b/build/windows/launcher/launch4j/lib/commons-logging.jar new file mode 100755 index 000000000..b73a80fab Binary files /dev/null and b/build/windows/launcher/launch4j/lib/commons-logging.jar differ diff --git a/build/windows/launcher/launch4j/lib/commons.LICENSE.txt b/build/windows/launcher/launch4j/lib/commons.LICENSE.txt new file mode 100755 index 000000000..fdb647522 --- /dev/null +++ b/build/windows/launcher/launch4j/lib/commons.LICENSE.txt @@ -0,0 +1,50 @@ +/* + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) @year@ The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be + used to endorse or promote products derived from this software without + prior written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + Stefano Mazzocchi . For more information on the Apache + Software Foundation, please see . + +*/ diff --git a/build/windows/launcher/launch4j/lib/forms.jar b/build/windows/launcher/launch4j/lib/forms.jar new file mode 100755 index 000000000..aed060a49 Binary files /dev/null and b/build/windows/launcher/launch4j/lib/forms.jar differ diff --git a/build/windows/launcher/launch4j/lib/formsrt.jar b/build/windows/launcher/launch4j/lib/formsrt.jar new file mode 100755 index 000000000..e0de6ecf1 Binary files /dev/null and b/build/windows/launcher/launch4j/lib/formsrt.jar differ diff --git a/build/windows/launcher/launch4j/lib/foxtrot.LICENSE.txt b/build/windows/launcher/launch4j/lib/foxtrot.LICENSE.txt new file mode 100755 index 000000000..5fa4019d5 --- /dev/null +++ b/build/windows/launcher/launch4j/lib/foxtrot.LICENSE.txt @@ -0,0 +1,25 @@ +Copyright (c) 2002, Simone Bordet & Marco Cravero +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + - Neither the name of Foxtrot nor the names of the contributors may be used + to endorse or promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/build/windows/launcher/launch4j/lib/foxtrot.jar b/build/windows/launcher/launch4j/lib/foxtrot.jar new file mode 100755 index 000000000..f39103a09 Binary files /dev/null and b/build/windows/launcher/launch4j/lib/foxtrot.jar differ diff --git a/build/windows/launcher/launch4j/lib/looks.jar b/build/windows/launcher/launch4j/lib/looks.jar new file mode 100755 index 000000000..d2c47c743 Binary files /dev/null and b/build/windows/launcher/launch4j/lib/looks.jar differ diff --git a/build/windows/launcher/launch4j/lib/xstream.jar b/build/windows/launcher/launch4j/lib/xstream.jar new file mode 100755 index 000000000..392e1c937 Binary files /dev/null and b/build/windows/launcher/launch4j/lib/xstream.jar differ diff --git a/build/windows/launcher/launch4j/manifest/uac.exe.manifest b/build/windows/launcher/launch4j/manifest/uac.exe.manifest new file mode 100755 index 000000000..3041fbc5b --- /dev/null +++ b/build/windows/launcher/launch4j/manifest/uac.exe.manifest @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/build/windows/launcher/launch4j/manifest/xp-themes.exe.manifest b/build/windows/launcher/launch4j/manifest/xp-themes.exe.manifest new file mode 100755 index 000000000..e2c7511f9 --- /dev/null +++ b/build/windows/launcher/launch4j/manifest/xp-themes.exe.manifest @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/build/windows/launcher/launch4j/src/images/asterix-o.gif b/build/windows/launcher/launch4j/src/images/asterix-o.gif new file mode 100755 index 000000000..f5cf3b307 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/asterix-o.gif differ diff --git a/build/windows/launcher/launch4j/src/images/asterix.gif b/build/windows/launcher/launch4j/src/images/asterix.gif new file mode 100755 index 000000000..ba801670a Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/asterix.gif differ diff --git a/build/windows/launcher/launch4j/src/images/build.png b/build/windows/launcher/launch4j/src/images/build.png new file mode 100755 index 000000000..625285f0b Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/build.png differ diff --git a/build/windows/launcher/launch4j/src/images/button_ok.png b/build/windows/launcher/launch4j/src/images/button_ok.png new file mode 100755 index 000000000..5b0f6a617 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/button_ok.png differ diff --git a/build/windows/launcher/launch4j/src/images/cancel16.png b/build/windows/launcher/launch4j/src/images/cancel16.png new file mode 100755 index 000000000..a432b492c Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/cancel16.png differ diff --git a/build/windows/launcher/launch4j/src/images/down16.png b/build/windows/launcher/launch4j/src/images/down16.png new file mode 100755 index 000000000..f3bc4cd09 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/down16.png differ diff --git a/build/windows/launcher/launch4j/src/images/edit_add16.png b/build/windows/launcher/launch4j/src/images/edit_add16.png new file mode 100755 index 000000000..e9485082e Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/edit_add16.png differ diff --git a/build/windows/launcher/launch4j/src/images/info.png b/build/windows/launcher/launch4j/src/images/info.png new file mode 100755 index 000000000..eb37d9a08 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/info.png differ diff --git a/build/windows/launcher/launch4j/src/images/new.png b/build/windows/launcher/launch4j/src/images/new.png new file mode 100755 index 000000000..6e2700ad9 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/new.png differ diff --git a/build/windows/launcher/launch4j/src/images/new16.png b/build/windows/launcher/launch4j/src/images/new16.png new file mode 100755 index 000000000..f38d02ee5 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/new16.png differ diff --git a/build/windows/launcher/launch4j/src/images/ok16.png b/build/windows/launcher/launch4j/src/images/ok16.png new file mode 100755 index 000000000..5b0f6a617 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/ok16.png differ diff --git a/build/windows/launcher/launch4j/src/images/open.png b/build/windows/launcher/launch4j/src/images/open.png new file mode 100755 index 000000000..a801665fd Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/open.png differ diff --git a/build/windows/launcher/launch4j/src/images/open16.png b/build/windows/launcher/launch4j/src/images/open16.png new file mode 100755 index 000000000..5321c17c6 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/open16.png differ diff --git a/build/windows/launcher/launch4j/src/images/run.png b/build/windows/launcher/launch4j/src/images/run.png new file mode 100755 index 000000000..b41fa2b97 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/run.png differ diff --git a/build/windows/launcher/launch4j/src/images/save.png b/build/windows/launcher/launch4j/src/images/save.png new file mode 100755 index 000000000..74b37b0b5 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/save.png differ diff --git a/build/windows/launcher/launch4j/src/images/up16.png b/build/windows/launcher/launch4j/src/images/up16.png new file mode 100755 index 000000000..184c118b6 Binary files /dev/null and b/build/windows/launcher/launch4j/src/images/up16.png differ diff --git a/build/windows/launcher/launch4j/src/launch4j.properties b/build/windows/launcher/launch4j/src/launch4j.properties new file mode 100755 index 000000000..463c7a034 --- /dev/null +++ b/build/windows/launcher/launch4j/src/launch4j.properties @@ -0,0 +1,2 @@ +versionNumber=3.0.1.0 +version=3.0.1 diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/Builder.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/Builder.java new file mode 100755 index 000000000..d7badc7f3 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/Builder.java @@ -0,0 +1,207 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import net.sf.launch4j.binding.InvariantViolationException; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Builder { + private final Log _log; + private final File _basedir; + + public Builder(Log log) { + _log = log; + _basedir = Util.getJarBasedir(); + } + + public Builder(Log log, File basedir) { + _log = log; + _basedir = basedir; + } + + /** + * @return Output file path. + */ + public File build() throws BuilderException { + final Config c = ConfigPersister.getInstance().getConfig(); + try { + c.validate(); + } catch (InvariantViolationException e) { + throw new BuilderException(e.getMessage()); + } + File rc = null; + File ro = null; + File outfile = null; + FileInputStream is = null; + FileOutputStream os = null; + final RcBuilder rcb = new RcBuilder(); + try { + rc = rcb.build(c); + ro = Util.createTempFile("o"); + outfile = ConfigPersister.getInstance().getOutputFile(); + + Cmd resCmd = new Cmd(_basedir); + resCmd.addExe("windres") + .add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat") + .add("-J rc -O coff -F pe-i386") + .addAbsFile(rc) + .addAbsFile(ro); + _log.append(Messages.getString("Builder.compiling.resources")); + resCmd.exec(_log); + + Cmd ldCmd = new Cmd(_basedir); + ldCmd.addExe("ld") + .add("-mi386pe") + .add("--oformat pei-i386") + .add((c.getHeaderType().equals(Config.GUI_HEADER)) + ? "--subsystem windows" : "--subsystem console") + .add("-s") // strip symbols + .addFiles(c.getHeaderObjects()) + .addAbsFile(ro) + .addFiles(c.getLibs()) + .add("-o") + .addAbsFile(outfile); + _log.append(Messages.getString("Builder.linking")); + ldCmd.exec(_log); + + if (!c.isDontWrapJar()) { + _log.append(Messages.getString("Builder.wrapping")); + int len; + byte[] buffer = new byte[1024]; + is = new FileInputStream(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), c.getJar())); + os = new FileOutputStream(outfile, true); + while ((len = is.read(buffer)) > 0) { + os.write(buffer, 0, len); + } + } + _log.append(Messages.getString("Builder.success") + outfile.getPath()); + return outfile; + } catch (IOException e) { + Util.delete(outfile); + _log.append(e.getMessage()); + throw new BuilderException(e); + } catch (ExecException e) { + Util.delete(outfile); + String msg = e.getMessage(); + if (msg != null && msg.indexOf("windres") != -1) { + if (e.getErrLine() != -1) { + _log.append(Messages.getString("Builder.line.has.errors", + String.valueOf(e.getErrLine()))); + _log.append(rcb.getLine(e.getErrLine())); + } else { + _log.append(Messages.getString("Builder.generated.resource.file")); + _log.append(rcb.getContent()); + } + } + throw new BuilderException(e); + } finally { + Util.close(is); + Util.close(os); + Util.delete(rc); + Util.delete(ro); + } + } +} + +class Cmd { + private final List _cmd = new ArrayList(); + private final File _basedir; + private final File _bindir; + + public Cmd(File basedir) { + _basedir = basedir; + String path = System.getProperty("launch4j.bindir"); + if (path == null) { + _bindir = new File(basedir, "bin"); + } else { + File bindir = new File(path); + _bindir = bindir.isAbsolute() ? bindir : new File(basedir, path); + } + } + + public Cmd add(String s) { + StringTokenizer st = new StringTokenizer(s); + while (st.hasMoreTokens()) { + _cmd.add(st.nextToken()); + } + return this; + } + + public Cmd addAbsFile(File file) { + _cmd.add(file.getPath()); + return this; + } + + public Cmd addFile(String pathname) { + _cmd.add(new File(_basedir, pathname).getPath()); + return this; + } + + public Cmd addExe(String pathname) { + if (Util.WINDOWS_OS) { + pathname += ".exe"; + } + _cmd.add(new File(_bindir, pathname).getPath()); + return this; + } + + public Cmd addFiles(List files) { + for (Iterator iter = files.iterator(); iter.hasNext();) { + addFile((String) iter.next()); + } + return this; + } + + public void exec(Log log) throws ExecException { + String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]); + Util.exec(cmd, log); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/BuilderException.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/BuilderException.java new file mode 100755 index 000000000..a84c2e279 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/BuilderException.java @@ -0,0 +1,52 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 13, 2005 + */ +package net.sf.launch4j; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class BuilderException extends Exception { + public BuilderException() {} + + public BuilderException(Throwable t) { + super(t); + } + + public BuilderException(String msg) { + super(msg); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ExecException.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ExecException.java new file mode 100755 index 000000000..236ae780f --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ExecException.java @@ -0,0 +1,66 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 14, 2005 + */ +package net.sf.launch4j; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ExecException extends Exception { + private final int _errLine; + + public ExecException(Throwable t, int errLine) { + super(t); + _errLine = errLine; + } + + public ExecException(Throwable t) { + this(t, -1); + } + + public ExecException(String msg, int errLine) { + super(msg); + _errLine = errLine; + } + + public ExecException(String msg) { + this(msg, -1); + } + + public int getErrLine() { + return _errLine; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/FileChooserFilter.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/FileChooserFilter.java new file mode 100755 index 000000000..5199a6deb --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/FileChooserFilter.java @@ -0,0 +1,76 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2004-01-15 + */ +package net.sf.launch4j; + +import java.io.File; + +import javax.swing.filechooser.FileFilter; + +/** + * @author Copyright (C) 2004 Grzegorz Kowal + */ +public class FileChooserFilter extends FileFilter { + String _description; + String[] _extensions; + + public FileChooserFilter(String description, String extension) { + _description = description; + _extensions = new String[] {extension}; + } + + public FileChooserFilter(String description, String[] extensions) { + _description = description; + _extensions = extensions; + } + + public boolean accept(File f) { + if (f.isDirectory()) { + return true; + } + String ext = Util.getExtension(f); + for (int i = 0; i < _extensions.length; i++) { + if (ext.toLowerCase().equals(_extensions[i].toLowerCase())) { + return true; + } + } + return false; + } + + public String getDescription() { + return _description; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/Log.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/Log.java new file mode 100755 index 000000000..c4d591b0c --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/Log.java @@ -0,0 +1,105 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 12, 2005 + */ +package net.sf.launch4j; + +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public abstract class Log { + private static final Log _consoleLog = new ConsoleLog(); + private static final Log _antLog = new AntLog(); + + public abstract void clear(); + public abstract void append(String line); + + public static Log getConsoleLog() { + return _consoleLog; + } + + public static Log getAntLog() { + return _antLog; + } + + public static Log getSwingLog(JTextArea textArea) { + return new SwingLog(textArea); + } +} + +class ConsoleLog extends Log { + public void clear() { + System.out.println("\n"); + } + + public void append(String line) { + System.out.println("launch4j: " + line); + } +} + +class AntLog extends Log { + public void clear() { + System.out.println("\n"); + } + + public void append(String line) { + System.out.println(line); + } +} + +class SwingLog extends Log { + private final JTextArea _textArea; + + public SwingLog(JTextArea textArea) { + _textArea = textArea; + } + + public void clear() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + _textArea.setText(""); + }}); + } + + public void append(final String line) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + _textArea.append(line + "\n"); + }}); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/Main.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/Main.java new file mode 100755 index 000000000..45f84ad79 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/Main.java @@ -0,0 +1,99 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2008 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j; + +import java.io.File; +import java.io.InputStream; +import java.util.Properties; + +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.formimpl.MainFrame; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Main { + private static String _name; + private static String _description; + + public static void main(String[] args) { + try { + Properties props = new Properties(); + InputStream in = Main.class.getClassLoader() + .getResourceAsStream("launch4j.properties"); + props.load(in); + in.close(); + setDescription(props); + + if (args.length == 0) { + ConfigPersister.getInstance().createBlank(); + MainFrame.createInstance(); + } else if (args.length == 1 && !args[0].startsWith("-")) { + ConfigPersister.getInstance().load(new File(args[0])); + Builder b = new Builder(Log.getConsoleLog()); + b.build(); + } else { + System.out.println(_description + + Messages.getString("Main.usage") + + ": launch4j config.xml"); + } + } catch (Exception e) { + Log.getConsoleLog().append(e.getMessage()); + } + } + + public static String getName() { + return _name; + } + + public static String getDescription() { + return _description; + } + + private static void setDescription(Properties props) { + _name = "Launch4j " + props.getProperty("version"); + _description = _name + + " (http://launch4j.sourceforge.net/)\n" + + "Cross-platform Java application wrapper" + + " for creating Windows native executables.\n\n" + + "Copyright (C) 2004, 2008 Grzegorz Kowal\n\n" + + "Launch4j comes with ABSOLUTELY NO WARRANTY.\n" + + "This is free software, licensed under the BSD License.\n" + + "This product includes software developed by the Apache Software Foundation" + + " (http://www.apache.org/)."; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/Messages.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/Messages.java new file mode 100755 index 000000000..35d4c8950 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/Messages.java @@ -0,0 +1,78 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + private static final MessageFormat FORMATTER = new MessageFormat(""); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(String key, String arg0) { + return getString(key, new Object[] {arg0}); + } + + public static String getString(String key, String arg0, String arg1) { + return getString(key, new Object[] {arg0, arg1}); + } + + public static String getString(String key, String arg0, String arg1, String arg2) { + return getString(key, new Object[] {arg0, arg1, arg2}); + } + + public static String getString(String key, Object[] args) { + try { + FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); + return FORMATTER.format(args); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/OptionParser.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/OptionParser.java new file mode 100755 index 000000000..bb2432c8e --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/OptionParser.java @@ -0,0 +1,71 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +//import net.sf.launch4j.config.Config; + +//import org.apache.commons.cli.CommandLine; +//import org.apache.commons.cli.CommandLineParser; +//import org.apache.commons.cli.HelpFormatter; +//import org.apache.commons.cli.Options; +//import org.apache.commons.cli.ParseException; +//import org.apache.commons.cli.PosixParser; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class OptionParser { + +// private final Options _options; +// +// public OptionParser() { +// _options = new Options(); +// _options.addOption("h", "header", true, "header"); +// } +// +// public Config parse(Config c, String[] args) throws ParseException { +// CommandLineParser parser = new PosixParser(); +// CommandLine cl = parser.parse(_options, args); +// c.setJar(getFile(props, Config.JAR)); +// c.setOutfile(getFile(props, Config.OUTFILE)); +// } +// +// public void printHelp() { +// HelpFormatter formatter = new HelpFormatter(); +// formatter.printHelp("launch4j", _options); +// } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/RcBuilder.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/RcBuilder.java new file mode 100755 index 000000000..f8885e3e6 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/RcBuilder.java @@ -0,0 +1,340 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; + +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.config.Jre; +import net.sf.launch4j.config.Msg; +import net.sf.launch4j.config.Splash; +import net.sf.launch4j.config.VersionInfo; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class RcBuilder { + + // winnt.h + public static final int LANG_NEUTRAL = 0; + public static final int SUBLANG_NEUTRAL = 0; + public static final int SUBLANG_DEFAULT = 1; + public static final int SUBLANG_SYS_DEFAULT = 2; + + // MANIFEST + public static final int MANIFEST = 1; + + // ICON + public static final int APP_ICON = 1; + + // BITMAP + public static final int SPLASH_BITMAP = 1; + + // RCDATA + public static final int JRE_PATH = 1; + public static final int JAVA_MIN_VER = 2; + public static final int JAVA_MAX_VER = 3; + public static final int SHOW_SPLASH = 4; + public static final int SPLASH_WAITS_FOR_WINDOW = 5; + public static final int SPLASH_TIMEOUT = 6; + public static final int SPLASH_TIMEOUT_ERR = 7; + public static final int CHDIR = 8; + public static final int SET_PROC_NAME = 9; + public static final int ERR_TITLE = 10; + public static final int GUI_HEADER_STAYS_ALIVE = 11; + public static final int JVM_OPTIONS = 12; + public static final int CMD_LINE = 13; + public static final int JAR = 14; + public static final int MAIN_CLASS = 15; + public static final int CLASSPATH = 16; + public static final int WRAPPER = 17; + public static final int JDK_PREFERENCE = 18; + public static final int ENV_VARIABLES = 19; + public static final int PRIORITY_CLASS = 20; + public static final int DOWNLOAD_URL = 21; + public static final int SUPPORT_URL = 22; + public static final int MUTEX_NAME = 23; + public static final int INSTANCE_WINDOW_TITLE = 24; + public static final int INITIAL_HEAP_SIZE = 25; + public static final int INITIAL_HEAP_PERCENT = 26; + public static final int MAX_HEAP_SIZE = 27; + public static final int MAX_HEAP_PERCENT = 28; + + public static final int STARTUP_ERR = 101; + public static final int BUNDLED_JRE_ERR = 102; + public static final int JRE_VERSION_ERR = 103; + public static final int LAUNCHER_ERR = 104; + public static final int INSTANCE_ALREADY_EXISTS_MSG = 105; + + private final StringBuffer _sb = new StringBuffer(); + + public String getContent() { + return _sb.toString(); + } + + public String getLine(int line) { + return _sb.toString().split("\n")[line - 1]; + } + + public File build(Config c) throws IOException { + _sb.append("LANGUAGE "); + _sb.append(LANG_NEUTRAL); + _sb.append(", "); + _sb.append(SUBLANG_DEFAULT); + _sb.append('\n'); + addVersionInfo(c.getVersionInfo()); + addJre(c.getJre()); + addManifest(MANIFEST, c.getManifest()); + addIcon(APP_ICON, c.getIcon()); + addText(ERR_TITLE, c.getErrTitle()); + addText(DOWNLOAD_URL, c.getDownloadUrl()); + addText(SUPPORT_URL, c.getSupportUrl()); + addText(CMD_LINE, c.getCmdLine()); + addWindowsPath(CHDIR, c.getChdir()); + addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass())); + addTrue(SET_PROC_NAME, c.isCustomProcName()); + addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive()); + addSplash(c.getSplash()); + addMessages(c); + + if (c.getSingleInstance() != null) { + addText(MUTEX_NAME, c.getSingleInstance().getMutexName()); + addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle()); + } + + if (c.getVariables() != null && !c.getVariables().isEmpty()) { + StringBuffer vars = new StringBuffer(); + append(vars, c.getVariables(), "\t"); + addText(ENV_VARIABLES, vars.toString()); + } + + // MAIN_CLASS / JAR + addTrue(WRAPPER, !c.isDontWrapJar()); + if (c.getClassPath() != null) { + addText(MAIN_CLASS, c.getClassPath().getMainClass()); + addWindowsPath(CLASSPATH, c.getClassPath().getPathsString()); + } + if (c.isDontWrapJar() && c.getJar() != null) { + addWindowsPath(JAR, c.getJar().getPath()); + } + + File f = Util.createTempFile("rc"); + BufferedWriter w = new BufferedWriter(new FileWriter(f)); + w.write(_sb.toString()); + w.close(); + return f; + } + + private void addVersionInfo(VersionInfo v) { + if (v == null) { + return; + } + _sb.append("1 VERSIONINFO\n"); + _sb.append("FILEVERSION "); + _sb.append(v.getFileVersion().replaceAll("\\.", ", ")); + _sb.append("\nPRODUCTVERSION "); + _sb.append(v.getProductVersion().replaceAll("\\.", ", ")); + _sb.append("\nFILEFLAGSMASK 0\n" + + "FILEOS 0x40000\n" + + "FILETYPE 1\n" + + "{\n" + + " BLOCK \"StringFileInfo\"\n" + + " {\n" + + " BLOCK \"040904E4\"\n" + // English + " {\n"); + addVerBlockValue("CompanyName", v.getCompanyName()); + addVerBlockValue("FileDescription", v.getFileDescription()); + addVerBlockValue("FileVersion", v.getTxtFileVersion()); + addVerBlockValue("InternalName", v.getInternalName()); + addVerBlockValue("LegalCopyright", v.getCopyright()); + addVerBlockValue("OriginalFilename", v.getOriginalFilename()); + addVerBlockValue("ProductName", v.getProductName()); + addVerBlockValue("ProductVersion", v.getTxtProductVersion()); + _sb.append(" }\n }\nBLOCK \"VarFileInfo\"\n{\nVALUE \"Translation\", 0x0409, 0x04E4\n}\n}"); + } + + private void addJre(Jre jre) { + addWindowsPath(JRE_PATH, jre.getPath()); + addText(JAVA_MIN_VER, jre.getMinVersion()); + addText(JAVA_MAX_VER, jre.getMaxVersion()); + addText(JDK_PREFERENCE, String.valueOf(jre.getJdkPreferenceIndex())); + addInteger(INITIAL_HEAP_SIZE, jre.getInitialHeapSize()); + addInteger(INITIAL_HEAP_PERCENT, jre.getInitialHeapPercent()); + addInteger(MAX_HEAP_SIZE, jre.getMaxHeapSize()); + addInteger(MAX_HEAP_PERCENT, jre.getMaxHeapPercent()); + + StringBuffer options = new StringBuffer(); + if (jre.getOptions() != null && !jre.getOptions().isEmpty()) { + addSpace(options); + append(options, jre.getOptions(), " "); + } + addText(JVM_OPTIONS, options.toString()); + } + + private void addSplash(Splash splash) { + if (splash == null) { + return; + } + addTrue(SHOW_SPLASH, true); + addTrue(SPLASH_WAITS_FOR_WINDOW, splash.getWaitForWindow()); + addText(SPLASH_TIMEOUT, String.valueOf(splash.getTimeout())); + addTrue(SPLASH_TIMEOUT_ERR, splash.isTimeoutErr()); + addBitmap(SPLASH_BITMAP, splash.getFile()); + } + + private void addMessages(Config c) { + Msg msg = c.getMessages(); + if (msg == null) { + msg = new Msg(); + } + addText(STARTUP_ERR, msg.getStartupErr()); + addText(BUNDLED_JRE_ERR, msg.getBundledJreErr()); + addText(JRE_VERSION_ERR, msg.getJreVersionErr()); + addText(LAUNCHER_ERR, msg.getLauncherErr()); + if (c.getSingleInstance() != null) { + addText(INSTANCE_ALREADY_EXISTS_MSG, msg.getInstanceAlreadyExistsMsg()); + } + } + + private void append(StringBuffer sb, List list, String separator) { + for (int i = 0; i < list.size(); i++) { + sb.append(list.get(i)); + if (i < list.size() - 1) { + sb.append(separator); + } + } + } + + private void addText(int id, String text) { + if (text == null || text.equals("")) { + return; + } + _sb.append(id); + _sb.append(" RCDATA BEGIN \""); + _sb.append(escape(text)); + _sb.append("\\0\" END\n"); + } + + private void addTrue(int id, boolean value) { + if (value) { + addText(id, "true"); + } + } + + private void addInteger(int id, Integer value) { + if (value != null) { + addText(id, value.toString()); + } + } + + /** + * Stores path in Windows format with '\' separators. + */ + private void addWindowsPath(int id, String path) { + if (path == null || path.equals("")) { + return; + } + _sb.append(id); + _sb.append(" RCDATA BEGIN \""); + _sb.append(path.replaceAll("\\\\", "\\\\\\\\") + .replaceAll("/", "\\\\\\\\")); + _sb.append("\\0\" END\n"); + } + + private void addManifest(int id, File manifest) { + if (manifest == null || manifest.getPath().equals("")) { + return; + } + _sb.append(id); + _sb.append(" 24 \""); + _sb.append(getPath(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), manifest))); + _sb.append("\"\n"); + } + + private void addIcon(int id, File icon) { + if (icon == null || icon.getPath().equals("")) { + return; + } + _sb.append(id); + _sb.append(" ICON DISCARDABLE \""); + _sb.append(getPath(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), icon))); + _sb.append("\"\n"); + } + + private void addBitmap(int id, File bitmap) { + if (bitmap == null) { + return; + } + _sb.append(id); + _sb.append(" BITMAP \""); + _sb.append(getPath(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), bitmap))); + _sb.append("\"\n"); + } + + private String getPath(File f) { + return f.getPath().replaceAll("\\\\", "\\\\\\\\"); + } + + private void addSpace(StringBuffer sb) { + int len = sb.length(); + if (len-- > 0 && sb.charAt(len) != ' ') { + sb.append(' '); + } + } + + private void addVerBlockValue(String key, String value) { + _sb.append(" VALUE \""); + _sb.append(key); + _sb.append("\", \""); + if (value != null) { + _sb.append(escape(value)); + } + _sb.append("\"\n"); + } + + private String escape(String text) { + return text.replaceAll("\"", "\"\""); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/Util.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/Util.java new file mode 100755 index 000000000..f3bf2456d --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/Util.java @@ -0,0 +1,197 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Util { + public static final boolean WINDOWS_OS = System.getProperty("os.name") + .toLowerCase().startsWith("windows"); + + private Util() {} + + public static File createTempFile(String suffix) throws IOException { + String tmpdir = System.getProperty("launch4j.tmpdir"); + if (tmpdir != null) { + if (tmpdir.indexOf(' ') != -1) { + throw new IOException(Messages.getString("Util.tmpdir")); + } + return File.createTempFile("launch4j", suffix, new File(tmpdir)); + } else { + return File.createTempFile("launch4j", suffix); + } + } + + /** + * Returns the base directory of a jar file or null if the class is a standalone file. + * @return System specific path + * + * Based on a patch submitted by Josh Elsasser + */ + public static File getJarBasedir() { + String url = Util.class.getClassLoader() + .getResource(Util.class.getName().replace('.', '/') + ".class") + .getFile() + .replaceAll("%20", " "); + if (url.startsWith("file:")) { + String jar = url.substring(5, url.lastIndexOf('!')); + int x = jar.lastIndexOf('/'); + if (x == -1) { + x = jar.lastIndexOf('\\'); + } + String basedir = jar.substring(0, x + 1); + return new File(basedir); + } else { + return new File("."); + } + } + + public static File getAbsoluteFile(File basepath, File f) { + return f.isAbsolute() ? f : new File(basepath, f.getPath()); + } + + public static String getExtension(File f) { + String name = f.getName(); + int x = name.lastIndexOf('.'); + if (x != -1) { + return name.substring(x); + } else { + return ""; + } + } + + public static void exec(String[] cmd, Log log) throws ExecException { + BufferedReader is = null; + try { + if (WINDOWS_OS) { + for (int i = 0; i < cmd.length; i++) { + cmd[i] = cmd[i].replaceAll("/", "\\\\"); + } + } + Process p = Runtime.getRuntime().exec(cmd); + is = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + int errLine = -1; + Pattern pattern = Pattern.compile(":\\d+:"); + while ((line = is.readLine()) != null) { + log.append(line); + Matcher matcher = pattern.matcher(line); + if (matcher.find()) { + errLine = Integer.valueOf( + line.substring(matcher.start() + 1, matcher.end() - 1)) + .intValue(); + if (line.matches("(?i).*unrecognized escape sequence")) { + log.append(Messages.getString("Util.use.double.backslash")); + } + break; + } + } + is.close(); + p.waitFor(); + if (errLine != -1) { + throw new ExecException(Messages.getString("Util.exec.failed") + + ": " + cmd, errLine); + } + if (p.exitValue() != 0) { + throw new ExecException(Messages.getString("Util.exec.failed") + + "(" + p.exitValue() + "): " + cmd); + } + } catch (IOException e) { + close(is); + throw new ExecException(e); + } catch (InterruptedException e) { + close(is); + throw new ExecException(e); + } + } + + public static void close(final InputStream o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static void close(final OutputStream o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static void close(final Reader o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static void close(final Writer o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static boolean delete(File f) { + return (f != null) ? f.delete() : false; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntClassPath.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntClassPath.java new file mode 100755 index 000000000..a67bab91f --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntClassPath.java @@ -0,0 +1,61 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 19, 2006 + */ +package net.sf.launch4j.ant; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.launch4j.config.ClassPath; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class AntClassPath extends ClassPath { + private final List wrappedPaths = new ArrayList(); + + public void setCp(String cp){ + wrappedPaths.add(cp); + } + + public void addCp(StringWrapper cp) { + wrappedPaths.add(cp); + } + + public void unwrap() { + setPaths(StringWrapper.unwrap(wrappedPaths)); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntConfig.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntConfig.java new file mode 100755 index 000000000..4482436a9 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntConfig.java @@ -0,0 +1,129 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 24, 2005 + */ +package net.sf.launch4j.ant; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tools.ant.BuildException; + +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.Msg; +import net.sf.launch4j.config.SingleInstance; +import net.sf.launch4j.config.Splash; +import net.sf.launch4j.config.VersionInfo; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class AntConfig extends Config { + private final List wrappedHeaderObjects = new ArrayList(); + private final List wrappedLibs = new ArrayList(); + private final List wrappedVariables = new ArrayList(); + + public void setJarPath(String path) { + setJar(new File(path)); + } + + public void addObj(StringWrapper obj) { + wrappedHeaderObjects.add(obj); + } + + public void addLib(StringWrapper lib) { + wrappedLibs.add(lib); + } + + public void addVar(StringWrapper var) { + wrappedVariables.add(var); + } + + // __________________________________________________________________________________ + + public void addSingleInstance(SingleInstance singleInstance) { + checkNull(getSingleInstance(), "singleInstance"); + setSingleInstance(singleInstance); + } + + public void addClassPath(AntClassPath classPath) { + checkNull(getClassPath(), "classPath"); + setClassPath(classPath); + } + + public void addJre(AntJre jre) { + checkNull(getJre(), "jre"); + setJre(jre); + } + + public void addSplash(Splash splash) { + checkNull(getSplash(), "splash"); + setSplash(splash); + } + + public void addVersionInfo(VersionInfo versionInfo) { + checkNull(getVersionInfo(), "versionInfo"); + setVersionInfo(versionInfo); + } + + public void addMessages(Msg messages) { + checkNull(getMessages(), "messages"); + setMessages(messages); + } + + // __________________________________________________________________________________ + + public void unwrap() { + setHeaderObjects(StringWrapper.unwrap(wrappedHeaderObjects)); + setLibs(StringWrapper.unwrap(wrappedLibs)); + setVariables(StringWrapper.unwrap(wrappedVariables)); + if (getClassPath() != null) { + ((AntClassPath) getClassPath()).unwrap(); + } + if (getJre() != null) { + ((AntJre) getJre()).unwrap(); + } + } + + private void checkNull(Object o, String name) { + if (o != null) { + throw new BuildException( + Messages.getString("AntConfig.duplicate.element") + + ": " + + name); + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntJre.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntJre.java new file mode 100755 index 000000000..b83e3ee02 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/AntJre.java @@ -0,0 +1,69 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 18, 2006 + */ +package net.sf.launch4j.ant; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.launch4j.config.Jre; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class AntJre extends Jre { + private final List wrappedOptions = new ArrayList(); + + public void addOpt(StringWrapper opt) { + wrappedOptions.add(opt); + } + + public void unwrap() { + setOptions(StringWrapper.unwrap(wrappedOptions)); + } + + /** + * For backwards compatibility. + */ + public void setDontUsePrivateJres(boolean dontUse) { + if (dontUse) { + setJdkPreference(JDK_PREFERENCE_JRE_ONLY); + } + else { + setJdkPreference(JDK_PREFERENCE_PREFER_JRE); + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java new file mode 100755 index 000000000..a28287698 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java @@ -0,0 +1,162 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 24, 2005 + */ +package net.sf.launch4j.ant; + +import java.io.File; + +import net.sf.launch4j.Builder; +import net.sf.launch4j.BuilderException; +import net.sf.launch4j.Log; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.config.ConfigPersisterException; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Launch4jTask extends Task { + private File _configFile; + private AntConfig _config; + + // System properties + private File tmpdir; // launch4j.tmpdir + private File bindir; // launch4j.bindir + + // Override configFile settings + private File jar; + private File outfile; + private String fileVersion; + private String txtFileVersion; + private String productVersion; + private String txtProductVersion; + + public void execute() throws BuildException { + try { + if (tmpdir != null) { + System.setProperty("launch4j.tmpdir", tmpdir.getPath()); + } + if (bindir != null) { + System.setProperty("launch4j.bindir", bindir.getPath()); + } + if (_configFile != null && _config != null) { + throw new BuildException( + Messages.getString("Launch4jTask.specify.config")); + } else if (_configFile != null) { + ConfigPersister.getInstance().load(_configFile); + Config c = ConfigPersister.getInstance().getConfig(); + if (jar != null) { + c.setJar(jar); + } + if (outfile != null) { + c.setOutfile(outfile); + } + if (fileVersion != null) { + c.getVersionInfo().setFileVersion(fileVersion); + } + if (txtFileVersion != null) { + c.getVersionInfo().setTxtFileVersion(txtFileVersion); + } + if (productVersion != null) { + c.getVersionInfo().setProductVersion(productVersion); + } + if (txtProductVersion != null) { + c.getVersionInfo().setTxtProductVersion(txtProductVersion); + } + } else if (_config != null) { + _config.unwrap(); + ConfigPersister.getInstance().setAntConfig(_config, + getProject().getBaseDir()); + } else { + throw new BuildException( + Messages.getString("Launch4jTask.specify.config")); + } + final Builder b = new Builder(Log.getAntLog()); + b.build(); + } catch (ConfigPersisterException e) { + throw new BuildException(e); + } catch (BuilderException e) { + throw new BuildException(e); + } + } + + public void setConfigFile(File configFile) { + _configFile = configFile; + } + + public void addConfig(AntConfig config) { + _config = config; + } + + public void setBindir(File bindir) { + this.bindir = bindir; + } + + public void setTmpdir(File tmpdir) { + this.tmpdir = tmpdir; + } + + public void setFileVersion(String fileVersion) { + this.fileVersion = fileVersion; + } + + public void setJar(File jar) { + this.jar = jar; + } + + public void setJarPath(String path) { + this.jar = new File(path); + } + + public void setOutfile(File outfile) { + this.outfile = outfile; + } + + public void setProductVersion(String productVersion) { + this.productVersion = productVersion; + } + + public void setTxtFileVersion(String txtFileVersion) { + this.txtFileVersion = txtFileVersion; + } + + public void setTxtProductVersion(String txtProductVersion) { + this.txtProductVersion = txtProductVersion; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Messages.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Messages.java new file mode 100755 index 000000000..0f823f7af --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/Messages.java @@ -0,0 +1,55 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.ant; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.ant.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/StringWrapper.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/StringWrapper.java new file mode 100755 index 000000000..6d38af1a5 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/StringWrapper.java @@ -0,0 +1,67 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 18, 2006 + */ +package net.sf.launch4j.ant; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class StringWrapper { + private String text; + + public static List unwrap(List wrappers) { + if (wrappers.isEmpty()) { + return null; + } + List strings = new ArrayList(wrappers.size()); + for (Iterator iter = wrappers.iterator(); iter.hasNext();) { + strings.add(iter.next().toString()); + } + return strings; + } + + public void addText(String text) { + this.text = text; + } + + public String toString() { + return text; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages.properties new file mode 100755 index 000000000..9666633c2 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages.properties @@ -0,0 +1,35 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Launch4jTask.specify.config=Specify configFile or config +AntConfig.duplicate.element=Duplicate element diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages_es.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages_es.properties new file mode 100755 index 000000000..9211e8e03 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/ant/messages_es.properties @@ -0,0 +1,35 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Launch4jTask.specify.config=Specify configFile or config +AntConfig.duplicate.element=Duplicate element diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Binding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Binding.java new file mode 100755 index 000000000..49c9b45ff --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Binding.java @@ -0,0 +1,62 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public interface Binding { + /** Used to mark components with invalid data. */ + public final static Color INVALID_COLOR = Color.PINK; + + /** Java Bean property bound to a component */ + public String getProperty(); + /** Clear component, set it to the default value */ + public void clear(IValidatable bean); + /** Java Bean property -> Component */ + public void put(IValidatable bean); + /** Component -> Java Bean property */ + public void get(IValidatable bean); + /** Mark component as valid */ + public void markValid(); + /** Mark component as invalid */ + public void markInvalid(); + /** Enable or disable the component */ + public void setEnabled(boolean enabled); +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/BindingException.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/BindingException.java new file mode 100755 index 000000000..15dc10cc0 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/BindingException.java @@ -0,0 +1,52 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +/** + * Signals a runtime error, a missing property in a Java Bean for example. + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class BindingException extends RuntimeException { + public BindingException(Throwable t) { + super(t); + } + + public BindingException(String msg) { + super(msg); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Bindings.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Bindings.java new file mode 100755 index 000000000..73f507e49 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Bindings.java @@ -0,0 +1,317 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JRadioButton; +import javax.swing.JTextArea; +import javax.swing.JToggleButton; +import javax.swing.text.JTextComponent; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * Creates and handles bindings. + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Bindings implements PropertyChangeListener { + private final Map _bindings = new HashMap(); + private final Map _optComponents = new HashMap(); + private boolean _modified = false; + + /** + * Used to track component modifications. + */ + public void propertyChange(PropertyChangeEvent evt) { + String prop = evt.getPropertyName(); + if ("AccessibleValue".equals(prop) + || "AccessibleText".equals(prop) + || "AccessibleVisibleData".equals(prop)) { + _modified = true; + } + } + + /** + * Any of the components modified? + */ + public boolean isModified() { + return _modified; + } + + public Binding getBinding(String property) { + return (Binding) _bindings.get(property); + } + + private void registerPropertyChangeListener(JComponent c) { + c.getAccessibleContext().addPropertyChangeListener(this); + } + + private void registerPropertyChangeListener(JComponent[] cs) { + for (int i = 0; i < cs.length; i++) { + cs[i].getAccessibleContext().addPropertyChangeListener(this); + } + } + + private boolean isPropertyNull(IValidatable bean, Binding b) { + try { + for (Iterator iter = _optComponents.keySet().iterator(); iter.hasNext();) { + String property = (String) iter.next(); + if (b.getProperty().startsWith(property)) { + return PropertyUtils.getProperty(bean, property) == null; + } + } + return false; + } catch (Exception e) { + throw new BindingException(e); + } + } + + /** + * Enables or disables all components bound to properties that begin with given prefix. + */ + public void setComponentsEnabled(String prefix, boolean enabled) { + for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { + Binding b = (Binding) iter.next(); + if (b.getProperty().startsWith(prefix)) { + b.setEnabled(enabled); + } + } + } + + /** + * Clear all components, set them to their default values. + * Clears the _modified flag. + */ + public void clear(IValidatable bean) { + for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) { + ((Binding) iter.next()).clear(bean); + } + for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { + ((Binding) iter.next()).clear(bean); + } + _modified = false; + } + + /** + * Copies data from the Java Bean to the UI components. + * Clears the _modified flag. + */ + public void put(IValidatable bean) { + for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) { + ((Binding) iter.next()).put(bean); + } + for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { + Binding b = (Binding) iter.next(); + if (isPropertyNull(bean, b)) { + b.clear(null); + } else { + b.put(bean); + } + } + _modified = false; + } + + /** + * Copies data from UI components to the Java Bean and checks it's class invariants. + * Clears the _modified flag. + * @throws InvariantViolationException + * @throws BindingException + */ + public void get(IValidatable bean) { + try { + for (Iterator iter = _optComponents.values().iterator(); iter.hasNext();) { + ((Binding) iter.next()).get(bean); + } + for (Iterator iter = _bindings.values().iterator(); iter.hasNext();) { + Binding b = (Binding) iter.next(); + if (!isPropertyNull(bean, b)) { + b.get(bean); + } + } + bean.checkInvariants(); + for (Iterator iter = _optComponents.keySet().iterator(); iter.hasNext();) { + String property = (String) iter.next(); + IValidatable component = (IValidatable) PropertyUtils.getProperty(bean, + property); + if (component != null) { + component.checkInvariants(); + } + } + _modified = false; // XXX + } catch (InvariantViolationException e) { + e.setBinding(getBinding(e.getProperty())); + throw e; + } catch (Exception e) { + throw new BindingException(e); + } + } + + private Bindings add(Binding b) { + if (_bindings.containsKey(b.getProperty())) { + throw new BindingException(Messages.getString("Bindings.duplicate.binding")); + } + _bindings.put(b.getProperty(), b); + return this; + } + + /** + * Add an optional (nullable) Java Bean component of type clazz. + */ + public Bindings addOptComponent(String property, Class clazz, JToggleButton c, + boolean enabledByDefault) { + Binding b = new OptComponentBinding(this, property, clazz, c, enabledByDefault); + if (_optComponents.containsKey(property)) { + throw new BindingException(Messages.getString("Bindings.duplicate.binding")); + } + _optComponents.put(property, b); + return this; + } + + /** + * Add an optional (nullable) Java Bean component of type clazz. + */ + public Bindings addOptComponent(String property, Class clazz, JToggleButton c) { + return addOptComponent(property, clazz, c, false); + } + + /** + * Handles JEditorPane, JTextArea, JTextField + */ + public Bindings add(String property, JTextComponent c, String defaultValue) { + registerPropertyChangeListener(c); + return add(new JTextComponentBinding(property, c, defaultValue)); + } + + /** + * Handles JEditorPane, JTextArea, JTextField + */ + public Bindings add(String property, JTextComponent c) { + registerPropertyChangeListener(c); + return add(new JTextComponentBinding(property, c, "")); + } + + /** + * Handles JToggleButton, JCheckBox + */ + public Bindings add(String property, JToggleButton c, boolean defaultValue) { + registerPropertyChangeListener(c); + return add(new JToggleButtonBinding(property, c, defaultValue)); + } + + /** + * Handles JToggleButton, JCheckBox + */ + public Bindings add(String property, JToggleButton c) { + registerPropertyChangeListener(c); + return add(new JToggleButtonBinding(property, c, false)); + } + + /** + * Handles JRadioButton + */ + public Bindings add(String property, JRadioButton[] cs, int defaultValue) { + registerPropertyChangeListener(cs); + return add(new JRadioButtonBinding(property, cs, defaultValue)); + } + + /** + * Handles JRadioButton + */ + public Bindings add(String property, JRadioButton[] cs) { + registerPropertyChangeListener(cs); + return add(new JRadioButtonBinding(property, cs, 0)); + } + + /** + * Handles JTextArea + */ + public Bindings add(String property, JTextArea textArea, String defaultValue) { + registerPropertyChangeListener(textArea); + return add(new JTextComponentBinding(property, textArea, defaultValue)); + } + + /** + * Handles JTextArea lists + */ + public Bindings add(String property, JTextArea textArea) { + registerPropertyChangeListener(textArea); + return add(new JTextAreaBinding(property, textArea)); + } + + /** + * Handles Optional JTextArea lists + */ + public Bindings add(String property, String stateProperty, + JToggleButton button, JTextArea textArea) { + registerPropertyChangeListener(button); + registerPropertyChangeListener(textArea); + return add(new OptJTextAreaBinding(property, stateProperty, button, textArea)); + } + + /** + * Handles JList + */ + public Bindings add(String property, JList list) { + registerPropertyChangeListener(list); + return add(new JListBinding(property, list)); + } + + /** + * Handles JComboBox + */ + public Bindings add(String property, JComboBox combo, int defaultValue) { + registerPropertyChangeListener(combo); + return add(new JComboBoxBinding(property, combo, defaultValue)); + } + + /** + * Handles JComboBox + */ + public Bindings add(String property, JComboBox combo) { + registerPropertyChangeListener(combo); + return add(new JComboBoxBinding(property, combo, 0)); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/IValidatable.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/IValidatable.java new file mode 100755 index 000000000..fe0dd4862 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/IValidatable.java @@ -0,0 +1,44 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2004-01-30 + */ +package net.sf.launch4j.binding; + +/** + * @author Copyright (C) 2004 Grzegorz Kowal + */ +public interface IValidatable { + public void checkInvariants(); +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java new file mode 100755 index 000000000..2f7f88b1d --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java @@ -0,0 +1,67 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jun 23, 2003 + */ +package net.sf.launch4j.binding; + +/** + * @author Copyright (C) 2003 Grzegorz Kowal + */ +public class InvariantViolationException extends RuntimeException { + private final String _property; + private Binding _binding; + + public InvariantViolationException(String msg) { + super(msg); + _property = null; + } + + public InvariantViolationException(String property, String msg) { + super(msg); + _property = property; + } + + public String getProperty() { + return _property; + } + + public Binding getBinding() { + return _binding; + } + + public void setBinding(Binding binding) { + _binding = binding; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java new file mode 100755 index 000000000..81d6ff28e --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java @@ -0,0 +1,119 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2007 Ian Roberts + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 10, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.JComboBox; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2007 Ian Roberts + */ +public class JComboBoxBinding implements Binding { + private final String _property; + private final JComboBox _combo; + private final int _defaultValue; + private final Color _validColor; + + public JComboBoxBinding(String property, JComboBox combo, int defaultValue) { + if (property == null || combo == null) { + throw new NullPointerException(); + } + if (property.equals("") + || combo.getItemCount() == 0 + || defaultValue < 0 || defaultValue >= combo.getItemCount()) { + throw new IllegalArgumentException(); + } + _property = property; + _combo = combo; + _defaultValue = defaultValue; + _validColor = combo.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + select(_defaultValue); + } + + public void put(IValidatable bean) { + try { + Integer i = (Integer) PropertyUtils.getProperty(bean, _property); + if (i == null) { + throw new BindingException( + Messages.getString("JComboBoxBinding.property.null")); + } + select(i.intValue()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + PropertyUtils.setProperty(bean, _property, new Integer(_combo.getSelectedIndex())); + return; + } catch (Exception e) { + throw new BindingException(e); + } + } + + private void select(int index) { + if (index < 0 || index >= _combo.getItemCount()) { + throw new BindingException( + Messages.getString("JComboBoxBinding.index.out.of.bounds")); + } + _combo.setSelectedIndex(index); + } + + public void markValid() { + _combo.setBackground(_validColor); + _combo.requestFocusInWindow(); + } + + public void markInvalid() { + _combo.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _combo.setEnabled(enabled); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JListBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JListBinding.java new file mode 100755 index 000000000..31dec58c1 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JListBinding.java @@ -0,0 +1,118 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.swing.DefaultListModel; +import javax.swing.JList; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class JListBinding implements Binding { + private final String _property; + private final JList _list; + private final Color _validColor; + + public JListBinding(String property, JList list) { + if (property == null || list == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _list = list; + _validColor = _list.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _list.setModel(new DefaultListModel()); + } + + public void put(IValidatable bean) { + try { + DefaultListModel model = new DefaultListModel(); + List list = (List) PropertyUtils.getProperty(bean, _property); + if (list != null) { + for (Iterator iter = list.iterator(); iter.hasNext();) { + model.addElement(iter.next()); + } + } + _list.setModel(model); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + DefaultListModel model = (DefaultListModel) _list.getModel(); + final int size = model.getSize(); + List list = new ArrayList(size); + for (int i = 0; i < size; i++) { + list.add(model.get(i)); + } + PropertyUtils.setProperty(bean, _property, list); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _list.setBackground(_validColor); + _list.requestFocusInWindow(); + } + + public void markInvalid() { + _list.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _list.setEnabled(enabled); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java new file mode 100755 index 000000000..9d922bedf --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java @@ -0,0 +1,146 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 10, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.JRadioButton; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class JRadioButtonBinding implements Binding { + private final String _property; + private final JRadioButton[] _buttons; + private final int _defaultValue; + private final Color _validColor; + + public JRadioButtonBinding(String property, JRadioButton[] buttons, int defaultValue) { + if (property == null || buttons == null) { + throw new NullPointerException(); + } + for (int i = 0; i < buttons.length; i++) { + if (buttons[i] == null) { + throw new NullPointerException(); + } + } + if (property.equals("") + || buttons.length == 0 + || defaultValue < 0 || defaultValue >= buttons.length) { + throw new IllegalArgumentException(); + } + _property = property; + _buttons = buttons; + _defaultValue = defaultValue; + _validColor = buttons[0].getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + select(_defaultValue); + } + + public void put(IValidatable bean) { + try { + Integer i = (Integer) PropertyUtils.getProperty(bean, _property); + if (i == null) { + throw new BindingException( + Messages.getString("JRadioButtonBinding.property.null")); + } + select(i.intValue()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + for (int i = 0; i < _buttons.length; i++) { + if (_buttons[i].isSelected()) { + PropertyUtils.setProperty(bean, _property, new Integer(i)); + return; + } + } + throw new BindingException( + Messages.getString("JRadioButtonBinding.nothing.selected")); + } catch (Exception e) { + throw new BindingException(e); + } + } + + private void select(int index) { + if (index < 0 || index >= _buttons.length) { + throw new BindingException( + Messages.getString("JRadioButtonBinding.index.out.of.bounds")); + } + _buttons[index].setSelected(true); + } + + public void markValid() { + for (int i = 0; i < _buttons.length; i++) { + if (_buttons[i].isSelected()) { + _buttons[i].setBackground(_validColor); + _buttons[i].requestFocusInWindow(); + return; + } + } + throw new BindingException( + Messages.getString("JRadioButtonBinding.nothing.selected")); + } + + public void markInvalid() { + for (int i = 0; i < _buttons.length; i++) { + if (_buttons[i].isSelected()) { + _buttons[i].setBackground(Binding.INVALID_COLOR); + return; + } + } + throw new BindingException( + Messages.getString("JRadioButtonBinding.nothing.selected")); + } + + public void setEnabled(boolean enabled) { + for (int i = 0; i < _buttons.length; i++) { + _buttons[i].setEnabled(enabled); + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java new file mode 100755 index 000000000..d4e8a2c65 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java @@ -0,0 +1,123 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jun 14, 2006 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextArea; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class JTextAreaBinding implements Binding { + private final String _property; + private final JTextArea _textArea; + private final Color _validColor; + + public JTextAreaBinding(String property, JTextArea textArea) { + if (property == null || textArea == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _textArea = textArea; + _validColor = _textArea.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + put(bean); + } + + public void put(IValidatable bean) { + try { + List list = (List) PropertyUtils.getProperty(bean, _property); + StringBuffer sb = new StringBuffer(); + if (list != null) { + for (int i = 0; i < list.size(); i++) { + sb.append(list.get(i)); + if (i < list.size() - 1) { + sb.append("\n"); + } + } + } + _textArea.setText(sb.toString()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + String text = _textArea.getText(); + if (!text.equals("")) { + String[] items = text.split("\n"); + List list = new ArrayList(); + for (int i = 0; i < items.length; i++) { + list.add(items[i]); + } + PropertyUtils.setProperty(bean, _property, list); + } else { + PropertyUtils.setProperty(bean, _property, null); + } + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _textArea.setBackground(_validColor); + _textArea.requestFocusInWindow(); + } + + public void markInvalid() { + _textArea.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _textArea.setEnabled(enabled); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java new file mode 100755 index 000000000..6b0dd1b0b --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java @@ -0,0 +1,108 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.text.JTextComponent; + +import org.apache.commons.beanutils.BeanUtils; + +/** + * Handles JEditorPane, JTextArea, JTextField + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class JTextComponentBinding implements Binding { + private final String _property; + private final JTextComponent _textComponent; + private final String _defaultValue; + private final Color _validColor; + + public JTextComponentBinding(String property, JTextComponent textComponent, + String defaultValue) { + if (property == null || textComponent == null || defaultValue == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _textComponent = textComponent; + _defaultValue = defaultValue; + _validColor = _textComponent.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _textComponent.setText(_defaultValue); + } + + public void put(IValidatable bean) { + try { + String s = BeanUtils.getProperty(bean, _property); + // XXX displays zeros as blank + _textComponent.setText(s != null && !s.equals("0") ? s : ""); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + BeanUtils.setProperty(bean, _property, _textComponent.getText()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _textComponent.setBackground(_validColor); + _textComponent.requestFocusInWindow(); + } + + public void markInvalid() { + _textComponent.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _textComponent.setEnabled(enabled); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java new file mode 100755 index 000000000..a7055cccc --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java @@ -0,0 +1,108 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.JToggleButton; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * Handles JToggleButton, JCheckBox + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class JToggleButtonBinding implements Binding { + private final String _property; + private final JToggleButton _button; + private final boolean _defaultValue; + private final Color _validColor; + + public JToggleButtonBinding(String property, JToggleButton button, + boolean defaultValue) { + if (property == null || button == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _button = button; + _defaultValue = defaultValue; + _validColor = _button.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _button.setSelected(_defaultValue); + } + + public void put(IValidatable bean) { + try { + Boolean b = (Boolean) PropertyUtils.getProperty(bean, _property); + _button.setSelected(b != null && b.booleanValue()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + PropertyUtils.setProperty(bean, _property, + Boolean.valueOf(_button.isSelected())); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _button.setBackground(_validColor); + _button.requestFocusInWindow(); + } + + public void markInvalid() { + _button.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _button.setEnabled(enabled); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Messages.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Messages.java new file mode 100755 index 000000000..91ddff2b1 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Messages.java @@ -0,0 +1,78 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.binding; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.binding.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + private static final MessageFormat FORMATTER = new MessageFormat(""); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(String key, String arg0) { + return getString(key, new Object[] {arg0}); + } + + public static String getString(String key, String arg0, String arg1) { + return getString(key, new Object[] {arg0, arg1}); + } + + public static String getString(String key, String arg0, String arg1, String arg2) { + return getString(key, new Object[] {arg0, arg1, arg2}); + } + + public static String getString(String key, Object[] args) { + try { + FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); + return FORMATTER.format(args); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java new file mode 100755 index 000000000..b573da628 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java @@ -0,0 +1,119 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 11, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; + +import javax.swing.JToggleButton; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class OptComponentBinding implements Binding, ActionListener { + private final Bindings _bindings; + private final String _property; + private final Class _clazz; + private final JToggleButton _button; + private final boolean _enabledByDefault; + + public OptComponentBinding(Bindings bindings, String property, Class clazz, + JToggleButton button, boolean enabledByDefault) { + if (property == null || clazz == null || button == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + if (!Arrays.asList(clazz.getInterfaces()).contains(IValidatable.class)) { + throw new IllegalArgumentException( + Messages.getString("OptComponentBinding.must.implement") + + IValidatable.class); + } + _bindings = bindings; + _property = property; + _clazz = clazz; + _button = button; + _button.addActionListener(this); + _enabledByDefault = enabledByDefault; + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _button.setSelected(_enabledByDefault); + updateComponents(); + } + + public void put(IValidatable bean) { + try { + Object component = PropertyUtils.getProperty(bean, _property); + _button.setSelected(component != null); + updateComponents(); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + PropertyUtils.setProperty(bean, _property, _button.isSelected() + ? _clazz.newInstance() : null); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() {} + + public void markInvalid() {} + + public void setEnabled(boolean enabled) {} // XXX implement? + + public void actionPerformed(ActionEvent e) { + updateComponents(); + } + + private void updateComponents() { + _bindings.setComponentsEnabled(_property, _button.isSelected()); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java new file mode 100755 index 000000000..3cea776d7 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java @@ -0,0 +1,141 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Sep 3, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextArea; +import javax.swing.JToggleButton; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class OptJTextAreaBinding implements Binding, ActionListener { + private final String _property; + private final String _stateProperty; + private final JToggleButton _button; + private final JTextArea _textArea; + private final Color _validColor; + + public OptJTextAreaBinding(String property, String stateProperty, + JToggleButton button, JTextArea textArea) { + if (property == null || button == null || textArea == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _stateProperty = stateProperty; + _button = button; + _textArea = textArea; + _validColor = _textArea.getBackground(); + button.addActionListener(this); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + put(bean); + } + + public void put(IValidatable bean) { + try { + boolean selected = "true".equals(BeanUtils.getProperty(bean, + _stateProperty)); + _button.setSelected(selected); + _textArea.setEnabled(selected); + List list = (List) PropertyUtils.getProperty(bean, _property); + StringBuffer sb = new StringBuffer(); + if (list != null) { + for (int i = 0; i < list.size(); i++) { + sb.append(list.get(i)); + if (i < list.size() - 1) { + sb.append("\n"); + } + } + } + _textArea.setText(sb.toString()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + String text = _textArea.getText(); + if (_button.isSelected() && !text.equals("")) { + String[] items = text.split("\n"); + List list = new ArrayList(); + for (int i = 0; i < items.length; i++) { + list.add(items[i]); + } + PropertyUtils.setProperty(bean, _property, list); + } else { + PropertyUtils.setProperty(bean, _property, null); + } + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _textArea.setBackground(_validColor); + _textArea.requestFocusInWindow(); + } + + public void markInvalid() { + _textArea.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _textArea.setEnabled(enabled); + } + + public void actionPerformed(ActionEvent e) { + _textArea.setEnabled(_button.isSelected()); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Validator.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Validator.java new file mode 100755 index 000000000..88ea67c33 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/Validator.java @@ -0,0 +1,259 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2004-01-30 + */ +package net.sf.launch4j.binding; + +import java.io.File; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; + +import net.sf.launch4j.Util; +import net.sf.launch4j.config.ConfigPersister; + +/** + * @author Copyright (C) 2004 Grzegorz Kowal + */ +public class Validator { + public static final String ALPHANUMERIC_PATTERN = "[\\w]*?"; + public static final String ALPHA_PATTERN = "[\\w&&\\D]*?"; + public static final String NUMERIC_PATTERN = "[\\d]*?"; + public static final String PATH_PATTERN = "[\\w|[ .,:\\-/\\\\]]*?"; + + public static final int MAX_STR = 128; + public static final int MAX_PATH = 260; + public static final int MAX_BIG_STR = 8192; // or 16384; + public static final int MAX_ARGS = 32767 - 2048; + + private Validator() {} + + public static boolean isEmpty(String s) { + return s == null || s.equals(""); + } + + public static void checkNotNull(Object o, String property, String name) { + if (o == null) { + signalViolation(property, + Messages.getString("Validator.empty.field", name)); + } + } + + public static void checkString(String s, int maxLength, String property, + String name) { + if (s == null || s.length() == 0) { + signalViolation(property, + Messages.getString("Validator.empty.field", name)); + } + if (s.length() > maxLength) { + signalLengthViolation(property, name, maxLength); + } + } + + public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, + String property, String name) { + if (strings == null) { + return; + } + int totalLength = 0; + for (Iterator iter = strings.iterator(); iter.hasNext();) { + String s = (String) iter.next(); + checkString(s, maxLength, property, name); + totalLength += s.length(); + if (totalLength > totalMaxLength) { + signalLengthViolation(property, name, totalMaxLength); + } + } + } + + public static void checkString(String s, int maxLength, String pattern, + String property, String name) { + checkString(s, maxLength, property, name); + if (!s.matches(pattern)) { + signalViolation(property, + Messages.getString("Validator.invalid.data", name)); + } + } + + public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, + String pattern, String property, String name, String msg) { + if (strings == null) { + return; + } + int totalLength = 0; + for (Iterator iter = strings.iterator(); iter.hasNext();) { + String s = (String) iter.next(); + checkString(s, maxLength, property, name); + if (!s.matches(pattern)) { + signalViolation(property, msg != null + ? msg + : Messages.getString("Validator.invalid.data", name)); + } + totalLength += s.length(); + if (totalLength > totalMaxLength) { + signalLengthViolation(property, name, totalMaxLength); + } + } + } + + public static void checkOptString(String s, int maxLength, String property, + String name) { + if (s == null || s.length() == 0) { + return; + } + if (s.length() > maxLength) { + signalLengthViolation(property, name, maxLength); + } + } + + public static void checkOptString(String s, int maxLength, String pattern, + String property, String name) { + if (s == null || s.length() == 0) { + return; + } + if (s.length() > maxLength) { + signalLengthViolation(property, name, maxLength); + } + if (!s.matches(pattern)) { + signalViolation(property, + Messages.getString("Validator.invalid.data", name)); + } + } + + public static void checkRange(int value, int min, int max, + String property, String name) { + if (value < min || value > max) { + signalViolation(property, + Messages.getString("Validator.must.be.in.range", name, + String.valueOf(min), String.valueOf(max))); + } + } + + public static void checkRange(char value, char min, char max, + String property, String name) { + if (value < min || value > max) { + signalViolation(property, Messages.getString("Validator.must.be.in.range", + name, String.valueOf(min), String.valueOf(max))); + } + } + + public static void checkMin(int value, int min, String property, String name) { + if (value < min) { + signalViolation(property, + Messages.getString("Validator.must.be.at.least", name, + String.valueOf(min))); + } + } + + public static void checkIn(String s, String[] strings, String property, + String name) { + if (isEmpty(s)) { + signalViolation(property, + Messages.getString("Validator.empty.field", name)); + } + List list = Arrays.asList(strings); + if (!list.contains(s)) { + signalViolation(property, + Messages.getString("Validator.invalid.option", name, list.toString())); + } + } + + public static void checkTrue(boolean condition, String property, String msg) { + if (!condition) { + signalViolation(property, msg); + } + } + + public static void checkFalse(boolean condition, String property, String msg) { + if (condition) { + signalViolation(property, msg); + } + } + + public static void checkElementsNotNullUnique(Collection c, String property, + String msg) { + if (c.contains(null) + || new HashSet(c).size() != c.size()) { + signalViolation(property, + Messages.getString("Validator.already.exists", msg)); + } + } + + public static void checkElementsUnique(Collection c, String property, String msg) { + if (new HashSet(c).size() != c.size()) { + signalViolation(property, + Messages.getString("Validator.already.exists", msg)); + } + } + + public static void checkFile(File f, String property, String fileDescription) { + File cfgPath = ConfigPersister.getInstance().getConfigPath(); + if (f == null + || f.getPath().equals("") + || (!f.exists() && !Util.getAbsoluteFile(cfgPath, f).exists())) { + signalViolation(property, + Messages.getString("Validator.doesnt.exist", fileDescription)); + } + } + + public static void checkOptFile(File f, String property, String fileDescription) { + if (f != null && f.getPath().length() > 0) { + checkFile(f, property, fileDescription); + } + } + + public static void checkRelativeWinPath(String path, String property, String msg) { + if (path == null + || path.equals("") + || path.startsWith("/") + || path.startsWith("\\") + || path.indexOf(':') != -1) { + signalViolation(property, msg); + } + } + + public static void signalLengthViolation(String property, String name, + int maxLength) { + signalViolation(property, + Messages.getString("Validator.exceeds.max.length", name, + String.valueOf(maxLength))); + } + + public static void signalViolation(String property, String msg) { + throw new InvariantViolationException(property, msg); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/messages.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/messages.properties new file mode 100755 index 000000000..adb5a8886 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/messages.properties @@ -0,0 +1,52 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +OptComponentBinding.must.implement=Optional component must implement + +Validator.empty.field=Enter: {0} +Validator.invalid.data=Invalid data: {0} +Validator.must.be.in.range={0} must be in range [{1}-{2}] +Validator.must.be.at.least={0} must be at least +Validator.already.exists={0} already exists. +Validator.doesnt.exist={0} doesn''t exist. +Validator.exceeds.max.length={0} exceeds the maximum length of {1} characters. +Validator.invalid.option={0} must be one of [{1}] + +Bindings.duplicate.binding=Duplicate binding + +JRadioButtonBinding.property.null=Property is null +JRadioButtonBinding.nothing.selected=Nothing selected +JRadioButtonBinding.index.out.of.bounds=Button index out of bounds + +JComboBoxBinding.property.null=Property is null +JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/messages_es.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/messages_es.properties new file mode 100755 index 000000000..e2e50fcb4 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/binding/messages_es.properties @@ -0,0 +1,51 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +OptComponentBinding.must.implement=El componente opcional debe ser implementado + +Validator.empty.field=Introduzca: {0} +Validator.invalid.data=Dato no válido: {0} +Validator.must.be.in.range={0} debe estar en el rango [{1}-{2}] +Validator.must.be.at.least={0} deb ser al menos +Validator.already.exists={0} ya existe. +Validator.doesnt.exist={0} no existe. +Validator.exceeds.max.length={0} excede la longitud máxima de {1} caracteres. +Validator.invalid.option={0} must be one of [{1}] + +Bindings.duplicate.binding=Binding duplicado + +JRadioButtonBinding.property.null=La propiedad es nula +JRadioButtonBinding.nothing.selected=Nada seleccionado +JRadioButtonBinding.index.out.of.bounds=Índice de botón fuera de límite +JComboBoxBinding.property.null=Property is null +JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ClassPath.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ClassPath.java new file mode 100755 index 000000000..da7dbd6c4 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ClassPath.java @@ -0,0 +1,87 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.config; + +import java.util.List; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class ClassPath implements IValidatable { + private String mainClass; + private List paths; + + public void checkInvariants() { + Validator.checkString(mainClass, Validator.MAX_PATH, "mainClass", + Messages.getString("ClassPath.mainClass")); + Validator.checkOptStrings(paths, + Validator.MAX_PATH, + Validator.MAX_BIG_STR, + "paths", + Messages.getString("ClassPath.path")); + } + + public String getMainClass() { + return mainClass; + } + + public void setMainClass(String mainClass) { + this.mainClass = mainClass; + } + + public List getPaths() { + return paths; + } + + public void setPaths(List paths) { + this.paths = paths; + } + + public String getPathsString() { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < paths.size(); i++) { + sb.append(paths.get(i)); + if (i < paths.size() - 1) { + sb.append(';'); + } + } + return sb.toString(); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Config.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Config.java new file mode 100755 index 000000000..27633bfb4 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Config.java @@ -0,0 +1,396 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j.config; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Config implements IValidatable { + + // 1.x config properties_____________________________________________________________ + public static final String HEADER = "header"; + public static final String JAR = "jar"; + public static final String OUTFILE = "outfile"; + public static final String ERR_TITLE = "errTitle"; + public static final String JAR_ARGS = "jarArgs"; + public static final String CHDIR = "chdir"; + public static final String CUSTOM_PROC_NAME = "customProcName"; + public static final String STAY_ALIVE = "stayAlive"; + public static final String ICON = "icon"; + + // __________________________________________________________________________________ + public static final String DOWNLOAD_URL = "http://java.com/download"; + + public static final String GUI_HEADER = "gui"; + public static final String CONSOLE_HEADER = "console"; + + private static final String[] HEADER_TYPES = new String[] { GUI_HEADER, + CONSOLE_HEADER }; + + private static final String[] PRIORITY_CLASS_NAMES = new String[] { "normal", + "idle", + "high" }; + + private static final int[] PRIORITY_CLASSES = new int[] { 0x00000020, + 0x00000040, + 0x00000080 }; + + private boolean dontWrapJar; + private String headerType = GUI_HEADER; + private List headerObjects; + private List libs; + private File jar; + private File outfile; + + // Runtime header configuration + private String errTitle; + private String cmdLine; + private String chdir; + private String priority; + private String downloadUrl; + private String supportUrl; + private boolean customProcName; + private boolean stayAlive; + private File manifest; + private File icon; + private List variables; + private SingleInstance singleInstance; + private ClassPath classPath; + private Jre jre; + private Splash splash; + private VersionInfo versionInfo; + private Msg messages; + + public void checkInvariants() { + Validator.checkTrue(outfile != null && outfile.getPath().endsWith(".exe"), + "outfile", Messages.getString("Config.specify.output.exe")); + if (dontWrapJar) { + if (jar != null && !jar.getPath().equals("")) { + Validator.checkRelativeWinPath(jar.getPath(), "jar", + Messages.getString("Config.application.jar.path")); + } else { + Validator.checkTrue(classPath != null, "classPath", + Messages.getString("ClassPath.or.jar")); + } + } else { + Validator.checkFile(jar, "jar", + Messages.getString("Config.application.jar")); + } + if (!Validator.isEmpty(chdir)) { + Validator.checkRelativeWinPath(chdir, "chdir", + Messages.getString("Config.chdir.relative")); + Validator.checkFalse(chdir.toLowerCase().equals("true") + || chdir.toLowerCase().equals("false"), + "chdir", Messages.getString("Config.chdir.path")); + } + Validator.checkOptFile(manifest, "manifest", Messages.getString("Config.manifest")); + Validator.checkOptFile(icon, "icon", Messages.getString("Config.icon")); + Validator.checkOptString(cmdLine, Validator.MAX_BIG_STR, "jarArgs", + Messages.getString("Config.jar.arguments")); + Validator.checkOptString(errTitle, Validator.MAX_STR, "errTitle", + Messages.getString("Config.error.title")); + Validator.checkOptString(downloadUrl, 256, + "downloadUrl", Messages.getString("Config.download.url")); + Validator.checkOptString(supportUrl, 256, + "supportUrl", Messages.getString("Config.support.url")); + Validator.checkIn(getHeaderType(), HEADER_TYPES, "headerType", + Messages.getString("Config.header.type")); + Validator.checkFalse(getHeaderType().equals(CONSOLE_HEADER) && splash != null, + "headerType", + Messages.getString("Config.splash.not.impl.by.console.hdr")); + Validator.checkOptStrings(variables, + Validator.MAX_ARGS, + Validator.MAX_ARGS, + "[^=%\t]+=[^=\t]+", + "variables", + Messages.getString("Config.variables"), + Messages.getString("Config.variables.err")); + Validator.checkIn(getPriority(), PRIORITY_CLASS_NAMES, "priority", + Messages.getString("Config.priority")); + jre.checkInvariants(); + } + + public void validate() { + checkInvariants(); + if (classPath != null) { + classPath.checkInvariants(); + } + if (splash != null) { + splash.checkInvariants(); + } + if (versionInfo != null) { + versionInfo.checkInvariants(); + } + } + + /** Change current directory to EXE location. */ + public String getChdir() { + return chdir; + } + + public void setChdir(String chdir) { + this.chdir = chdir; + } + + /** Constant command line arguments passed to the application. */ + public String getCmdLine() { + return cmdLine; + } + + public void setCmdLine(String cmdLine) { + this.cmdLine = cmdLine; + } + + /** Optional, error message box title. */ + public String getErrTitle() { + return errTitle; + } + + public void setErrTitle(String errTitle) { + this.errTitle = errTitle; + } + + /** launch4j header file. */ + public String getHeaderType() { + return headerType.toLowerCase(); + } + + public void setHeaderType(String headerType) { + this.headerType = headerType; + } + + /** launch4j header file index - used by GUI. */ + public int getHeaderTypeIndex() { + int x = Arrays.asList(HEADER_TYPES).indexOf(getHeaderType()); + return x != -1 ? x : 0; + } + + public void setHeaderTypeIndex(int headerTypeIndex) { + headerType = HEADER_TYPES[headerTypeIndex]; + } + + public boolean isCustomHeaderObjects() { + return headerObjects != null && !headerObjects.isEmpty(); + } + + public List getHeaderObjects() { + return isCustomHeaderObjects() ? headerObjects + : getHeaderType().equals(GUI_HEADER) + ? LdDefaults.GUI_HEADER_OBJECTS + : LdDefaults.CONSOLE_HEADER_OBJECTS; + } + + public void setHeaderObjects(List headerObjects) { + this.headerObjects = headerObjects; + } + + public boolean isCustomLibs() { + return libs != null && !libs.isEmpty(); + } + + public List getLibs() { + return isCustomLibs() ? libs : LdDefaults.LIBS; + } + + public void setLibs(List libs) { + this.libs = libs; + } + + /** Wrapper's manifest for User Account Control. */ + public File getManifest() { + return manifest; + } + + public void setManifest(File manifest) { + this.manifest = manifest; + } + + /** ICO file. */ + public File getIcon() { + return icon; + } + + public void setIcon(File icon) { + this.icon = icon; + } + + /** Jar to wrap. */ + public File getJar() { + return jar; + } + + public void setJar(File jar) { + this.jar = jar; + } + + public List getVariables() { + return variables; + } + + public void setVariables(List variables) { + this.variables = variables; + } + + public ClassPath getClassPath() { + return classPath; + } + + public void setClassPath(ClassPath classpath) { + this.classPath = classpath; + } + + /** JRE configuration */ + public Jre getJre() { + return jre; + } + + public void setJre(Jre jre) { + this.jre = jre; + } + + /** Output EXE file. */ + public File getOutfile() { + return outfile; + } + + public void setOutfile(File outfile) { + this.outfile = outfile; + } + + /** Custom process name as the output EXE file name. */ + public boolean isCustomProcName() { + return customProcName; + } + + public void setCustomProcName(boolean customProcName) { + this.customProcName = customProcName; + } + + /** Splash screen configuration. */ + public Splash getSplash() { + return splash; + } + + public void setSplash(Splash splash) { + this.splash = splash; + } + + /** Stay alive after launching the application. */ + public boolean isStayAlive() { + return stayAlive; + } + + public void setStayAlive(boolean stayAlive) { + this.stayAlive = stayAlive; + } + + public VersionInfo getVersionInfo() { + return versionInfo; + } + + public void setVersionInfo(VersionInfo versionInfo) { + this.versionInfo = versionInfo; + } + + public boolean isDontWrapJar() { + return dontWrapJar; + } + + public void setDontWrapJar(boolean dontWrapJar) { + this.dontWrapJar = dontWrapJar; + } + + public int getPriorityIndex() { + int x = Arrays.asList(PRIORITY_CLASS_NAMES).indexOf(getPriority()); + return x != -1 ? x : 0; + } + + public void setPriorityIndex(int x) { + priority = PRIORITY_CLASS_NAMES[x]; + } + + public String getPriority() { + return Validator.isEmpty(priority) ? PRIORITY_CLASS_NAMES[0] : priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public int getPriorityClass() { + return PRIORITY_CLASSES[getPriorityIndex()]; + } + + public String getDownloadUrl() { + return downloadUrl == null ? DOWNLOAD_URL : downloadUrl; + } + + public void setDownloadUrl(String downloadUrl) { + this.downloadUrl = downloadUrl; + } + + public String getSupportUrl() { + return supportUrl; + } + + public void setSupportUrl(String supportUrl) { + this.supportUrl = supportUrl; + } + + public Msg getMessages() { + return messages; + } + + public void setMessages(Msg messages) { + this.messages = messages; + } + + public SingleInstance getSingleInstance() { + return singleInstance; + } + + public void setSingleInstance(SingleInstance singleInstance) { + this.singleInstance = singleInstance; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersister.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersister.java new file mode 100755 index 000000000..43daf8681 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersister.java @@ -0,0 +1,249 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 22, 2005 + */ +package net.sf.launch4j.config; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import net.sf.launch4j.Util; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomDriver; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConfigPersister { + + private static final ConfigPersister _instance = new ConfigPersister(); + + private final XStream _xstream; + private Config _config; + private File _configPath; + + private ConfigPersister() { + _xstream = new XStream(new DomDriver()); + _xstream.alias("launch4jConfig", Config.class); + _xstream.alias("classPath", ClassPath.class); + _xstream.alias("jre", Jre.class); + _xstream.alias("splash", Splash.class); + _xstream.alias("versionInfo", VersionInfo.class); + + _xstream.addImplicitCollection(Config.class, "headerObjects", "obj", + String.class); + _xstream.addImplicitCollection(Config.class, "libs", "lib", String.class); + _xstream.addImplicitCollection(Config.class, "variables", "var", String.class); + _xstream.addImplicitCollection(ClassPath.class, "paths", "cp", String.class); + _xstream.addImplicitCollection(Jre.class, "options", "opt", String.class); + } + + public static ConfigPersister getInstance() { + return _instance; + } + + public Config getConfig() { + return _config; + } + + public File getConfigPath() { + return _configPath; + } + + public File getOutputPath() throws IOException { + if (_config.getOutfile().isAbsolute()) { + return _config.getOutfile().getParentFile(); + } + File parent = _config.getOutfile().getParentFile(); + return (parent != null) ? new File(_configPath, parent.getPath()) : _configPath; + } + + public File getOutputFile() throws IOException { + return _config.getOutfile().isAbsolute() + ? _config.getOutfile() + : new File(getOutputPath(), _config.getOutfile().getName()); + } + + public void createBlank() { + _config = new Config(); + _config.setJre(new Jre()); + _configPath = null; + } + + public void setAntConfig(Config c, File basedir) { + _config = c; + _configPath = basedir; + } + + public void load(File f) throws ConfigPersisterException { + try { + FileReader r = new FileReader(f); + char[] buf = new char[(int) f.length()]; + r.read(buf); + r.close(); + // Convert 2.x config to 3.x + String s = String.valueOf(buf) + .replaceAll("0<", "gui<") + .replaceAll("1<", "console<") + .replaceAll("jarArgs>", "cmdLine>") + .replaceAll("", "") + .replaceAll("args>", "opt>") + .replaceAll("", "") + .replaceAll("false", + "" + Jre.JDK_PREFERENCE_PREFER_JRE + "") + .replaceAll("true", + "" + Jre.JDK_PREFERENCE_JRE_ONLY + "") + .replaceAll("0", "") + .replaceAll("0", ""); + _config = (Config) _xstream.fromXML(s); + setConfigPath(f); + } catch (Exception e) { + throw new ConfigPersisterException(e); + } + } + + /** + * Imports launch4j 1.x.x config file. + */ + public void loadVersion1(File f) throws ConfigPersisterException { + try { + Props props = new Props(f); + _config = new Config(); + String header = props.getProperty(Config.HEADER); + _config.setHeaderType(header == null + || header.toLowerCase().equals("guihead.bin") ? Config.GUI_HEADER + : Config.CONSOLE_HEADER); + _config.setJar(props.getFile(Config.JAR)); + _config.setOutfile(props.getFile(Config.OUTFILE)); + _config.setJre(new Jre()); + _config.getJre().setPath(props.getProperty(Jre.PATH)); + _config.getJre().setMinVersion(props.getProperty(Jre.MIN_VERSION)); + _config.getJre().setMaxVersion(props.getProperty(Jre.MAX_VERSION)); + String args = props.getProperty(Jre.ARGS); + if (args != null) { + List jreOptions = new ArrayList(); + jreOptions.add(args); + _config.getJre().setOptions(jreOptions); + } + _config.setCmdLine(props.getProperty(Config.JAR_ARGS)); + _config.setChdir("true".equals(props.getProperty(Config.CHDIR)) + ? "." : null); + _config.setCustomProcName("true".equals( + props.getProperty("setProcName"))); // 1.x + _config.setStayAlive("true".equals(props.getProperty(Config.STAY_ALIVE))); + _config.setErrTitle(props.getProperty(Config.ERR_TITLE)); + _config.setIcon(props.getFile(Config.ICON)); + File splashFile = props.getFile(Splash.SPLASH_FILE); + if (splashFile != null) { + _config.setSplash(new Splash()); + _config.getSplash().setFile(splashFile); + String waitfor = props.getProperty("waitfor"); // 1.x + _config.getSplash().setWaitForWindow(waitfor != null + && !waitfor.equals("")); + String splashTimeout = props.getProperty(Splash.TIMEOUT); + if (splashTimeout != null) { + _config.getSplash().setTimeout(Integer.parseInt(splashTimeout)); + } + _config.getSplash().setTimeoutErr("true".equals( + props.getProperty(Splash.TIMEOUT_ERR))); + } else { + _config.setSplash(null); + } + setConfigPath(f); + } catch (IOException e) { + throw new ConfigPersisterException(e); + } + } + + public void save(File f) throws ConfigPersisterException { + try { + BufferedWriter w = new BufferedWriter(new FileWriter(f)); + _xstream.toXML(_config, w); + w.close(); + setConfigPath(f); + } catch (Exception e) { + throw new ConfigPersisterException(e); + } + } + + private void setConfigPath(File configFile) { + _configPath = configFile.getAbsoluteFile().getParentFile(); + } + + private class Props { + final Properties _properties = new Properties(); + + public Props(File f) throws IOException { + FileInputStream is = null; + try { + is = new FileInputStream(f); + _properties.load(is); + } finally { + Util.close(is); + } + } + + /** + * Get property and remove trailing # comments. + */ + public String getProperty(String key) { + String p = _properties.getProperty(key); + if (p == null) { + return null; + } + int x = p.indexOf('#'); + if (x == -1) { + return p; + } + do { + x--; + } while (x > 0 && (p.charAt(x) == ' ' || p.charAt(x) == '\t')); + return (x == 0) ? "" : p.substring(0, x + 1); + } + + public File getFile(String key) { + String value = getProperty(key); + return value != null ? new File(value) : null; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java new file mode 100755 index 000000000..29940b945 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java @@ -0,0 +1,51 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 22, 2005 + */ +package net.sf.launch4j.config; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConfigPersisterException extends Exception { + + public ConfigPersisterException(String msg, Throwable t) { + super(msg, t); + } + + public ConfigPersisterException(Throwable t) { + super(t); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Jre.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Jre.java new file mode 100755 index 000000000..0df45bb84 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Jre.java @@ -0,0 +1,235 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j.config; + +import java.util.Arrays; +import java.util.List; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Jre implements IValidatable { + + // 1.x config properties_____________________________________________________________ + public static final String PATH = "jrepath"; + public static final String MIN_VERSION = "javamin"; + public static final String MAX_VERSION = "javamax"; + public static final String ARGS = "jvmArgs"; + + // __________________________________________________________________________________ + public static final String VERSION_PATTERN = "(\\d\\.){2}\\d(_\\d+)?"; + + public static final String JDK_PREFERENCE_JRE_ONLY = "jreOnly"; + public static final String JDK_PREFERENCE_PREFER_JRE = "preferJre"; + public static final String JDK_PREFERENCE_PREFER_JDK = "preferJdk"; + public static final String JDK_PREFERENCE_JDK_ONLY = "jdkOnly"; + + private static final String[] JDK_PREFERENCE_NAMES = new String[] { + JDK_PREFERENCE_JRE_ONLY, + JDK_PREFERENCE_PREFER_JRE, + JDK_PREFERENCE_PREFER_JDK, + JDK_PREFERENCE_JDK_ONLY }; + + public static final int DEFAULT_JDK_PREFERENCE_INDEX + = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(JDK_PREFERENCE_PREFER_JRE); + + private String path; + private String minVersion; + private String maxVersion; + private String jdkPreference; + private Integer initialHeapSize; + private Integer initialHeapPercent; + private Integer maxHeapSize; + private Integer maxHeapPercent; + private List options; + + public void checkInvariants() { + Validator.checkOptString(minVersion, 10, VERSION_PATTERN, + "jre.minVersion", Messages.getString("Jre.min.version")); + Validator.checkOptString(maxVersion, 10, VERSION_PATTERN, + "jre.maxVersion", Messages.getString("Jre.max.version")); + if (Validator.isEmpty(path)) { + Validator.checkFalse(Validator.isEmpty(minVersion), + "jre.minVersion", Messages.getString("Jre.specify.jre.min.version.or.path")); + } else { + Validator.checkString(path, Validator.MAX_PATH, + "jre.path", Messages.getString("Jre.bundled.path")); + } + if (!Validator.isEmpty(maxVersion)) { + Validator.checkFalse(Validator.isEmpty(minVersion), + "jre.minVersion", Messages.getString("Jre.specify.min.version")); + Validator.checkTrue(minVersion.compareTo(maxVersion) < 0, + "jre.maxVersion", Messages.getString("Jre.max.greater.than.min")); + } + Validator.checkTrue(initialHeapSize == null || maxHeapSize != null, + "jre.maxHeapSize", Messages.getString("Jre.initial.and.max.heap")); + Validator.checkTrue(initialHeapSize == null || initialHeapSize.intValue() > 0, + "jre.initialHeapSize", Messages.getString("Jre.initial.heap")); + Validator.checkTrue(maxHeapSize == null || (maxHeapSize.intValue() + >= ((initialHeapSize != null) ? initialHeapSize.intValue() : 1)), + "jre.maxHeapSize", Messages.getString("Jre.max.heap")); + Validator.checkTrue(initialHeapPercent == null || maxHeapPercent != null, + "jre.maxHeapPercent", Messages.getString("Jre.initial.and.max.heap")); + if (initialHeapPercent != null) { + Validator.checkRange(initialHeapPercent.intValue(), 1, 100, + "jre.initialHeapPercent", + Messages.getString("Jre.initial.heap.percent")); + } + if (maxHeapPercent != null) { + Validator.checkRange(maxHeapPercent.intValue(), + initialHeapPercent != null ? initialHeapPercent.intValue() : 1, 100, + "jre.maxHeapPercent", + Messages.getString("Jre.max.heap.percent")); + } + Validator.checkIn(getJdkPreference(), JDK_PREFERENCE_NAMES, + "jre.jdkPreference", Messages.getString("Jre.jdkPreference.invalid")); + Validator.checkOptStrings(options, + Validator.MAX_ARGS, + Validator.MAX_ARGS, + "[^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*", + "jre.options", + Messages.getString("Jre.jvm.options"), + Messages.getString("Jre.jvm.options.unclosed.quotation")); + + // Quoted variable references: "[^%]*|([^%]*\"([^%]*%[^%]+%[^%]*)+\"[^%]*)*" + Validator.checkOptStrings(options, + Validator.MAX_ARGS, + Validator.MAX_ARGS, + "[^%]*|([^%]*([^%]*%[^%]+%[^%]*)+[^%]*)*", + "jre.options", + Messages.getString("Jre.jvm.options"), + Messages.getString("Jre.jvm.options.variable")); + } + + /** JVM options */ + public List getOptions() { + return options; + } + + public void setOptions(List options) { + this.options = options; + } + + /** Max Java version (x.x.x) */ + public String getMaxVersion() { + return maxVersion; + } + + public void setMaxVersion(String maxVersion) { + this.maxVersion = maxVersion; + } + + /** Min Java version (x.x.x) */ + public String getMinVersion() { + return minVersion; + } + + public void setMinVersion(String minVersion) { + this.minVersion = minVersion; + } + + /** Preference for standalone JRE or JDK-private JRE */ + public String getJdkPreference() { + return Validator.isEmpty(jdkPreference) ? JDK_PREFERENCE_PREFER_JRE + : jdkPreference; + } + + public void setJdkPreference(String jdkPreference) { + this.jdkPreference = jdkPreference; + } + + /** Preference for standalone JRE or JDK-private JRE */ + public int getJdkPreferenceIndex() { + int x = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(getJdkPreference()); + return x != -1 ? x : DEFAULT_JDK_PREFERENCE_INDEX; + } + + public void setJdkPreferenceIndex(int x) { + jdkPreference = JDK_PREFERENCE_NAMES[x]; + } + + /** JRE path */ + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + /** Initial heap size in MB */ + public Integer getInitialHeapSize() { + return initialHeapSize; + } + + public void setInitialHeapSize(Integer initialHeapSize) { + this.initialHeapSize = getInteger(initialHeapSize); + } + + /** Max heap size in MB */ + public Integer getMaxHeapSize() { + return maxHeapSize; + } + + public void setMaxHeapSize(Integer maxHeapSize) { + this.maxHeapSize = getInteger(maxHeapSize); + } + + public Integer getInitialHeapPercent() { + return initialHeapPercent; + } + + public void setInitialHeapPercent(Integer initialHeapPercent) { + this.initialHeapPercent = getInteger(initialHeapPercent); + } + + public Integer getMaxHeapPercent() { + return maxHeapPercent; + } + + public void setMaxHeapPercent(Integer maxHeapPercent) { + this.maxHeapPercent = getInteger(maxHeapPercent); + } + + /** Convert 0 to null */ + private Integer getInteger(Integer i) { + return i != null && i.intValue() == 0 ? null : i; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/LdDefaults.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/LdDefaults.java new file mode 100755 index 000000000..55f457cc3 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/LdDefaults.java @@ -0,0 +1,62 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Sep 3, 2005 + */ +package net.sf.launch4j.config; + +import java.util.Arrays; +import java.util.List; + +public class LdDefaults { + + public static final List GUI_HEADER_OBJECTS = Arrays.asList(new String[] { + "w32api/crt2.o", + "head/guihead.o", + "head/head.o" }); + + public static final List CONSOLE_HEADER_OBJECTS = Arrays.asList(new String[] { + "w32api/crt2.o", + "head/consolehead.o", + "head/head.o"}); + + public static final List LIBS = Arrays.asList(new String[] { + "w32api/libmingw32.a", + "w32api/libgcc.a", + "w32api/libmsvcrt.a", + "w32api/libkernel32.a", + "w32api/libuser32.a", + "w32api/libadvapi32.a", + "w32api/libshell32.a" }); +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Messages.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Messages.java new file mode 100755 index 000000000..a3f344e59 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Messages.java @@ -0,0 +1,78 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.config; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.config.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + private static final MessageFormat FORMATTER = new MessageFormat(""); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(String key, String arg0) { + return getString(key, new Object[] {arg0}); + } + + public static String getString(String key, String arg0, String arg1) { + return getString(key, new Object[] {arg0, arg1}); + } + + public static String getString(String key, String arg0, String arg1, String arg2) { + return getString(key, new Object[] {arg0, arg1, arg2}); + } + + public static String getString(String key, Object[] args) { + try { + FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); + return FORMATTER.format(args); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Msg.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Msg.java new file mode 100755 index 000000000..ea3acfa34 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Msg.java @@ -0,0 +1,111 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Oct 8, 2006 + */ +package net.sf.launch4j.config; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class Msg implements IValidatable { + private String startupErr; + private String bundledJreErr; + private String jreVersionErr; + private String launcherErr; + private String instanceAlreadyExistsMsg; + + public void checkInvariants() { + Validator.checkOptString(startupErr, 1024, "startupErr", + Messages.getString("Msg.startupErr")); + Validator.checkOptString(bundledJreErr, 1024, "bundledJreErr", + Messages.getString("Msg.bundledJreErr")); + Validator.checkOptString(jreVersionErr, 1024, "jreVersionErr", + Messages.getString("Msg.jreVersionErr")); + Validator.checkOptString(launcherErr, 1024, "launcherErr", + Messages.getString("Msg.launcherErr")); + Validator.checkOptString(instanceAlreadyExistsMsg, 1024, "instanceAlreadyExistsMsg", + Messages.getString("Msg.instanceAlreadyExistsMsg")); + } + + public String getStartupErr() { + return !Validator.isEmpty(startupErr) ? startupErr + : "An error occurred while starting the application."; + } + + public void setStartupErr(String startupErr) { + this.startupErr = startupErr; + } + + public String getBundledJreErr() { + return !Validator.isEmpty(bundledJreErr) ? bundledJreErr + : "This application was configured to use a bundled Java Runtime" + + " Environment but the runtime is missing or corrupted."; + } + + public void setBundledJreErr(String bundledJreErr) { + this.bundledJreErr = bundledJreErr; + } + + public String getJreVersionErr() { + return !Validator.isEmpty(jreVersionErr) ? jreVersionErr + : "This application requires a Java Runtime Environment"; + } + + public void setJreVersionErr(String jreVersionErr) { + this.jreVersionErr = jreVersionErr; + } + + public String getLauncherErr() { + return !Validator.isEmpty(launcherErr) ? launcherErr + : "The registry refers to a nonexistent Java Runtime Environment" + + " installation or the runtime is corrupted."; + } + + public void setLauncherErr(String launcherErr) { + this.launcherErr = launcherErr; + } + + public String getInstanceAlreadyExistsMsg() { + return !Validator.isEmpty(instanceAlreadyExistsMsg) ? instanceAlreadyExistsMsg + : "An application instance is already running."; + } + + public void setInstanceAlreadyExistsMsg(String instanceAlreadyExistsMsg) { + this.instanceAlreadyExistsMsg = instanceAlreadyExistsMsg; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/SingleInstance.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/SingleInstance.java new file mode 100755 index 000000000..0ae340cd7 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/SingleInstance.java @@ -0,0 +1,74 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Created on 2007-09-16 + */ +package net.sf.launch4j.config; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2007 Grzegorz Kowal + */ +public class SingleInstance implements IValidatable { + + private String mutexName; + private String windowTitle; + + public void checkInvariants() { + Validator.checkString(mutexName, Validator.MAX_STR, + "singleInstance.mutexName", + Messages.getString("SingleInstance.mutexName")); + Validator.checkOptString(windowTitle, Validator.MAX_STR, + "singleInstance.windowTitle", + Messages.getString("SingleInstance.windowTitle")); + } + + public String getWindowTitle() { + return windowTitle; + } + + public void setWindowTitle(String appWindowName) { + this.windowTitle = appWindowName; + } + + public String getMutexName() { + return mutexName; + } + + public void setMutexName(String mutexName) { + this.mutexName = mutexName; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Splash.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Splash.java new file mode 100755 index 000000000..f736f8208 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/Splash.java @@ -0,0 +1,103 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j.config; + +import java.io.File; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Splash implements IValidatable { + + // 1.x config properties_____________________________________________________________ + public static final String SPLASH_FILE = "splash"; + public static final String WAIT_FOR_TITLE = "waitForTitle"; + public static final String TIMEOUT = "splashTimeout"; + public static final String TIMEOUT_ERR = "splashTimeoutErr"; + + // __________________________________________________________________________________ + private File file; + private boolean waitForWindow = true; + private int timeout = 60; + private boolean timeoutErr = true; + + public void checkInvariants() { + Validator.checkFile(file, "splash.file", + Messages.getString("Splash.splash.file")); + Validator.checkRange(timeout, 1, 60 * 15, "splash.timeout", + Messages.getString("Splash.splash.timeout")); + } + + /** Splash screen in BMP format. */ + public File getFile() { + return file; + } + + public void setFile(File file) { + this.file = file; + } + + /** Splash timeout in seconds. */ + public int getTimeout() { + return timeout; + } + + public void setTimeout(int timeout) { + this.timeout = timeout; + } + + /** Signal error on splash timeout. */ + public boolean isTimeoutErr() { + return timeoutErr; + } + + public void setTimeoutErr(boolean timeoutErr) { + this.timeoutErr = timeoutErr; + } + + /** Hide splash screen when the child process displayes the first window. */ + public boolean getWaitForWindow() { + return waitForWindow; + } + + public void setWaitForWindow(boolean waitForWindow) { + this.waitForWindow = waitForWindow; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/VersionInfo.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/VersionInfo.java new file mode 100755 index 000000000..d719460c2 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/VersionInfo.java @@ -0,0 +1,168 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 21, 2005 + */ +package net.sf.launch4j.config; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class VersionInfo implements IValidatable { + public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+"; + + private String fileVersion; + private String txtFileVersion; + private String fileDescription; + private String copyright; + private String productVersion; + private String txtProductVersion; + private String productName; + private String companyName; + private String internalName; + private String originalFilename; + + public void checkInvariants() { + Validator.checkString(fileVersion, 20, VERSION_PATTERN, + "versionInfo.fileVersion", + Messages.getString("VersionInfo.file.version")); + Validator.checkString(txtFileVersion, 50, "versionInfo.txtFileVersion", + Messages.getString("VersionInfo.txt.file.version")); + Validator.checkString(fileDescription, 150, "versionInfo.fileDescription", + Messages.getString("VersionInfo.file.description")); + Validator.checkString(copyright, 150, "versionInfo.copyright", + Messages.getString("VersionInfo.copyright")); + Validator.checkString(productVersion, 20, VERSION_PATTERN, + "versionInfo.productVersion", + Messages.getString("VersionInfo.product.version")); + Validator.checkString(txtProductVersion, 50, "versionInfo.txtProductVersion", + Messages.getString("VersionInfo.txt.product.version")); + Validator.checkString(productName, 150, "versionInfo.productName", + Messages.getString("VersionInfo.product.name")); + Validator.checkOptString(companyName, 150, "versionInfo.companyName", + Messages.getString("VersionInfo.company.name")); + Validator.checkString(internalName, 50, "versionInfo.internalName", + Messages.getString("VersionInfo.internal.name")); + Validator.checkTrue(!internalName.endsWith(".exe"), "versionInfo.internalName", + Messages.getString("VersionInfo.internal.name.not.exe")); + Validator.checkString(originalFilename, 50, "versionInfo.originalFilename", + Messages.getString("VersionInfo.original.filename")); + Validator.checkTrue(originalFilename.endsWith(".exe"), + "versionInfo.originalFilename", + Messages.getString("VersionInfo.original.filename.exe")); + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + public String getCopyright() { + return copyright; + } + + public void setCopyright(String copyright) { + this.copyright = copyright; + } + + public String getFileDescription() { + return fileDescription; + } + + public void setFileDescription(String fileDescription) { + this.fileDescription = fileDescription; + } + + public String getFileVersion() { + return fileVersion; + } + + public void setFileVersion(String fileVersion) { + this.fileVersion = fileVersion; + } + + public String getInternalName() { + return internalName; + } + + public void setInternalName(String internalName) { + this.internalName = internalName; + } + + public String getOriginalFilename() { + return originalFilename; + } + + public void setOriginalFilename(String originalFilename) { + this.originalFilename = originalFilename; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProductVersion() { + return productVersion; + } + + public void setProductVersion(String productVersion) { + this.productVersion = productVersion; + } + + public String getTxtFileVersion() { + return txtFileVersion; + } + + public void setTxtFileVersion(String txtFileVersion) { + this.txtFileVersion = txtFileVersion; + } + + public String getTxtProductVersion() { + return txtProductVersion; + } + + public void setTxtProductVersion(String txtProductVersion) { + this.txtProductVersion = txtProductVersion; + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/messages.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/messages.properties new file mode 100755 index 000000000..5753663f4 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/messages.properties @@ -0,0 +1,93 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Splash.splash.file=Splash file +Splash.splash.timeout=Splash timeout + +Config.specify.output.exe=Specify output file with .exe extension. +Config.application.jar=Application jar +Config.application.jar.path=Specify runtime path of the jar relative to the executable. +Config.chdir.relative='chdir' must be a path relative to the executable. +Config.chdir.path='chdir' is now a path instead of a boolean, please check the docs. +Config.manifest=Manifest +Config.icon=Icon +Config.jar.arguments=Jar arguments +Config.error.title=Error title +Config.download.url=Download URL +Config.support.url=Support URL +Config.header.type=Header type +Config.splash.not.impl.by.console.hdr=Splash screen is not implemented by console header. +Config.variables=Environment variables +Config.variables.err=Environment variable assignment should have the form varname=[value][%varref%]... +Config.priority=Process priority + +ClassPath.mainClass=Main class +ClassPath.or.jar=Specify runtime path of a jar or the classpath. +ClassPath.path=Classpath + +VersionInfo.file.version=File version, should be 'x.x.x.x' +VersionInfo.txt.file.version=Free form file version +VersionInfo.file.description=File description +VersionInfo.copyright=Copyright +VersionInfo.product.version=Product version, should be 'x.x.x.x' +VersionInfo.txt.product.version=Free from product version +VersionInfo.product.name=Product name +VersionInfo.company.name=Company name +VersionInfo.internal.name=Internal name +VersionInfo.internal.name.not.exe=Internal name shouldn't have the .exe extension. +VersionInfo.original.filename=Original filename +VersionInfo.original.filename.exe=Original filename should end with the .exe extension. + +Jre.min.version=Minimum JRE version should be x.x.x[_xx] +Jre.max.version=Maximum JRE version should be x.x.x[_xx] +Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path. +Jre.bundled.path=Bundled JRE path +Jre.specify.min.version=Specify minimum JRE version. +Jre.max.greater.than.min=Maximum JRE version must be greater than the minimum.\nTo use a certain JRE version, you may set the min/max range to [1.4.2 - 1.4.2_10] for example. +Jre.initial.and.max.heap=If you change the initial heap size please also specify the maximum size. +Jre.initial.heap=Initial heap size must be greater than 0, leave the field blank to use the JVM default. +Jre.max.heap=Maximum heap size cannot be less than the initial size, leave the field blank to use the JVM default. +Jre.initial.heap.percent=Initial heap % +Jre.max.heap.percent=Maximum heap % +Jre.jdkPreference.invalid=Unrecognised value for JDK preference, should be between 0 and 3 inclusive. +Jre.jvm.options=JVM arguments +Jre.jvm.options.unclosed.quotation=JVM arguments contain an unclosed quotation. +Jre.jvm.options.variable=Invalid environment variable reference. + +Msg.startupErr=Startup error message +Msg.bundledJreErr=Bundled JRE error message +Msg.jreVersionErr=JRE version error message +Msg.launcherErr=Launcher error message + +SingleInstance.mutexName=Mutex name +SingleInstance.windowTitle=Window title diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/config/messages_es.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/messages_es.properties new file mode 100755 index 000000000..5e8659b1f --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/config/messages_es.properties @@ -0,0 +1,75 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Splash.splash.file = Fichero de la pantalla de bienvenida +Splash.splash.timeout = Tiempo de espera de la pantalla de bienvenida + +Config.specify.output.exe = Especifique el fichero de salida con extensi\u00F3n .exe. +Config.application.jar = Aplicaci\u00F3n jar +Config.application.jar.path = Especifique la ruta del jar relativa al ejecutable. +Config.chdir.relative = 'Cambiar al directorio' debe ser una ruta relativa al ejecutable. +Config.chdir.path = 'Cambiar al directorio' ahora es una ruta en lugar de un booleano, por favor consulte la documentaci\u00F3n. +Config.icon = Icono +Config.jar.arguments = Argumentos del jar +Config.error.title = T\u00EDtulo de error +Config.header.type = Tipo de cabecera +Config.splash.not.impl.by.console.hdr = La pantalla de bienvenida no est\u00E1 implementada para la cabecera de tipo consola. + +VersionInfo.file.version = La versi\u00F3n del fichero, deber\u00EDa ser 'x.x.x.x' +VersionInfo.txt.file.version = Forma libre de versi\u00F3n del fichero +VersionInfo.file.description = Descripci\u00F3n del fichero +VersionInfo.copyright = Copyright +VersionInfo.product.version = Versi\u00F3n del producto, deber\u00EDa ser 'x.x.x.x' +VersionInfo.txt.product.version = Forma libre de versi\u00F3n del producto +VersionInfo.product.name = Nombre del producto +VersionInfo.company.name = Nombre de la organizaci\u00F3n +VersionInfo.internal.name = Nombre interno +VersionInfo.internal.name.not.exe = El nombre interno no deber\u00EDa tener extensi\u00F3n .exe. +VersionInfo.original.filename = Nombre original del fichero +VersionInfo.original.filename.exe = El nombre original del fichero debe acabar con extensi\u00F3n .exe. +Jre.min.version = La versi\u00F3n m\u00EDnima del JRE deber\u00EDa ser x.x.x[_xx] +Jre.max.version = La versi\u00F3n m\u00E1xima del JRE deber\u00EDa ser x.x.x[_xx] +Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path. +Jre.bundled.path.rel = La ruta del JRE debe ser relativa al ejecutable. +Jre.specify.min.version = Especifique la versi\u00F3n m\u00EDnima del JRE. +Jre.max.greater.than.min = La versi\u00F3n m\u00E1xima del JRE debe ser mayor que la m\u00EDnima.\nPara usar cierta versi\u00F3n del JRE, puede esyablecer el rango m\u00EDnimo/m\u00E1ximo a [1.4.2 - 1.4.2_10], por ejemplo. +Jre.jvm.options = Argumentos de la JVM + +Msg.startupErr=Startup error message +Msg.bundledJreErr=Bundled JRE error message +Msg.jreVersionErr=JRE version error message +Msg.launcherErr=Launcher error message + +SingleInstance.mutexName=Mutex name +SingleInstance.windowTitle=Window title + diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.java new file mode 100755 index 000000000..4dadbb983 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.java @@ -0,0 +1,283 @@ +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; + +public abstract class BasicForm extends JPanel +{ + protected final JButton _outfileButton = new JButton(); + protected final JLabel _outfileLabel = new JLabel(); + protected final JLabel _iconLabel = new JLabel(); + protected final JLabel _jarLabel = new JLabel(); + protected final JButton _jarButton = new JButton(); + protected final JButton _iconButton = new JButton(); + protected final JLabel _cmdLineLabel = new JLabel(); + protected final JLabel _optionsLabel = new JLabel(); + protected final JLabel _chdirLabel = new JLabel(); + protected final JLabel _processPriorityLabel = new JLabel(); + protected final JRadioButton _normalPriorityRadio = new JRadioButton(); + protected final ButtonGroup _buttongroup1 = new ButtonGroup(); + protected final JRadioButton _idlePriorityRadio = new JRadioButton(); + protected final JRadioButton _highPriorityRadio = new JRadioButton(); + protected final JCheckBox _customProcNameCheck = new JCheckBox(); + protected final JCheckBox _stayAliveCheck = new JCheckBox(); + protected final JTextField _cmdLineField = new JTextField(); + protected final JTextField _chdirField = new JTextField(); + protected final JTextField _iconField = new JTextField(); + protected final JCheckBox _dontWrapJarCheck = new JCheckBox(); + protected final JTextField _jarField = new JTextField(); + protected final JTextField _outfileField = new JTextField(); + protected final JLabel _errorTitleLabel = new JLabel(); + protected final JTextField _errorTitleField = new JTextField(); + protected final JLabel _downloadUrlLabel = new JLabel(); + protected final JTextField _downloadUrlField = new JTextField(); + protected final JLabel _supportUrlLabel = new JLabel(); + protected final JTextField _supportUrlField = new JTextField(); + protected final JTextField _manifestField = new JTextField(); + protected final JButton _manifestButton = new JButton(); + + /** + * Default constructor + */ + public BasicForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _outfileButton.setIcon(loadImage("images/open16.png")); + _outfileButton.setName("outfileButton"); + jpanel1.add(_outfileButton,cc.xy(12,2)); + + _outfileLabel.setIcon(loadImage("images/asterix.gif")); + _outfileLabel.setName("outfileLabel"); + _outfileLabel.setText(Messages.getString("outfile")); + jpanel1.add(_outfileLabel,cc.xy(2,2)); + + _iconLabel.setName("iconLabel"); + _iconLabel.setText(Messages.getString("icon")); + jpanel1.add(_iconLabel,cc.xy(2,10)); + + _jarLabel.setIcon(loadImage("images/asterix.gif")); + _jarLabel.setName("jarLabel"); + _jarLabel.setText(Messages.getString("jar")); + jpanel1.add(_jarLabel,cc.xy(2,4)); + + _jarButton.setIcon(loadImage("images/open16.png")); + _jarButton.setName("jarButton"); + jpanel1.add(_jarButton,cc.xy(12,4)); + + _iconButton.setIcon(loadImage("images/open16.png")); + _iconButton.setName("iconButton"); + jpanel1.add(_iconButton,cc.xy(12,10)); + + _cmdLineLabel.setName("cmdLineLabel"); + _cmdLineLabel.setText(Messages.getString("cmdLine")); + _cmdLineLabel.setToolTipText(""); + jpanel1.add(_cmdLineLabel,cc.xy(2,14)); + + _optionsLabel.setName("optionsLabel"); + _optionsLabel.setText(Messages.getString("options")); + jpanel1.add(_optionsLabel,cc.xy(2,18)); + + _chdirLabel.setName("chdirLabel"); + _chdirLabel.setText(Messages.getString("chdir")); + jpanel1.add(_chdirLabel,cc.xy(2,12)); + + _processPriorityLabel.setName("processPriorityLabel"); + _processPriorityLabel.setText(Messages.getString("priority")); + jpanel1.add(_processPriorityLabel,cc.xy(2,16)); + + _normalPriorityRadio.setActionCommand(Messages.getString("normalPriority")); + _normalPriorityRadio.setName("normalPriorityRadio"); + _normalPriorityRadio.setText(Messages.getString("normalPriority")); + _buttongroup1.add(_normalPriorityRadio); + jpanel1.add(_normalPriorityRadio,cc.xy(4,16)); + + _idlePriorityRadio.setActionCommand(Messages.getString("idlePriority")); + _idlePriorityRadio.setName("idlePriorityRadio"); + _idlePriorityRadio.setText(Messages.getString("idlePriority")); + _buttongroup1.add(_idlePriorityRadio); + jpanel1.add(_idlePriorityRadio,cc.xy(6,16)); + + _highPriorityRadio.setActionCommand(Messages.getString("highPriority")); + _highPriorityRadio.setName("highPriorityRadio"); + _highPriorityRadio.setText(Messages.getString("highPriority")); + _buttongroup1.add(_highPriorityRadio); + jpanel1.add(_highPriorityRadio,cc.xy(8,16)); + + _customProcNameCheck.setActionCommand("Custom process name"); + _customProcNameCheck.setName("customProcNameCheck"); + _customProcNameCheck.setText(Messages.getString("customProcName")); + jpanel1.add(_customProcNameCheck,cc.xywh(4,18,7,1)); + + _stayAliveCheck.setActionCommand("Stay alive after launching a GUI application"); + _stayAliveCheck.setName("stayAliveCheck"); + _stayAliveCheck.setText(Messages.getString("stayAlive")); + jpanel1.add(_stayAliveCheck,cc.xywh(4,20,7,1)); + + _cmdLineField.setName("cmdLineField"); + _cmdLineField.setToolTipText(Messages.getString("cmdLineTip")); + jpanel1.add(_cmdLineField,cc.xywh(4,14,7,1)); + + _chdirField.setName("chdirField"); + _chdirField.setToolTipText(Messages.getString("chdirTip")); + jpanel1.add(_chdirField,cc.xywh(4,12,7,1)); + + _iconField.setName("iconField"); + _iconField.setToolTipText(Messages.getString("iconTip")); + jpanel1.add(_iconField,cc.xywh(4,10,7,1)); + + _dontWrapJarCheck.setActionCommand("Don't wrap the jar, launch it only"); + _dontWrapJarCheck.setName("dontWrapJarCheck"); + _dontWrapJarCheck.setText(Messages.getString("dontWrapJar")); + jpanel1.add(_dontWrapJarCheck,cc.xywh(4,6,7,1)); + + _jarField.setName("jarField"); + _jarField.setToolTipText(Messages.getString("jarTip")); + jpanel1.add(_jarField,cc.xywh(4,4,7,1)); + + _outfileField.setName("outfileField"); + _outfileField.setToolTipText(Messages.getString("outfileTip")); + jpanel1.add(_outfileField,cc.xywh(4,2,7,1)); + + TitledSeparator titledseparator1 = new TitledSeparator(); + titledseparator1.setText(Messages.getString("downloadAndSupport")); + jpanel1.add(titledseparator1,cc.xywh(2,22,11,1)); + + _errorTitleLabel.setName("errorTitleLabel"); + _errorTitleLabel.setText(Messages.getString("errorTitle")); + jpanel1.add(_errorTitleLabel,cc.xy(2,24)); + + _errorTitleField.setName("errorTitleField"); + _errorTitleField.setToolTipText(Messages.getString("errorTitleTip")); + jpanel1.add(_errorTitleField,cc.xywh(4,24,7,1)); + + _downloadUrlLabel.setIcon(loadImage("images/asterix.gif")); + _downloadUrlLabel.setName("downloadUrlLabel"); + _downloadUrlLabel.setText(Messages.getString("downloadUrl")); + jpanel1.add(_downloadUrlLabel,cc.xy(2,26)); + + _downloadUrlField.setName("downloadUrlField"); + jpanel1.add(_downloadUrlField,cc.xywh(4,26,7,1)); + + _supportUrlLabel.setName("supportUrlLabel"); + _supportUrlLabel.setText(Messages.getString("supportUrl")); + jpanel1.add(_supportUrlLabel,cc.xy(2,28)); + + _supportUrlField.setName("supportUrlField"); + jpanel1.add(_supportUrlField,cc.xywh(4,28,7,1)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText(Messages.getString("manifest")); + jpanel1.add(jlabel1,cc.xy(2,8)); + + _manifestField.setName("manifestField"); + _manifestField.setToolTipText(Messages.getString("manifestTip")); + jpanel1.add(_manifestField,cc.xywh(4,8,7,1)); + + _manifestButton.setIcon(loadImage("images/open16.png")); + _manifestButton.setName("manifestButton"); + jpanel1.add(_manifestButton,cc.xy(12,8)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm new file mode 100755 index 000000000..1d8a9ad58 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.java new file mode 100755 index 000000000..9f4f52471 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.java @@ -0,0 +1,193 @@ +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +public abstract class ClassPathForm extends JPanel +{ + protected final JTextField _classpathField = new JTextField(); + protected final JLabel _classpathFieldLabel = new JLabel(); + protected final JLabel _classpathListLabel = new JLabel(); + protected final JList _classpathList = new JList(); + protected final JLabel _mainclassLabel = new JLabel(); + protected final JTextField _mainclassField = new JTextField(); + protected final JButton _acceptClasspathButton = new JButton(); + protected final JButton _removeClasspathButton = new JButton(); + protected final JButton _importClasspathButton = new JButton(); + protected final JButton _classpathUpButton = new JButton(); + protected final JButton _classpathDownButton = new JButton(); + protected final JCheckBox _classpathCheck = new JCheckBox(); + protected final JButton _newClasspathButton = new JButton(); + + /** + * Default constructor + */ + public ClassPathForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _classpathField.setName("classpathField"); + jpanel1.add(_classpathField,cc.xywh(4,11,7,1)); + + _classpathFieldLabel.setIcon(loadImage("images/asterix.gif")); + _classpathFieldLabel.setName("classpathFieldLabel"); + _classpathFieldLabel.setText(Messages.getString("editClassPath")); + jpanel1.add(_classpathFieldLabel,cc.xy(2,11)); + + _classpathListLabel.setName("classpathListLabel"); + _classpathListLabel.setText(Messages.getString("classPath")); + jpanel1.add(_classpathListLabel,cc.xy(2,6)); + + _classpathList.setName("classpathList"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_classpathList); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xywh(4,6,7,4)); + + _mainclassLabel.setIcon(loadImage("images/asterix.gif")); + _mainclassLabel.setName("mainclassLabel"); + _mainclassLabel.setText(Messages.getString("mainClass")); + jpanel1.add(_mainclassLabel,cc.xy(2,4)); + + _mainclassField.setName("mainclassField"); + jpanel1.add(_mainclassField,cc.xywh(4,4,7,1)); + + _acceptClasspathButton.setActionCommand("Add"); + _acceptClasspathButton.setIcon(loadImage("images/ok16.png")); + _acceptClasspathButton.setName("acceptClasspathButton"); + _acceptClasspathButton.setText(Messages.getString("accept")); + jpanel1.add(_acceptClasspathButton,cc.xy(8,13)); + + _removeClasspathButton.setActionCommand("Remove"); + _removeClasspathButton.setIcon(loadImage("images/cancel16.png")); + _removeClasspathButton.setName("removeClasspathButton"); + _removeClasspathButton.setText(Messages.getString("remove")); + jpanel1.add(_removeClasspathButton,cc.xy(10,13)); + + _importClasspathButton.setIcon(loadImage("images/open16.png")); + _importClasspathButton.setName("importClasspathButton"); + _importClasspathButton.setToolTipText(Messages.getString("importClassPath")); + jpanel1.add(_importClasspathButton,cc.xy(12,4)); + + _classpathUpButton.setIcon(loadImage("images/up16.png")); + _classpathUpButton.setName("classpathUpButton"); + jpanel1.add(_classpathUpButton,cc.xy(12,6)); + + _classpathDownButton.setIcon(loadImage("images/down16.png")); + _classpathDownButton.setName("classpathDownButton"); + jpanel1.add(_classpathDownButton,cc.xy(12,8)); + + _classpathCheck.setActionCommand("Custom classpath"); + _classpathCheck.setName("classpathCheck"); + _classpathCheck.setText(Messages.getString("customClassPath")); + jpanel1.add(_classpathCheck,cc.xy(4,2)); + + _newClasspathButton.setActionCommand("New"); + _newClasspathButton.setIcon(loadImage("images/new16.png")); + _newClasspathButton.setName("newClasspathButton"); + _newClasspathButton.setText(Messages.getString("new")); + jpanel1.add(_newClasspathButton,cc.xy(6,13)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm new file mode 100755 index 000000000..764329d2b Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.java new file mode 100755 index 000000000..b3c6fffed --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.java @@ -0,0 +1,132 @@ +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; + +public abstract class ConfigForm extends JPanel +{ + protected final JTextArea _logTextArea = new JTextArea(); + protected final TitledSeparator _logSeparator = new TitledSeparator(); + protected final JTabbedPane _tab = new JTabbedPane(); + + /** + * Default constructor + */ + public ConfigForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _logTextArea.setName("logTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_logTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xy(2,6)); + + _logSeparator.setName("logSeparator"); + _logSeparator.setText(Messages.getString("log")); + jpanel1.add(_logSeparator,cc.xy(2,4)); + + _tab.setName("tab"); + jpanel1.add(_tab,cc.xywh(1,2,3,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,4,5,6,7 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm new file mode 100755 index 000000000..2c6721e14 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java new file mode 100755 index 000000000..f2b79e6e7 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java @@ -0,0 +1,127 @@ +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public abstract class EnvironmentVarsForm extends JPanel +{ + protected final JTextArea _envVarsTextArea = new JTextArea(); + protected final JLabel _envVarsLabel = new JLabel(); + + /** + * Default constructor + */ + public EnvironmentVarsForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _envVarsTextArea.setName("envVarsTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_envVarsTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xy(4,2)); + + _envVarsLabel.setName("envVarsLabel"); + _envVarsLabel.setText(Messages.getString("setVariables")); + jpanel1.add(_envVarsLabel,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm new file mode 100755 index 000000000..6e89ec4d1 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.java new file mode 100755 index 000000000..91c40024a --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.java @@ -0,0 +1,171 @@ +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public abstract class HeaderForm extends JPanel +{ + protected final JLabel _headerTypeLabel = new JLabel(); + protected final JRadioButton _guiHeaderRadio = new JRadioButton(); + protected final ButtonGroup _headerButtonGroup = new ButtonGroup(); + protected final JRadioButton _consoleHeaderRadio = new JRadioButton(); + protected final JTextArea _headerObjectsTextArea = new JTextArea(); + protected final JTextArea _libsTextArea = new JTextArea(); + protected final JCheckBox _headerObjectsCheck = new JCheckBox(); + protected final JCheckBox _libsCheck = new JCheckBox(); + protected final TitledSeparator _linkerOptionsSeparator = new TitledSeparator(); + + /** + * Default constructor + */ + public HeaderForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(0.2),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _headerTypeLabel.setName("headerTypeLabel"); + _headerTypeLabel.setText(Messages.getString("headerType")); + jpanel1.add(_headerTypeLabel,cc.xy(2,2)); + + _guiHeaderRadio.setActionCommand("GUI"); + _guiHeaderRadio.setName("guiHeaderRadio"); + _guiHeaderRadio.setText(Messages.getString("gui")); + _headerButtonGroup.add(_guiHeaderRadio); + jpanel1.add(_guiHeaderRadio,cc.xy(4,2)); + + _consoleHeaderRadio.setActionCommand("Console"); + _consoleHeaderRadio.setName("consoleHeaderRadio"); + _consoleHeaderRadio.setText(Messages.getString("console")); + _headerButtonGroup.add(_consoleHeaderRadio); + jpanel1.add(_consoleHeaderRadio,cc.xy(6,2)); + + _headerObjectsTextArea.setName("headerObjectsTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_headerObjectsTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xywh(4,6,4,1)); + + _libsTextArea.setName("libsTextArea"); + JScrollPane jscrollpane2 = new JScrollPane(); + jscrollpane2.setViewportView(_libsTextArea); + jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane2,cc.xywh(4,8,4,1)); + + _headerObjectsCheck.setActionCommand("Object files"); + _headerObjectsCheck.setName("headerObjectsCheck"); + _headerObjectsCheck.setText(Messages.getString("objectFiles")); + jpanel1.add(_headerObjectsCheck,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _libsCheck.setActionCommand("w32api"); + _libsCheck.setName("libsCheck"); + _libsCheck.setText(Messages.getString("libs")); + jpanel1.add(_libsCheck,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _linkerOptionsSeparator.setName("linkerOptionsSeparator"); + _linkerOptionsSeparator.setText(Messages.getString("linkerOptions")); + jpanel1.add(_linkerOptionsSeparator,cc.xywh(2,4,6,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm new file mode 100755 index 000000000..a7cbed144 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.java new file mode 100755 index 000000000..ed16c50b6 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.java @@ -0,0 +1,266 @@ +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +public abstract class JreForm extends JPanel +{ + protected final JLabel _jrePathLabel = new JLabel(); + protected final JLabel _jreMinLabel = new JLabel(); + protected final JLabel _jreMaxLabel = new JLabel(); + protected final JLabel _jvmOptionsTextLabel = new JLabel(); + protected final JTextField _jrePathField = new JTextField(); + protected final JTextField _jreMinField = new JTextField(); + protected final JTextField _jreMaxField = new JTextField(); + protected final JTextArea _jvmOptionsTextArea = new JTextArea(); + protected final JLabel _initialHeapSizeLabel = new JLabel(); + protected final JLabel _maxHeapSizeLabel = new JLabel(); + protected final JTextField _initialHeapSizeField = new JTextField(); + protected final JTextField _maxHeapSizeField = new JTextField(); + protected final JComboBox _varCombo = new JComboBox(); + protected final JButton _propertyButton = new JButton(); + protected final JButton _optionButton = new JButton(); + protected final JButton _envPropertyButton = new JButton(); + protected final JButton _envOptionButton = new JButton(); + protected final JTextField _envVarField = new JTextField(); + protected final JTextField _maxHeapPercentField = new JTextField(); + protected final JTextField _initialHeapPercentField = new JTextField(); + protected final JComboBox _jdkPreferenceCombo = new JComboBox(); + + /** + * Default constructor + */ + public JreForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _jrePathLabel.setName("jrePathLabel"); + _jrePathLabel.setText(Messages.getString("jrePath")); + jpanel1.add(_jrePathLabel,cc.xy(2,2)); + + _jreMinLabel.setName("jreMinLabel"); + _jreMinLabel.setText(Messages.getString("jreMin")); + jpanel1.add(_jreMinLabel,cc.xy(2,4)); + + _jreMaxLabel.setName("jreMaxLabel"); + _jreMaxLabel.setText(Messages.getString("jreMax")); + jpanel1.add(_jreMaxLabel,cc.xy(2,6)); + + _jvmOptionsTextLabel.setName("jvmOptionsTextLabel"); + _jvmOptionsTextLabel.setText(Messages.getString("jvmOptions")); + jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _jrePathField.setName("jrePathField"); + _jrePathField.setToolTipText(Messages.getString("jrePathTip")); + jpanel1.add(_jrePathField,cc.xywh(4,2,7,1)); + + _jreMinField.setName("jreMinField"); + jpanel1.add(_jreMinField,cc.xy(4,4)); + + _jreMaxField.setName("jreMaxField"); + jpanel1.add(_jreMaxField,cc.xy(4,6)); + + _jvmOptionsTextArea.setName("jvmOptionsTextArea"); + _jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip")); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_jvmOptionsTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xywh(4,12,7,1)); + + _initialHeapSizeLabel.setName("initialHeapSizeLabel"); + _initialHeapSizeLabel.setText(Messages.getString("initialHeapSize")); + jpanel1.add(_initialHeapSizeLabel,cc.xy(2,8)); + + _maxHeapSizeLabel.setName("maxHeapSizeLabel"); + _maxHeapSizeLabel.setText(Messages.getString("maxHeapSize")); + jpanel1.add(_maxHeapSizeLabel,cc.xy(2,10)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText("MB"); + jpanel1.add(jlabel1,cc.xy(6,8)); + + JLabel jlabel2 = new JLabel(); + jlabel2.setText("MB"); + jpanel1.add(jlabel2,cc.xy(6,10)); + + _initialHeapSizeField.setName("initialHeapSizeField"); + jpanel1.add(_initialHeapSizeField,cc.xy(4,8)); + + _maxHeapSizeField.setName("maxHeapSizeField"); + jpanel1.add(_maxHeapSizeField,cc.xy(4,10)); + + jpanel1.add(createPanel1(),cc.xywh(2,14,9,1)); + _maxHeapPercentField.setName("maxHeapPercentField"); + jpanel1.add(_maxHeapPercentField,cc.xy(8,10)); + + _initialHeapPercentField.setName("initialHeapPercentField"); + jpanel1.add(_initialHeapPercentField,cc.xy(8,8)); + + _jdkPreferenceCombo.setName("jdkPreferenceCombo"); + jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,4,3,1)); + + JLabel jlabel3 = new JLabel(); + jlabel3.setText(Messages.getString("freeMemory")); + jpanel1.add(jlabel3,cc.xy(10,8)); + + JLabel jlabel4 = new JLabel(); + jlabel4.setText(Messages.getString("freeMemory")); + jpanel1.add(jlabel4,cc.xy(10,10)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }); + return jpanel1; + } + + public JPanel createPanel1() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _varCombo.setName("varCombo"); + jpanel1.add(_varCombo,cc.xy(3,1)); + + _propertyButton.setActionCommand("Add"); + _propertyButton.setIcon(loadImage("images/edit_add16.png")); + _propertyButton.setName("propertyButton"); + _propertyButton.setText(Messages.getString("property")); + _propertyButton.setToolTipText(Messages.getString("propertyTip")); + jpanel1.add(_propertyButton,cc.xy(5,1)); + + _optionButton.setActionCommand("Add"); + _optionButton.setIcon(loadImage("images/edit_add16.png")); + _optionButton.setName("optionButton"); + _optionButton.setText(Messages.getString("option")); + _optionButton.setToolTipText(Messages.getString("optionTip")); + jpanel1.add(_optionButton,cc.xy(7,1)); + + _envPropertyButton.setActionCommand("Add"); + _envPropertyButton.setIcon(loadImage("images/edit_add16.png")); + _envPropertyButton.setName("envPropertyButton"); + _envPropertyButton.setText(Messages.getString("property")); + _envPropertyButton.setToolTipText(Messages.getString("propertyTip")); + jpanel1.add(_envPropertyButton,cc.xy(5,3)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText(Messages.getString("varsAndRegistry")); + jpanel1.add(jlabel1,cc.xy(1,1)); + + JLabel jlabel2 = new JLabel(); + jlabel2.setIcon(loadImage("images/asterix.gif")); + jlabel2.setText(Messages.getString("envVar")); + jpanel1.add(jlabel2,cc.xy(1,3)); + + _envOptionButton.setActionCommand("Add"); + _envOptionButton.setIcon(loadImage("images/edit_add16.png")); + _envOptionButton.setName("envOptionButton"); + _envOptionButton.setText(Messages.getString("option")); + _envOptionButton.setToolTipText(Messages.getString("optionTip")); + jpanel1.add(_envOptionButton,cc.xy(7,3)); + + _envVarField.setName("envVarField"); + jpanel1.add(_envVarField,cc.xy(3,3)); + + addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.jfrm new file mode 100755 index 000000000..1e61237e0 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/JreForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/Messages.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/Messages.java new file mode 100755 index 000000000..aaf995f80 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/Messages.java @@ -0,0 +1,55 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.form; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.form.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.java new file mode 100755 index 000000000..f2e8723da --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.java @@ -0,0 +1,183 @@ +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public abstract class MessagesForm extends JPanel +{ + protected final JTextArea _startupErrTextArea = new JTextArea(); + protected final JTextArea _bundledJreErrTextArea = new JTextArea(); + protected final JTextArea _jreVersionErrTextArea = new JTextArea(); + protected final JTextArea _launcherErrTextArea = new JTextArea(); + protected final JCheckBox _messagesCheck = new JCheckBox(); + protected final JTextArea _instanceAlreadyExistsMsgTextArea = new JTextArea(); + + /** + * Default constructor + */ + public MessagesForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _startupErrTextArea.setName("startupErrTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_startupErrTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xy(4,4)); + + _bundledJreErrTextArea.setName("bundledJreErrTextArea"); + JScrollPane jscrollpane2 = new JScrollPane(); + jscrollpane2.setViewportView(_bundledJreErrTextArea); + jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane2,cc.xy(4,6)); + + _jreVersionErrTextArea.setName("jreVersionErrTextArea"); + _jreVersionErrTextArea.setToolTipText(Messages.getString("jreVersionErrTip")); + JScrollPane jscrollpane3 = new JScrollPane(); + jscrollpane3.setViewportView(_jreVersionErrTextArea); + jscrollpane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane3,cc.xy(4,8)); + + _launcherErrTextArea.setName("launcherErrTextArea"); + JScrollPane jscrollpane4 = new JScrollPane(); + jscrollpane4.setViewportView(_launcherErrTextArea); + jscrollpane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane4,cc.xy(4,10)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText(Messages.getString("startupErr")); + jpanel1.add(jlabel1,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + JLabel jlabel2 = new JLabel(); + jlabel2.setText(Messages.getString("bundledJreErr")); + jpanel1.add(jlabel2,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + JLabel jlabel3 = new JLabel(); + jlabel3.setText(Messages.getString("jreVersionErr")); + jpanel1.add(jlabel3,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + JLabel jlabel4 = new JLabel(); + jlabel4.setText(Messages.getString("launcherErr")); + jpanel1.add(jlabel4,new CellConstraints(2,10,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _messagesCheck.setActionCommand("Add version information"); + _messagesCheck.setName("messagesCheck"); + _messagesCheck.setText(Messages.getString("addMessages")); + jpanel1.add(_messagesCheck,cc.xy(4,2)); + + JLabel jlabel5 = new JLabel(); + jlabel5.setText(Messages.getString("instanceAlreadyExistsMsg")); + jpanel1.add(jlabel5,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _instanceAlreadyExistsMsgTextArea.setName("instanceAlreadyExistsMsgTextArea"); + _instanceAlreadyExistsMsgTextArea.setToolTipText(Messages.getString("instanceAlreadyExistsMsgTip")); + JScrollPane jscrollpane5 = new JScrollPane(); + jscrollpane5.setViewportView(_instanceAlreadyExistsMsgTextArea); + jscrollpane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane5,cc.xy(4,12)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm new file mode 100755 index 000000000..e8044dfd7 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java new file mode 100755 index 000000000..2bfe724a6 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java @@ -0,0 +1,141 @@ +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +public abstract class SingleInstanceForm extends JPanel +{ + protected final JLabel _splashFileLabel = new JLabel(); + protected final JTextField _mutexNameField = new JTextField(); + protected final JCheckBox _singleInstanceCheck = new JCheckBox(); + protected final JTextField _windowTitleField = new JTextField(); + protected final JLabel _splashFileLabel1 = new JLabel(); + + /** + * Default constructor + */ + public SingleInstanceForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _splashFileLabel.setIcon(loadImage("images/asterix.gif")); + _splashFileLabel.setName("splashFileLabel"); + _splashFileLabel.setText(Messages.getString("mutexName")); + jpanel1.add(_splashFileLabel,cc.xy(2,4)); + + _mutexNameField.setName("mutexNameField"); + _mutexNameField.setToolTipText(Messages.getString("mutexNameTip")); + jpanel1.add(_mutexNameField,cc.xywh(4,4,2,1)); + + _singleInstanceCheck.setActionCommand("Enable splash screen"); + _singleInstanceCheck.setName("singleInstanceCheck"); + _singleInstanceCheck.setText(Messages.getString("enableSingleInstance")); + jpanel1.add(_singleInstanceCheck,cc.xywh(4,2,2,1)); + + _windowTitleField.setName("windowTitleField"); + _windowTitleField.setToolTipText(Messages.getString("windowTitleTip")); + jpanel1.add(_windowTitleField,cc.xywh(4,6,2,1)); + + _splashFileLabel1.setName("splashFileLabel"); + _splashFileLabel1.setText(Messages.getString("windowTitle")); + jpanel1.add(_splashFileLabel1,cc.xy(2,6)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm new file mode 100755 index 000000000..c9d7ce28d Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.java new file mode 100755 index 000000000..22a0ed8a3 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.java @@ -0,0 +1,166 @@ +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +public abstract class SplashForm extends JPanel +{ + protected final JLabel _splashFileLabel = new JLabel(); + protected final JLabel _waitForWindowLabel = new JLabel(); + protected final JLabel _timeoutLabel = new JLabel(); + protected final JCheckBox _timeoutErrCheck = new JCheckBox(); + protected final JTextField _splashFileField = new JTextField(); + protected final JTextField _timeoutField = new JTextField(); + protected final JButton _splashFileButton = new JButton(); + protected final JCheckBox _splashCheck = new JCheckBox(); + protected final JCheckBox _waitForWindowCheck = new JCheckBox(); + + /** + * Default constructor + */ + public SplashForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _splashFileLabel.setIcon(loadImage("images/asterix.gif")); + _splashFileLabel.setName("splashFileLabel"); + _splashFileLabel.setText(Messages.getString("splashFile")); + jpanel1.add(_splashFileLabel,cc.xy(2,4)); + + _waitForWindowLabel.setName("waitForWindowLabel"); + _waitForWindowLabel.setText(Messages.getString("waitForWindow")); + jpanel1.add(_waitForWindowLabel,cc.xy(2,6)); + + _timeoutLabel.setIcon(loadImage("images/asterix.gif")); + _timeoutLabel.setName("timeoutLabel"); + _timeoutLabel.setText(Messages.getString("timeout")); + jpanel1.add(_timeoutLabel,cc.xy(2,8)); + + _timeoutErrCheck.setActionCommand("Signal error on timeout"); + _timeoutErrCheck.setName("timeoutErrCheck"); + _timeoutErrCheck.setText(Messages.getString("timeoutErr")); + _timeoutErrCheck.setToolTipText(Messages.getString("timeoutErrTip")); + jpanel1.add(_timeoutErrCheck,cc.xywh(4,10,2,1)); + + _splashFileField.setName("splashFileField"); + _splashFileField.setToolTipText(Messages.getString("splashFileTip")); + jpanel1.add(_splashFileField,cc.xywh(4,4,2,1)); + + _timeoutField.setName("timeoutField"); + _timeoutField.setToolTipText(Messages.getString("timeoutTip")); + jpanel1.add(_timeoutField,cc.xy(4,8)); + + _splashFileButton.setIcon(loadImage("images/open16.png")); + _splashFileButton.setName("splashFileButton"); + jpanel1.add(_splashFileButton,cc.xy(7,4)); + + _splashCheck.setActionCommand("Enable splash screen"); + _splashCheck.setName("splashCheck"); + _splashCheck.setText(Messages.getString("enableSplash")); + jpanel1.add(_splashCheck,cc.xywh(4,2,2,1)); + + _waitForWindowCheck.setActionCommand("Close splash screen when an application window appears"); + _waitForWindowCheck.setName("waitForWindowCheck"); + _waitForWindowCheck.setText(Messages.getString("waitForWindowText")); + jpanel1.add(_waitForWindowCheck,cc.xywh(4,6,2,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm new file mode 100755 index 000000000..114f0e31d Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java new file mode 100755 index 000000000..5a4d9440c --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java @@ -0,0 +1,232 @@ +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +public abstract class VersionInfoForm extends JPanel +{ + protected final JCheckBox _versionInfoCheck = new JCheckBox(); + protected final JLabel _fileVersionLabel = new JLabel(); + protected final JTextField _fileVersionField = new JTextField(); + protected final TitledSeparator _addVersionInfoSeparator = new TitledSeparator(); + protected final JLabel _productVersionLabel = new JLabel(); + protected final JTextField _productVersionField = new JTextField(); + protected final JLabel _fileDescriptionLabel = new JLabel(); + protected final JTextField _fileDescriptionField = new JTextField(); + protected final JLabel _copyrightLabel = new JLabel(); + protected final JTextField _copyrightField = new JTextField(); + protected final JLabel _txtFileVersionLabel = new JLabel(); + protected final JTextField _txtFileVersionField = new JTextField(); + protected final JLabel _txtProductVersionLabel = new JLabel(); + protected final JTextField _txtProductVersionField = new JTextField(); + protected final JLabel _productNameLabel = new JLabel(); + protected final JTextField _productNameField = new JTextField(); + protected final JLabel _originalFilenameLabel = new JLabel(); + protected final JTextField _originalFilenameField = new JTextField(); + protected final JLabel _internalNameLabel = new JLabel(); + protected final JTextField _internalNameField = new JTextField(); + protected final JLabel _companyNameLabel = new JLabel(); + protected final JTextField _companyNameField = new JTextField(); + + /** + * Default constructor + */ + public VersionInfoForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:7DLU:NONE,RIGHT:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _versionInfoCheck.setActionCommand("Add version information"); + _versionInfoCheck.setName("versionInfoCheck"); + _versionInfoCheck.setText(Messages.getString("addVersionInfo")); + jpanel1.add(_versionInfoCheck,cc.xywh(4,2,5,1)); + + _fileVersionLabel.setIcon(loadImage("images/asterix.gif")); + _fileVersionLabel.setName("fileVersionLabel"); + _fileVersionLabel.setText(Messages.getString("fileVersion")); + jpanel1.add(_fileVersionLabel,cc.xy(2,4)); + + _fileVersionField.setName("fileVersionField"); + _fileVersionField.setToolTipText(Messages.getString("fileVersionTip")); + jpanel1.add(_fileVersionField,cc.xy(4,4)); + + _addVersionInfoSeparator.setName("addVersionInfoSeparator"); + _addVersionInfoSeparator.setText("Additional information"); + jpanel1.add(_addVersionInfoSeparator,cc.xywh(2,10,7,1)); + + _productVersionLabel.setIcon(loadImage("images/asterix.gif")); + _productVersionLabel.setName("productVersionLabel"); + _productVersionLabel.setText(Messages.getString("productVersion")); + jpanel1.add(_productVersionLabel,cc.xy(2,12)); + + _productVersionField.setName("productVersionField"); + _productVersionField.setToolTipText(Messages.getString("productVersionTip")); + jpanel1.add(_productVersionField,cc.xy(4,12)); + + _fileDescriptionLabel.setIcon(loadImage("images/asterix.gif")); + _fileDescriptionLabel.setName("fileDescriptionLabel"); + _fileDescriptionLabel.setText(Messages.getString("fileDescription")); + jpanel1.add(_fileDescriptionLabel,cc.xy(2,6)); + + _fileDescriptionField.setName("fileDescriptionField"); + _fileDescriptionField.setToolTipText(Messages.getString("fileDescriptionTip")); + jpanel1.add(_fileDescriptionField,cc.xywh(4,6,5,1)); + + _copyrightLabel.setIcon(loadImage("images/asterix.gif")); + _copyrightLabel.setName("copyrightLabel"); + _copyrightLabel.setText(Messages.getString("copyright")); + jpanel1.add(_copyrightLabel,cc.xy(2,8)); + + _copyrightField.setName("copyrightField"); + jpanel1.add(_copyrightField,cc.xywh(4,8,5,1)); + + _txtFileVersionLabel.setIcon(loadImage("images/asterix.gif")); + _txtFileVersionLabel.setName("txtFileVersionLabel"); + _txtFileVersionLabel.setText(Messages.getString("txtFileVersion")); + jpanel1.add(_txtFileVersionLabel,cc.xy(6,4)); + + _txtFileVersionField.setName("txtFileVersionField"); + _txtFileVersionField.setToolTipText(Messages.getString("txtFileVersionTip")); + jpanel1.add(_txtFileVersionField,cc.xy(8,4)); + + _txtProductVersionLabel.setIcon(loadImage("images/asterix.gif")); + _txtProductVersionLabel.setName("txtProductVersionLabel"); + _txtProductVersionLabel.setText(Messages.getString("txtProductVersion")); + jpanel1.add(_txtProductVersionLabel,cc.xy(6,12)); + + _txtProductVersionField.setName("txtProductVersionField"); + _txtProductVersionField.setToolTipText(Messages.getString("txtProductVersionTip")); + jpanel1.add(_txtProductVersionField,cc.xy(8,12)); + + _productNameLabel.setIcon(loadImage("images/asterix.gif")); + _productNameLabel.setName("productNameLabel"); + _productNameLabel.setText(Messages.getString("productName")); + jpanel1.add(_productNameLabel,cc.xy(2,14)); + + _productNameField.setName("productNameField"); + jpanel1.add(_productNameField,cc.xywh(4,14,5,1)); + + _originalFilenameLabel.setIcon(loadImage("images/asterix.gif")); + _originalFilenameLabel.setName("originalFilenameLabel"); + _originalFilenameLabel.setText(Messages.getString("originalFilename")); + jpanel1.add(_originalFilenameLabel,cc.xy(2,20)); + + _originalFilenameField.setName("originalFilenameField"); + _originalFilenameField.setToolTipText(Messages.getString("originalFilenameTip")); + jpanel1.add(_originalFilenameField,cc.xywh(4,20,5,1)); + + _internalNameLabel.setIcon(loadImage("images/asterix.gif")); + _internalNameLabel.setName("internalNameLabel"); + _internalNameLabel.setText(Messages.getString("internalName")); + jpanel1.add(_internalNameLabel,cc.xy(2,18)); + + _internalNameField.setName("internalNameField"); + _internalNameField.setToolTipText(Messages.getString("internalNameTip")); + jpanel1.add(_internalNameField,cc.xywh(4,18,5,1)); + + _companyNameLabel.setName("companyNameLabel"); + _companyNameLabel.setText(Messages.getString("companyName")); + jpanel1.add(_companyNameLabel,cc.xy(2,16)); + + _companyNameField.setName("companyNameField"); + jpanel1.add(_companyNameField,cc.xywh(4,16,5,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm new file mode 100755 index 000000000..32eb136c8 Binary files /dev/null and b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm differ diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages.properties new file mode 100755 index 000000000..1be6c9584 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages.properties @@ -0,0 +1,146 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +log=Log + +outfile=Output file: +outfileTip=Output executable file. +customProcName=Custom process name and XP style manifest +stayAlive=Stay alive after launching a GUI application +manifest=Manifest: +manifestTip=Wrapper's manifest for User Account Control, will not enable XP styles! +icon=Icon: +iconTip=Application icon. +jar=Jar: +jarTip=Application jar. +dontWrapJar=Dont't wrap the jar, launch only +cmdLine=Command line args: +cmdLineTip=Constant command line arguments passed to the application. +options=Options: +chdir=Change dir: +chdirTip=Change current directory to a location relative to the executable. Empty field has no effect, . - changes directory to the exe location. +priority=Process priority: +normalPriority=Normal +idlePriority=Idle +highPriority=High +downloadAndSupport=Java download and support +errorTitle=Error title: +errorTitleTip=Launch4j signals errors using a message box, you can set it's title to the application's name. +downloadUrl=Java download URL: +supportUrl=Support URL: + +new=New +accept=Accept +remove=Remove +customClassPath=Custom classpath +classPath=Classpath: +mainClass=Main class: +editClassPath=Edit item: +importClassPath=Import attributes from a jar's manifest. + +headerType=Header type: +gui=GUI +console=Console +objectFiles=Object files: +libs=w32api: +linkerOptions=Custom header - linker options + +enableSingleInstance=Allow only a single instance of the application +mutexName=Mutex name +mutexNameTip=Mutex name that will uniquely identify your application. +windowTitle=Window title +windowTitleTip=Title of the GUI application window to bring up on attempt to start a next instance. + +jrePath=Bundled JRE path: +jrePathTip=Bundled JRE path relative to the executable or absolute. +jreMin=Min JRE version: +jreMax=Max JRE version: +dontUsePrivateJres=Don't use private JREs +jvmOptions=JVM options: +jvmOptionsTip=Accepts everything you would normally pass to java/javaw launcher: assertion options, system properties and X options. +initialHeapSize=Initial heap size: +maxHeapSize=Max heap size: +freeMemory=% of free memory +jdkPreference=JDK/JRE preference: +addVariables=Add variables: +addVariablesTip=Add special variable or map environment variables to system properties. +exeDirVarTip=Executable's runtime directory path. +exeFileVarTip=Executable's runtime file path (directory and filename). +varsAndRegistry=Variables / registry: +envVar=Environment var: +property=Property +propertyTip=Map a variable to a system property. +option=Option +optionTip=Pass a JVM option using a variable. + +setVariables=Set variables: + +enableSplash=Enable splash screen +splashFile=Splash file: +splashFileTip=Splash screen file in BMP format. +waitForWindow=Wait for window +waitForWindowText=Close splash screen when an application window appears +timeout=Timeout [s]: +timeoutTip=Number of seconds after which the splash screen must close. Splash timeout may cause an error depending on splashTimeoutErr property. +timeoutErr=Signal error on timeout +timeoutErrTip=True signals an error on splash timeout, false closes the splash screen quietly. + +version=Version +additionalInfo=Additional information +addVersionInfo=Add version information +fileVersion=File version: +fileVersionTip=Version number 'x.x.x.x' +productVersion=Product version: +productVersionTip=Version number 'x.x.x.x' +fileDescription=File description: +fileDescriptionTip=File description presented to the user. +copyright=Copyright: +txtFileVersion=Free form: +txtFileVersionTip=Free form file version, for example '1.20.RC1'. +txtProductVersion=Free form: +txtProductVersionTip=Free form product version, for example '1.20.RC1'. +productName=Product name: +originalFilename=Original filename: +originalFilenameTip=Original name of the file without the path. Allows to determine whether a file has been renamed by a user. +internalName=Internal name: +internalNameTip=Internal name without extension, original filename or module name for example. +companyName=Company name: + +addMessages=Add custom messages +startupErr=Startup error: +bundledJreErr=Bundled JRE error: +jreVersionErr=JRE version error: +jreVersionErrTip=Launch4j will append the required version number at the end of this message. +launcherErr=Launcher error: +instanceAlreadyExistsMsg=Inst. already exists: +instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages_es.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages_es.properties new file mode 100755 index 000000000..50e2d7587 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/form/messages_es.properties @@ -0,0 +1,118 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +log = Registro + +outfile = Fichero de salida +outfileTip = Fichero ejecutable de salida. +errorTitle = T\u00EDtulo de error +errorTitleTip = Launch4j indica los errores usando una ventana de mensaje, usted puede ponerle el nombre de la aplicaci\u00F3n a esta ventana. +customProcName = Nombre personalizado del proceso +stayAlive = Mantener abierto despu\u00E9s de lanzar una aplicaci\u00F3n GUI +icon = Icono +iconTip = Icono de la aplicaci\u00F3n. +jar = Jar +jarTip = Jar de la aplicaci\u00F3n. +dontWrapJar = No empaquetar el jar, s\u00F3lo lanzar +cmdLine = Argumentos del jar +cmdLine = Argumentos de l\u00EDnea de \u00F3rdenes pasados a la aplicaci\u00F3n. +options = Opciones +chdir = Cambiar al directorio +chdirTip = Cambia el directorio actual a la localizaci\u00F3n relativa al ejecutable. Si el campo se deja vac\u00EDo, no tiene efecto, . - cambia el directorio a la localizaci\u00F3n del exe. +headerType = Tipo de cabecera +gui = GUI +console = Consola +objectFiles = Ficheros objeto +libs = w32api +linkerOptions = Cabecera personalizada - opciones del enlazador +jrePath = Ruta del JRE +jrePathTip = Ruta relativa al ejecutable del JRE. +jreMin = Versi\u00F3n m\u00EDnima del JRE +jreMax = Versi\u00F3n m\u00E1xima del JRE +jvmOptions = Argumentos de la JVM +jvmOptionsTip = Acepta cualquier argumento que normalmente se le pasar\u00EDa al lanzador java/javaw\: opciones assertion, propiedades de sistema y opciones X. +initialHeapSize = Tama\u00F1o inicial de la pila +maxHeapSize = Tama\u00F1o m\u00E1ximo de la pila +freeMemory=% of free memory +addVariables = A\u00F1adir variables +addVariablesTip = A\u00F1adir una variable especial o mapear variables de entorno a las propiedades del sistema. +exeDirVarTip = Ruta del directorio del ejecutable. +exeFileVarTip = Ruta del fichero ejecutable (directorio y nombre del fichero). +other = Otra +otherTip = Mapear una variable de entorno a una propiedad del sistema. +otherVarTip = Variable de entorno que mapear. +add = A\u00F1adir +specifyVar = Especificar variable de entorno que a\u00F1adir. +enableSplash = Activar pantalla de bienvenida +splashFile = Imagen +splashFileTip = Imagen en formato BMP para la pantalla de bienvenida. +waitForWindow = Esperar la ventana +waitForWindowText = Cerrar la pantalla de bienvenida cuando aparezca una ventana de la aplicaci\u00F3n +timeout = Tiempo de espera [s] +timeoutTip = Numero de segundos despu\u00E9s de los que la pantalla de bienvenida se debe cerrar. Esta propiedad puede causar provocar un error dependiendo de la propiedad splashTimeoutErr. +timeoutErr = Se\u00F1al de error asociada al tiempo de espera +timeoutErrTip = Marcado (true) se\u00F1ala un error despu\u00E9s del tiempo de espera de la pantalla de bienvenida, no marcado (false) cierra la pantalla de bienvenida silenciosamente +addVersionInfo = A\u00F1ade informaci\u00F3n sobre la versi\u00F3n +fileVersion = Versi\u00F3n del fichero +fileVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x' +additionalInfo = Informaci\u00F3n adicional +productVersion = Versi\u00F3n del producto +productVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x' +fileDescription = Descripci\u00F3n del fichero +fileDescriptionTip = Descripci\u00F3n del fichero que se le muestra al usuario. +copyright = Copyright +txtFileVersion = Forma libre +txtFileVersionTip = Forma libre de versi\u00F3n, por ejemplo '1.20.RC1'. +txtProductVersion = Forma libre +txtProductVersionTip = Forma libre del producto, por ejemplo '1.20.RC1'. +productName = Nombre del producto +originalFilename = Nombre original del fichero +originalFilenameTip = Nombre original del fichero sin la ruta. Permite determinar si un fichero ha sido renombrado por un usuario. +internalName = Nombre interno +internalNameTip = Nombre interno sin extensi\u00F3n, el nombre original del fichero o el m\u00F3dulo, por ejemplo. +companyName = Nombre de la organizaci\u00F3n + +addMessages=Add custom messages +startupErr=Startup error: +bundledJreErr=Bundled JRE error: +jreVersionErr=JRE version error: +jreVersionErrTip=Launch4j will append the required version number at the end of this message. +launcherErr=Launcher error: +instanceAlreadyExistsMsg=Inst. already exists: +instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. + +enableSingleInstance=Allow only a single instance of the application +mutexName=Mutex name +mutexNameTip=Mutex name that will uniquely identify your application. +windowTitle=Window title +windowTitleTip=Title of the application window to bring up on attempt to start a next instance. diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java new file mode 100755 index 000000000..5265e6436 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java @@ -0,0 +1,75 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.Color; +import java.awt.event.ActionListener; + +import javax.swing.JTextField; + +import net.sf.launch4j.binding.Binding; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public abstract class AbstractAcceptListener implements ActionListener { + final JTextField _field; + + public AbstractAcceptListener(JTextField f, boolean listen) { + _field = f; + if (listen) { + _field.addActionListener(this); + } + } + + protected String getText() { + return _field.getText(); + } + + protected void clear() { + _field.setText(""); + _field.requestFocusInWindow(); + } + + protected void signalViolation(String msg) { + final Color bg = _field.getBackground(); + _field.setBackground(Binding.INVALID_COLOR); + MainFrame.getInstance().warn(msg); + _field.setBackground(bg); + _field.requestFocusInWindow(); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java new file mode 100755 index 000000000..01ebe8adf --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java @@ -0,0 +1,101 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.JFileChooser; +import javax.swing.JRadioButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.form.BasicForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class BasicFormImpl extends BasicForm { + + public BasicFormImpl(Bindings bindings, JFileChooser fc) { + bindings.add("outfile", _outfileField) + .add("dontWrapJar", _dontWrapJarCheck) + .add("jar", _jarField) + .add("manifest", _manifestField) + .add("icon", _iconField) + .add("cmdLine", _cmdLineField) + .add("errTitle", _errorTitleField) + .add("downloadUrl", _downloadUrlField, Config.DOWNLOAD_URL) + .add("supportUrl", _supportUrlField) + .add("chdir", _chdirField) + .add("priorityIndex", new JRadioButton[] { _normalPriorityRadio, + _idlePriorityRadio, + _highPriorityRadio }) + .add("customProcName", _customProcNameCheck) + .add("stayAlive", _stayAliveCheck); + + _dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener()); + + _outfileButton.addActionListener(new BrowseActionListener(true, fc, + new FileChooserFilter("Windows executables (.exe)", ".exe"), + _outfileField)); + _jarButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Jar files", ".jar"), _jarField)); + _manifestButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Manifest files (.manifest)", ".manifest"), + _manifestField)); + _iconButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField)); + } + + private class DontWrapJarChangeListener implements ChangeListener { + + public void stateChanged(ChangeEvent e) { + boolean dontWrap = _dontWrapJarCheck.isSelected(); + if (dontWrap) { + _jarLabel.setIcon(loadImage("images/asterix-o.gif")); + _jarLabel.setText(Messages.getString("jarPath")); + _jarField.setToolTipText(Messages.getString("jarPathTip")); + } else { + _jarLabel.setIcon(loadImage("images/asterix.gif")); + _jarLabel.setText(Messages.getString("jar")); + _jarField.setToolTipText(Messages.getString("jarTip")); + } + _jarButton.setEnabled(!dontWrap); + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java new file mode 100755 index 000000000..89a5017ee --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java @@ -0,0 +1,79 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import net.sf.launch4j.FileChooserFilter; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class BrowseActionListener implements ActionListener { + private final boolean _save; + private final JFileChooser _fileChooser; + private final FileChooserFilter _filter; + private final JTextField _field; + + public BrowseActionListener(boolean save, JFileChooser fileChooser, + FileChooserFilter filter, JTextField field) { + _save = save; + _fileChooser = fileChooser; + _filter = filter; + _field = field; + } + + public void actionPerformed(ActionEvent e) { + if (!_field.isEnabled()) { + return; + } + _fileChooser.setFileFilter(_filter); + _fileChooser.setSelectedFile(new File("")); + int result = _save + ? _fileChooser.showSaveDialog(MainFrame.getInstance()) + : _fileChooser.showOpenDialog(MainFrame.getInstance()); + if (result == JFileChooser.APPROVE_OPTION) { + _field.setText(_fileChooser.getSelectedFile().getPath()); + } + _fileChooser.removeChoosableFileFilter(_filter); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java new file mode 100755 index 000000000..65d82096e --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java @@ -0,0 +1,222 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import java.util.jar.Attributes; +import java.util.jar.JarFile; + +import javax.swing.DefaultListModel; +import javax.swing.JFileChooser; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.binding.Validator; +import net.sf.launch4j.config.ClassPath; +import net.sf.launch4j.form.ClassPathForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class ClassPathFormImpl extends ClassPathForm { + private final JFileChooser _fileChooser; + private final FileChooserFilter _filter + = new FileChooserFilter("Executable jar", ".jar"); + + public ClassPathFormImpl(Bindings bindings, JFileChooser fc) { + bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck) + .add("classPath.mainClass", _mainclassField) + .add("classPath.paths", _classpathList); + _fileChooser = fc; + + ClasspathCheckListener cpl = new ClasspathCheckListener(); + _classpathCheck.addChangeListener(cpl); + cpl.stateChanged(null); + + _classpathList.setModel(new DefaultListModel()); + _classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + _classpathList.addListSelectionListener(new ClasspathSelectionListener()); + + _newClasspathButton.addActionListener(new NewClasspathListener()); + _acceptClasspathButton.addActionListener( + new AcceptClasspathListener(_classpathField)); + _removeClasspathButton.addActionListener(new RemoveClasspathListener()); + _importClasspathButton.addActionListener(new ImportClasspathListener()); + _classpathUpButton.addActionListener(new MoveUpListener()); + _classpathDownButton.addActionListener(new MoveDownListener()); + } + + private class ClasspathCheckListener implements ChangeListener { + public void stateChanged(ChangeEvent e) { + boolean on = _classpathCheck.isSelected(); + _importClasspathButton.setEnabled(on); + _classpathUpButton.setEnabled(on); + _classpathDownButton.setEnabled(on); + _classpathField.setEnabled(on); + _newClasspathButton.setEnabled(on); + _acceptClasspathButton.setEnabled(on); + _removeClasspathButton.setEnabled(on); + } + } + + private class NewClasspathListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + _classpathList.clearSelection(); + _classpathField.setText(""); + _classpathField.requestFocusInWindow(); + } + } + + private class AcceptClasspathListener extends AbstractAcceptListener { + public AcceptClasspathListener(JTextField f) { + super(f, true); + } + + public void actionPerformed(ActionEvent e) { + String cp = getText(); + if (Validator.isEmpty(cp)) { + signalViolation(Messages.getString("specifyClassPath")); + return; + } + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + if (_classpathList.isSelectionEmpty()) { + model.addElement(cp); + clear(); + } else { + model.setElementAt(cp, _classpathList.getSelectedIndex()); + } + } + } + + private class ClasspathSelectionListener implements ListSelectionListener { + public void valueChanged(ListSelectionEvent e) { + if (e.getValueIsAdjusting()) { + return; + } + if (_classpathList.isSelectionEmpty()) { + _classpathField.setText(""); + } else { + _classpathField.setText((String) _classpathList.getSelectedValue()); + } + _classpathField.requestFocusInWindow(); + } + } + + private class RemoveClasspathListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (_classpathList.isSelectionEmpty() + || !MainFrame.getInstance().confirm( + Messages.getString("confirmClassPathRemoval"))) { + return; + } + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + while (!_classpathList.isSelectionEmpty()) { + model.remove(_classpathList.getSelectedIndex()); + } + } + } + + private class MoveUpListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + int x = _classpathList.getSelectedIndex(); + if (x < 1) { + return; + } + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + Object o = model.get(x - 1); + model.set(x - 1, model.get(x)); + model.set(x, o); + _classpathList.setSelectedIndex(x - 1); + } + } + + private class MoveDownListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + int x = _classpathList.getSelectedIndex(); + if (x == -1 || x >= model.getSize() - 1) { + return; + } + Object o = model.get(x + 1); + model.set(x + 1, model.get(x)); + model.set(x, o); + _classpathList.setSelectedIndex(x + 1); + } + } + + private class ImportClasspathListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + try { + _fileChooser.setFileFilter(_filter); + _fileChooser.setSelectedFile(new File("")); + if (_fileChooser.showOpenDialog(MainFrame.getInstance()) + == JFileChooser.APPROVE_OPTION) { + JarFile jar = new JarFile(_fileChooser.getSelectedFile()); + if (jar.getManifest() == null) { + jar.close(); + MainFrame.getInstance().info(Messages.getString("noManifest")); + return; + } + Attributes attr = jar.getManifest().getMainAttributes(); + String mainClass = (String) attr.getValue("Main-Class"); + String classPath = (String) attr.getValue("Class-Path"); + jar.close(); + _mainclassField.setText(mainClass != null ? mainClass : ""); + DefaultListModel model = new DefaultListModel(); + if (classPath != null) { + String[] paths = classPath.split(" "); + for (int i = 0; i < paths.length; i++) { + model.addElement(paths[i]); + } + } + _classpathList.setModel(model); + } + } catch (IOException ex) { + MainFrame.getInstance().warn(ex.getMessage()); + } + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java new file mode 100755 index 000000000..d29720642 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java @@ -0,0 +1,100 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 10, 2005 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.BorderFactory; +import javax.swing.JFileChooser; +import javax.swing.JTextArea; + +import net.sf.launch4j.binding.Binding; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.form.ConfigForm; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConfigFormImpl extends ConfigForm { + private final Bindings _bindings = new Bindings(); + private final JFileChooser _fileChooser = new FileChooser(ConfigFormImpl.class); + + public ConfigFormImpl() { + _tab.setBorder(BorderFactory.createMatteBorder(0, -1, -1, -1, getBackground())); + _tab.addTab(Messages.getString("tab.basic"), + new BasicFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.classpath"), + new ClassPathFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.header"), + new HeaderFormImpl(_bindings)); + _tab.addTab(Messages.getString("tab.singleInstance"), + new SingleInstanceFormImpl(_bindings)); + _tab.addTab(Messages.getString("tab.jre"), + new JreFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.envVars"), + new EnvironmentVarsFormImpl(_bindings)); + _tab.addTab(Messages.getString("tab.splash"), + new SplashFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.version"), + new VersionInfoFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.messages"), + new MessagesFormImpl(_bindings)); + } + + public void clear(IValidatable bean) { + _bindings.clear(bean); + } + + public void put(IValidatable bean) { + _bindings.put(bean); + } + + public void get(IValidatable bean) { + _bindings.get(bean); + } + + public boolean isModified() { + return _bindings.isModified(); + } + + public JTextArea getLogTextArea() { + return _logTextArea; + } + + public Binding getBinding(String property) { + return _bindings.getBinding(property); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java new file mode 100755 index 000000000..2f325fe3c --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java @@ -0,0 +1,50 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jun 10, 2006 + */ +package net.sf.launch4j.formimpl; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.form.EnvironmentVarsForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class EnvironmentVarsFormImpl extends EnvironmentVarsForm { + + public EnvironmentVarsFormImpl(Bindings bindings) { + bindings.add("variables", _envVarsTextArea); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java new file mode 100755 index 000000000..c1b984e58 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java @@ -0,0 +1,65 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 19, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.io.File; +import java.util.prefs.Preferences; + +import javax.swing.JFileChooser; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class FileChooser extends JFileChooser { + private final Preferences _prefs; + private final String _key; + + public FileChooser(Class clazz) { + _prefs = Preferences.userNodeForPackage(clazz); + _key = "currentDir-" + + clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1); + String path = _prefs.get(_key, null); + if (path != null) { + setCurrentDirectory(new File(path)); + } + } + + public void approveSelection() { + _prefs.put(_key, getCurrentDirectory().getPath()); + super.approveSelection(); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java new file mode 100755 index 000000000..c1b1d8dd4 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java @@ -0,0 +1,67 @@ +package net.sf.launch4j.formimpl; + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.AWTEventListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; + +import javax.swing.JComponent; +import javax.swing.SwingUtilities; + +/** + * This is the glass pane class that intercepts screen interactions during + * system busy states. + * + * Based on JavaWorld article by Yexin Chen. + */ +public class GlassPane extends JComponent implements AWTEventListener { + private final Window _window; + + public GlassPane(Window w) { + _window = w; + addMouseListener(new MouseAdapter() {}); + addKeyListener(new KeyAdapter() {}); + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + } + + /** + * Receives all key events in the AWT and processes the ones that originated + * from the current window with the glass pane. + * + * @param event + * the AWTEvent that was fired + */ + public void eventDispatched(AWTEvent event) { + Object source = event.getSource(); + if (event instanceof KeyEvent + && source instanceof Component) { + /* + * If the event originated from the window w/glass pane, + * consume the event. + */ + if ((SwingUtilities.windowForComponent((Component) source) == _window)) { + ((KeyEvent) event).consume(); + } + } + } + + /** + * Sets the glass pane as visible or invisible. The mouse cursor will be set + * accordingly. + */ + public void setVisible(boolean visible) { + if (visible) { + // Start receiving all events and consume them if necessary + Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK); + } else { + // Stop receiving all events + Toolkit.getDefaultToolkit().removeAWTEventListener(this); + } + super.setVisible(visible); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java new file mode 100755 index 000000000..accfaa9de --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java @@ -0,0 +1,102 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JRadioButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import net.sf.launch4j.binding.Binding; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.form.HeaderForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class HeaderFormImpl extends HeaderForm { + private final Bindings _bindings; + + public HeaderFormImpl(Bindings bindings) { + _bindings = bindings; + _bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio, + _consoleHeaderRadio }) + .add("headerObjects", "customHeaderObjects", _headerObjectsCheck, + _headerObjectsTextArea) + .add("libs", "customLibs", _libsCheck, _libsTextArea); + + _guiHeaderRadio.addChangeListener(new HeaderTypeChangeListener()); + _headerObjectsCheck.addActionListener(new HeaderObjectsActionListener()); + _libsCheck.addActionListener(new LibsActionListener()); + } + + private class HeaderTypeChangeListener implements ChangeListener { + public void stateChanged(ChangeEvent e) { + Config c = ConfigPersister.getInstance().getConfig(); + c.setHeaderType(_guiHeaderRadio.isSelected() ? Config.GUI_HEADER + : Config.CONSOLE_HEADER); + if (!_headerObjectsCheck.isSelected()) { + Binding b = _bindings.getBinding("headerObjects"); + b.put(c); + } + } + } + + private class HeaderObjectsActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (!_headerObjectsCheck.isSelected()) { + ConfigPersister.getInstance().getConfig().setHeaderObjects(null); + Binding b = _bindings.getBinding("headerObjects"); + b.put(ConfigPersister.getInstance().getConfig()); + } + } + } + + private class LibsActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (!_libsCheck.isSelected()) { + ConfigPersister.getInstance().getConfig().setLibs(null); + Binding b = _bindings.getBinding("libs"); + b.put(ConfigPersister.getInstance().getConfig()); + } + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java new file mode 100755 index 000000000..48a2f18e8 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java @@ -0,0 +1,166 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.binding.Validator; +import net.sf.launch4j.form.JreForm; +import net.sf.launch4j.config.Jre; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class JreFormImpl extends JreForm { + + public JreFormImpl(Bindings bindings, JFileChooser fc) { + _jdkPreferenceCombo.setModel(new DefaultComboBoxModel(new String[] { + Messages.getString("jdkPreference.jre.only"), + Messages.getString("jdkPreference.prefer.jre"), + Messages.getString("jdkPreference.prefer.jdk"), + Messages.getString("jdkPreference.jdk.only")})); + bindings.add("jre.path", _jrePathField) + .add("jre.minVersion", _jreMinField) + .add("jre.maxVersion", _jreMaxField) + .add("jre.jdkPreferenceIndex", _jdkPreferenceCombo, + Jre.DEFAULT_JDK_PREFERENCE_INDEX) + .add("jre.initialHeapSize", _initialHeapSizeField) + .add("jre.initialHeapPercent", _initialHeapPercentField) + .add("jre.maxHeapSize", _maxHeapSizeField) + .add("jre.maxHeapPercent", _maxHeapPercentField) + .add("jre.options", _jvmOptionsTextArea); + + _varCombo.setModel(new DefaultComboBoxModel(new String[] { + "EXEDIR", "EXEFILE", "PWD", "OLDPWD", + "HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", + "HKEY_USERS", "HKEY_CURRENT_CONFIG" })); + + _varCombo.addActionListener(new VarComboActionListener()); + _varCombo.setSelectedIndex(0); + + _propertyButton.addActionListener(new PropertyActionListener()); + _optionButton.addActionListener(new OptionActionListener()); + + _envPropertyButton.addActionListener(new EnvPropertyActionListener(_envVarField)); + _envOptionButton.addActionListener(new EnvOptionActionListener(_envVarField)); + } + + private class VarComboActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + _optionButton.setEnabled(((String) _varCombo.getSelectedItem()) + .startsWith("HKEY_")); + } + } + + private class PropertyActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + final int pos = _jvmOptionsTextArea.getCaretPosition(); + final String var = (String) _varCombo.getSelectedItem(); + if (var.startsWith("HKEY_")) { + _jvmOptionsTextArea.insert("-Dreg.key=\"%" + + var + "\\\\...%\"\n", pos); + } else { + _jvmOptionsTextArea.insert("-Dlaunch4j." + var.toLowerCase() + + "=\"%" + var + "%\"\n", pos); + } + } + } + + private class OptionActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + final int pos = _jvmOptionsTextArea.getCaretPosition(); + final String var = (String) _varCombo.getSelectedItem(); + if (var.startsWith("HKEY_")) { + _jvmOptionsTextArea.insert("%" + var + "\\\\...%\n", pos); + } else { + _jvmOptionsTextArea.insert("%" + var + "%\n", pos); + } + } + } + + private abstract class EnvActionListener extends AbstractAcceptListener { + public EnvActionListener(JTextField f, boolean listen) { + super(f, listen); + } + + public void actionPerformed(ActionEvent e) { + final int pos = _jvmOptionsTextArea.getCaretPosition(); + final String var = getText() + .replaceAll("\"", "") + .replaceAll("%", ""); + if (Validator.isEmpty(var)) { + signalViolation(Messages.getString("specifyVar")); + return; + } + add(var, pos); + clear(); + } + + protected abstract void add(String var, int pos); + } + + private class EnvPropertyActionListener extends EnvActionListener { + public EnvPropertyActionListener(JTextField f) { + super(f, true); + } + + protected void add(String var, int pos) { + final String prop = var + .replaceAll(" ", ".") + .replaceAll("_", ".") + .toLowerCase(); + _jvmOptionsTextArea.insert("-Denv." + prop + "=\"%" + var + + "%\"\n", pos); + } + } + + private class EnvOptionActionListener extends EnvActionListener { + public EnvOptionActionListener(JTextField f) { + super(f, false); + } + + protected void add(String var, int pos) { + _jvmOptionsTextArea.insert("%" + var + "%\n", pos); + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java new file mode 100755 index 000000000..4a2cc8715 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java @@ -0,0 +1,358 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-05-09 + */ +package net.sf.launch4j.formimpl; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JToolBar; +import javax.swing.UIManager; + +import com.jgoodies.looks.Options; +import com.jgoodies.looks.plastic.PlasticXPLookAndFeel; + +import foxtrot.Task; +import foxtrot.Worker; + +import net.sf.launch4j.Builder; +import net.sf.launch4j.BuilderException; +import net.sf.launch4j.ExecException; +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.Log; +import net.sf.launch4j.Main; +import net.sf.launch4j.Util; +import net.sf.launch4j.binding.Binding; +import net.sf.launch4j.binding.BindingException; +import net.sf.launch4j.binding.InvariantViolationException; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.config.ConfigPersisterException; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class MainFrame extends JFrame { + private static MainFrame _instance; + + private final JToolBar _toolBar; + private final JButton _runButton; + private final ConfigFormImpl _configForm; + private final JFileChooser _fileChooser = new FileChooser(MainFrame.class); + private File _outfile; + private boolean _saved = false; + + public static void createInstance() { + try { + Toolkit.getDefaultToolkit().setDynamicLayout(true); + System.setProperty("sun.awt.noerasebackground","true"); + + // JGoodies + Options.setDefaultIconSize(new Dimension(16, 16)); // menu icons + Options.setUseNarrowButtons(false); + Options.setPopupDropShadowEnabled(true); + + UIManager.setLookAndFeel(new PlasticXPLookAndFeel()); + _instance = new MainFrame(); + } catch (Exception e) { + System.err.println(e); + } + } + + public static MainFrame getInstance() { + return _instance; + } + + public MainFrame() { + showConfigName(null); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + addWindowListener(new MainFrameListener()); + setGlassPane(new GlassPane(this)); + _fileChooser.setFileFilter(new FileChooserFilter( + Messages.getString("MainFrame.config.files"), + new String[] {".xml", ".cfg"})); + + _toolBar = new JToolBar(); + _toolBar.setFloatable(false); + _toolBar.setRollover(true); + addButton("images/new.png", Messages.getString("MainFrame.new.config"), + new NewActionListener()); + addButton("images/open.png", Messages.getString("MainFrame.open.config"), + new OpenActionListener()); + addButton("images/save.png", Messages.getString("MainFrame.save.config"), + new SaveActionListener()); + _toolBar.addSeparator(); + addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"), + new BuildActionListener()); + _runButton = addButton("images/run.png", + Messages.getString("MainFrame.test.wrapper"), + new RunActionListener()); + setRunEnabled(false); + _toolBar.addSeparator(); + addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"), + new AboutActionListener()); + + _configForm = new ConfigFormImpl(); + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(_toolBar, BorderLayout.NORTH); + getContentPane().add(_configForm, BorderLayout.CENTER); + pack(); + Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension fr = getSize(); + fr.width += 25; + fr.height += 100; + setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2, + fr.width, fr.height); + setVisible(true); + } + + private JButton addButton(String iconPath, String tooltip, ActionListener l) { + ImageIcon icon = new ImageIcon(MainFrame.class.getClassLoader() + .getResource(iconPath)); + JButton b = new JButton(icon); + b.setToolTipText(tooltip); + b.addActionListener(l); + _toolBar.add(b); + return b; + } + + public void info(String text) { + JOptionPane.showMessageDialog(this, + text, + Main.getName(), + JOptionPane.INFORMATION_MESSAGE); + } + + public void warn(String text) { + JOptionPane.showMessageDialog(this, + text, + Main.getName(), + JOptionPane.WARNING_MESSAGE); + } + + public void warn(InvariantViolationException e) { + Binding b = e.getBinding(); + if (b != null) { + b.markInvalid(); + } + warn(e.getMessage()); + if (b != null) { + e.getBinding().markValid(); + } + } + + public boolean confirm(String text) { + return JOptionPane.showConfirmDialog(MainFrame.this, + text, + Messages.getString("MainFrame.confirm"), + JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; + } + + private boolean isModified() { + return (!_configForm.isModified()) + || confirm(Messages.getString("MainFrame.discard.changes")); + } + + private boolean save() { + // XXX + try { + _configForm.get(ConfigPersister.getInstance().getConfig()); + if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) { + File f = _fileChooser.getSelectedFile(); + if (!f.getPath().endsWith(".xml")) { + f = new File(f.getPath() + ".xml"); + } + ConfigPersister.getInstance().save(f); + _saved = true; + showConfigName(f); + return true; + } + return false; + } catch (InvariantViolationException ex) { + warn(ex); + return false; + } catch (BindingException ex) { + warn(ex.getMessage()); + return false; + } catch (ConfigPersisterException ex) { + warn(ex.getMessage()); + return false; + } + } + + private void showConfigName(File config) { + setTitle(Main.getName() + " - " + (config != null ? config.getName() + : Messages.getString("MainFrame.untitled"))); + } + + private void setRunEnabled(boolean enabled) { + if (!enabled) { + _outfile = null; + } + _runButton.setEnabled(enabled); + } + + private void clearConfig() { + ConfigPersister.getInstance().createBlank(); + _configForm.clear(ConfigPersister.getInstance().getConfig()); + } + + private class MainFrameListener extends WindowAdapter { + public void windowOpened(WindowEvent e) { + clearConfig(); + } + + public void windowClosing(WindowEvent e) { + if (isModified()) { + System.exit(0); + } + } + } + + private class NewActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (isModified()) { + clearConfig(); + } + _saved = false; + showConfigName(null); + setRunEnabled(false); + } + } + + private class OpenActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + try { + if (isModified() && _fileChooser.showOpenDialog(MainFrame.this) + == JOptionPane.YES_OPTION) { + final File f = _fileChooser.getSelectedFile(); + if (f.getPath().endsWith(".xml")) { + ConfigPersister.getInstance().load(f); + _saved = true; + } else { + ConfigPersister.getInstance().loadVersion1(f); + _saved = false; + } + _configForm.put(ConfigPersister.getInstance().getConfig()); + showConfigName(f); + setRunEnabled(false); + } + } catch (ConfigPersisterException ex) { + warn(ex.getMessage()); + } catch (BindingException ex) { + warn(ex.getMessage()); + } + } + } + + private class SaveActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + save(); + } + } + + private class BuildActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + final Log log = Log.getSwingLog(_configForm.getLogTextArea()); + try { + if ((!_saved || _configForm.isModified()) + && !save()) { + return; + } + log.clear(); + ConfigPersister.getInstance().getConfig().checkInvariants(); + Builder b = new Builder(log); + _outfile = b.build(); + setRunEnabled(ConfigPersister.getInstance().getConfig() + .getHeaderType() == Config.GUI_HEADER // TODO fix console app test + && (Util.WINDOWS_OS || !ConfigPersister.getInstance() + .getConfig().isDontWrapJar())); + } catch (InvariantViolationException ex) { + setRunEnabled(false); + ex.setBinding(_configForm.getBinding(ex.getProperty())); + warn(ex); + } catch (BuilderException ex) { + setRunEnabled(false); + log.append(ex.getMessage()); + } + } + } + + private class RunActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + try { + getGlassPane().setVisible(true); + Worker.post(new Task() { + public Object run() throws ExecException { + Log log = Log.getSwingLog(_configForm.getLogTextArea()); + log.clear(); + String path = _outfile.getPath(); + if (Util.WINDOWS_OS) { + log.append(Messages.getString("MainFrame.executing") + path); + Util.exec(new String[] { path }, log); + } else { + log.append(Messages.getString("MainFrame.jar.integrity.test") + + path); + Util.exec(new String[] { "java", "-jar", path }, log); + } + return null; + } + }); + } catch (Exception ex) { + // XXX errors logged by exec + } finally { + getGlassPane().setVisible(false); + } + }; + } + + private class AboutActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + info(Main.getDescription()); + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/Messages.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/Messages.java new file mode 100755 index 000000000..5e1c64110 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/Messages.java @@ -0,0 +1,55 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.formimpl; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.formimpl.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java new file mode 100755 index 000000000..c05d7f047 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java @@ -0,0 +1,58 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Oct 7, 2006 + */ +package net.sf.launch4j.formimpl; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Msg; +import net.sf.launch4j.form.MessagesForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class MessagesFormImpl extends MessagesForm { + + public MessagesFormImpl(Bindings bindings) { + Msg m = new Msg(); + bindings.addOptComponent("messages", Msg.class, _messagesCheck) + .add("messages.startupErr", _startupErrTextArea, m.getStartupErr()) + .add("messages.bundledJreErr", _bundledJreErrTextArea, m.getBundledJreErr()) + .add("messages.jreVersionErr", _jreVersionErrTextArea, m.getJreVersionErr()) + .add("messages.launcherErr", _launcherErrTextArea, m.getLauncherErr()) + .add("messages.instanceAlreadyExistsMsg", _instanceAlreadyExistsMsgTextArea, + m.getInstanceAlreadyExistsMsg()); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java new file mode 100755 index 000000000..c916a9184 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java @@ -0,0 +1,54 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Created on 2007-09-22 + */ +package net.sf.launch4j.formimpl; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.SingleInstance; +import net.sf.launch4j.form.SingleInstanceForm; + +/** + * @author Copyright (C) 2007 Grzegorz Kowal + */ +public class SingleInstanceFormImpl extends SingleInstanceForm { + + public SingleInstanceFormImpl(Bindings bindings) { + bindings.addOptComponent("singleInstance", SingleInstance.class, + _singleInstanceCheck) + .add("singleInstance.mutexName", _mutexNameField) + .add("singleInstance.windowTitle", _windowTitleField); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java new file mode 100755 index 000000000..7413d4a21 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java @@ -0,0 +1,61 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.JFileChooser; + +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Splash; +import net.sf.launch4j.form.SplashForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class SplashFormImpl extends SplashForm { + + public SplashFormImpl(Bindings bindings, JFileChooser fc) { + bindings.addOptComponent("splash", Splash.class, _splashCheck) + .add("splash.file", _splashFileField) + .add("splash.waitForWindow", _waitForWindowCheck, true) + .add("splash.timeout", _timeoutField, "60") + .add("splash.timeoutErr", _timeoutErrCheck, true); + + _splashFileButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Bitmap files (.bmp)", ".bmp"), _splashFileField)); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java new file mode 100755 index 000000000..c2f60d1d3 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java @@ -0,0 +1,63 @@ +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Launch4j nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.JFileChooser; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.VersionInfo; +import net.sf.launch4j.form.VersionInfoForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class VersionInfoFormImpl extends VersionInfoForm { + + public VersionInfoFormImpl(Bindings bindings, JFileChooser fc) { + bindings.addOptComponent("versionInfo", VersionInfo.class, _versionInfoCheck) + .add("versionInfo.fileVersion", _fileVersionField) + .add("versionInfo.productVersion", _productVersionField) + .add("versionInfo.fileDescription", _fileDescriptionField) + .add("versionInfo.internalName", _internalNameField) + .add("versionInfo.originalFilename", _originalFilenameField) + .add("versionInfo.productName", _productNameField) + .add("versionInfo.txtFileVersion", _txtFileVersionField) + .add("versionInfo.txtProductVersion", _txtProductVersionField) + .add("versionInfo.companyName", _companyNameField) + .add("versionInfo.copyright", _copyrightField); + } +} diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/messages.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/messages.properties new file mode 100755 index 000000000..53a2442a8 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/messages.properties @@ -0,0 +1,74 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +tab.basic=Basic +tab.classpath=Classpath +tab.header=Header +tab.singleInstance=Single instance +tab.jre=JRE +tab.envVars=Set env. variables +tab.splash=Splash +tab.version=Version Info +tab.messages=Messages + +# Basic +jar=Jar: +jarPath=Jar runtime path: +jarTip=Application jar. +jarPathTip=Optional runtime path of the jar relative to the executable. For example, if the executable launcher and the application jar named calc.exe and calc.jar are in the same directory, it would be: calc.jar. + +# Classpath +specifyClassPath=Specify classpath item to add. +confirmClassPathRemoval=Remove selected classpath items? +noManifest=The selected jar does not have a manifest. + +# JRE +specifyVar=Specify environment variable to add. +otherVar=Other var +jdkPreference.jre.only=Only use public JREs +jdkPreference.prefer.jre=Prefer public JRE, but use JDK runtime if newer +jdkPreference.prefer.jdk=Prefer JDK runtime, but use public JRE if newer +jdkPreference.jdk.only=Only use private JDK runtimes + +MainFrame.config.files=launch4j config files (.xml, .cfg) +MainFrame.new.config=New configuration +MainFrame.open.config=Open configuration or import 1.x +MainFrame.save.config=Save configuration +MainFrame.build.wrapper=Build wrapper +MainFrame.test.wrapper=Test wrapper +MainFrame.about.launch4j=About launch4j +MainFrame.discard.changes=Discard changes? +MainFrame.confirm=Confirm +MainFrame.untitled=untitled +MainFrame.executing=Executing: +MainFrame.jar.integrity.test=Jar integrity test, executing: diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties new file mode 100755 index 000000000..1d2fac25f --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties @@ -0,0 +1,56 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +tab.basic = B\u00E1sico +tab.header = Cabecera +tab.jre = JRE +tab.splash = Pantalla de bienvenida +tab.version = Informaci\u00F3n de la versi\u00F3n + +jar = Jar +jarPath = Ruta del jar +jarTip = Jar de la aplicaci\u00F3n. +jarPathTip = Ruta del jar relativa al ejecutable. Por ejemplo, si el lanzador ejecutable y el jar de la aplicaci\u00F3n, llamados calc.exe y calc.jar respectivamente, est\u00E1n en el mismo directorio, ser\u00EDa\: calc.jar. + +MainFrame.config.files = Ficheros de configuraci\u00F3n de launch4j (.xml, .cfg) +MainFrame.new.config = Nueva configuraci\u00F3n +MainFrame.open.config = Abrir configuraci\u00F3n o importar 1.x +MainFrame.save.config = Guardar configuraci\u00F3n +MainFrame.build.wrapper = Construir el empaquetador +MainFrame.test.wrapper = Comprobar el empaquetador +MainFrame.about.launch4j = Acerca de launch4j +MainFrame.discard.changes = \u00BFDescartar cambios? +MainFrame.confirm = Confirmar +MainFrame.untitled = Sin nombre +MainFrame.executing = Ejecutando\: +MainFrame.jar.integrity.test = Prueba de integridad jar, ejecutando\: diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/messages.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/messages.properties new file mode 100755 index 000000000..cf28d15af --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/messages.properties @@ -0,0 +1,45 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Main.usage=usage + +Builder.compiling.resources=Compiling resources +Builder.linking=Linking +Builder.wrapping=Wrapping +Builder.success=Successfully created +Builder.generated.resource.file=Generated resource file...\n +Builder.line.has.errors=Line {0} has errors... + +Util.exec.failed=Exec failed +Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. +Util.use.double.backslash=Use \\\\ to code Windows paths in fields that don't represent files or paths! diff --git a/build/windows/launcher/launch4j/src/net/sf/launch4j/messages_es.properties b/build/windows/launcher/launch4j/src/net/sf/launch4j/messages_es.properties new file mode 100755 index 000000000..b179d9bd5 --- /dev/null +++ b/build/windows/launcher/launch4j/src/net/sf/launch4j/messages_es.properties @@ -0,0 +1,45 @@ +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Launch4j nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Main.usage=Uso + +Builder.compiling.resources=Compilando recursos +Builder.linking=Enlazando +Builder.wrapping=Empaquetando +Builder.success=Creado con \ufffdxito +Builder.generated.resource.file=Fichero de recursos generado...\n +Builder.line.has.errors=Line {0} has errors... + +Util.exec.failed=Fallo en la ejecuci\ufffd +Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. +Util.use.double.backslash=Use \\\\ to code Windows paths in fields that don't represent files or paths! \ No newline at end of file diff --git a/build/windows/launcher/launch4j/w32api/MinGW.LICENSE.txt b/build/windows/launcher/launch4j/w32api/MinGW.LICENSE.txt new file mode 100755 index 000000000..141412dd9 --- /dev/null +++ b/build/windows/launcher/launch4j/w32api/MinGW.LICENSE.txt @@ -0,0 +1,25 @@ +MinGW - Licensing Terms + +Various pieces distributed with MinGW come with its own copyright and license: + +Basic MinGW runtime + MinGW base runtime package is uncopyrighted and placed in the public domain. + This basically means that you can do what you want with the code. + +w32api + You are free to use, modify and copy this package. + No restrictions are imposed on programs or object files compiled with this library. + You may not restrict the the usage of this library. + You may distribute this library as part of another package or as a modified package + if and only if you do not restrict the usage of the portions consisting + of this (optionally modified) library. + If distributed as a modified package then this file must be included. + + 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. + +MinGW profiling code + MinGW profiling code is distributed under the GNU General Public License. + +The development tools such as GCC, GDB, GNU Make, etc all covered by GNU General Public License. diff --git a/build/windows/launcher/launch4j/w32api/libadvapi32.a b/build/windows/launcher/launch4j/w32api/libadvapi32.a new file mode 100755 index 000000000..c471853c7 Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libadvapi32.a differ diff --git a/build/windows/launcher/launch4j/w32api/libgcc.a b/build/windows/launcher/launch4j/w32api/libgcc.a new file mode 100755 index 000000000..d3f89479e Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libgcc.a differ diff --git a/build/windows/launcher/launch4j/w32api/libkernel32.a b/build/windows/launcher/launch4j/w32api/libkernel32.a new file mode 100755 index 000000000..5d3eb074f Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libkernel32.a differ diff --git a/build/windows/launcher/launch4j/w32api/libmingw32.a b/build/windows/launcher/launch4j/w32api/libmingw32.a new file mode 100755 index 000000000..d1f7888d8 Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libmingw32.a differ diff --git a/build/windows/launcher/launch4j/w32api/libmsvcrt.a b/build/windows/launcher/launch4j/w32api/libmsvcrt.a new file mode 100755 index 000000000..6714146b6 Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libmsvcrt.a differ diff --git a/build/windows/launcher/launch4j/w32api/libshell32.a b/build/windows/launcher/launch4j/w32api/libshell32.a new file mode 100755 index 000000000..d35fbdaf3 Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libshell32.a differ diff --git a/build/windows/launcher/launch4j/w32api/libuser32.a b/build/windows/launcher/launch4j/w32api/libuser32.a new file mode 100755 index 000000000..387fb650d Binary files /dev/null and b/build/windows/launcher/launch4j/w32api/libuser32.a differ diff --git a/build/windows/launcher/launch4j/web/bullet.gif b/build/windows/launcher/launch4j/web/bullet.gif new file mode 100755 index 000000000..f3f133bb8 Binary files /dev/null and b/build/windows/launcher/launch4j/web/bullet.gif differ diff --git a/build/windows/launcher/launch4j/web/changelog.html b/build/windows/launcher/launch4j/web/changelog.html new file mode 100755 index 000000000..83511a554 --- /dev/null +++ b/build/windows/launcher/launch4j/web/changelog.html @@ -0,0 +1,356 @@ + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.0.1 +
+ +
+

Changelog

+ +

Changes in version 3.0.1 (20-07-2008)

+
    +
  • Enhanced the runtime logging (--l4j-debug).
  • +
  • Fixed critical bug #1925387 64-bit JDK detection problem caused a runtime search error (found by Stivo).
  • +
  • Fixed bug #1919406, #1989479 Not every option is loaded from saved xml file (found by Robert Lachner, Jan-Philipp Rathje).
  • +
  • Fixed bug #1930222 Simple typo (found by Daniel).
  • +
+ +

Changes in version 3.0.0 (16-03-2008)

+
    +
  • FR #1390075 Added dynamic initial/max heap values.
  • +
  • FR #1707827 Allow to prefer JDK private runtimes over JREs (Ian Roberts).
  • +
  • FR #1730245 Allow to run only a single aplication instance (Sylvain Mina).
  • +
  • FR #1391610 Added IBM JRE/JDK support.
  • +
  • Added environment variable expansion in bundled JRE path.
  • +
  • Fixed critical bug #1882524 JRE detection problem on 64-bit Windows.
  • +
  • Fixed bug #1758912 Vista elevation to full administrator privileges.
  • +
  • Fixed bug #1784341 Problems with spaces in paths under linux (Michael Piefel).
  • +
  • Fixed bug where /bin was appended to path environment variable instead of jre_path/bin.
  • +
+ +

Changed license to BSD, MIT (26-01-2008)

+
    +
  • + The upcoming Launch4j 3.0.0 release will be licensed under the much more + liberal new BSD license. The head subproject (the binary header attached to wrapped jars) + will be licensed under the similar MIT license. +
  • +
+ +

Changes in version 3.0.0-pre2 (29-10-2006)

+
    +
  • Enhanced GUI.
  • +
  • Redesigned error reporting.
  • +
  • Added custom error messages.
  • +
  • Added support website feature.
  • +
  • Added PWD and OLDPWD special variables and access to the registry.
  • +
  • Runtime ini file extension changed to .l4j.ini, added comments (#).
  • +
  • FR #1427811 Initial process priority.
  • +
  • FR #1547339 Added VarFileInfo structure to Version Info (Stephan Laertz).
  • +
  • FR #1584295 Updated documentation for --l4j-debug. +
  • Fixed <jarArgs/> and <args/> config conversion bug (found by Dafe Simonek).
  • +
  • Fixed the Ant task exception reporting bug, added tmpdir and bindir attributes.
  • +
  • Fixed bug #1563415 Problem with launching application when ini file exists (found by mojomax).
  • +
  • Fixed bug #1527619 Console header wildcard expansion (found by erikjv).
  • +
  • Fixed bug #1544167 NPE when dontwrap and only classpath given (found by Hendrik Schreiber).
  • +
  • Fixed bug #1584264 Dropdown boxes get mixed up (found by Larsen).
  • +
+ +

News (17-10-2006)

+ + +

Changes in version 3.0.0-pre1 (21-07-2006)

+
    +
  • Improved configuration file format and embedded Ant config.
  • +
  • Launch executable jars, regular jars and class files.
  • +
  • Added dynamic classpath resolution with environment variable references and wildcards.
  • +
  • Added option to set environment variables before launching the application.
  • +
  • New command line switches to change the compiled options.
  • +
  • Improved debug information.
  • +
  • Added support for XP visual style manifests.
  • +
  • Added option to disable use of private JREs.
  • +
  • Many small fixes and improvements...
  • +
+ +

Configuration file changes in 3.x

+
    +
  • Previous formats (1.x and 2.x) are supported.
  • +
  • <headerType> accepts gui|console
  • +
  • <jarArgs> was changed to <cmdLine>
  • +
  • + <launch4jConfig><headerObjects><file> was changed to + <launch4jConfig><obj> +
  • +
  • + <launch4jConfig><libs><file> was changed to + <launch4jConfig><lib> +
  • +
  • + <launch4jConfig><jre><args> was changed to multiple + <launch4jConfig><jre><opt> +
  • +
+ +

Embedded Ant configuration changes in 3.x

+
    +
  • + <jre args="value"> was changed to + <jre><opt>value</opt></jre> +
  • +
  • Now it's possible to define headerObjects, libs and classpath.
  • +
+ +

Changes in version 2.1.5 (21-07-2006)

+
    +
  • Changed the Java download site to http://java.com/download.
  • +
  • Now it's possible to use absolute and relative paths to specify the bundled JRE.
  • +
+ +

Changes in version 2.1.4 (15-06-2006)

+
    +
  • + Fixed bug #1503996 Only the first wrapper instance had a custom process name + (found by Helge Böhme). +
  • +
+ +

Changes in version 2.1.3 (31-05-2006)

+
    +
  • + Fixed bug #1497453 Ant task doesn't support relative jar path with '..' + (found by Aston, Pavel Moukhataev). +
  • +
  • Jar argument size limit is now 16KB.
  • +
  • Environment variable size limit raised to 32KB.
  • +
  • Allow to concatenate multiple env. variables in one property (Maria D.)
  • +
  • Added launch4j.tmpdir property.
  • +
+ +

Changes in version 2.1.2 (03-04-2006)

+
    +
  • Important bugfix: insufficient command line buffer size was increased to 32KB + (found by Sebastian Kopsan).
  • +
  • Added runtime JVM options from an .ini file.
  • +
  • Launch4j's bin directory is now configurable through launch4j.bindir + system property.
  • +
+ +

Changes in version 2.1.1 (25-01-2006)

+
    +
  • Fixed bug #1402748. Validation error occurred when using an Ant task with + embedded config and dontWrapJar option (found by Chris Nokleberg).
  • +
+ +

Changes in version 2.1.0 (10-01-2006)

+
    +
  • More features and smaller header: 18 KB!!
  • +
  • Added launcher mode, you can choose whether or not to wrap the jar.
  • +
  • Spanish translation of the website/docs and program messages + (Patricio Martínez Ros).
  • +
  • JRE's bin directory is appended to the Path environment variable + (Ianiv Schweber).
  • +
  • Added special variables EXEDIR and EXEFILE that hold the executable's + directory and full path.
  • +
  • Support for mapping environment variables to system properties.
  • +
  • Added debug launching mode - various information is displayed before + starting the Java application.
  • +
  • Fixed min/max JRE version checking, previous versions allowed these + to be equal (found by Ryan).
  • +
  • Bug fixed. Quotes in jar/JVM arguments were handled incorrectly (found by Juan Alvarez Ferrando).
  • +
  • A few other enhancements.
  • +
+ +

Changes in version 2.0.0 (31-10-2005)

+
    +
  • Launch4j for Mac OS X is available thanks to Peter Centgraf.
  • +
  • Added support for custom headers.
  • +
  • Fixed bug #1343908, command line arguments with spaces were handled + incorrectly by the console header (found by Oliver Schaefer / Steve Alberty).
  • +
  • Fixed stdin redirection bug (found by Timo Santasalo).
  • +
+ +

Changes in version 2.0 RC3 (13-08-2005) - final RC

+
    +
  • Correct handling of pathnames with spaces.
  • +
  • Fixed the '%20' pathname bug.
  • +
  • Fixed basedir bug (Richard Xing).
  • +
  • Splash screen can be closed when the application window becomes visible + with out specifying it's title (Martin Busik). + Update your config file: <waitForTitle>title</waitForTitle> + is now <waitForWindow>true</waitForWindow>. +
  • +
  • Fixed build.bat files in demo directories.
  • +
+ +

Changes in version 2.0 RC2 (21-06-2005)

+
    +
  • chdir allows to change the current directory to arbitrary paths + relative to the executable (FR #1144907). It's incompatible with + previous versions, update your config file: + <chdir>true</chdir> + is now <chdir>.</chdir>. +
  • +
  • Bundled JRE path no longer depends on chdir function.
  • +
  • Fixed Ant task bug, build files outside launch4j's directory + wouldn't work. Josh Elsasser submitted a patch that works without + setting launch4j's home dir in the build file. Thanks! +
  • +
  • Removed static edge from splash screen (Serge Baranov).
  • +
  • Program checks that the output file path doesn't contain spaces.
  • +
  • Fixed a NPE bug caused by a missing maxVersion property + (found by Morgan Schweers). +
  • +
  • Fixed relative JRE path bug (found by Nili_).
  • +
  • Cleaned up the Builder class.
  • +
  • Fixed Ant task NPE where the config was entirely defined in the + build file (Josh Elsasser). +
  • +
+ +

Changes in version 2.0 RC (07-06-2005)

+
    +
  • Added an Ant task for better build integration.
  • +
  • Added 2.x documentation.
  • +
  • Updated the demo configuration files.
  • +
  • Fixed issues with relative paths in the configuration.
  • +
  • Removed the '-1' option in console mode.
  • +
  • Minor fixes.
  • +
+ +

Changes in version 2.0 beta2 (23-05-2005)

+
    +
  • # comments are recognized when importing 1.x cfg files.
  • +
  • Added version information.
  • +
  • Resource file is displayed when a resource error occurs.
  • +
  • Fixed a bug found by Max, options on the first tab were always enabled.
  • +
+ +

Changes in version 2.0 beta1 (13-05-2005)

+
    +
  • Completely new, cross-platform wrapper - create windows executables on Linux.
  • +
  • New .xml configuration file.
  • +
  • Application icon with multiple resolutions and color depths.
  • +
  • Swing GUI interface.
  • +
  • Header compiled with MinGW port of gcc instead of VC++.
  • +
+ +

Changes in version 1.4.2 (12-03-2005)

+
    +
  • Fixed bug #1158143, stayAlive without a splash screen caused + an infinite loop (found by Gregory Kotsaftis). +
  • +
+ +

Changes in version 1.4.1 (04-03-2005)

+
    +
  • Fixed bug #1119040, buffer for reading config properties + was too short (found by Tom Jensen and Neil). +
  • +
  • Added configurable splash timeout (FR #1102951).
  • +
  • Added option to disable the error message on splash timeout (FR #1109159).
  • +
  • Option to keep the gui launcher 'alive' after starting an application (FR #1124653).
  • +
  • Removed version info.
  • +
  • 'waitfor' property is now optional.
  • +
+ +

Changes in version 1.4.0 (26-01-2005)

+
    +
  • Removed .lch4j suffix from process name, now it has the + form of the executable filename. The temporary launchers are stored in + launch4j-tmp directory (suggested by Emmanuel). +
  • +
  • Added support for console apps (FR #1050053).
  • +
+ +

Changes in version 1.3.1 (05-11-2004)

+
    +
  • Fixed a bug where explorer window was opened instead of + launching the application when setProcName was set to false + (found by Rob Jones). +
  • +
  • Fixed temporary launcher deletion bug.
  • +
+ +

Changes in version 1.3.0 (01-11-2004)

+
    +
  • Now you can configure launch4j to: +
      +
    • Use a bundled JRE.
    • +
    • Search for java, show an error message if the + right version cannot be found and open the java download page.
    • +
    • And a feature you asked for: use bundled JRE, if + that fails search for java and bring up the java download page on error.
    • +
    +
  • +
  • Enhanced code that sets the custom process name. In + case launch4j can't refresh the temporary launcher, bundled JRE on a + read only file system for example, it will use one created previously, + if it's present and has the correct size. If not, launching will still + continue, but with javaw.exe process name.Temporary launchers are + now created in the jre directory instead of jre/bin. +
  • +
  • errTitle property allows to set the title of the error message box.
  • +
+ +

Changes in version 1.2.1 (25-09-2004)

+
    +
  • Bugfix that allows launching from command line using short + name (#1026514 / found by Zach Del) +
  • +
+ +

Changes in version 1.2.0 (10-09-2004)

+
    +
  • Custom process name (myapp.lch4j.exe)
  • +
  • 9 KB stub!
  • +
  • Jar arguments
  • +
  • Bugfix that allows launching from command line.
  • +
  • Hide splash on javaw error.
  • +
  • Easier configuration with case insensitive parameters + show unrecognized parameter.
  • +
  • 12 KB demo application, 34 KB with splash screen.
  • +
  • Configuration parameter 'args' changed to 'jvmArgs'
  • +
+
+ +
+ + diff --git a/build/windows/launcher/launch4j/web/docs.html b/build/windows/launcher/launch4j/web/docs.html new file mode 100755 index 000000000..67f898eb2 --- /dev/null +++ b/build/windows/launcher/launch4j/web/docs.html @@ -0,0 +1,585 @@ + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.0.1 +
+ +
+Running launch4j
+Configuration file
+Importing 1.x configuration
+Ant Task
+Additional JVM options at runtime
+Runtime options
+Settings
+ +

Running launch4j

+Run launch4j.exe or launch4j script without command +line arguments to enter the GUI mode. + +
launch4j.exe
+ +To wrap a jar in console mode use launch4jc.exe and +specify the configuration file. + +
launch4jc.exe config.xml
+ +On Linux use the launch4j script. + +
launch4j ./demo/l4j/config.xml
+ +

Configuration file

+Launch4j requires an xml configuration file for each output executable. +You can create and edit it conveniently using the graphic user +interface or your favorite editor. Alternatively it's possible to pass +all of the configuration parameters through the Ant task. All files +may be absolute paths or relative to the configuration file path. + +
+<!-- Bold elements are required -->
+<launch4jConfig>
+  <headerType>gui|console</headerType>
+  <outfile>file.exe</outfile>
+  <jar>file</jar>
+  <dontWrapJar>true|false</dontWrapJar>
+  <errTitle>text</errTitle>
+  <downloadUrl>http://java.com/download</downloadUrl>
+  <supportUrl>url</supportUrl>
+  <cmdLine>text</cmdLine>
+  <chdir>path</chdir>
+  <priority>normal|idle|high</priority>
+  <customProcName>true|false</customProcName>
+  <stayAlive>true|false</stayAlive>
+  <icon>file</icon>
+  <obj>header object file</obj>
+  ...
+  <lib>w32api lib</lib>
+  ...
+  <var>var=text</var>
+  ...
+  <classPath>
+    <mainClass>main class</mainClass>
+    <cp>classpath</cp>
+    ...
+  </classPath>
+  <singleInstance>
+    <mutexName>text</mutexName>
+    <windowTitle>text</windowTitle>
+  </singleInstance> 
+  <jre>
+    <!-- Specify one of the following or both -->
+    <path>bundled JRE path</path>
+    <minVersion>x.x.x[_xx]</minVersion>
+    <maxVersion>x.x.x[_xx]</maxVersion>
+    <jdkPreference>jreOnly|preferJre|preferJdk|jdkOnly</jdkPreference>
+    <!-- Heap sizes in MB and % of free memory -->
+    <initialHeapSize>MB</initialHeapSize>
+    <initialHeapPercent>%</initialHeapPercent>
+    <maxHeapSize>MB</maxHeapSize>
+    <maxHeapPercent>%</maxHeapPercent>
+    <opt>text</opt>
+    ...
+  </jre>
+  <splash>
+    <file>file</file>
+    <waitForWindow>true|false</waitForWindow>
+    <timeout>seconds [60]</timeout>
+    <timeoutErr>true|false</timeoutErr>
+  </splash>
+  <versionInfo>
+    <fileVersion>x.x.x.x</fileVersion>
+    <txtFileVersion>text</txtFileVersion>
+    <fileDescription>text</fileDescription>
+    <copyright>text</copyright>
+    <productVersion>x.x.x.x</productVersion>
+    <txtProductVersion>text</txtProductVersion>
+    <productName>text</productName>
+    <companyName>text</companyName>
+    <internalName>filename</internalName>
+    <originalFilename>filename.exe</originalFilename>
+  </versionInfo>
+  <messages>
+    <startupErr>text</startupErr>
+    <bundledJreErr>text</bundledJreErr>
+    <jreVersionErr>text</jreVersionErr>
+    <launcherErr>text</launcherErr>
+  </messages>
+</launch4jConfig>
+
+ +
+
<headerType>
+
+ Type of the header used to wrap the application. + + + + + + + + + + + + + + + + + + + + + + + +
Header typeLauncherSplash screenWait for the application to close
guijavawyeswrapper waits only if stayAlive is set to true, + otherwise it terminates immediately or after closing + the splash screen. +
consolejavanoalways waits and returns application's exit code.
+
+
+
+
<outfile>
+
Output executable file.
+
+
+
<jar>
+
+ Optional, by default specifies the jar to wrap. To launch a jar without + wrapping it enter the runtime path of the jar relative to + the executable and set <dontWrapJar> to true. + For example, if the executable launcher and the application jar named + calc.exe and calc.jar are in the same directory + then you would use <jar>calc.jar</jar> + and <dontWrapJar>true</dontWrapJar>. +
+
+
+
<dontWrapJar>
+
+ Optional, defaults to false. Launch4j by default wraps jars in native + executables, you can prevent this by setting <dontWrapJar> to true. + The exe acts then as a launcher and starts the application specified in + <jar> or <classPath><mainClass> +
+
+
+
<errTitle>
+
+ Optional, sets the title of the error message box that's displayed if Java cannot + be found for instance. This usually should contain the name of your + application. The console header prefixes error messages with this + property (myapp: error...) +
+
+
+
<cmdLine>
+
Optional, constant command line arguments.
+
+
+
<chdir>
+
Optional. Change current directory to an arbitrary path relative to the executable. + If you omit this property or leave it blank it will have no effect. + Setting it to . will change the current dir to the same directory + as the executable. .. will change it to the parent directory, and so on. +
+
+
<chdir>.</chdir>
+
+
+
<chdir>../somedir</chdir>
+
+
+
+
<customProcName>
+
Optional, defaults to false. + Set the process name as the executable filename and use Xp style manifests + (if any). + Creates a temporary file in launch4j-tmp directory inside the used JRE. + These files are deleted by any launch4j wrapped application, which sets + the process name and uses the same JRE. The removal takes place + when the application starts, + so at least one copy of this file will always be present. +
+
+
+
<stayAlive>
+
Optional, defaults to false in GUI header, always true in console header. + When enabled the launcher waits for the Java application + to finish and returns it's exit code. +
+
+
+
<icon>
+
Application icon in ICO format. May contain multiple color depths/resolutions.
+
+
+
<obj>
+
Optional, custom headers only. Ordered list of header object files.
+
+
+
<lib>
+
Optional, custom headers only. Ordered list of libraries used by header.
+
+
+
<singleInstance>
+
Optional, allow to run only a single instance of the application.
+
+
+
+
<mutexName>
+
Unique mutex name that will identify the application.
+
<windowTitle>
+
Optional, recognized by GUI header only. Title or title part of a window + to bring up instead of running a new instance. +
+
+
+
+
<jre>
+
Required element that groups JRE settings.
+
+
+
+
<path>, <minVersion>, <maxVersion>
+
The <path> property is used + to specify the absolute or relative path (to the executable) of a bundled JRE, it + does not rely on the current directory or <chdir>. + Note that this path is not checked until the actual application execution. + If you'd like the wrapper to search for a JRE (public or SDK private) + use the <minVersion> property, you may also specify + the <maxVersion> to prevent it from using higher Java versions. + Launch4j will always use the highest version available (in the min/max range of course). + If a Sun's JRE is not available or does not satisfy the search criteria, + the search will be repeated on IBM runtimes. + You can also combine these properties to change the startup process... +
+
+
+
+
<path>
+
Run if bundled JRE and javaw.exe are present, otherwise stop with error.
+
<path> + <minVersion>  [+ <maxVersion>]
+
Use bundled JRE first, if it cannot be located search for Java, + if that fails display error message and open the Java download page. +
+
<minVersion>  [+ <maxVersion>]
+
Search for Java, if an appropriate version cannot be found display + error message and open the Java download page. +
+
+
+
+
+
+
<jdkPreference>
+
Optional, defaults to preferJre; Allows you to specify a preference + for a public JRE or a private JDK runtime. Valid values are: +
+
+
+
+
jreOnly
+
Always use a public JRE (equivalent to the + old option dontUsePrivateJres=true)
+
preferJre
+
Prefer a public JRE, but use a JDK private + runtime if it is newer than the public + JRE (equivalent to the old option + dontUsePrivateJres=false)
+
preferJdk
+
Prefer a JDK private runtime, but use a + public JRE if it is newer than the + JDK
+
jdkOnly
+
Always use a private JDK runtime (fails + if there is no JDK installed)
+
+
+
+
HeapSize, HeapPercent
+
If size and percent are specified, then the setting which yields + more memory will be chosen at runtime. In other words, setting both values + means: percent of free memory no less than size in MB. +
+
+
+
+
<initialHeapSize>
+
Optional, initial heap size in MB.
+
+
+
<initialHeapPercent>
+
Optional, initial heap size in % of free memory.
+
+
+
<maxHeapSize>
+
Optional, max heap size in MB.
+
+
+
<maxHeapPercent>
+
Optional, max heap size in % of free memory.
+
+
+
+
<opt>
+
Optional, accepts everything you would normally pass to + java/javaw launcher: assertion options, system properties and X options. + Here you can map environment and special variables EXEDIR + (exe's runtime directory), EXEFILE (exe's runtime full file path) + to system properties. All variable references must be surrounded with + percentage signs and quoted. +
+<opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
+<opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
+<opt>-Denv.path="%Path%"</opt>
+<opt>-Dsettings="%HomeDrive%%HomePath%\\settings.ini"</opt>
+
+
+
+
+ +
+
<splash>
+
Optional, groups the splash screen settings. Allowed only in GUI header.
+
+
+
+
<file>
+
Splash screen image in BMP format.
+
+
+
<waitForWindow>
+
Optional, defaults to true. Close the splash screen when an application + window or Java error message box appears. If set to false, + the splash screen will be closed on timeout. +
+
+
+
<timeout>
+
Optional, defaults to 60. Number of seconds after which the splash screen + must be closed. Splash timeout may cause an error depending on + <timeoutErr>. +
+
+
+
<timeoutErr>
+
Optional, defaults to true. True signals an error on splash timeout, + false closes the splash screen quietly. +
+
+
+ +
+
<versionInfo>
+
Optional, version information to be displayed by the Windows Explorer.
+
+
+
+
<fileVersion>
+
Version number 'x.x.x.x'
+
+
+
<txtFileVersion>
+
Free form file version, for example '1.20.RC1'.
+
+
+
<fileDescription>
+
File description presented to the user.
+
+
+
<copyright>
+
Legal copyright.
+
+
+
<productVersion>
+
Version number 'x.x.x.x'
+
+
+
<txtProductVersion>
+
Free form file version, for example '1.20.RC1'.
+
+
+
<productName>
+
Text.
+
+
+
<companyName>
+
Optional text.
+
+
+
<internalName>
+
Internal name without extension, original filename or module name for example.
+
+
+
<originalFilename>
+
Original name of the file without the path. Allows to determine + whether a file has been renamed by a user. +
+
+
+ +

Importing 1.x configuration

+It's possible to import a 1.x configuration file using the GUI +interface. Open the file, correct the paths and save it as a new xml +configuration. + +

Ant task

+You may set a launch4j directory property or change the task definition. + +
<property name="launch4j.dir" location="/opt/launch4j" />
+ +Define the task in your Ant build script. + +
+<taskdef name="launch4j"
+    classname="net.sf.launch4j.ant.Launch4jTask"
+    classpath="${launch4j.dir}/launch4j.jar
+        :${launch4j.dir}/lib/xstream.jar" />
+
+ +Execute the task! + +
<launch4j configFile="./l4j/demo.xml" />
+ +You can set or override the following configuration properties... +

+ jar="absolute path or relative to basedir"
+ jarPath="relative path"
+ outfile
+ fileVersion
+ txtFileVersion
+ productVersion
+ txtProductVersion
+ bindir="alternate bin directory..."
+ tmpdir="alternate working directory..." +

+ +
+<launch4j configFile="./l4j/demo.xml" outfile="mydemo.exe"
+    fileVersion="1.0.0.0" txtFileVersion="1.0 RC2" />
+
+ +You can also define the entire configuration in the task, but it will +not be possible to edit such a file in the GUI mode. All paths except +for <chdir>, <jre><path> and jarPath +are calculated using the basedir project attribute. + +
+<launch4j>
+  <config headerType="gui" outfile="demo.exe"
+      dontWrapJar="true" jarPath="demo.jar" >
+    <var>SETTINGS="%HomeDrive%%HomePath%\\settings.ini"</var>
+    <classPath mainClass="org.demo.DemoApp">
+        <cp>./lib/looks.jar</cp>
+        <cp>%USER_LIBS%/*.jar</cp>
+    </classPath>
+    <jre minVersion="1.4.0">
+        <opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
+        <opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
+    </jre>
+  </config>
+</launch4j>
+
+ +

Additional JVM options at runtime

+When you create a wrapper or launcher all configuration details are compiled into the +executable and cannot be changed without recreating it or hacking with a resource editor. +Launch4j 2.1.2 introduces a new feature that allows to pass additional JVM options +at runtime from an .l4j.ini file. Now you can specify the options in the configuration file, +ini file or in both, but you cannot override them. The ini file's name must correspond +to the executable's (myapp.exe : myapp.l4j.ini). +The arguments should be separated with spaces or new lines, environment variable +expansion is supported, for example: +
+# Launch4j runtime config
+-Dswing.aatext=true
+-Dsomevar="%SOMEVAR%"
+-Xms16m
+
+ +

Runtime options

+
+
--l4j-debug
+
+ To make sure the output executable is configured correctly you can use the + debug launching mode to log various information to the launch4j.log file. +
+ +
--l4j-default-proc
+
+ Use default process name. +
+ +
--l4j-dont-wait
+
+ Disable the "stay alive" function. +
+ +
--l4j-no-splash
+
+ Disable the splash screen. +
+ +
--l4j-no-splash-err
+
+ Disable splash screen error on timeout, might be useful on very slow computers. +
+
+ +

Settings

+
+
Alternate bin directory: launch4j.bindir
+
+ It's possible to override the default bin directory location which contains windres and ld + tools using the launch4j.bindir system property. The property can have two forms: + a path relative to Launch4j's directory (altbin for example) or an absolute path. +
+ +
Working directory: launch4j.tmpdir
+
Change the working directory if the default path contains spaces which windres cannot handle.
+
+
+ +
+ + diff --git a/build/windows/launcher/launch4j/web/index.html b/build/windows/launcher/launch4j/web/index.html new file mode 100755 index 000000000..d1f928e6e --- /dev/null +++ b/build/windows/launcher/launch4j/web/index.html @@ -0,0 +1,128 @@ + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.0.1 +
+ +
+

Cross-platform Java executable wrapper

+

+ Launch4j is a cross-platform tool for wrapping + Java applications distributed as jars in lightweight Windows + native executables. The executable can be + configured to search for a certain JRE version or + use a bundled one, and it's possible to set + runtime options, like the initial/max heap size. + The wrapper also provides better user experience + through an application icon, a native pre-JRE + splash screen, a custom process name, and a Java + download page in case the appropriate JRE cannot + be found. +

+How to use Launch4 +

Features

+
    +
  • Launch4j wraps jars in Windows native executables and allows to run them + like a regular Windows program. It's possible to wrap applications + on Windows, Linux, Mac OS X and Solaris! +
  • +
  • Also creates launchers for jars and class files without wrapping.
  • +
  • + Supports executable jars and dynamic classpath resolution using + environment variables and wildcards. +
  • +
  • Doesn't extract the jar from the executable.
  • +
  • Custom application icon with multiple resolutions and color depths.
  • +
  • Native pre-JRE splash screen in BMP format shown until + the Java application starts. +
  • +
  • Process name as the executable filename to easily + identify your application, initial priority and + single aplication instance features. +
  • +
  • Works with a bundled JRE or searches for newest Sun or IBM JRE / JDK in given + version range.
  • +
  • Opens Java download page if an appropriate Java version cannot be + found or a support website in case of an error. +
  • +
  • Supports GUI and console apps.
  • +
  • Supports Vista manifests and XP visual style manifests.
  • +
  • Passes command line arguments, also supports constant arguments.
  • +
  • Allows to set the initial/max heap size also dynamically in percent of free memory.
  • +
  • JVM options: set system properties, tweak the garbage collection...
  • +
  • Runtime JVM options from an .l4j.ini file.
  • +
  • Runtime command line switches to change the compiled options.
  • +
  • Access to environment variables, the registry and executable file path through system properties.
  • +
  • Set environment variables.
  • +
  • Option to change current directory to the executable location.
  • +
  • The JRE's bin directory is appended to the Path environment variable.
  • +
  • Custom version information shown by Windows Explorer.
  • +
  • GUI and command line interface.
  • +
  • Build integration through an Ant task and a Maven Plugin.
  • +
  • Lightweight: 26 KB!
  • +
  • It's free and may be used for commercial purposes.
  • +
  • Includes a sample application and Ant script + that automates the build process from Java sources to native executable. +
  • +
  • The wrapped program works on all Windows platforms (98/Me/NT/2K/XP/Vista), + Launch4j works on NT/2K/XP/Vista, Linux, Mac OS X (build on 10.4) and Sparc Solaris 8-10. +
  • +
+

License

+

+ This program is free software licensed under the + BSD license, the head subproject + (the code which is attached to the wrapped jars) is licensed under the + MIT license. + Launch4j may be used for wrapping closed source, commercial applications. +

+

Info

+

+ Running Launch4j on other Java enabled platforms is a matter of getting a binary version + of MinGW binutils 2.15.90 (windres and ld only) + for your system or compiling them. If you'll provide these, I'll be able to create a binary package + available for download. +

+ +
+ +
+ + diff --git a/build/windows/launcher/launch4j/web/launch4j-use.gif b/build/windows/launcher/launch4j/web/launch4j-use.gif new file mode 100755 index 000000000..ccb888247 Binary files /dev/null and b/build/windows/launcher/launch4j/web/launch4j-use.gif differ diff --git a/build/windows/launcher/launch4j/web/launch4j.gif b/build/windows/launcher/launch4j/web/launch4j.gif new file mode 100755 index 000000000..27552074a Binary files /dev/null and b/build/windows/launcher/launch4j/web/launch4j.gif differ diff --git a/build/windows/launcher/launch4j/web/links.html b/build/windows/launcher/launch4j/web/links.html new file mode 100755 index 000000000..4213b86f9 --- /dev/null +++ b/build/windows/launcher/launch4j/web/links.html @@ -0,0 +1,73 @@ + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + + + + diff --git a/build/windows/launcher/launch4j/web/style.css b/build/windows/launcher/launch4j/web/style.css new file mode 100755 index 000000000..f57c086d6 --- /dev/null +++ b/build/windows/launcher/launch4j/web/style.css @@ -0,0 +1,159 @@ +body, table { + font: 12px/20px Verdana, Arial, Helvetica, sans-serif; +} + + +pre { + padding: 8px; + border: 1px dashed #999999; + background-color: #f1f1f1; + font: 13px/20px "Courier New", Courier, monospace; +} + + +.version { + color: #307fe1; + font-weight: bold; +} + + +.codeword { + color: #3333ff; +} +.attrib { + color: #404040; +} +.option { + font-family: "Courier New", Courier, monospace; + font-weight: bold; +} + + +dt { + margin-top: 1.5em; + color: #404040; + font-size: 115%; + border-bottom: 1px solid #cccccc; +} +dd { + margin-left: 1em; +} + + +.warn, ul.changes em { + color: #ff0000; +} + + +table { + margin-top: 1em; + padding: 0; + border: 1px solid #999999; + border-collapse: collapse; + text-align: center; +} +table th { + padding: 2px 4px; + border: 1px solid #999999; + background-color: #f1f1f1; +} +table td { + padding: 2px 4px; + border: 1px solid #999999; +} +.description { + text-align: left; +} + + +#container { + width: 90%; + margin: 10px auto; + border-width: 0; + background-color: #ffffff; +} + + +#top { + padding: 0.5em; + background-color: #ffffff; +} +#top h1 { + margin: 0; + padding: 0; +} + + +#leftnav { + float: left; + width: 170px; + margin: 0; + padding: 0.5em; + background-color: #ffffff; +} +#leftnav ul { + margin: 0; + padding: 0; + border: none; + list-style-type: none; + font-size: 115%; +} +#leftnav a { + width: 170px; + height: 1.6em; + line-height: 1.6em; + display: block; + padding-left: 0.2em; +} +#leftnav a:link, #leftnav a:visited { + text-decoration: none; + color: #666666; +} +#leftnav a:hover { + background-color: #307fe1; + color: #ffffff; +} + + +#content { + max-width: 52em; + margin-left: 190px; + padding: 1em; + border-left: 1px solid #cccccc; + background-color: #ffffff; +} + +#content ul { + list-style-image: url('bullet.gif'); +} + +#content a:link { + text-decoration: none; + color: #307fe1; +} +#content a:visited { + text-decoration: none; + color: #307fe1; +} +#content a:hover { + color: #307fe1; + text-decoration: underline; +} + +#content h2 { + font-size: 150%; +} +#content h2:first-child { + margin: 0 0 0.5em; +} + + +.footer { + clear: both; + margin: 0; + padding: 0.5em; + background-color: #ffffff; + color: #333333; + text-align: center; + font-size: 90%; +} diff --git a/build/windows/launcher/processing.exe b/build/windows/launcher/processing.exe new file mode 100755 index 000000000..0a8839d45 Binary files /dev/null and b/build/windows/launcher/processing.exe differ diff --git a/build/windows/make.sh b/build/windows/make.sh new file mode 100755 index 000000000..e7efec5f5 --- /dev/null +++ b/build/windows/make.sh @@ -0,0 +1,283 @@ +#!/bin/sh + + +### -- SETUP WORK DIR ------------------------------------------- + +if test -d work +then + BUILD_PREPROC=false +else + echo Setting up directories to build P5... + BUILD_PREPROC=true + + mkdir work + cp -r ../shared/lib work/ + cp -r ../shared/libraries work/ + cp -r ../shared/tools work/ + + cp ../../app/lib/antlr.jar work/lib/ + cp ../../app/lib/ecj.jar work/lib/ + cp ../../app/lib/jna.jar work/lib/ + + echo Extracting examples... + unzip -q -d work/ ../shared/examples.zip + + echo Extracting reference... + unzip -q -d work/ ../shared/reference.zip + + cp -r ../../net work/libraries/ + cp -r ../../opengl work/libraries/ + cp -r ../../serial work/libraries/ + cp -r ../../video work/libraries/ + cp -r ../../pdf work/libraries/ + cp -r ../../dxf work/libraries/ + + echo Extracting enormous JRE... + unzip -q -d work jre.zip + + # build the export launcher + cd export + make + cd .. + + # build the processing.exe bundle + # there are a few hacks in the source to launch4j-3.0.1 + # to build them, use the following: + # cd head_src/gui_head && make -f Makefile.win + cd launcher + ./launch4j/launch4jc.exe config.xml + cp processing.exe ../work/ + cd .. + + # chmod +x the crew + # cygwin requires this because of unknown weirdness + # it was not formerly this anal retentive + # with the html, it's necessary on windows for launching reference + # from shell/command prompt, which is done internally to view reference + find work -name "*.html" -exec chmod +x {} ';' + find work -name "*.dll" -exec chmod +x {} ';' + find work -name "*.exe" -exec chmod +x {} ';' + find work -name "*.html" -exec chmod +x {} ';' +fi + +cd ../.. + + +### -- BUILD CORE ---------------------------------------------- + +echo Building processing.core... + +cd core + +#CLASSPATH="..\\build\\windows\\work\\java\\lib\\rt.jar;..\\build\\windows\\work\\java\\lib\\tools.jar" +#CLASSPATH="..\\build\\windows\\work\\java\\lib\\tools.jar" +#export CLASSPATH + +perl preproc.pl + +mkdir -p bin +../build/windows/work/java/bin/java \ + -classpath "..\\build\\windows\\work\\java\\lib\\tools.jar" \ + com.sun.tools.javac.Main \ + -source 1.5 -target 1.5 -d bin \ + src/processing/core/*.java src/processing/xml/*.java + +rm -f ../build/windows/work/lib/core.jar + +# package this folder into core.jar +cd bin && zip -rq ../../build/windows/work/lib/core.jar \ + processing/core/*.class processing/xml/*.class && cd .. + +# back to base processing dir +cd .. + +### -- BUILD PREPROC --------------------------------------------- + +if $BUILD_PREPROC +then + +echo Building PDE for JDK 1.5 + +cd app + +# first build the default java goop +../build/windows/work/java/bin/java \ + -cp "..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool \ + -o src/antlr/java \ + src/antlr/java/java.g + +# now build the pde stuff that extends the java classes +#../../build/windows/work/java/bin/java \ +# -cp "..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool \ +# -o src/processing/app/preproc \ +# -glib antlr/java/java.g processing/app/preproc/pde.g + +# this is totally ugly and needs to be fixed +# the problem is that -glib doesn't set the main path properly, +# so it's necessary to cd into the antlr/java folder, otherwise +# the JavaTokenTypes.txt file won't be found + +# this is the eventual hack to make things work +# why this is required on windows and not the others is beyond me +cp src/antlr/java/JavaTokenTypes.txt src/processing/app/preproc/ + +# this is a total disaster...fix me soon! +cd src/processing/app/preproc +../../../../../build/windows/work/java/bin/java \ + -cp "..\\..\\..\\..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool \ + -glib ../../../antlr/java/java.g \ + pde.g +cd ../../../.. + + +# back to base processing dir +cd .. + +fi + + +### -- BUILD PDE ------------------------------------------------ + +cd app + +# has to be present, otherwise javac will complain of file writing errors +rm -rf ../build/windows/work/classes +mkdir ../build/windows/work/classes + +../build/windows/work/java/bin/java \ + -classpath "..\\build\\windows\\work\\java\\lib\\tools.jar" \ + com.sun.tools.javac.Main \ + -source 1.5 -target 1.5 \ + -classpath "..\\build\\windows\\work\\lib\\core.jar;..\\build\\windows\\work\\lib\antlr.jar;..\\build\\windows\\work\\lib\\ecj.jar;..\\build\\windows\\work\\lib\\jna.jar;..\\build\\windows\\work\\java\\lib\\tools.jar" \ + -d ..\\build\\windows\\work\\classes \ + src/processing/app/*.java \ + src/processing/app/debug/*.java \ + src/processing/app/syntax/*.java \ + src/processing/app/preproc/*.java \ + src/processing/app/tools/*.java \ + src/processing/app/windows/*.java \ + src/antlr/*.java \ + src/antlr/java/*.java + +cd ../build/windows/work/classes +rm -f ../lib/pde.jar +zip -rq ../lib/pde.jar . +cd ../.. + + +### -- BUILD LIBRARIES ------------------------------------------------ + +PLATFORM=windows + + +#CLASSPATH="..\\build\\$PLATFORM\\work\\lib\\core.jar;..\\build\\$PLATFORM\\work\\java\\lib\\rt.jar" +#CLASSPATH="..\\build\\$PLATFORM\\work\\lib\\core.jar" + +JAVAC="../build/windows/work/java/bin/java -classpath ..\\build\\windows\\work\\java\\lib\\tools.jar com.sun.tools.javac.Main -source 1.5 -target 1.5" +CORE="..\\build\\$PLATFORM\\work\\lib\\core.jar" +LIBRARIES="..\\build\\$PLATFORM\\work\\libraries" + +# move to processing/build +cd .. + + +# SERIAL LIBRARY +echo Building serial library... +cd ../serial +mkdir -p bin +$JAVAC \ + -classpath "library\\RXTXcomm.jar;$CORE" \ + -d bin src/processing/serial/*.java +rm -f library/serial.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/serial.jar processing/serial/*.class && cd .. +mkdir -p $LIBRARIES/serial/library/ +cp library/serial.jar $LIBRARIES/serial/library/ + +# NET LIBRARY +echo Building net library... +cd ../net +mkdir -p bin +$JAVAC \ + -classpath "$CORE" \ + -d bin src/processing/net/*.java +rm -f library/net.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/net.jar processing/net/*.class && cd .. +mkdir -p $LIBRARIES/net/library/ +cp library/net.jar $LIBRARIES/net/library/ + + +# VIDEO LIBRARY +echo Building video library... +if test -f "${QTJAVA}" +then + echo "Found Quicktime 7 installation" +else + QTJAVA="$WINDIR\\system32\\QTJava.zip" + if test -f "${QTJAVA}" + then + echo "Found Quicktime 6 at $QTJAVA" + else + echo "Could not find QuickTime for Java," + echo "you'll need to install it before building." + exit 1; + fi +fi +cd ../video +mkdir -p bin +$JAVAC \ + -classpath "$QTJAVA;$CORE" \ + -d bin src/processing/video/*.java +rm -f library/video.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/video.jar processing/video/*.class && cd .. +mkdir -p $LIBRARIES/video/library/ +cp library/video.jar $LIBRARIES/video/library/ + + +# OPENGL LIBRARY +echo Building OpenGL library... +cd ../opengl +mkdir -p bin +$JAVAC \ + -classpath "library\\jogl.jar;$CORE" \ + -d bin src/processing/opengl/*.java +rm -f library/opengl.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/opengl.jar processing/opengl/*.class && cd .. +mkdir -p $LIBRARIES/opengl/library/ +cp library/opengl.jar $LIBRARIES/opengl/library/ + + +# PDF LIBRARY +echo Building PDF library... +cd ../pdf +mkdir -p bin +$JAVAC \ + -classpath "library\\itext.jar;$CORE" \ + -d bin src/processing/pdf/*.java +rm -f library/pdf.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/pdf.jar processing/pdf/*.class && cd .. +mkdir -p $LIBRARIES/pdf/library/ +cp library/pdf.jar $LIBRARIES/pdf/library/ + + +# DXF LIBRARY +echo Building DXF library... +cd ../dxf +mkdir -p bin +$JAVAC \ + -classpath "$CORE" \ + -d bin src/processing/dxf/*.java +rm -f library/dxf.jar +find bin -name "*~" -exec rm -f {} ';' +cd bin && zip -rq ../library/dxf.jar processing/dxf/*.class && cd .. +mkdir -p $LIBRARIES/dxf/library/ +cp library/dxf.jar $LIBRARIES/dxf/library/ + + +echo +echo Done. + diff --git a/build/windows/run.sh b/build/windows/run.sh new file mode 100644 index 000000000..f02bbbdff --- /dev/null +++ b/build/windows/run.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +CLASSPATH=lib\\pde.jar\;lib\\core.jar\;lib\\jna.jar\;lib\\ecj.jar\;lib\\antlr.jar\;java\\lib\\tools.jar +export CLASSPATH + +cd work && ./java/bin/java processing.app.Base diff --git a/build/windows/srun.sh b/build/windows/srun.sh new file mode 100755 index 000000000..d81943ba9 --- /dev/null +++ b/build/windows/srun.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +QT_JAVA_PATH="$WINDIR\\system32\\QTJava.zip" +if test -f "${QT_JAVA_PATH}" +then + #echo "Found Quicktime at $QT_JAVA_PATH" +else + QT_JAVA_PATH="$WINDIR\\system\\QTJava.zip" + if test -f "${QT_JAVA_PATH}" + echo "could not find qtjava.zip in either" + echo "${WINDIR}\\system32\\qtjava.zip or" + echo "${WINDIR}\\system\\qtjava.zip" + echo "quicktime for java must be installed before building." + exit 1; + then + #echo "Found Quicktime at $QT_JAVA_PATH" + else + fi +fi + +CLASSPATH=\"java\\lib\\rt.jar\;lib\;lib\\build\;lib\\pde.jar\;lib\\kjc.jar\;lib\\antlr.jar\;lib\\oro.jar\;lib\\comm.jar\;lib\\RXTXcomm.jar\;${QT_JAVA_PATH}\" + +export CLASSPATH + +cd work && ./java/bin/java -Djava.compiler=NONE PdeBase diff --git a/core/.classpath b/core/.classpath new file mode 100644 index 000000000..fb5011632 --- /dev/null +++ b/core/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/core/.project b/core/.project new file mode 100644 index 000000000..9884df8b9 --- /dev/null +++ b/core/.project @@ -0,0 +1,17 @@ + + + core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/core/.settings/org.eclipse.jdt.core.prefs b/core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..f80f9b559 --- /dev/null +++ b/core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,261 @@ +#Thu Aug 28 17:36:28 EDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +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=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +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_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.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=true +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.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +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=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_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_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_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_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_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.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=false +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_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/core/.settings/org.eclipse.jdt.ui.prefs b/core/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..cfbda4c3e --- /dev/null +++ b/core/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,5 @@ +#Thu Jan 10 10:50:38 PST 2008 +eclipse.preferences.version=1 +formatter_profile=_two spaces no tabs +formatter_settings_version=11 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/core/api.txt b/core/api.txt new file mode 100644 index 000000000..4b2746f8b --- /dev/null +++ b/core/api.txt @@ -0,0 +1,413 @@ + + public void setParent(PApplet parent) + public void setPrimary(boolean primary) + public void setPath(String path) + public void setSize(int iwidth, int iheight) + protected void allocate() + public void dispose() + + public boolean canDraw() + public void beginDraw() + public void endDraw() + + protected void checkSettings() + protected void defaultSettings() + protected void reapplySettings() + + public void hint(int which) + + public void beginShape() + public void beginShape(int kind) + public void edge(boolean e) + public void normal(float nx, float ny, float nz) + public void textureMode(int mode) + public void texture(PImage image) + public void vertex(float x, float y) + public void vertex(float x, float y, float z) + public void vertex(float x, float y, float u, float v) + public void vertex(float x, float y, float z, float u, float v) + protected void vertexTexture(float u, float v); + public void breakShape() + public void endShape() + public void endShape(int mode) + + protected void bezierVertexCheck(); + public void bezierVertex(float x2, float y2, + float x3, float y3, + float x4, float y4) + public void bezierVertex(float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) + + protected void curveVertexCheck(); + public void curveVertex(float x, float y) + public void curveVertex(float x, float y, float z) + protected void curveVertexSegment(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) + protected void curveVertexSegment(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) + + protected void renderPoints(int start, int stop) // P3D + protected void rawPoints(int start, int stop) // P3D + + protected void renderLines(int start, int stop) // P3D + protected void rawLines(int start, int stop) // P3D + + protected void renderTriangles(int start, int stop) // P3D + protected void rawTriangles(int start, int stop) // P3D + + public void flush() + protected void render() + proected void sort() + + public void point(float x, float y) + public void point(float x, float y, float z) + public void line(float x1, float y1, float x2, float y2) + public void line(float x1, float y1, float z1, + float x2, float y2, float z2) + public void triangle(float x1, float y1, + float x2, float y2, + float x3, float y3) + public void quad(float x1, float y1, float x2, float y2, + float x3, float y3, float x4, float y4) + + public void rectMode(int mode) + public void rect(float a, float b, float c, float d) + protected void rectImpl(float x1, float y1, float x2, float y2) + + public void ellipseMode(int mode) + public void ellipse(float a, float b, float c, float d) + protected void ellipseImpl(float x, float y, float w, float h) + + public void arc(float a, float b, float c, float d, + float start, float stop) + protected void arcImpl(float x, float y, float w, float h, + float start, float stop) + + public void box(float size) + public void box(float w, float h, float d) + + public void sphereDetail(int res) + public void sphereDetail(int ures, int vres) + public void sphere(float r) + + public float bezierPoint(float a, float b, float c, float d, float t) + public float bezierTangent(float a, float b, float c, float d, float t) + protected void bezierInitCheck() + protected void bezierInit() + public void bezierDetail(int detail) + public void bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) + public void bezier(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) + + public float curvePoint(float a, float b, float c, float d, float t) + public float curveTangent(float a, float b, float c, float d, float t) + public void curveDetail(int detail) + public void curveTightness(float tightness) + protected void curveInitCheck() + protected void curveInit() + public void curve(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) + public void curve(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) + + protected void splineForward(int segments, PMatrix3D matrix) + + public void smooth() + public void noSmooth() + + public void imageMode(int mode) + public void image(PImage image, float x, float y) + public void image(PImage image, float x, float y, float c, float d) + public void image(PImage image, + float a, float b, float c, float d, + int u1, int v1, int u2, int v2) + protected void imageImpl(PImage image, + float x1, float y1, float x2, float y2, + int u1, int v1, int u2, int v2) + + public void shapeMode(int mode) + public void shape(PShape shape) + public void shape(PShape shape, float x, float y) + public void shape(PShape shape, float x, float y, float c, float d) + + public void textAlign(int align) + public void textAlign(int alignX, int alignY) + public float textAscent() + public float textDescent() + public void textFont(PFont which) + public void textFont(PFont which, float size) + public void textLeading(float leading) + public void textMode(int mode) + protected boolean textModeCheck(int mode) + public void textSize(float size) + public float textWidth(char c) + public float textWidth(String str) + protected float textWidthImpl(char buffer[], int start, int stop) + + public void text(char c) + public void text(char c, float x, float y) + public void text(char c, float x, float y, float z) + public void text(String str) + public void text(String str, float x, float y) + public void text(String str, float x, float y, float z) + public void text(String str, float x1, float y1, float x2, float y2) + public void text(String s, float x1, float y1, float x2, float y2, float z) + public void text(int num, float x, float y) + public void text(int num, float x, float y, float z) + public void text(float num, float x, float y) + public void text(float num, float x, float y, float z) + + protected void textLineAlignImpl(char buffer[], int start, int stop, + float x, float y) + protected void textLineImpl(char buffer[], int start, int stop, + float x, float y) + protected void textCharImpl(char ch, float x, float y) + protected void textCharModelImpl(PImage glyph, + float x1, float y1, //float z1, + float x2, float y2, //float z2, + int u2, int v2) + protected void textCharScreenImpl(PImage glyph, + int xx, int yy, + int w0, int h0) + + public void pushMatrix() + public void popMatrix() + + public void translate(float tx, float ty) + public void translate(float tx, float ty, float tz) + public void rotate(float angle) + public void rotateX(float angle) + public void rotateY(float angle) + public void rotateZ(float angle) + public void rotate(float angle, float vx, float vy, float vz) + public void scale(float s) + public void scale(float sx, float sy) + public void scale(float x, float y, float z) + + public void resetMatrix() + public void applyMatrix(PMatrix2D source) + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) + public void applyMatrix(PMatrix3D source) + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) + + public getMatrix(PMatrix2D target) + public getMatrix(PMatrix3D target) + public void setMatrix(PMatrix2D source) + public void setMatrix(PMatrix3D source) + public void printMatrix() + + public void beginCamera() + public void endCamera() + public void camera() + public void camera(float eyeX, float eyeY, float eyeZ, + float centerX, float centerY, float centerZ, + float upX, float upY, float upZ) + public void printCamera() + + public void ortho() + public void ortho(float left, float right, + float bottom, float top, + float near, float far) + public void perspective() + public void perspective(float fov, float aspect, float near, float far) + public void frustum(float left, float right, + float bottom, float top, + float near, float far) + public void printProjection() + + public float screenX(float x, float y) + public float screenY(float x, float y) + public float screenX(float x, float y, float z) + public float screenY(float x, float y, float z) + public float screenZ(float x, float y, float z) + public float modelX(float x, float y, float z) + public float modelY(float x, float y, float z) + public float modelZ(float x, float y, float z) + + public void pushStyle() + public void popStyle() + public void style(PStyle) + public PStyle getStyle() + public void getStyle(PStyle) + + public void strokeCap(int cap) + public void strokeJoin(int join) + public void strokeWeight(float weight) + + public void noStroke() + public void stroke(int rgb) + public void stroke(int rgb, float alpha) + public void stroke(float gray) + public void stroke(float gray, float alpha) + public void stroke(float x, float y, float z) + public void stroke(float x, float y, float z, float a) + protected void strokeFromCalc() + + public void noTint() + public void tint(int rgb) + public void tint(int rgb, float alpha) + public void tint(float gray) + public void tint(float gray, float alpha) + public void tint(float x, float y, float z) + public void tint(float x, float y, float z, float a) + protected void tintFromCalc() + + public void noFill() + public void fill(int rgb) + public void fill(int rgb, float alpha) + public void fill(float gray) + public void fill(float gray, float alpha) + public void fill(float x, float y, float z) + public void fill(float x, float y, float z, float a) + protected void fillFromCalc() + + public void ambient(int rgb) + public void ambient(float gray) + public void ambient(float x, float y, float z) + protected void ambientFromCalc() + public void specular(int rgb) + public void specular(float gray) + public void specular(float x, float y, float z) + protected void specularFromCalc() + public void shininess(float shine) + public void emissive(int rgb) + public void emissive(float gray) + public void emissive(float x, float y, float z ) + protected void emissiveFromCalc() + + public void lights() + public void noLights() + public void ambientLight(float red, float green, float blue) + public void ambientLight(float red, float green, float blue, + float x, float y, float z) + public void directionalLight(float red, float green, float blue, + float nx, float ny, float nz) + public void pointLight(float red, float green, float blue, + float x, float y, float z) + public void spotLight(float red, float green, float blue, + float x, float y, float z, + float nx, float ny, float nz, + float angle, float concentration) + public void lightFalloff(float constant, float linear, float quadratic) + public void lightSpecular(float x, float y, float z) + protected void lightPosition(int num, float x, float y, float z) + protected void lightDirection(int num, float x, float y, float z) + + public void background(int rgb) + public void background(int rgb, float alpha) + public void background(float gray) + public void background(float gray, float alpha) + public void background(float x, float y, float z) + public void background(float x, float y, float z, float a) + public void background(PImage image) + protected void backgroundFromCalc() + protected void backgroundImpl(PImage image) + protected void backgroundImpl() + + public void colorMode(int mode) + public void colorMode(int mode, float max) + public void colorMode(int mode, float maxX, float maxY, float maxZ) + public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA) + + protected void colorCalc(int rgb) + protected void colorCalc(int rgb, float alpha) + protected void colorCalc(float gray) + protected void colorCalc(float gray, float alpha) + protected void colorCalc(float x, float y, float z) + protected void colorCalc(float x, float y, float z, float a) + protected void colorCalcARGB(int argb, float alpha) + + public final int color(int gray) + public final int color(int gray, int alpha) + public final int color(int rgb, float alpha) + public final int color(int x, int y, int z) + + public final float alpha(int what) + public final float red(int what) + public final float green(int what) + public final float blue(int what) + public final float hue(int what) + public final float saturation(int what) + public final float brightness(int what) + + public int lerpColor(int c1, int c2, float amt) + static public int lerpColor(int c1, int c2, float amt, int mode) + + public void beginRaw(PGraphics rawGraphics) + public void endRaw() + + static public void showWarning(String msg) + static public void showException(String msg) + + public boolean displayable() + public boolean is2D() + public boolean is3D() + +// + +These are the methods found in PImage, which are inherited by PGraphics. + + public PImage(Image) + public Image getImage() + + public void setCache(Object parent, Object storage) + public void getCache(Object parent) + public void removeCache(Object parent) + + public boolean isModified(); + public void setModified(); + public void setModified(boolean state); + + public void loadPixels() + public void updatePixels() + public void updatePixels(int x, int y, int w, int h) + + public void resize(int wide, int high) + + public int get(int x, int y) + public PImage get(int x, int y, int w, int h) + protected PImage getImpl(int x, int y, int w, int h) + public PImage get() + public void set(int x, int y, int c) + public void set(int x, int y, PImage src) + protected void setImpl(int dx, int dy, int sx, int sy, int sw, int sh, + PImage src) + + public void mask(int alpha[]) + public void mask(PImage alpha) + + public void filter(int kind) + public void filter(int kind, float param) + + public void copy(int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh) + public void copy(PImage src, + int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh) + + static public int blendColor(int c1, int c2, int mode) + public void blend(int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh, int mode) + public void blend(PImage src, + int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh, int mode) + + public void save(String path) diff --git a/core/done.txt b/core/done.txt new file mode 100644 index 000000000..e2eb2ec90 --- /dev/null +++ b/core/done.txt @@ -0,0 +1,2878 @@ +0164 core (1.0.2) +X requestImage() causing problems with JAVA2D +X fix minor strokeWeight bug with OpenGL +X text() with char array +o add documentation +o add this for text in a rectangle? +X minor bug fix to svg files that weren't being resized properly +X OpenGL is rendering darker in 0149+ +X http://dev.processing.org/bugs/show_bug.cgi?id=958 +X the fix has been found, just incorporate it +X thanks to dave bollinger +X OutOfMemoryError with ellipse() in P3D and OPENGL +X http://dev.processing.org/bugs/show_bug.cgi?id=1086 +X should also fix problem with AIOOBE +X http://dev.processing.org/bugs/show_bug.cgi?id=1117 +X point(x,y) ignores noStroke() (in some renderers) +X http://dev.processing.org/bugs/show_bug.cgi?id=1090 +X fix startup problem when scheme coloring was odd +X http://dev.processing.org/bugs/show_bug.cgi?id=1109 +X fix several point() problems with P3D +X http://dev.processing.org/bugs/show_bug.cgi?id=1110 +X nextPage() not working properly with PDF as the renderer +X http://dev.processing.org/bugs/show_bug.cgi?id=1131 +X save styles when nextPage() is called +X beginRaw() broken (no DXF, etc working) +X http://dev.processing.org/bugs/show_bug.cgi?id=1099 +X http://dev.processing.org/bugs/show_bug.cgi?id=1144 +X Fix algorithm for quadratic to cubic curve conversion +X wrong algorithm in PGraphicsOpenGL and PShapeSVG +X (thanks to user 'shambles') +X http://dev.processing.org/bugs/show_bug.cgi?id=1122 +X tint() not working in P2D +X http://dev.processing.org/bugs/show_bug.cgi?id=1132 +X blend() y coordinates inverted when using OpenGL +X http://dev.processing.org/bugs/show_bug.cgi?id=1137 + +invalid/wontfix/dupe +X Processing will not start with non-standard disk partitioning on OS X +X http://dev.processing.org/bugs/show_bug.cgi?id=1127 +X Got NoClassDefFoundError exception when accessing quicktime API +X http://dev.processing.org/bugs/show_bug.cgi?id=1128 +X http://dev.processing.org/bugs/show_bug.cgi?id=1129 +X http://dev.processing.org/bugs/show_bug.cgi?id=1130 +X not using present mode correctly +X http://dev.processing.org/bugs/show_bug.cgi?id=1138 +X apparent graphics driver conflict on vista +X http://dev.processing.org/bugs/show_bug.cgi?id=1140 +X PImage.save() does not create parent directories +X http://dev.processing.org/bugs/show_bug.cgi?id=1124 +X sketch turning blue and not working on osx +X http://dev.processing.org/bugs/show_bug.cgi?id=1164 +X dupe: blend() inaccurary +X http://dev.processing.org/bugs/show_bug.cgi?id=1008 +X glPushAttrib style function +X http://dev.processing.org/bugs/show_bug.cgi?id=1150 +X calling saveFrame() in noLoop() (update reference) +X http://dev.processing.org/bugs/show_bug.cgi?id=1155 + +xml +X fix for xml elements that have null names +X added listChildren() method +X added optional toString(boolean) parameter to enable/disable indents + + +0163 core (1.0.1) +X do not parse split() with regexp +X http://dev.processing.org/bugs/show_bug.cgi?id=1060 +X ArrayIndexOutOfBoundsException in ellipseImpl() with 1.0 +X http://dev.processing.org/bugs/show_bug.cgi?id=1068 + + +0162 core (1.0) +X no additional changes for 1.0 + + +0161 core +X present on macosx causing strange flicker/jump while window opens +X using validate() for present mode, pack() otherwise +X http://dev.processing.org/bugs/show_bug.cgi?id=1051 + + +0160 core +X stroked lines drawing on top of everything else in P3D +X http://dev.processing.org/bugs/show_bug.cgi?id=1032 +X 100x100 sketches not working + + +0159 core +o disable present mode? (weirdness with placements on mac) +X deal with some present mode issues +X use FSE on mac within the PDE +X when exporting, never use FSE +_ document changes re: can specify --exclusive on command line +X do we need to do glEnable for multisample with gl? +o just need to test this on a few platforms +X doesn't seem to be the case +X Present mode and OPENGL not working in 0156 with Windows Vista +X http://dev.processing.org/bugs/show_bug.cgi?id=1009 +X Seems to be limited to Java 6u10 (but verify) +o -Dsun.java2d.d3d=false seems to fix the problem +o can probably add that to PApplet.main() +X does not work + + +0158 core +X beginShape(TRIANGLE_FAN), and therefore arc(), broken in P2D +X also a typo in the ColorWheel example +X http://dev.processing.org/bugs/show_bug.cgi?id=1019 +X P2D - null pointer exception drawing line with alpha stroke +X http://dev.processing.org/bugs/show_bug.cgi?id=1023 +X P2D endShape() is working like endShape(CLOSE) +X http://dev.processing.org/bugs/show_bug.cgi?id=1021 +X http://dev.processing.org/bugs/show_bug.cgi?id=1028 (mark as dupe) +X arc() center transparent +X http://dev.processing.org/bugs/show_bug.cgi?id=1027 +X mark as dupe of bug #200 +X but fixed for the P2D case, still afflicts P2D +X P2D - alpha stroke rendered at full opacity +X http://dev.processing.org/bugs/show_bug.cgi?id=1024 +X smooth() on single line ellipses not coming out smooth +X sort of works, just not great +X improve (slightly) the quality of ellipse() and arc() with P2D +X don't use TRIANGLE_FAN on ellipseImpl() and arcImpl() with P2D +X split out ellipseImpl and arcImpl from PGraphics into P2D and P3D +X figure out better model for adaptive sizing of circles +X also goes for arcs, though will be weighted based on arc size +X Bring back CENTER_RADIUS but deprecate it +X http://dev.processing.org/bugs/show_bug.cgi?id=1035 +X enable smoothing by default in opengl +X change hints to instead only be able to DISABLE 2X or 4X +X bring back .width and .height fields for PShape +o need to update the examples to reflect +X no examples to update +X change reference re: smoothing in opengl +X hint(), smooth(), and size() +X rev the version number + + +0157 core +X SVG polygon shapes not drawing since loadShape() and PShape changes +X http://dev.processing.org/bugs/show_bug.cgi?id=1005 +X image(a, x, y) not honoring imageMode(CENTER) +X need to just pass image(a, x, y) to image(a, x, y, a.width, a.height) +X rather than passing it directly to imageImpl() +X http://dev.processing.org/bugs/show_bug.cgi?id=1013 +o disable P2D before releasing (unless implementation is finished) + + +0156 core +X clarify the "no variables in size() command" rule +X http://dev.processing.org/bugs/show_bug.cgi?id=992 +X present mode broken in general? +X placement of elements in present mode is messed up +X "stop" button hops around, window not centered on screen +X http://dev.processing.org/bugs/show_bug.cgi?id=923 +X disable P2D for size() and createGraphics() before releasing +X already was disabled, just a bug in detecting it + + +0155 core +X hint(DISABLE_DEPTH_TEST) throws null pointer exception with OpenGL +X http://dev.processing.org/bugs/show_bug.cgi?id=984 + + +0154 core +X only set apple.awt.graphics.UseQuartz on osx, otherwise security error +X http://dev.processing.org/bugs/show_bug.cgi?id=976 +X add skewX() and skewY() to PMatrix +X Add support style attribute for path tag to Candy SVG (ricard) +X http://dev.processing.org/bugs/show_bug.cgi?id=771 +X remove setX/Y/Z from PVector, copy() (use get() instead), add mult/div +X remove copy() from PVector? +X add mult() and div() with vector inputs? + + +0153 core +X make PImage.init() public again + + +0152 core +X no changes to 0152 core + + +0151 core +X NullPointerException on curveVertex() when using more than 128 vertices +X http://dev.processing.org/bugs/show_bug.cgi?id=952 +X Text not bounding correctly with x, y, w, h +X http://dev.processing.org/bugs/show_bug.cgi?id=954 +o dataFolder() might be flawed b/c it's referring to contents of jar file +o for input, better to use openStream +X clear up the javadoc on this +X odd-size height will make blue line across image in saveFrame() +X http://dev.processing.org/bugs/show_bug.cgi?id=944 +X probably the pixel flipping code (and endian sorting) not happening +X because the blue comes from the byte order flip +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=post;num=1219196429 +X ArrayIndexOutOfBoundsException in PLine +X http://dev.processing.org/bugs/show_bug.cgi?id=246 +X http://dev.processing.org/bugs/show_bug.cgi?id=462 +X random AIOOBE with P3D and points +X http://dev.processing.org/bugs/show_bug.cgi?id=937 + +cleanup +X alter bezier and curve matrices to use PMatrix +X float array stuff is redundant with code that's in PMatrix +X and PMatrix has to be included even w/o P3D so... +X add texture support to begin/endRaw +X should we do joins when alpha is turned off? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1210007450 +X no, because it's too processor intensive to draw a lotta ellipses +X but added a note about it to the reference for 0151 +X strokeWeight() doesn't work in opengl or p3d +o gl smoothing.. how to disable polygon but keep line enabled +o or at least make a note of this? +o leave smooth off, get the gl object, then enable line smooth +X don't bother, this is a workaround for another bug +o PPolygon no longer in use and PLine is a mess +o make a version of PGraphics3 that uses it for more accurate rendering? + + +0150 core +X no changes to processing.core in 0150 + + +0149 core +X remove MACOS9 constant from processing.core.* +X because code no longer runs on os9 since dropping 1.1 support +X specular() with alpha has been removed +X GLDrawableFactory.chooseGraphicsConfiguration() error with OpenGL +X http://dev.processing.org/bugs/show_bug.cgi?id=891 +X http://dev.processing.org/bugs/show_bug.cgi?id=908 +X fix problem with unregisterXxxx() +X http://dev.processing.org/bugs/show_bug.cgi?id=910 +X make parseFloat() with String[] array return NaN for missing values +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1220880375 +X fix problems with text in a rectangle +X http://dev.processing.org/bugs/show_bug.cgi?id=893 +X http://dev.processing.org/bugs/show_bug.cgi?id=899 +X finish getImage() method inside PImage +X delay() is broken +X http://dev.processing.org/bugs/show_bug.cgi?id=894 +X remove extra ~ files from core.jar +X also fix for other libraries in the make scripts across platforms +X fix problems in PApplet regarding signed code +X createInput() wasn't bothering to check files when not online +X unhint() has been removed, see the reference for hint() for changes +o enable() and disable() instead of hint()/unhint() +o should these use text strings? how will that be compiled? +X remove unhint(), add opposite hints for those that need to be disabled +o maybe update hint() ref to be more clear about screen not accumulating +X no, it's explicitly stated as such +X make decisions about whether PGraphics is an abstract class or not +X method signature is a real problem +X figure out how to handle constructor mess +X clean up setMainDrawingSurface() +X should instead be inside size(), and init(), no? +X add to hint(DISABLE_DEPTH_TEST) +X gl.glClear(GL.GL_DEPTH_BUFFER_BIT); +X or clearing the zbuffer for P3D +X also add a note to the hint() reference +X DISABLE_DEPTH_TEST bad results +X have to clear the zbuffer to make it work +X this may be specific to lines +X http://dev.processing.org/bugs/show_bug.cgi?id=827 +X though it also seems to be a problem with opengl +X also make a note of disabling as a way to help font appearance +o Font width calculation fails when using vectorfonts and PDF +o http://dev.processing.org/bugs/show_bug.cgi?id=920 +X um, this is gross: getMatrix((PMatrix2D) null) +X no changing point sizes when using beginShape(POINTS) +X this is an opengl restriction, should we stick with it elsewhere? +X and changing stroke weight in general (with lines/shapes) +o no renderer does this, we should probably disable it +X added a note to the reference about it +X may need to add to PApplet.main() for OS X 10.5 +X System.setProperty("apple.awt.graphics.UseQuartz", "true"); +X deprecate arraycopy(), change to arrayCopy() + +cleaning +o chooseFile() and chooseFolder() with named fxn callbacks +o the function must take a File object as a parameter +o add better error messages for all built-in renderers +o i.e. "import library -> pdf" when pdf is missing +o cameraXYZ doesn't seem to actually be used for anything +o since camera functions don't even look at it or set it +o registerSize() in arcball is causing trouble +o some sort of infinite loop issue +o textMode(SCREEN) is broken for opengl +o http://dev.processing.org/bugs/show_bug.cgi?id=426 +o textSpace(SCREEN) for opengl and java2d +o don't use loadPixels for either +o use font code to set the cached color of the font, then call set() +o although set() with alpha is a little different.. +o resizing opengl applet likely to cause big trouble +o componentlistener should prolly only do size() command outside of draw +o fjen says blend() doens't work in JAVA2D +o the functions are fairly well separated now in PMethods +o just go through all the stuff to make sure it's setting properly + +point() +X java2d - if strokeWeight is 1, do screenX/Y and set() +X if strokeWeight larger, should work ok with line() +X no, use an ellipse if strokeWeight is larger +X gl points not working again +X need to implement point() as actual gl points +X this means adding points to the pipeline +X point() doesn't work with some graphics card setups +X particularly with opengl and java2d +X http://dev.processing.org/bugs/show_bug.cgi?id=121 +X point() issues +o point() being funneled through beginShape is terribly slow +X go the other way 'round +X sometimes broken, could be a problem with java 1.5? (was using win2k) + +font +X fix getFontMetrics() warning +X need to have a getGraphics() to get the actual Graphics object +X where drawing is happening. parent.getGraphics() works except for OpenGL +X Java2D textLinePlacedImpl should check for ENABLE_NATIVE_FONTS hint +X http://dev.processing.org/bugs/show_bug.cgi?id=633 +X also try to check native font on textFont() commands +X in case the hint() has been enabled in the meantime +X or rather, always load native font, even w/o the hint() being set + +PGraphics API changes +X setMainDrawingSurface() -> setPrimarySurface() +X mainDrawingSurface = primarySurface; +X resize() -> setSize() (roughly) +X endShape() with no params is no longer 'final' +X X/Y/Z -> TX/TY/TZ +X MX/MY/MZ -> X/Y/Z (for sake of PShape) +X render_triangles -> renderTriangles() +X depth_sort_triangles -> sortTriangles() +X render_lines -> renderLines() +X depth_sort_lines -> sortLines() +X no longer any abstract methods in PGraphics itself +X removed support for specular alpha (and its 'SPA' constant) +X clear() -> backgroundImpl() +X add DIAMETER as synonym for CENTER for ellipseMode and friends +X textFontNative and textFontNativeMetrics have been removed +X they've been re-implemented per-PGraphics in a less hacky way +X hint(ENABLE_NATIVE_FONTS) goes away +X need to mention in createFont() reference +X also maybe cover in the loadFont() reference? (maybe problem...) +X image.cache has been removed, replaced with get/set/removeCache() +X this allows per-renderer image cache data to be stored +X imageMode has been removed from PImage, too awkward +X this also means that imageMode ignored for get(), set(), blend() and copy() +X smooth is now part of PGraphics, moved out of PImage +X raw must handle points, lines, triangles, and textures +X light position and normal are now PVector object +X changed NORMALIZED to NORMAL for textureMode() + +shapes +X maybe finish off the svg crap for this release +X working on pshape +X add shape() methods to PGraphics/PApplet +X test and fix svg examples +X revisions.txt for x/y/z/ tx/ty/tz.. other changes in api.txt +X bring svg into main lib +X need to straighten out 'table' object for quick object lookup +X maybe add to all parent tables? (no, this gets enormous quickly) +X fix svg caps/joins for opengl with svg library +X http://dev.processing.org/bugs/show_bug.cgi?id=628 +X save/restore more of the p5 graphics drawing state +X not setting colorMode(), strokeCap, etc. +X ignoreStyles is broken - how to handle +X need a whole "styles" handler +X handle cap/join stuff by +X if it's setting the default, no error message +X if it's not the default, then show an error msg once +X have a list Strings for errors called, rather than constants for all +X that way, no need to have an error message for every friggin function +X PMatrix now PMatrix3D (maybe not yet?) +X change svg library reference + +hint/unhint/enable/disable +X option to have renderer errors show up +X 1) as text warnings 2) as runtime exceptions 3) never +X add warning system for pgraphics, rather than runtime exceptions +X keep array of warning strings, and booleans for whether they've called +X ENABLE_DEPTH_SORT not really working for GL +X because the zbuffer is still there, it's still calculating +X actually, this is probably because it happens after the frame +X so really, flush is required whenever the depth sort is called +X need to check this--isn't this referring to DISABLE_DEPTH_TEST? +X ENABLE_DEPTH_SORT causing trouble with MovieMaker +X need to make the flush() api accessible +X http://dev.processing.org/bugs/show_bug.cgi?id=692 +X image smoothing +X straighten out default vs. ACCURATE vs. whatever +X Java2D and P3D and OpenGL are all inconsistent +o need to be able to do hint() to do nearest neighbor filtering +X http://dev.processing.org/bugs/show_bug.cgi?id=685 +o imageDetail(), textDetail(), etc? +o decisions on image smoothing vs. text smoothing vs. all + + +0148 core +X tweaks to PGraphicsOpenGL to support GLGraphics + + +0147 core +X processing sketches not restarting after switching pages in safari +X http://dev.processing.org/bugs/show_bug.cgi?id=581 + +cleaning +X misshapen fonts on osx (apple fixed their bug) +X http://dev.processing.org/bugs/show_bug.cgi?id=404 + + +0146 core +X fix the internal file chooser so that people don't need to make their own +X threading is a problem with inputFile() and inputFolder() +X dynamically load swingworker? +o remove saveFile() methods? +o write up examples for these instead? +o start an integration section? +X get() in java2d not honoring imageMode or rectMode +X add imageMode(CENTER) implementation +X add a bunch of changes to the reference to support this +X Duplicate 3d faces in beginRaw() export +X this was actually doubling geometry, potentially a bit of a disaster +X http://dev.processing.org/bugs/show_bug.cgi?id=737 +o bezierVertex YZ Plane fill problem +X http://dev.processing.org/bugs/show_bug.cgi?id=752 +X weird coplanar stuff, shouldn't be doing 3D anyway + +cleanup +X switch to requestImage() (done in 0145) +o can bug 77 be fixed with a finalizer? (no, it cannot) +X make sure that images with alpha still have alpha in current code +X text in rectangle is drawing outside the box +X http://dev.processing.org/bugs/show_bug.cgi?id=844 +X points missing in part of screen +X http://dev.processing.org/bugs/show_bug.cgi?id=269 + + +0145 core +X separate x/y axis on sphereDetail() params +X http://dev.processing.org/bugs/show_bug.cgi?id=856 +X make sure docs for PImage use createImage +X add notes about JOGLAppletLauncher +X http://download.java.net/media/jogl/builds/nightly/javadoc_public/com/sun/opengl/util/JOGLAppletLauncher.html +X added to javadoc +o need a halt() method which will kill but not quit app (sets finished?) +o exit() will actually leave the application +o this may in fact only be internal +X this is just the stop() method, though maybe we need to document it +X text(String, float, float, float, float) draws text outside box +X http://dev.processing.org/bugs/show_bug.cgi?id=844 +X implement textAlign() for y coords in text rect +X need to add reference for this +X textAlign() bottom now takes textDescent() into account +X remove gzip-related hint() + +threading +X major threading overhaul before 1.0 (compendium) +X http://dev.processing.org/bugs/show_bug.cgi?id=511 +X ewjordan has added a good trace of the badness +X need to move off anim off the main event thread +X move away from using method like display +X look into opengl stuff for dealing with this +X move addListeners() calls back out of PGraphics +X resize window will nuke font setting +X textFont() used in setup() is null once draw() arrives +X http://dev.processing.org/bugs/show_bug.cgi?id=726 +X colorMode() set inside setup() sometimes not set once draw() arrives +X http://dev.processing.org/bugs/show_bug.cgi?id=767 +X applet sizing issues with external vm +X could this possibly be related to the linux bug? +X http://dev.processing.org/bugs/show_bug.cgi?id=430 +X alloc() stuff not fixed because of thread halting +X problem where alloc happens inside setup(), so, uh.. +X http://dev.processing.org/bugs/show_bug.cgi?id=369 +X should instead create new buffer, and swap it in next time through +X sonia (and anything awt) is locking up on load in rev 91 +X prolly something w/ the threading issues +X paint is synchronized in 0091 +X however this is a necessity, otherwise nasty flickering ensues +X and using a "glock" object seems to completely deadlock +X http://dev.processing.org/bugs/show_bug.cgi?id=46 +o claim that things are much slower in 107 vs 92 +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1141763531 +X hopefully this is cleaned up by removing some of the synchronization +X sketches lock up when system time is changed +X http://dev.processing.org/bugs/show_bug.cgi?id=639 +X can draw() not be run on awt event thread? +X look into opengl stuff for dealing with this +o "is there a better way to do this" thread in lists folder +X framerate that's reported is out of joint with actual +X http://dev.processing.org/bugs/show_bug.cgi?id=512 +X accuracy of frame timer is incorrect +X seems to be aliasing effect of low resolution on millis() +X so rates coming out double or half of their actual +X probably need to integrate over a rolling array of 10 frames or so +X frameRate() speeds up temporarily if CPU load drops dramatically +X http://dev.processing.org/bugs/show_bug.cgi?id=297 +o perhaps add a hint(DISABLE_FRAMERATE_DAMPER) +X fix the flicker in java2d mode +X http://dev.processing.org/bugs/show_bug.cgi?id=122 +X framerate(30) is still flickery and jumpy.. +X not clear what's happening here +X appears to be much worse (unfinished drawing) on macosx +X try turning off hw accel on the mac to see if that's the problem + + +0144 core +X if loading an image in p5 and the image is bad, no error msg shown +X that is, if a loadImage() turns up an access denied page +X added an error message for this, and the image width and height will be -1 +X added loadImageAsync() for threaded image loading + +opengl fixes +X incorporate changes from andres colubri into PGraphicsOpenGL +X most of the changes incorporated, something weird with constructors +X use gluErrorString() for glError() stuff +X PGraphicsOpenGL.java: +X directionalLight() and .pointLight() are both calling +X glLightNoAmbient() which then creates a new FloatBuffer +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1199376364 + + +0143 core +X some fonts broken in java 1.5 on osx have changed again +X http://dev.processing.org/bugs/show_bug.cgi?id=407 +X filed as bug #4769141 with apple http://bugreport.apple.com/ +X appears that asking for the postscript name no longer works +o fix "create font" and associated font stuff to straighten it out +X was grabbing the wrong native font with ico sketch +X seems that the psname is no longer a good way to grab the font? related? +X available font issues +X is getFontList returning a different set of fonts from device2d? +X try it out on java 1.3 versus 1.4 +X getAllFonts() not quite working for many fonts +X i.e. Orator Std on windows.. macosx seems to be ok +X is getFamilyNames() any different/better? +X when did this break? 1.4.1? 1.4.x vs 1.3? +X may be that cff fonts won't work? +X or is it only those with ps names? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1117445969 +o leading looks too big, at least in PGraphics2 with news gothic +X though prolly the converted version of the .ttf? +X add a fix so that negative angle values won't hork up arc() command +X add resize() method to PImage + + +0142 core +X update iText in PDF library to 2.1.2u +X loadStrings(".") should not list directory contents +X http://dev.processing.org/bugs/show_bug.cgi?id=716 + + +0141 core +X no changes to core in 0141 + + +0140 core +X add static version of loadBytes() that reads from a File object +X slightly clearer error messages when OpenGL stuff is missing + + +0139 core +X no changes to core in 0139 + + +0138 core +X improve tessellation accuracy by using doubles internally +X http://dev.processing.org/bugs/show_bug.cgi?id=774 + + +0137 core +X add gz handling for createOutput() +X change openStream() to createInput() (done in 0136) +X add createOutput() +X deprecate openStream() naming + + +0136 core +X add static version of saveStream() (uses a File and InputStream object) +X A "noLoop()" sketch may be unresponsive to exit request +X http://dev.processing.org/bugs/show_bug.cgi?id=694 +X Fixed bug with subset() when no length parameter was specified +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1196366408 +X http://dev.processing.org/bugs/show_bug.cgi?id=707 +X figure out why tiff images won't open with after effects +X http://dev.processing.org/bugs/show_bug.cgi?id=153 +X open with photoshop, resave, see which tags change +X specifically, which tags that were in the original image file +X perhaps something gets corrected? +X had a fix, but decided not to re-implement the loadTIFF stuff too +X fix for bezierTangent() problem from dave bollinger +X http://dev.processing.org/bugs/show_bug.cgi?id=710 +X implement curveTangent (thanks to davbol) +X http://dev.processing.org/bugs/show_bug.cgi?id=715 +X fix problem with get() when imageMode(CORNERS) was in use +X fix bug with splice() and arrays +X http://dev.processing.org/bugs/show_bug.cgi?id=734 +X 'screen' is now static +X undo this--may need to be better about specifying screen and all +X PImage mask doesn't work after first call +X http://dev.processing.org/bugs/show_bug.cgi?id=744 +X load and save tga results in upside down tga +X http://dev.processing.org/bugs/show_bug.cgi?id=742 +X fix problem with g.smooth always returning false in JAVA2D +X http://dev.processing.org/bugs/show_bug.cgi?id=762 +X add XMLElement (not filename) constructor to SVG lib +X http://dev.processing.org/bugs/show_bug.cgi?id=773 + + +0135 core +X modelX/Y/Z still having trouble +X http://dev.processing.org/bugs/show_bug.cgi?id=486 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1186614415 +X add docs for model/screen/Y/Z +X added for model, along with example. +X screen was already complete +X bring back opengl mipmaps (create them myself? try w/ newer jogl?) +X opengl mipmaps are leaking (regression in spite of #150 fix) +X http://dev.processing.org/bugs/show_bug.cgi?id=610 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1193967684 +X seems to not actually be a problem on mbp, try desktop? +X copy() was needing updatePixels() when used with OPENGL or JAVA2D +X http://dev.processing.org/bugs/show_bug.cgi?id=681 +X check on the bug report for this one as well +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1173394373 + +earlier +o add notes about fixing serial on the mac to the faq (and link to bug) +X not necessary, hopefuly things working better now +X utf8 and encodings +X createWriter() and createReader() that take encodings +X xml files seem to be a lot of UTF-8 +X xml stuff +X getItem("name"); +X getItems("name"); (same, but looks for multiple matches +X getItem("path/to/item"); +o or could use getItem and getItemList? getItemArray()? +o read more about xpath +X parse xml from a string object +X not have to just use Reader +X add mention of this to the board +o update to new version of jogl +X fix mini p5 bugs for eugene + + +0134 core +X add noLights() method +X http://dev.processing.org/bugs/show_bug.cgi?id=666 +X redraw the screen after resize events (even with noLoop) +X http://dev.processing.org/bugs/show_bug.cgi?id=664 +o problem with transparency in mask() +o http://dev.processing.org/bugs/show_bug.cgi?id=674 +X mark bug as invalid, using fill() instead of tint() +X move to UTF-8 as native format for core file i/o operations +X update reference to document the change +o jogl glibc 2.4 problem on linux +o move back to previous jogl until 1.1.1 is released +X http://dev.processing.org/bugs/show_bug.cgi?id=675 +o deal with opengl applet export changes +o what is deployment suggestion for all the different platforms? +o can the jar files actually provide the DLLs properly? +X revert back to jogl 1.0 + + +0133 core +X fix problem with "export to application" and opengl +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1193142573 +X add focus requests so that better chance of keys etc working +X http://dev.processing.org/bugs/show_bug.cgi?id=645 +X argh, these make things worse (P3D run internal) +X add stuff about classversionerrors to the reference +X also update the libraries page +X fix background() with P3D and beginRaw() +X endRaw() has a problem with hint(ENABLE_DEPTH_SORT) +X because the triangles won't be rendered by the time endRaw() is called +X force depth sorted triangles to flush +X is mousePressed broken with noLoop() or redraw()? +X sort of but not really, add notes to reference about it + +cleaning +o calling graphics.smooth(), graphics.colorMode() outside begin/endDraw +o this causes everything to be reset once the draw occurs +o kinda seems problematic and prone to errors? +X nope, just need to say to do all commands inside begin/endDraw +o finish implementation so 1.1 support can return +X http://dev.processing.org/bugs/show_bug.cgi?id=125 +o check into ricard's problems with beginRecord() +X i believe these were caused by linux java2d issues +X beginFrame()/beginDraw() and defaults() +X when should these be called, when not? +X seems as though the begin/end should happen inside beginRaw/Record +X defaults() gets called by the size() command in PApplet +o would be cool if could sort w/o the sort class.. +o meaning use reflection to sort objects, just by implementing a few methods +o would be much simpler and less confusing than new Sort() etc +o or would it be ridiculously slow? +X just using Comparator instead, since moving to Java 1.4 +X make a PException that extends RuntimeException but packages an ex? +X http://java.sun.com/docs/books/tutorial/essential/exceptions/runtime.html +X no, not necessary, and exceptions suck +o need to write an error if people try to use opengl with 1.3 (i.e. on export) +o don't let users with java < 1.4 load OPENGL +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1114368123;start=3 +o catch security exceptions around applet i/o calls +o not just for saving files, but provide better error msgs when +o attempting to download from another server +X nope, just cover this in the reference +o files not in the data folder (works in env, not in sketch) +X mentioned repeatedly in the docs +o fix link() to handle relative URLs +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081710684 +X more trouble (and bug-worthy) than it's worth +o put SecurityException things around file i/o for applets +o rather than checking online(), since applets might be signed +X no, better to let errors come through +o slow on java2d, fast on p3d +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115276250;start=3 + +ancient +o strokeWeight is still broken +o setting stroke width on circle makes odd patterns +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077013848 +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1080347160 +o more weirdness with stroke on rect, prolly not alpha +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1085799526 +o rect is not getting it's stroke color set +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1073582391;start=0 +o weird problem with drawing/filling squares +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077226984 +o alpha of zero still draws boogers on screen +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1073329613;start=0 +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1080342288;start=0 +o break apart functions into local (placement) and override (blitting) +o just have a "thin_flat_line" option in opengl code +o is quad strip broken or not behaving as expected? +X may be correct, it worked for nik +X inside draw() mode, delay() does nothing +X delay might be a good way to signal drawing to the screen/updating +X set(x, y, image) x, y not setting with processing + +fixed earlier +X is the texture[] array in PGraphics3D causing the problems with memory? +X actually it's a PGraphicsGL problem.. +X maybe the image binding not getting unbound? +o should image i/o be moved into PImage? +o still needs applet object, so it's not like this is very useful +o external PImage methods could take stream, i suppose.. +X relevant parts were moved in, others not +o loadImage() using spaces in the name +o if loadImage() with spaces when online(), throw an error +o get tiff exporter for p5 to support argb and gray +X would also need to modify the tiff loading code, +X because the header would be different +X http://dev.processing.org/bugs/show_bug.cgi?id=343 +X map() is not colored, neither is norm +X image outofmemoryerror for casey's students +X http://dev.processing.org/bugs/show_bug.cgi?id=355 +X this may be related to a ton of other memory bugs +X 1.5.0_07 and 1.4.2_12 contain the -XX:+HeapDumpOnOutOfMemoryError switch +X invaluable for tracking down memory leaks +X can't replicate anymore +X texture mapping +X very odd, "doom era" stuff +X would it be possible to have a 'slow but accurate' mode? +X http://dev.processing.org/bugs/show_bug.cgi?id=103 +X fixed in release 0125 +X add hint() and unhint() +X also add unhint() to the keywords file +X and maybe remove hint() from keywords_base? +o present mode is flakey.. applet doesn't always come up +o seems like hitting stop helps shut it down? +o is full screen window not being taken down properly? +o has this fixed itself, or is it an issue with launching externally? +X seems to be fixed in later java versions +X rewrite getImpl/setImpl inside opengl +X placement of 100x100 items is odd +X happens with P3D and maybe also P2D? +X http://dev.processing.org/bugs/show_bug.cgi?id=128 + + +0132 core +X an image marked RGB but with 0s for the alpha won't draw in JAVA2D +X images with 0x00 in their high bits being drawn transparent +X also if transparency set but RGB is setting, still honors transparency +X http://dev.processing.org/bugs/show_bug.cgi?id=351 +X improve memory requirements for drawing images with JAVA2D +X now using significantly less memory + +tint/textures +X tint() and noTint() switching problem in P2D +X this should be a quick fix +X http://dev.processing.org/bugs/show_bug.cgi?id=222 +X related to the fill bugs: when fill is identical, no fill applied +X actually tint() should take over for fill as per-vertex color +X when textured images are being used +X http://dev.processing.org/bugs/show_bug.cgi?id=169 +X tint() should set texture color, fill() is ignored with textures +X add to the reference +X fix tint() for PGraphics3 (what could be wrong?) +X tint() honoring alpha but not colored tint +X maybe not setting fill color when drawing textures +X guessing it's an implementation issue in sami's renderer +X check with the a_Displaying example and tint(255, 0, 0, 100); +X http://dev.processing.org/bugs/show_bug.cgi?id=90 + + +0131 core +X hint(DISABLE_DEPTH_TEST) not behaving consistently +X http://dev.processing.org/bugs/show_bug.cgi?id=483 +o make hints static - cannot do that +X clean up hinting mechanism a bit +X look into jogl anti-aliasing on osx +o smoothMode(2) and smoothMode(4), right after size()? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1175552759 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1164236069 +X look into capabilities stuff from mike creighton +X also sets the aa mode on the pc so it no longer needs control panel bunk +X update to JOGL 1.1.0 +X add gluegen-rt back to the applet export +X http://download.java.net/media/jogl/builds/nightly/javadoc_public/com/sun/opengl/util/JOGLAppletLauncher.html +X add print() and println() for long and double +X http://dev.processing.org/bugs/show_bug.cgi?id=652 +X fix minor bug in saveStream() (undocumented) +X "this file is named" errors don't like subdirectories +X need to strip off past the file separator or something + + +0130 core +X fixed problem with size() and the default renderer +X the renderer was being reset after setup(), +X so anything that occurred inside setup() was completely ignored. +X http://dev.processing.org/bugs/show_bug.cgi?id=646 +X http://dev.processing.org/bugs/show_bug.cgi?id=648 +X http://dev.processing.org/bugs/show_bug.cgi?id=649 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1192873557 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1192731014 + + +0129 core +X width and height not always set properly +X http://dev.processing.org/bugs/show_bug.cgi?id=642 +X bring back background() with alpha + + +0128 core +X remove PFont reflection stuff +X remove cursor reflection stuff +X fix up sorting functions +X implement sortCompare() and sortSwap() +X discuss this with casey +X also could be using Arrays.sort(blah) with Comparable (1.2+) +X make sorting functions static +X use methods from Arrays class, cuts down on code significantly +X implement sortCompare() and sortSwap() +X discuss this with casey +o also could be using Arrays.sort(blah) with Comparable (1.2+) +X make sorting functions static? +o should loadFont() work with ttf files (instead of createFont?) +X otherwise loadFont() would work with font names as well, awkward +X better to use createFont() for both +o jogl issues with some cards on linux, might be fixed with newer jogl +X http://dev.processing.org/bugs/show_bug.cgi?id=367 +X remove methods for background() to include an alpha value +X this is undefined territory because of zbuffer and all +X if you want that effect, use a rect() +X saveFrame() produces a black background because bg not set correctly: +X http://dev.processing.org/bugs/show_bug.cgi?id=421 +X background not being set properly +X http://dev.processing.org/bugs/show_bug.cgi?id=454 +X having shut off the defaults reset, background not getting called for java2d +X so this will make that other stuff regress again +X in particular, when the applet is resized, but renderer not changed +X why aren't background() / defaults() being called for opengl? +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1118784331 +o simon reports borders on P3D and OPENGL if background() not called +X window fixed at 100x100 pixels +X http://dev.processing.org/bugs/show_bug.cgi?id=197 +X width/height on problem machine prints out as: +X 100x100 issues are exhibited on bh140c PCs, test and fix! +X 100,200 and 128,200 +o AIOOBE on PLine 757.. halts renderer +o fix erik's problems with export (also in bugs db) +X draw() called twice in vista with java 1.6 +X http://dev.processing.org/bugs/show_bug.cgi?id=587 + +cleanup from previous releases +X P3D not doing bilinear interpolation in text and images +X because smooth() has to be set (and smooth throws an error in P3D) +X how should this be handled? a hint? allowing smooth()? +X probably just allow smooth() but don't smooth anything +o pdf export ignoring transparency on linux +o check to see if this is the case on other linux machines +o seems to be working fine on windows +o http://dev.processing.org/bugs/show_bug.cgi?id=345 +X change how java version is determined on mac +X http://developer.apple.com/technotes/tn2002/tn2110.html +X (this tn provides no guidance for macos8/9.. gah) +o little window showing up on macosx when running +X never able to confirm, probably just old java bug +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081284410 +o flicker happening on osx java 1.4, but not 1.3: +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1083184297 +o don't let users on < 1.3 load JAVA2D +X set upper bound on framerate so as not to completely hose things? + +fixed in 0127 +X ARGB problems with createGraphics +o P3D from createGraphics needs to be marked RGB not ARGB +X http://dev.processing.org/bugs/show_bug.cgi?id=160 +X http://dev.processing.org/bugs/show_bug.cgi?id=428 +X http://dev.processing.org/bugs/show_bug.cgi?id=482 +X http://dev.processing.org/bugs/show_bug.cgi?id=530 +X http://dev.processing.org/bugs/show_bug.cgi?id=527 + +reasons to drop 1.1 support (and support 1.3+) +X remove reflection from createFont() constructor/methods in PFont +X this would make PFont much smaller +X array functions could be done through Arrays.xxx class +X although some of these may be built in +X sorting could be done through built-in sort() class +X split() function could echo the built in split/regexp setup +X and add features for regexp +X could introduce use of Timer class in examples +X also use SwingWorker to launch things on other threads +X weirdness of two modes of handling font metrics +X textFontNativeMetrics gives deprecation error +X getFontList stuff in PFont causes problems + + +0127 core +X pixel operations are broken in opengl +X get(), set(), copy(), blend(), loadPixels, updatePixels() +X set(x, y, image) y reversed in openGL +X background(image) also broken +X also textMode(SCREEN) +X http://dev.processing.org/bugs/show_bug.cgi?id=91 +o replaceAll() not supported by 1.1 +o http://dev.processing.org/bugs/show_bug.cgi?id=561 +o make version of loadBytes that checks length of the stream first +o this might not be worth it +o the number of cases where this works is small (half of url streams) +o and who knows if the value returned will be correct +o (i.e. will it be the uncompressed or compressed size of the data?) + +createGraphics() issues +X offscreen buffers fail with texture mapping +X pixels not being set opaque (only with textures?) +X http://dev.processing.org/bugs/show_bug.cgi?id=594 +X add note to createGraphics() docs that opacity at edges is binary +X PGraphics problem with fillColor +X http://dev.processing.org/bugs/show_bug.cgi?id=468 + +fixed earlier +X add to open() reference problems with mac +X need to use the 'open' command on osx +X or need to do this by hand +X prolly better to do it by default, since on windows we use cmd? +X check to see if the user has 'open' in there already +X they can call Runtime.getRuntime().exec() if they want more control + +fixed earlier (in 0125) by ewjordan +X accuracy in P3D is very low +X http://dev.processing.org/bugs/show_bug.cgi?id=95 +X textured polys throwing a lot of exceptions (ouch) +X http://dev.processing.org/bugs/show_bug.cgi?id=546 +X polygons in z axis with nonzero x or y not filling properly +X http://dev.processing.org/bugs/show_bug.cgi?id=547 + + +0126 core +o rect() after strokeWeight(1) gives wrong coords +X http://dev.processing.org/bugs/show_bug.cgi?id=535 +X bug in osx java 1.4 vs 1.5 +X fix bug in str() methods that take arrays +X method was not working properly, was using the object reference +X new version of saveStream() +X implement auto-gzip and gunzip +X fix bug where sort() on 0 length array would return null +X instead, returns an array +X unregisterXxxx() calls to remove methods from libs +X http://dev.processing.org/bugs/show_bug.cgi?id=312 +X implemented by ewjordan +X sort() on strings ignores case +X mention the change in the reference +X added MIN_FLOAT, MAX_FLOAT, MIN_INT, MAX_INT to PConstants +X throw AIOOBE when min() or max() called on zero length array +o fix lerpColor() to take the shortest route around the HSB scale +o loadBytes() doesn't do auto gunzip? but loadStrings and createReader do? +X this might be a good solution for dealing with the differences +o with loadBytes(), they can use gzipInput (or loadBytesGZ?) +o although what does openStream do? (doesn't do auto?) +X auto-gunzip on createReader() +o add auto-gunzip to loadStrings() +X others for auto-gunzip? +X do the same for createWriter() et al +X disable mipmaps in 0126 +X http://dev.processing.org/bugs/show_bug.cgi?id=610 +X add match() method that returns an array of matched items + + +0125 core +X more blend() modes (the five listed on the thread below?) +X http://dev.processing.org/bugs/show_bug.cgi?id=132 +X figure out what the modes should actually be: +X photoshop: normal, dissolve; darken, multiply, color burn, +X linear burn; lighten, screen, color dodge, linear +X dodge; overlay, soft light, hard light, vivid light, +X linear light, pin light, hard mix; difference, +X exclusion; hue, saturation, color, luminosity +X illustrator: normal; darken, multiply, color burn; lighten, +X screen, color dodge; overlay, soft light, hard light; +X difference, exclusion; hue, sat, color, luminosity +X director: Copy, Transparent, Reverse, Ghost, Not copy, +X Not transparent, Not reverse, Not ghost, Matte, Mask; +X (below seems more useful: +X Blend, Add pin, Add, Subtract pin, Background transparent, +X Lightest, Subtract, Darkest, Lighten, Darken +X flash: +X DIFFERENCE: C = abs(A-B); +X MULTIPLY: C = (A * B ) / 255 +X SCREEN: C= 255 - ( (255-A) * (255-B) / 255 ) +X OVERLAY: C = B < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255 +X HARD_LIGHT: C = A < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255 +X SOFT_LIGHT: C = B < 128 ? 2*((A>>1)+64)*B/255 : 255-(2*(255-((A>>1)+64))*(255-B)/255) +X jre 1.5.0_10 is still default at java.com.. blech +X http://dev.processing.org/bugs/show_bug.cgi?id=513 +X constant CENTER_RADIUS will be changed to just RADIUS +X CENTER_RADIUS is being deprecated, not removed +X remove CENTER_RADIUS from any p5 code (i.e. examples) +X split() inconsistency (emailed casey, will discuss later) +X make split(String, String) behave like String.split(String) +X and make current split(String) into splitTokens(String) +X that means split(String) no longer exists +o add splitTokens() documentation +o document new version of split() and regexp +o should we mention String.split? +X ironed out more of the preproc parseXxxx() functions +X deal with targa upside-down and non-rle encoding for tga images +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1171576234 +X change println(array) to be useful +o document using join() for old method +X remove print(array) since it's silly? +X make sure it's not in the reference +X [0] "potato", [1] "tomato", [2] "apple" +X fix filter(GRAY) on an ALPHA image to produce a good RGB image + +0125p2 +X updatePixels ref is wrong +X has x/y/w/h version +X the reference is also cut off +X make ENTER, TAB, etc all into char values (instead of int) +X some way to vertically center text +X either by setting its middle vertical point +X or by setting a top/bottom for the rectangle in which it should be placed +o maybe textAlign(CENTER | VERTICAL_CENTER); +X or TOP, MIDDLE, and BOTTOM +o textAlign(CENTER | TOP); +o could even have textAlign(CENTER) and textAlign(TOP) not replace each other +X or textAlign(LEFT, MIDDLE); -> this one seems best +X add reference for new param, and update keywords.txt +X given to andy + +0125p3 +X PImage.save() method is not working with get() +X http://dev.processing.org/bugs/show_bug.cgi?id=558 +X NullPointerException in Create Font with "All Characters" enabled +X http://dev.processing.org/bugs/show_bug.cgi?id=564 +X added min() and max() for float and int arrays +X need to update reference +X moved around min/max functions +X opengl image memory leaking +X when creating a new PImage on every frame, slurps a ton of memory +X workaround is to write the code properly, but suggests something bad +X http://dev.processing.org/bugs/show_bug.cgi?id=150 +X opengl keeping memory around.. +X could this be in vertices that have an image associated +X or the image buffer used for textures +X that never gets cleared fully? +X registerSize() was registering as pre() instead +X http://dev.processing.org/bugs/show_bug.cgi?id=582 +X set() doesn't bounds check +X this shouldn't actually be the case +X http://dev.processing.org/bugs/show_bug.cgi?id=522 +X get()/set() in PGraphicsJava2D don't bounds check +X was actually a dumb error in setDataElements() +X set modified to true on endDraw() so that image updates properly +X http://dev.processing.org/bugs/show_bug.cgi?id=526 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1171574044 + +0125p4 (in progress) +X significant improvement to text and images in opengl +X now using mipmaps to interpolate large and small images +X fix bug with mipmapping on radeon 9700 +X things not showing up in linux +X this may be fixed along with bug #341 +X probably threading issue, 98 doesn't have any trouble +X signs point to Runner or PApplet changes between 98 and 99 +X commenting out applet.setupFrameResizeListener() +X in line 307 from Runner.java solved the problem +X http://dev.processing.org/bugs/show_bug.cgi?id=282 +X size of sketch different in setup() and draw() on linux +X make sure that the sketch isn't being sized based on bad insets +X problem with resizing the component when the frame wasn't resizable +X http://dev.processing.org/bugs/show_bug.cgi?id=341 +X major rework of the open() command +X add gnome-open/kde-open for with PApplet.open() +X add open (-a?) on osx to the open() command +X make changes in the javadoc and reference +X opengl crashes when depth sorting more than two textured shapes +X http://dev.processing.org/bugs/show_bug.cgi?id=560 + +ewjordan stuff (changes checked in) +X rect() changes size as it changes position +X http://dev.processing.org/bugs/show_bug.cgi?id=95 +X strange texture warping in P3D +X hint(ENABLE_ACCURATE_TEXTURES) +X http://dev.processing.org/bugs/show_bug.cgi?id=103 +X lines skip on 200x200 surface because of fixed point rounding error +X http://dev.processing.org/bugs/show_bug.cgi?id=267 +X this may be same as 95 +X Polygons parallel to z-axis not always filling with nonzero x or y +X http://dev.processing.org/bugs/show_bug.cgi?id=547 + + +0124 core +X with smooth() turned off, shouldn't be smoothing image on resize +X but on osx, apple defaults the image smoothing to true +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1164753510 +X http://developer.apple.com/documentation/Java/Conceptual/JavaPropVMInfoRef/Articles/JavaSystemProperties.html#//apple_ref/doc/uid/TP40001975-DontLinkElementID_6 +X background(0, 0, 0, 0) was resetting stroke, smooth, etc. +X make imageImpl() use WritableRaster in an attempt to speed things up +X fix weird situation where fonts used in more than one renderer wouldn't show +X opengl doesn't draw a background for the raw recorder +X change P3D to smooth images nicely (bilinear was disabled) +X ambientLight(r,g,b) was still ambientLight(r,g,r) +X http://dev.processing.org/bugs/show_bug.cgi?id=465 +X fix from dave bollinger for the POSTERIZE filter +X http://dev.processing.org/bugs/show_bug.cgi?id=399 +X fix PImage regression in 0124 and the cache crap +X added a version of trim() that handles an entire array +X removed contract(), one can use expand() and subset() instead +X backgroundColor to cccccc instead of c0c0c0 +X loadImage() requires an extension, maybe add a second version? +X loadImage("blah", "jpg"); +X otherwise people have to use strange hacks to get around it +X also chop off ? from url detritus +X also just pass off to default createImage() if no extension available +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1165174666 +X http://dev.processing.org/bugs/show_bug.cgi?id=500 +X java 1.5.0_10 breaks jogl +X add error message to p5 about it +X http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6504460 +X http://www.javagaming.org/forums/index.php?topic=15439.0 +X upgrade to 1.5.0_11 or later: +X http://java.sun.com/javase/downloads/index_jdk5.jsp +X or downgrade to 1.5.0_09 +X http://java.sun.com/products/archive/j2se/5.0_09/index.html +X no disk in drive error +X was this something that changed with the java updates? (1.5_10) +X doesn't seem to be, still not sure +X problem was the floppy drive.. gak +X http://dev.processing.org/bugs/show_bug.cgi?id=478 +X copy() sort of broken in JAVA2D +X example sketch posted with bug report +X http://dev.processing.org/bugs/show_bug.cgi?id=372 +o saveStrings(filename, strings, count) +o otherwise the save is kinda wonky +o or maybe that should just be done with the array fxns + +fixed earlier +o sketches often freeze when stop is hit on an HT machine +o need to test the examples cited on pardis' machine +o http://dev.processing.org/bugs/show_bug.cgi?id=232 +X debug NumberFormat InterruptedException on dual proc machine +X use notify() instead of interrupt()? +X or Thread.currentThread() should be checked first? +o svg loader is on the list for 1.0 +o maybe include as part of PApplet (casey thinks so) +X using gl, lines don't show up in pdf with record (they're ok with p3d) +X http://dev.processing.org/bugs/show_bug.cgi?id=325 +o with network connection +o download a copy of the source for 0069, get the renderer +o svn mv PGraphics2 PGraphicsJava +o version of BApplet that replaces g. with ai. or pdf. + + +0123 core +X setup() and basic mode apps not working +X http://dev.processing.org/bugs/show_bug.cgi?id=463 + + +0122 core +X noiseSeed() only works once, before the arrays are created +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1162856262 +X make lerpColor honor the current color mode +X lerpColor(c1, c2, amt, RGB/HSB/???) +o test this out for a bit +o though that's awkward b/c colors always RGB +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1160096087 +X regression in P3D that prevents point() from drawing +X problem is with setup_vertex() not adding similar points +X http://dev.processing.org/bugs/show_bug.cgi?id=444 +X if doing openstream on url, says that "the file" is missing or invalid +X add notes about it being a url + +fixed earlier, bug cleaning +X gray background in pdf (using both gl and p3d) +X http://dev.processing.org/bugs/show_bug.cgi?id=324 +X verified as fixed in 0122 + + +0121 core +X need to document changes to int() (no longer accepts boolean) +X background(0, 0, 0, 0) is the way to really clear everything with zeroes +X or background(0, 0), but the former is prolly better conceptually +X how to clear the screen with alpha? background(0, 0, 0, 0)? +o background(EMPTY) -> background(0x01000000) or something? +X size(), beginRecords(), beginRaw(), createGraphics() +X broken for file-based renderers in 0120 +X http://dev.processing.org/bugs/show_bug.cgi?id=434 + + +0120 core +X fixed error when using hint(ENABLE_NATIVE_FONTS) with JAVA2D +X java.lang.IllegalArgumentException: +X null incompatible with Global antialiasing enable key +X fix issue where ambientLight(r, g, b) was instead ambientLight(r, g, r) +X http://dev.processing.org/bugs/show_bug.cgi?id=412 +X createFont() should always use native fonts +X need to warn that fonts may not be installed +X recommend that people include the ttf if that's the thing +X or rather, that this is only recommended for offline use +X fix 3D tessellation problems with curveVertex and bezierVertex +X actually was z = Float.MAX_VALUE regression +X http://dev.processing.org/bugs/show_bug.cgi?id=390 +X two examples in sketchbook +X this has been reported several times +X concave polygons having trouble if points come back to meet +X tesselator/triangulator gets confused when points doubled up +X might need to avoid previous vertex hitting itself +X http://dev.processing.org/bugs/show_bug.cgi?id=97 +X graphics gems 5 has more about tessellation +X polygons perpendicular to axis not drawing +X is this a clipping error? +X probably a triangulation error, because triangles work ok +X http://dev.processing.org/bugs/show_bug.cgi?id=111 +X problem is that the area of the polygon isn't taking into account z +X lookat is now camera(), but not fixed in the docs +X add notes to the faq about the camera changes on the changes page +o update run.bat for new quicktime +o unfortunately this is messy because qtjava sometimes has quotes +o and qtsystem might be somewhere besides c:\progra~1 +X run.bat has been removed from current releases +X registering font directories in pdf.. is it necessary? +X (commented out for 0100) +X re-added for 0120 +o when re-calling size() with opengl, need to remove the old canvas +o need to check to see if this is working properly now +X passing applet into createGraphics.. problems with re-adding listeners +X since the listeners are added to the PApplet +X i think the listeners aren't re-added, but need to double check +X createGraphics() having problems with JAVA2D, and sometimes with P3D +X http://dev.processing.org/bugs/show_bug.cgi?id=419 +X with default renderer, no default background color? +X only sometimes.. why is this? +X only call defaults() when it's part of a PApplet canvas +X make sure that defaults() is no longer necessary +X don't want to hose PGraphics for others +X both for pdf, and making background transparent images +X PGraphics3D should alloc to all transparent +X unless it's the main drawing surface (does it know on alloc?) +X in which case it should be set to opaque +X have createGraphics() create a completely transparent image +X and also not require defaults() to be called +X make a note in the createFont() reference that 1.5 on OS X has problems +o if calling beginPixels inside another, need to increment a counter +o otherwise the end will look like it's time to update +o which may not actually be the case +o i.e. calling filter() inside begin/end block +X get creating new PGraphics/2/3 working again +X http://dev.processing.org/bugs/show_bug.cgi?id=92 +X maybe createGraphics(200, 200) to create same as source +X createGraphics(200, 200, P2D) to create 2D from 3D +X also, drawing a PGraphics2 doesn't seem to work +X new PGraphics2 objects are set as RGB, but on loadPixels/updatePixels +X they're drawn as transparent and don't have their high bits set +X problems between modelX between alpha and beta +X http://dev.processing.org/bugs/show_bug.cgi?id=386 +X y may be flipped in modelX/Y/Z stuff on opengl +X is this the same bug? assuming that it is + +in previous releases +X when using PGraphics, must call beginFrame() and endFrame() +X also need to be able to turn off MemoryImageSource on endFrame +X call defaults() in beginFrame() +X should PGraphics be a base class with implementations and variables? +X then PGraphics2D and PGraphics3D that subclass it? +X (or even just PGraphics2 and PGraphics3) +X also rename PGraphics2 to PGraphicsJava +X it's goofy to have the naming so different +X tweak to only exit from ESC on keyPressed +o probably should just make this a hint() instead +X just documented in reference instead +o metaballs example dies when using box() +o long string of exceptions, which are also missing their newlines +X grabbing sun.cpu.endian throws a security exception with gl applets +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1114368123 + + +0119 core +X add saveStream() method +X change to handle Java 1.5 f-up where URLs now give FileNotFoundException +X http://dev.processing.org/bugs/show_bug.cgi?id=403 +X add unlerp() method + + +0118 core +X replace jogl.jar with a signed version +X fix the export.txt file for the linux release +X fix problem with setting the parent and the PDF renderer + + +0117 core +X no changes, only to the build scripts + + +0116 core +X make background() ignore transformations in JAVA2D +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1147010374 +o createGraphics to not require defaults() +X can't do, because an end() function must be called to clear the renderer +X add "hide stop button" arg for PApplet +X beginFrame/endFrame -> beginDraw/endDraw +X add new constant for the DXF renderer +X array utilities on Object[] are worthless.. fix it with reflection? +X see if reflection will allow expand for all class types +X expand, append, contract, subset, splice, concat, reverse +X typed version of array functions: +X append(), shorten(), splice, slice, subset, concat, reverse +X http://dev.processing.org/bugs/show_bug.cgi?id=115 +X fix issue where processing applets would run extremely fast +X after having been starved of resources where there framerate dropped +X http://dev.processing.org/bugs/show_bug.cgi?id=336 +X added color/stroke/tint/fill(#FF8800, 30); +X test imageio with images that have alpha (does it work?) +X nope, doesn't, didn't finish support +X http://dev.processing.org/bugs/show_bug.cgi?id=350 +X openStream() fails with java plug-in because non-null stream returned +X http://dev.processing.org/bugs/show_bug.cgi?id=359 +X update jogl to latest beta 5 +X make framerate into frameRate (to match frameCount) +X AIOOBE in P3D during defaults/background/clear +X PGraphics.clear() problem from workbench and malware stuff +X had to put synchronized onto draw and size() +X actually it'll work if it's only on size() +X the sync on the mac hangs an applet running by itself +X even though it seems to be ok for a component +X thread sync problem with allocation +X http://dev.processing.org/bugs/show_bug.cgi?id=369 +X major threading change to use wait()/notifyAll() instead of interrupt/sleep +X noLoop() at end of setup is prolly b/c of interruptedex +X need to not call Thread.interrupt() +X opengl + noLoop() causes InterruptedException +X check to see noLoop() breakage is fixed in 92 vs 91 +X checked, not fixed +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115330568 +X http://dev.processing.org/bugs/show_bug.cgi?id=164 +X remove image(filename) and textFont(filename) et al. +X revision 115 may be saving raw files as TIFF format +X may be a bug specific to java 1.5 (nope) +X http://dev.processing.org/bugs/show_bug.cgi?id=378 +X saveFrame() not working for casey +X problem with tiff loading in photoshop etc +X check http:// stuff to see if it's a url first on openStream() +X it's the most harmless, since prolly just a MFUEx +X fix problem where root of exported sketch won't be checked +X http://dev.processing.org/bugs/show_bug.cgi?id=389 +X createFont not working from applets (only with .ttf?) +X throws a security exception because of the reflection stuff +X http://dev.processing.org/bugs/show_bug.cgi?id=101 +X urls with ampersands don't work with link() +X Runtime.getRuntime().exec("cmd /c start " + url.replaceAll("&","^&")); +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1149974261 +X fix bug where smooth() was shut off after using text +X (that had the smoothing turned off when used in "Create Font") +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1148362664 +X fix dxf to use begin/endDraw instead of begin/endFrame +X fixes axel's bug with dxf export +X set default frameRate cap at 60 +X otherwise really thrashing the cpu when not necessary +X jpeg loading may be extremely slow (loadBytes?) +X seems specific to 0115 versus the others +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1158111639 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1154714548 +X http://dev.processing.org/bugs/show_bug.cgi?id=392 +X loadImage() problems with png and jpg +X actually it's an issue with some types of jpeg files +X http://dev.processing.org/bugs/show_bug.cgi?id=279 +X java.lang.IllegalArgumentException: +X Width (-1) and height (-1) cannot be <= 0 +X identical to what happens when the image data is bad +X for instance, trying to load a tiff image with the jpg loader +X http://dev.processing.org/bugs/show_bug.cgi?id=305 +o blend() mode param should be moved to the front +X nah, works better with the other format +X make sure there's parity with the copy() functions +X remove single pixel blend functions +o blend() should prolly have its mode be the first param +X move blend() to blendColor() when applying it to a color +X added lerpColor(), though it needs a new name +X went back to old image i/o (sometimes caused trouble when exported) +X http://dev.processing.org/bugs/show_bug.cgi?id=376 +X change reader() to createReader() for consistency? +X though printwriter is odd for output.. +X also createWriter() and the rest +o add to docs: save() on a PImage needs savePath() added +X hint(DISABLE_NATIVE_FONTS) to disable the built-in stuff? +X or maybe this should be hint(ENABLE_NATIVE_FONTS) instead? +X figure out default behavior for native text fonts +X make sure insideDrawWait() is in other resize() methods +X begin/end/alloc waits to PGraphicsJava2D, PGraphicsOpenGL, PGraphics3D +X fix bug with fill(#ffcc00, 50); +X toInt() on a float string needs to work +X need to check for periods to see if float -> int first +X shape changes +X remove LINE_STRIP - tell people to use beginShape() with no params +X remove LINE_LOOP - tell people to use endShape(CLOSE) +o also remove POLYGON? +X may as well remove it +X though something still needed as an internal constant +X add endShape(CLOSE) or CLOSED +X when running as an applet, sketchPath won't be set +X change the error message slightly +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1153150923 +X use parseFloat instead of toFloat()? to be consistent with javascript +X also clean up some of the casting silliness + +more recent +X only update mouse pos on moved and dragged +X http://dev.processing.org/bugs/show_bug.cgi?id=170 +X also updates a bug that caused sketches to jump in funny ways + +fixed in 0115 / quicktime 7.1 +X color values on camera input flipped on intel macs +X checked in a change for this recommended on qtjava list +X http://dev.processing.org/bugs/show_bug.cgi?id=313 + +really old stuff +o get loop, noLoop, redraw, and framerate all working in opengl +o needs custom animator thread.. +o depth() shouldn't be needed for opengl unless actually 3D +o right now the camera doesn't get set up unless you call depth() +o box and sphere are broken in gl +o what should the update image function be called? + + +0115 core +X remove debug message from loadPixels() +X remove debug message from PGraphics2.save() +X fix error message with dxf when used with opengl +X if file is missing for reader() +X return null and println an error rather than failing +X add arraycopy(from, to, count); +X fix fill/stroke issues in bugs db (bug 339) +X saveTIFF, saveHeaderTIFF, saveTGA no longer public/static in PImage +X this was a mistake to expose the api this way +X more image file i/o in java 1.4 +X add dynamic loading of the jpeg, png, and gif(?) encoder classes +X http://dev.processing.org/bugs/show_bug.cgi?id=165 +X http://java.sun.com/products/java-media/jai/index.jsp +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1120174647 +X P5 cannot read files generated by saveFrame() +X need to update docs re: tga +X and add support for reading its own uncompressed TIFs +X http://dev.processing.org/bugs/show_bug.cgi?id=260 + + +0114 core +X added createGraphics(width, height, renderer) +X no need to use (..., null) anymore +X fix set() for JAVA2D, also fixes background(PImage) for JAVA2D +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1145108567 +X remove "max texture size" debug message +X flicker with depth sort enabled +X implement basic depth sorting for triangles in P3D and OPENGL +X add option to sort triangles back to front so alpha works +X http://dev.processing.org/bugs/show_bug.cgi?id=176 +o at least add it to the faq, or this would be a test case w/ the sorting + + +0113 core +X fix for open() on macosx submitted by chandler + + +0112 core +X saveFrame() issues with JAVA2D on osx +X http://dev.processing.org/bugs/show_bug.cgi?id=189 +o implement hint(NO_DEPTH_TEST) for opengl +X already done hint(DISABLE_DEPTH_TEXT); +X check min/max texture sizes when binding to avoid problems +X minimum texture size may be 64x64 +X maximum appears to be 2048, on macs maybe 512 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1137130317 +X fix non-bound textures from mangling everything else +X http://dev.processing.org/bugs/show_bug.cgi?id=322 +X fix enable/disable textures for some objects +X also a big problem for fonts +X calling updatePixels() on each frame fixes the issue (sorta) +X images are memory leaking pretty badly +X texture re-allocated on each frame +X lighting bug introduced in rev 109 +X spotLight has troubles with an invalid value +X probably somethign weird about the params (3 vs 4) being sent +X the first spotLight works fine, it's something with the second +X (the one that follows the mouse) +X just something to debug in the example +X regression from contributed code.. +X was using apply() instead of set() in PMatrix inverse copy +X filter() is also broken (not rewinding the intbuffer) +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1144561113 + +sound has been removed +o duration as an internal param, not a function +o When a sound is finished playing, +o it should return to 0 so it can play again +o Putting sound.loop() in draw() seemed to spawn multiple sounds threads? +o After a sound is paused, it will only play from where it was paused +o to its end and will not loop again +o The ref in PSound2 says volume accepts vals from 0...1 +o but values larger than one increase the volume. +o SoundEvent // is sound finished?? Can't access now. +o make java 1.1 version of PSound work properly +o merge PSound and PSound2 via reflection? +o once debugged, merge these back together and use reflection +o (unless it's a messy disaster) +o Unsupported control type: Master Gain +o what's actually causing this error? +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115467831 +o PSound.play() won't play the sound a 2nd time (reopened) +o http://dev.processing.org/bugs/show_bug.cgi?id=208 +o loadSound apparently broken in java 1.5? +o http://dev.processing.org/bugs/show_bug.cgi?id=285 +X need to just remove PSound altogether + + +0111 core +X need to have a better way of getting/figuring out the endian +X use ByteOrder class in jdk 1.4, since issue is local to JOGL +X security ex when run as an applet +X also can no longer assume that macosx is big endian +X http://dev.processing.org/bugs/show_bug.cgi?id=309 +o making 'run' synchronized caused a freeze on start w/ opengl +X display() as a function name is problematic +X causes nothing to show up.. either rename or mark it final +X http://dev.processing.org/bugs/show_bug.cgi?id=213 +X fix for lights throwing a BufferOverflowException + + +0110 core +X finish updates for osx and opengl +X http://developer.apple.com/qa/qa2005/qa1295.html +X find/build universal version of jogl + + +0109 core +X loadImage("") produces weird error message +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1136487954 +X still having strokeCap() problems +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1134011764 +X fixes contributed by willis morse to deal with memory wastefulness +X should help speed up some types of OPENGL and P3D mode sketches + + +0108 core +X image(String filename, ...) and textFont(String filename, ...) implemented +X add notes to faq about video fix +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1134871549 +X look into code that fixes crash on camera.settings() +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1139376484 +X finish dxf writer that'll work with recordRaw() + + +0107 core +X no changes, only fixes for "save" bugs + + +0106 core +X fix bug where more than 512 vertices would cause trouble in P3D and OPENGL + + +0105 core +X fix some issues with beginRaw and opengl + + +0104 core +X don't open a window the size of the pdf if in pdf mode +X need to have some sort of flag in the gfx context that it's visible or not +o handled inside updateSize()? +X if it doesn't display to the screen, needs to never show a window +X basically if the main gfx context isn't viewable, close the window +X since it may have already been opened at 100x100 +X avoid opening it in the first place? +X added toolkit getFontMetrics() for shape mode fonts to be able to change size +X recordRaw() to a PGraphics3 should send 3D data. +X but recordRaw() to a PGraphics(2) should send only 2D data. + + +0103 core +X fix stack overflow problem +X bug in itext implementation on osx (10.4 only?) +X http://www.mail-archive.com/itext-questions@lists.sourceforge.net/msg20234.html + +in previous releases +X recordFrame() and beginFile()/endFile() +X how to deal with triangles/lines and triangleCount and lineCount +X maybe just need a triangleImpl and lineImpl +X because it's too messy to retain the triangle objects and info +X calling recordFrame() from mousePressed is important +X dangerous tho because mouse fxn called just before endFrame + + +0102 core +X no changes, windows-only release to deal with processing.exe + + +0101 core +X add dispose() call to the shutdown part of PApplet + + +0100 core +X user.dir wasn't getting set properly +X when graphics can be resized, resize rather than creating new context +X change savePath() et al a great deal, include better docs +X http://dev.processing.org/bugs/show_bug.cgi?id=199 +X straighten out save() and saveFrame() +o use File object for when people know what they're doing? +X same issue occurs with pdf and creating graphics obj + +get initial version of pdf working +X get rid of beginFrame/endFrame echo to recorders? +X that way begin/end can just be where the recorder starts/stops? +X recordRaw is really confusing.. +X when to use beginFrame/endFrame +X is beginRaw/endRaw really needed? +X seems to be a problem that it's an applet method +X but then it's called on the g of the applet +X but then it's the recorderRaw of that g that gets it called.. +X how to flush when the sketch is done +X inside dispose method? explicit close? +X call exit() at end of pdf apps? exit calls dispose on gfx? +X beginRecord() and endRecord() so that record doesn't stop after frame? +X enable PGraphicsPDF for inclusion +X write documentation on images (they suck) and fonts (use ttf) + + +0099 core +X removed playing() method from PSound +X integrate destroy() method from shiffman as dispose() in PSound2 +X ComponentListener is probably what's needed for resize() +X make sure that components can be resized properly via size() +X http://dev.processing.org/bugs/show_bug.cgi?id=209 +X or that it properly responds to a setBounds() call +X calling size() elsewhere in the app doesn't quite work +X A second call to size almost works. +X The buffer apparently gets allocated and saveFrame saves the +X new size but drawing appears to be disabled. +X http://dev.processing.org/bugs/show_bug.cgi?id=243 + + +0098 core +X change recordShapes() to just record() and recordRaw() +X width, height set to zero in static mode +X http://dev.processing.org/bugs/show_bug.cgi?id=198 +X probably only set when resize() is called, and it's not happening +X be careful when fixing this, bugs 195/197 were a result: +X http://dev.processing.org/bugs/show_bug.cgi?id=195 +X http://dev.processing.org/bugs/show_bug.cgi?id=197 +X PSound.play() won't play the sound a 2nd time +X (have to call stop() first) +X http://dev.processing.org/bugs/show_bug.cgi?id=208 + + +0097 core +X no changes, only export to application stuff + + +0096 core +X set applet.path to user.dir if init() is reached and it's not set +X add DISABLE_DEPTH_TEST to PGraphics3 +X need to document this somewhere +X also need to add to PGraphicsGL +X access logs are being spammed because openStream() gets a 404 +X the default should be to check the .jar file +X openStream() doesn't work with subfolders +X http://dev.processing.org/bugs/show_bug.cgi?id=218 +X screwed up movie loading paths (quick fix) +X http://dev.processing.org/bugs/show_bug.cgi?id=216 +X additional cleanup in the Movie class +X make path thing into getPath() or something? +X sketchPath(), dataPath(), savePath(), createPath() +X applet shouldn't be resizing itself +X opens at correct size, then makes itself small, then large again +X setup() mode apps often don't open at the correct placement +X because of their resizing +X check into bug where applet crashing if image not available +X probably need to add a hint() to make things not halt +X loadBytes() and openStream() et al need to return null +X loadImage() can too, but print an error to the console +X "not available in P3D" should read "OPENGL" in opengl lib +X keypressed ref: repeating keys +X also remove "no drawing inside keypressed" +X text block wrap problem with manual break character (\n) +X http://dev.processing.org/bugs/show_bug.cgi?id=188 + +draw mode issues +X when run externally without a draw, applets will exit immediately +X when run internally (no code folder or .java files) will just wait +X shouldn't quit draw mode apps immediately +X otherwise something gets drawn then the applet exits +X should instead use exit() when they need to exit +X NullPointerException when no draw() +X http://dev.processing.org/bugs/show_bug.cgi?id=210 +X window closing immediately with library imports +X http://dev.processing.org/bugs/show_bug.cgi?id=204 +X check into loadImage() with jars bug, very frustrating +o when using loadImage() on a jar, turn off "no cache" option? +X image no load halts the program (rather than returning null) +X note in the reference: png images work with java 1.3+ +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=WebsiteBugs;action=display;num=1125968697 +X add bug re: gif image break missing to revisions.txt +X http://dev.processing.org/bugs/show_bug.cgi?id=217 + +image pile +X get loadImage() to work properly with data folder +X should probably use the code from loadStream +X and the url stuff should be an alternate method altogether +o loadImage() seems to be caching everything from the jar +X http://java.sun.com/developer/technicalArticles/Media/imagestrategies/index.html +o make a note of how to disable this +o http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1078795681 +o bizarre image loading error with c_Rollover.zip +X couldn't find/replicate this +o read uncompressed tiff +X read uncompressed tga files. +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1081190619 +X http://processing.org/discourse/yabb/YaBB.cgi?board=Tools;action=display;num=1066742994 +o updated png encoder +o http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083792994 + +older stuff, no longer an issue +o don't cache stuff from loadStrings and others +o mac java vm won't give up old version of file +o or use setUseCaches(false) +o too many push() will silently stop the applet inside a loop +X allow save(), saveFrame() et al to properly pass in absolute paths +X (so that it doesn't always save to the applet folder) +X could require that save() takes an absolute path? +X loadImage must be used inside or after setup +X either document this and/or provide a better error message +X http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1060879468 +X expose function to write tiff header in PImage (advanced) +X helps with writing enormous images +X tag release 93 (francis thinks it's rev 1666) + + +0095 core +X undo the fix that causes the width/height to be properly set + + +0094 core +X fix bug that was causing font sizes not to be set on opengl +X http://dev.processing.org/bugs/show_bug.cgi?id=174 +X apply fix from toxi to make targa files less picky +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1127999630 +X "folder" has been renamed to "path" to match savePath(). +X added "dataPath" to return the full path to something in the data folder +X savePath should maybe be appletPath or sketchPath +X because can be used for opening files too +X (i.e. if needing a File object) +X width, height set to zero in static mode +X probably only set when resize() is called, and it's not happening +X g.smooth is always false in opengl +X http://dev.processing.org/bugs/show_bug.cgi?id=192 + +o triangleColors are different because they're per-triangle +o as opposed to per-vertex, because it's based on the facet of the tri +X make vertexCount etc properly accessible in PGraphics3 +X so that people can do things like the dxf renderer +X also have a simple way to hook in triangle leeches to PGraphics3 +X this exists, but needs to be documented, or have accessors + + +0093 core +X upgrade jogl to a newer rev to fix osx "cannot lock" issues +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1118603714 +X http://192.18.37.44/forums/index.php?topic=1596.msg79680#msg79680 +X faster blur code contributed by toxi +X filter(ERODE) and filter(DILATE) contributed by toxi +o textAscent() should probably be g.textAscent instead +o more like textLeading() etc +X nope, because it requires grabbing the font metrics and other calculations +X bezierDetail, curveDetail made public +X added textMode(SHAPE) for OPENGL +X error message saying that strokeCap and strokeJoin don't work in P3D +X textMode(SHAPE) throws ex when drawing and font not installed +X fix a bug with filename capitalization error throwing +X add NO_DEPTH_TEST to PGraphics3 +X java 1.4 code snuck into PApplet, causing problems on the mac +X http://dev.processing.org/bugs/show_bug.cgi?id=146 +X prevent PGraphics.save() from inserting a file prefix +X so that people can use absolute paths +X or add a version that takes a file object + +nixed or fixed in previous releases +X textMode(SCREEN) having issues on Mac OS X +X seem to be problems with updatePixels() on the mac +X appears to run asynchronously +X move zbuffer et al into PGraphics so that people don't have to cast to P3 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1116978834 +o noLoop() is behaving strangely +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1116002432;start=0 + + +0092 core +X rle-compressed tga save() method added by toxi +X also version that only saves RGB instead of ARGB +X proper/consistent api to access matrices in PGraphics/PGraphics3 +X first use loadMatrix(), then m00, m01 etc +X find the post on the board and make a note of this +X proper api for access to Graphics2D object in PGraphics2 +X just add the current "g2" thing to the faq +X and make a note of it on the suggestions board +X vars like cameraX etc need to be in PGraphics +X otherwise g.xxxx won't work +X how far should this go? vertices etc? +X vertices not included because switching to triangleImpl and lineImpl +X fix for copy() in java2d to make things a little speedier +X make PApplet.main() for java 1.3 friendly (Color class constants) +X remove call to background() in PGraphics2 +o change PGraphics to PGraphics2 +o or not, because PGraphics has all the base stuff for 3D +o change PGraphics2 to PGraphicsJava or PGraphicsJava2D +o maybe wait until the new shape stuff is done? +X move font placement stuff back into PGraphics? +X figure out how to get regular + java fonts working +X use that do drive how the api is set up +X optimize fonts by using native fonts in PGraphics2 +X especially textMode(SCREEN) which is disastrously slow +X in java2d, can quickly blit the image itself +X this way, can isolate it for gl too, which will use glBitmap +X danger of this setup is that it may run much nicer for the author +X i.e. with the font installed, and then super slow for their users +X add "smooth" as a field inside the font file +X and when smooth field is set, make sure JAVA2D enables smoothing +X since otherwise smooth() has to be called for the whole g2 +X rob saunders contributed a fix for a bug in PImage.copy() +X the wrong boundaries were being copied in the code +X fix bug where noLoop() was waiting 10 secs to call exit() +X add ability to draw text from the current text position + + +0091 core +X change to synchronization to hopefully fix some update issues +X curveVertex() problem in P2D when > 128 points fixed +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115856359;start=0 +X for present mode, need to set a default display +X currently crashes if only --present is specified w/o --display +o make the 1.4 code in PApplet load via reflection +X doesn't appear necessary with 1.3 applets +o or is some of the stuff usable in 1.3 but not all? +o ie. the device config classes exist but not the set full screen method +X currently some bugs in the main() because it's not sizing applets +X if running in present mode it works ok +X but that also needs its display set.. argh +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115834600;start=0 +X add exit() function to actually explicitly quit +X scripts will just require that people include exit at the end +X esc should kill fullscreen mode (actually now it just quits anything) +X can a key handler be added to the window? not really +X add an escape listener to the applet tho.. but will it work with gl? +X how can this be shut off for presentations? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114027594;start=0 +X present mode wasn't reading the stop button color +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1116166897;start=0 +X cleaned up the createFont() functions a little +X java 1.3 required message isn't clickable +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1117552076 + + +0090 core +X added arraycopy() function that calls System.arraycopy() +X also the useful shortcut fxn + + +0089 core +X no changes since 88 + + +0088 core +X createFont crashes on verdana (win2k) +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115258282;start=0 +X made ceil(), floor(), and round() return ints instead of floats +X fix for PSound: Unsupported control type: Master Gain +X just shuts off the volume control +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115467831;start=0 + +cleared out / completed in previous releases +X typed version of expand() and contract() +o fishwick bug with text() and shapes +o ellipses no longer completed when g.dimensions = 2 or 3, +o or not even drawn.. what a mess. +X go through and figure out what stuff to make public +o depth testing of lines vs text is problematic +o probably need to patch in an older version of the line code +o use depth()/noDepth() to handle depth test +X on exceptions, use die to just kill the applet +X make the file i/o stuff work more cleanly +X if people want to use their own file i/o they can do that too +o this could also be contributing to the hanging bug +X static applets need to be able to resize themselves on 'play' +X figure out what to do with static apps exported as application +X needs to just hang there +o scripts (w/ no graphics) will need to call exit() explicitly +o actually.. just override the default draw() to say exit() +X may need a fileOutput() and fileInput() function +X to take care of exception handling +o or maybe scripts are just handled with a different method? (yech) +o or maybe setup() can actually throw and Exception? +o but that's inserted by the parser, and hidden from the user? +o implement size(0, 0) -> just doesn't bother doing a frame.show(); +o too abstract, just have draw() call exit by default +o so if nothing inside draw, just quits +o make properly exit after things are finished +o still some weirdness with thread flickering on the mac +o and frenetic display updates on the pc +o move really general things out of PConstants (X, Y, Z..) ? +X add something to PApplet to have constants for the platform +o needed for error messages (don't talk about winvdig on mac) +X and also useful for programs +X bring screen space and font size settings back in to PGraphics +X causing too much trouble to be stuck down in PFont + + +0087 core + +fixed in previous releases +X The PushPop example in Transformations is not working +X with lights() callled +X The transparency of the Rotate3D example in Translformations +X is not as expected +X lighting totally sucks (both PGraphics3 and PGraphicsGL) +X bring in materials for opengl as well? +X don't include a class, just make it similar to the light functions +X sphere() and box() should set normals and take textures +X background color seems to be wrong? +X check this once lighting actually works +X printarr() of null array crashes without an error +X actually, errors from many crashes not coming through on the mac? + + +0086 core +X java 1.4 getButton() was inside the mouse handler +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114147314;start=3 +X color() doesn't work properly because g might be null? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114518309;start=0 +X textMode(RIGHT) etc causing trouble.. tell ppl to use textAlign() +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1114219121;start=4 +X saveFrame with a filename still causing trouble: +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114097641;start=0 +X fov should be in radians +X present mode not working on macosx 10.2? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114381302;start=0 +X ex on endshape if no calls to vertex +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1113940972 +X is camera backwards, or staying fixed and moving the scene? +X camera() is broken, should be ok to call it at beinning of loop +X end of lookat might be backwards +X or endCamera might be swapping camera and cameraInv +X beginCamera also grabs it backwards + + +0085 core +X camera() was missing from PGraphics +X some tweaks to openStream() for loading images and less errors +X basic clipping in P3D from simon + + +0084 core +X fixed create font / incremented font file version number +X simon lighting fixes +X added simon's lighting docs to lights() fxn in javadoc +X set default stroke cap as ROUND +X otherwise smooth() makes points disappear +X hack for text with a z coordinate + + +0083 core +X fix double key events +X fix mrj.version security error on the pc +X set() fixes for PGraphics2 and setImpl inside PGraphics +X remove angleMode (also from PMatrix classes) +X remove/rename postSetup() stuff from PGraphics/PApplet +X camera(), perspective(), ortho() +X matrix set by the camera on each beginFrame +X push/pop are now pushMatrix/popMatrix +o get PGraphics.java engine working again + +lighting stuff +X make fill() cover ambient and diffuse +X provide separate call for ambient to shut it off +o why does diffuse just mirror fill()? +o seems to cover just diffuse, not ambient_and_diffuse like fill +o maybe fill() should set diffuse, and sep call to ambient() sets ambient? +X removed it +X move dot() to the bottom w/ the other math + +already done +X remove PMethods as actual class, use recordFrame(PGraphics) +X size(200, 200, "processing.illustrator.PGraphicsAI"); + +api questions +o image(String name) and textFont(String name) +o do we change to font(arial, 12) ? +X remove angleMode() ? +X be consistent about getXxx() methods +X just use the variable names.. don't do overkill on fillR et al +X or just what functions are actually made public +X is fillRi needed? it's pretty goofy.. +X how to handle full screen (opengl especially) or no screen (for scripts) + +tweaking up simong light code +o what's up with resetLights? +o add PLight object to avoid method overflow +o preApplyMatrix, invApplyMatrix? +o applyMatrixPre and applyMatrixIn +o rotateXInv is ugly.. +o irotateX?, papplyMatrix? + +wednesday evening +X expose api to launch files, folders, URLs +X use with/in place of link() +X call it open() +X what to call firstMouse +X implement rightMouse? +X yes, mouseButton = LEFT, CENTER, or RIGHT +X error when running on 1.1... +X You need to install Java 1.3 or later to view this content. +X Click here to visit java.com and install. +X make inverseCamera into cameraInv +X fix messages referring to depth() +X route all of them through a single function rather than current waste +X fix bezierVertex() in P3D for newer api + +wednesday late +X track loadImage() with filenames that are inconsistent +X really a problem with the ves61r kids +X i.e. mixed case filename in sketch is different in windows +X but when uploaded to a unix server causes a serious problem +X use canonicalPath to flag possible problems +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1096508877;start=5 +o fix shapes in P3D (line loop, polygons, etc) +o should we include a from and to for the directional light? +X no, cuz it doesn't do much really.. +X fromX-toX etc is all that's different + +thursday day +X set modelview to camera on endCamera +X add ortho() and perspective() to PGraphics.java + +thursday evening +o textMode(ALIGN_LEFT) etc, should make sure that left/center/right not used +X though since have to change to LEFT, should be easy to switch + +friday night +o should toInt('5') return the ascii or the char? +X since (int) '5' returns the ascii, that's what it does +X made a note in the PApplet reference + +text api +X textMode ALIGN_CENTER _LEFT _RIGHT -> CENTER, LEFT, RIGHT ? +X use built-in font if available? yes +o text() with \n is semi-broken +X does the font or PApplet control the size? (the font, ala java) +X without setting the font, SCREEN_SPACE comes out weird +o move SCREEN_SPACE into ScreenFont() class? +o probably not, casey thinks screen space text is prolly more useful +o that way can clear up some of the general confusion in the code +X textFont with a named font can use the renderer/os font +X illustrator api can get the ps name from the java font name +X since it's associated with the font file.. wee! +X for postscript, can grab the real font +o altho problem here is that really the fonts just need a name +o since needs to render to screen as well +o font has to be installed to get psname +X fine because why would you embed a ps font that you don't have? +o need to resolve SCREEN_SPACE vs OBJECT_SPACE +o can this be auto-detected with noDepth()? +o how does rotated text work? +o PFont.rotate(180) rotate(PI) +o or can this be detected from the matrix? +X don't use pixels to do screen space text inside PFont +X add a function in PGraphics for direct pixel image impl +X store the font name in the vlw font file (at the end) +o could include multiple names for multi platforms +X get text impl stuff working properly +o look into fixing the texture mapping to not squash fonts +o NEW_GRAPHICS totally smashes everything + +friday postgame +X implement createFont() +X with a .ttf does a create font internally (1.3+ only) +X although the images aren't populated +X until a P2D/P3D/OPENGL tries to draw them, which triggers it +X but if PGraphics2, just uses the built-in font +X also works for font names and just creating them +X if font name doesn't end with otf or ttf, then tries to create it +X change objectX/Y/Z to modelX/Y/Z +X PFont.list() to return string list of all the available fonts +X probably not a mode of use that we really want to encourage +X actually important because the whole graphicsdevice crap is silly +X and we need a 1.1 versus 1.3/1.4 version +X implement printarr() as println() ? +X actually deal with all the array types.. oy +X should nf() handle commas as well? +X just add a basic nfc() version for ints and floats +o yes, and add nf(int what) so that non-padded version works +o but don't put commas into the zero-padded version +o make nf/nfs/nfp not so weird +o nf(PLUS, ...) nf(PAD, ...) nfc(PLUS, ...) +X unhex was broken for numbers bigger than 2^31 + +saturday late afternoon +X fix bug with openStream() and upper/lowercase stuff +X do a better job of handling any kind of URLs in openStream() + +sunday morning +X incorporate simon's new lighting code + + +0082 core +X make jdkVersion, jdkVersionName, platform, platformName variables +X additional note about screen sizes and displays +X sto instead of stop in present mode +X appears that opengl libraries weren't correctly added in 81? +X requestFocus() now called on gl canvas +X basic lights now work by default + + +0081 core +X background(PImage) now works in opengl +X when running externally, applets don't always get placed properly +X if size is never set, then doesn't always layout +X problem is in gl and in core, and is inconsistent +X move more logic for layout into PApplet.. maybe a static method? +X this way can avoid duplicating / breaking things +o what is the stroked version of a sphere? a circle? +X write list of params that can be passed to PApplet +o document in the code a note about how size() et al place themselves +X saveFrame was double-adding the save path because of save() changes + +size(200, 200, P3D) - createGraphics and placement issues +X make pappletgl work back inside papplet +X and then size(300, 300, DEPTH) etc +X get rid of opengl renderer menu +o otherwise hint() to use the p5 renderer instead of java2d +X applet placement is screwy +X how to force PGraphics() instead of PGraphics2() +X size(300, 200, P2D); +X size() doing a setBounds() is really bad +X because it means things can't be embedded properly +o applets on osx (and windows) sometimes show up 20 pixels off the top +X how to shut off rendering to screen when illustrator in use? +X need size(30000, 20000) for illustrator, problem in papplet +X size(30000, 20000, ILLUSTRATOR) +X make Graphics2 et al load dynamically using reflection +X can this be done with g2 and if exception just falls back to g1? +X this way people can remove g1 by hand +o size() that changes renderer will throw nasty exception in draw() +X or maybe that's ok? document that no changing renderers? +X take a look to see what needs to happen to get PAppletGL merged in +X i.e. can i just extend GLCanvas? + +present mode +o call present() from inside the code? +o that if applet is 500x500, centers on a 800x600 window +X no, that's nasty... use --present to launch in present window +X though how do you get the screen size? +X screen.width and screen.height? - yes +X write java 1.4 code for full screen version of PApplet +X this might be used for presentation mode +X proper full screen code for present mode +X why do mouse motion events go away in full screen mode +X or with a Window object +X use screen manager to run present mode properly +X set both versions to require java 1.4 +X change the Info.plist inside macosx +X and add something to PdeBase to make sure that it's in 1.4 +X running present mode with a bug in the program hoses things +X make sure the program compiles before starting present mode + + +0080 core +X PApplet.saveFrame() is saving to sketch folder, PApplet.save() is not +X PApplet.save() will save to the applet folder, +X but PImage.save() or PGraphics.save() will save only to the current +X working directory, usually the Processing folder. +X removed static version of mask() from PImage +X no more PImage.mask(theImage, maskImage) +X just use theImage.mask(maskImage) +X PImage.filter() +X maybe use quasimondo's gaussian blur code? +X http://incubator.quasimondo.com/processing/gaussian_blur_1.php +o filter() on subsections? yes, in keeping with rest of api +X no, in keeping with getting shit done +X BLUR - write simple blur +X how does photoshop handle this? +X BLUR - add gaussian blur +X email re: credit/attribution and descrepancy between algos +X forgot to mention the line hack to get points working in 78 +X implemented PGraphicsGL.set(x, y, argb) +X implement PGraphicsGL.set(x, y, PImage) +X blend, copy, filter all implemented for opengl +X copy(Pimage, x, y) has become set(x, y, PImage) +X textMode -> textAlign +X ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT -> LEFT, CENTER, RIGHT +X textSpace -> textMode +X NORMAL_SPACE -> NORMALIZED, OBJECT_SPACE -> OBJECT +X text in a box is broken (at least for PGraphics2) +o check to see if it's a rounding error with width() +o get text rect working again (seems to be in infinite loop) +X nope, was just that the space width wasn't being scaled up properly +X clean up the javadoc so no more errors +X change mbox to PFont.size? +o make width() return values based on natural size? +X not a great idea.. plus java2d uses 1 pixel font for things +X email simon re: lighting api +X things are actually more on track than expected +X camera is swapping colors in gl (on mac?) +X in fact, all textures on mac were swapping colors +X test this on windows to see if fixed +X sphere x,y,z,r or box w,h,d.. need to make them consistent +X goodbye sphere(x, y, z, r) +o should available() be waiting() or something like that instead? +o go through and see what functions (no pixel ops?) frame recorders should have +X decided instead to use recordFrame(PGraphics) +o remove SCREEN_SPACE altogether? +X can't do this for now + +implemented in 79 +X make sure arc goes in the right direction that we want it to +X (make sure that PGraphics3 goes the same direction) + + +0079 core +X no changes to core in this release + + +0078 core +X text fixes +X lines were getting horizontally mashed together +X lines also getting vertically smashed together +X make a note of the change to font.width() +X backwards rects and backwards ellipses weren't properly drawn +X code now compensates for negative widths or swapped x1/x2 +X what to do about backwards images +X imageMode() wasn't being set properly +X fix noLoop() not properly running +X If noLoop() is called in setup(), nothing is drawn to the screen. +X also fix redraw() to include interrupt() again +X loadPixels throwing NPEs +X fixes to SCREEN_SPACE text not being sized properly +X loadPixels()/updatePixels() on screen space text (ouch) +X get SCREEN_SPACE text working again +X patch in newer jogl.. too many BSODs +X saveFrame seems to be broken +X fixed for PGraphics2 +X fixed for PGraphicsGL +X also implemented loadPixels/updatePixels for gl +X fix tint() with color and alpha for PGraphics2 +X alpha() colors are inverted (white is opaque.. doesn't make sense) +X should we swap this around? no - this is how photoshop works +X fix arc +X get() is back +X set camera.modified so that it draws properly +X it's annoying not having a copy() function inside PImage +X formerly get() with no params +o clone throws an exception +o PImage constructor that takes itself? +o PImage copy = new PImage(another); +X got rid of CONCAVE_POLYGON and CONVEX_POLYGON +X hack for points to work in opengl, but still not working broadly +X work on filter() functions +X POSTERIZE - find simple code that does it? +X there must be a straightforward optimized version of it +o EDGES - find edges in casey's example is differen than photoshop +o which version do people want with their stuff +X edges filter removed +X several fixes to Movie and Camera to work with the new gfx model +X PImage.get(x, y, w, h) had a bug when things went off the edge +X set defaults for strokeCap and strokeJoin +X get() and gl images were broken for screen sizes less than full size +X fix arcs, were badly broken between java2d and pgraphics +X look at curve functions more closely +X should we switch to curveVertex(1,2,3) (ala curveto) +X because some confusion with mixing types of curves +o make sure we don't want curveVertices(1,2,3,u,v) +o also make test cases so that java2d and java11 behave the same +X implement PGraphics2.curveVertex() +X updatePixels() not setting PApplet.pixels +X make loadPixels in PGraphics ignored, and put it in PApplet +X made loadStrings() and openStream(File) static again +X test loadPixels()/updatePixels()/saveFrame() on the pc +X better, just assume that they need the endian swap +X fixed draw mode apps for opengl +X (gl was missing a beginFrame) +X pmouseX, pmouseY are not working in OpenGL mode +X (as they are working in Processing mode) + +o screenX/Y aren't properly working for 2D points against a 3D matrix +o (ryan alexander rounding bug) +o Just to clarify, it works completely correctly with rounding +o screenX/Y and also using the 3 arg version of translate - +o ie translate(hw,hh,0) instead of just translate(hw,hh). +X no longer an issue because moving to 2D and 3D modes +o PImage: remove the static versions of manipulators? +o probably not, because they're inherited by PApplet +o i.e. mask(image, themask); +X no PImage needed b/c PGraphics is a PImage +o colorMode(GRAY) to avoid stroke(0) causing trouble? +o or maybe get rid of stroke(0)? hrm + + +0077 core +X bring back pmouseX/Y using a tricky method of storing separate +X values for inside draw() versus inside the event handler versions +X debug handling, and make firstMouse public +X explicitly state depth()/nodepth() +X don't allocate zbuffer & stencil until depth() is called +X arc with stroke only draws the arc shape itself +X may need a 'wedge' function to draw a stroke around the whole thing +X only allocate stencil and zbuffer on first call to depth() +X this will require changes to PTriangle and PLine inside their loops +X try running javadoc +X die() may need to throw a RuntimeException +o call filter() to convert RGB/RGBA/ALPHA/GRAY +o cuz the cache is gonna be bad going rgb to rgba +X don't bother, people can re-create the image or set cache null +X fix font coloring in PGraphics2 +X fix tint() for PGraphics2 +X get text working again +X partially the problem is with ALPHA images +X how should they be stored internally +X also colored text, requires tint() to work properly +X move textMode and textSpace back out of PFont +X use die() to fail in font situations +X can't, just use a RuntimeException + +covered in previous +X before graphics engine change, attach jogl stuff +X need to try jogl to make sure no further changes +X and the illustrator stuff +o massive graphics engine changes +o move to new graphics engine +o test with rgb cube, shut off smoothing +o make sure line artifacts are because of smoothing +o implement 2x oversampling for anti-aliasing +o renderers can plug in: +o at direct api level +o taking over all color() functions and vertex collection +o at endShape() level +o where vertices are collected by core and blit on endShape() +o (takes polygons and lines) +o at post tesselation level +o takes only line segments and triangles to blit (dxf writer) +o api for file-based renderers +o need to work this out since it will affect other api changes +o size(0, 0) and then ai.size(10000, 20000) +o size 0 is code for internal to not show any window +o saveFrame(PRenderer) or saveFrame("name", PRenderer) +o saveFrame gets called at the beginning of loop() +o or is just a message to save the next frame (problem for anim) +X vertices max out at 512.. make it grow +X add gzipInput and gzipOutput +X light(x, y, z, c1, c2, c3, TYPE) +X also BLight with same constructor, and on() and off() fxn +X make sure applet is stopping in draw mode +X loadImage() is broken on some machines +X hacked for a fix in 72, but need to better coordinate with openStream() + +postscript +X pushing all intelligence down into class that implements PMethods +o keep hints about type of geometry used to reconstruct +o no special class, just uses public vars from PGraphics +o how to hook into curve rendering so that curve segments are drawn +o maybe lines are rendered and sorted, +o but they point to an original version of the curve geometry +o that can be re-rendered +o also integrate catmull-rom -> bezier inverse matrices +o even with the general catmull-rom, to render via ai beziers + +api changes +X removed circle.. it's dumb when ellipse() is in there +X (it's not like we have square() in the api) +X arcMode is gone.. just uses ellipseMode() +X save tga and tif methods are static and public +X imageMode(CORNER) and CORNERS are the only usable versions +X alpha(PImage) is now called mask() instead +X already have an alpha() function that gets alpha bits +X on start, mouseX is 0.. how to avoid? +X use firstMouse variable.. figure out naming +X get frame recording working +X not tested, but at least it's there + +image stuff +o could also do PImage2, which would need a getPixels() before messing w/ it +o bad idea, distinction not clear +o even in java 1.1, could use regular java.awt.Image and require getPixels() +o -> 1.1 wouldn't help anything, because needs pixels to render, oops +X the updatePixels() in PGraphics has to be overridden (from PImage) +X to make itself actually update on-screen +X actually, should be no different than the check_image function +X PGraphics2 and PGraphicsGL will need loadPixels() to be called +X in order to read pixels from the buffer +X loadPixels() and updatePixels() prolly should be shut off in opengl +X make people use get() instead to grab sub-images +X PGraphicsGL.copy() needs to be overridden.. use glDrawBitmap +o loadImage() needs to handle 1.1 vs 1.3 loading +o set image.format to be BUFFERED? no.. just use RGBA always +o have a flag to always use the cache, i.e. with BufferedImage +o turn that off when someone modifies it (nope, no need to) +X PImage.getPixels(), updatePixels(), updatePixels(x, y, w, h), +o PImage.setPixels(int another[]); +X imageMode(CENTER) is weird for copy() and updatePixels() +X perhaps copy() and get() ignore imageMode and use xywh or x1y1x2y2? +X or disallow imageMode(CENTER) altogether? +o in java 1.3, getPixels() can call getRGB() via reflection +o cache.getClass().getName().equals("BufferedImage") +X readPixels/writePixels? +X has to happen, since this is so fundamental to gl as well +X loadImage in 1.3 leaves pixels[] null (not in 1.1) +X 1.3 plus gl is a problem, since conflicting caches +X gl has no need for a bufferedimage tho +X so maybe checks to see if the cache is a BufferedImage +X if it is, calls getPixels to set the int array +X then replaces cache with glimageache +X pappletgl loadimage could take care of this instead +X calls super.loadImage(), if cache != null, proceed.. +X this is prolly a mess +X PImage.getPixels() and PImage.getPixels(x, y, w, h) -> +X (the xywh version still allocates the entire array, but only updates those) +X only needed for java2d +X not (necessarily) needed when loading images, +X but definitely needed when setting pixels on PGraphics +X PImage.updatePixels() and PImage.updatePixels(x, y, w, h) +X (this is actually just setModified) +X in opengl, marks all or some as modified +X so next time it's drawn, the texture is updated PGraphicsGL.image() +X in java2d, updates the BufferedImage on next draw +X can't use regular getPixels() on PGraphics, because its image isn't 'cache' +X also, the cache may be used to draw the whole surface as a gl texture (?) +X not a problem for the main PGraphics, but for any others created to draw on + +opengl +X make light() functions actually do something in PGraphicsGL +X box() and sphere() working again +X make opengl work in draw mode +X set initial size using --size= +X color channels seem to be swapped on windows in image example +X check on the mac to see what it looks like + +X default to single byte input from serial port +X and add serial.setBuffer() for message length as alternative +X or serial.setDelimiter() to fire message on delim +X named it bufferUntil(); + + +0076 core +X no changes, only launcher issues + + +0075 +X textureMode(NORMAL_SPACE) screws up the image() command +X image() appears to require IMAGE_SPACE to function properly. +X added focusGained() and focusLost() +X lots of changes to internal naming of vars +X screenX(x, y) and screenY(x, y) added for noDepth() +X add TRIANGLE_FAN +X eyeX, eyeY etc have been renamed cameraX/Y/Z, and cameraNear/Far +X modify targa and tiff writing routines to break into header writing +X writeTIFF, writeHeaderTIFF, writeTGA, writeHeaderTGA +X MAJOR CHANGE: RGBA becomes ARGB for accuracy +o uv coords > 1 shouldn't clamp, they should just repeat ala opengl +o actually i think opengl has a setting for it +o remove need to use depth() at the beginning +X need only be set once +X pmouseX is broken again +X remove pmouseX/Y altogether +X maintain things a bit different +o email the beta@ list to see how people are using pmouseX +X changed PMovie.length to PMovie.duration +X move around/simplify loadImage() inside PApplet +X working to add more die() statements inside PApplet +o can ALPHA fonts work using the other replace modes? + +fixed in previous releases +X text stuff +X text() with alignment doesn't work for multiple lines +X don't change the size of a font when in screen space mode +X patch rotated text (from visualclusto) into bfont +X what sort of api? textSpace(ROTATED) ? +X rotated text has a bug for when it goes offscreen + +opengl +X why is the thing hanging until 'stop' is hit? +X what happens when stop is hit that sets it free? +X (at what point does it start working properly?) +X cache needs to also make things a power of 2 +X if images are already a power of 2, then needn't re-alloc +X cacheIndex needs to be set to -1 when the image is modified +X or maybe have a modified() function? +X debug why certain spots are having errors (see 'problem here' notes) +X INVALID_OPERATION after drawing lines for cube +X fix noLoop bug +X remove errors when drawing textures +X reverse y coordinates +X make play button un-highlight with opengl +X also make window move messages work properly +X very necessary, since opens window at 100x100 +X problem was the threading issues +X bring back renderer menu +X reading/saving pref for opengl renderer +X remove cameraMode(PERSPECTIVE) on each frame +X why is the first one failing? +X still threading issues with running opengl +X threading really horks up dual processor machine.. +X first run hangs until quit +X though doesn't seem to replicate when p5 is restarted +X make sure background() gets called at least once with opengl +X otherwise screen never actually updates +X beginFrame() around setup() +X draw mode stuff happens inside setup.. +o or maybe need to get better at size() inside of draw() ? +X make this consistent with the regular PApplet +X otherwise things are going to be weird/difficult for debugging + + +0074 core +X removed zbuffer precision hack in PLine to improve z ordering +X no longer set g.dimensions = 3 when using vertex(x, y, 0) + + +0073 core +X tweak to fonts to use TEXT_ANTIALIAS because of macosx @#$(*& +X loadImage() is broken on some machines +X hacked for a fix in 72, but need to better coordinate with openStream() + + +0072 core +X make m00, m01 etc public +X hack to make loadImage() work +X cache settings are ignored, may be slow as hell +X make hints[] no longer static +X they weren't properly resetting + + +0071 core +X properly swap alpha values when lines need to be rendered backwards +X make cursor() commands public +X ltext and rtext for screen space stuff +X ltext is broken when it goes y < 0 or y > height +X ltext & rtext completely working +X make sure font creator is making fonts properly fixed width +X probably not using java charwidth for the char's width +X probably wasn't using textFont() properly +X now that it's actually a key, should it be a char? (what's keyChar?) +X that way println(c) would work a little better.. +X libraryCalls() not properly working for pre, post, or draw() +o image(myg, x, y) doesn't work but image(myg, x, y, w, h) does +o (image kind prolly not set right and so image() gets pissy) +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1091798655 + +text fixes +X make text rect use rectMode for placement +X if a word (no spaces) is too long to fit, insert a 'space' +X move left/center/right aligning into the font class +X otherwise text with alignment has problems with returns +X could PFont2 be done entirely with reflection? +X that way other font types can properly extend PFont +o font char widths from orator were not fixed width +o may just need to regenerate. if not, widths may be set wrong. + + +0070 core +o check ordering of split() in java vs perl for regexp +X don't include empty chars in font builder +X .vlw font files are enormous with full charset +X check to see if the character exists before adding it to the font +X fixed (unreported) problem with char lookup code +o split() with multiple args (i think this is completed) +X http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1078985667 +X trim() not chop().. whups +X random(5, 5) -> return 5, random(6, 4) return error +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1083275855;start=0 +X use random.nextFloat() because it's faster +X make grayscale image in p5 +X could be used with alpha() to properly set alpha values +X made into filter(GRAYSCALE) and filter(BLACK_WHITE) functions +X make g.depthTest settable as a hint +X http://processing.org/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1096303102;start=0 +X #ifdef to remove client and server code as well +X need to resolve issues between rendering screen/file +X illustrator-based rendering needs to work for ars projects +X screen may be 400x400 pixels, but file be 36x36" +X launcher.cpp broke serial.. see versions in processing.notcvs +X rewrite bagel code.. +X for this release, because it will break things along with the lib stuff +X switch to PImage, PApplet, etc +o bug in BImage.smooth() when resizing an image +o http://processing.org/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1096303158;start=0 +X shut off the automatic gunzipping of streams, keep for fonts +X fix for duplicated points in polygons that foiled the tesselator +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077819175 +X cleaned up texture() code between NEW/OLD graphics +X not quite so much duplicated in cases etc. +X lines: vertex coloring bug with my swap hack +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1085348942 +X last vertex on LINE_LOOP fades out +X http://processing.org/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1096303406;start=0 +X include values in PConstants for additional blend modes: +X DIFFERENCE, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT +X include a lerp()? is there one in flash? +X http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1083289030 +X should it be called lerp or mix? +X acos, asin, atan, log, exp, ceil/floor, pow, mag(x,y,z) +X color issues +X doesn't work when outside a function: +X color bg_color = color(255,0,0); +X colorMode broken for red() green() etc +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1068664455 +X add color(gray) and color(gray, alpha) +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1089898189;start=0 +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1090133107 +o update() mode needs to be hacked in (?) +X make 'online' a boolean +X pass in args[] from main +X angleMode(DEGREES) and angleMode(RADIANS) +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1075507381;start=0 +X fixes to line and curve code +X api to properly sense when applet has focus +X add a 'focused' variable to the applet +X code now in zipdecode, maybe just list this as a standard thing? +X do applets know when they're stopped? stop? dispose? +X would be good to set a param in p5 so that the thread dies +X if people have other threads they've spawned, impossible to stop + +cleaning up +X make bagel more usable as standalone +X breakout BGraphics (have its own BImage) +o breakout BApplet into BComponent ? (fix out-of-bounds mouse - doesn't) +o opengl export / rendering mode +o currently implemented, but somewhat broken +o finish this once all the line code is done +o make possible to use buzz.pl to create versions w/ stuff removed +o build gl4java for java 1.4 +o separating of BGraphics and BApplet +o change copyrights on the files again (to match ?) +X loadStrings has a problem with URLs and a code folder +o turned out to be a problem with firewall/antivirus software +o http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1086551792 +o when running as an applet, need to loadStream from documentBase too +o problem is that BGraphics has the loadStream code, not BApplet +o new sphere code from toxi +o already added a while back +o http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1067005325 +o sphere code needs only front face polygon +o all triangles must be counter-clockwise (front-facing) +X fix loadImage to be inside PApplet + +040715 +X saveFrame() to a folder horks things up if a mkdirs() is required +X on macosx, this makes things hang; on windows it complains +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081706752;start=0 +X decide on whether to use PTools +X decided against, since it doesn't help anything +X and some functions need the applet object, so it's just annoying +o i.e. move math functions into utility library +o check what other functions require PGraphics to exist but shouldn't +o look at BGraphics to see if setting an 'applet' could be used +o then other than that, if no applet set, no connection to PApplet + +040716 +X change font api to not use leading() as a way to reset the leading +X resetLeading and resetSize are the things +X embed all available chars from a font, so japanese, etc works +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1083598817;start=3 +X fix a bunch of font bugs regarding charsets and lookup +X array operations: boolean, byte, char, int, float, String +X expand/contract +X append, shorten +o shift/unshift +o slice +X splice +X reverse +X concat + +040717 +X make clone() into copy() +X add a method BApplet.setPath() or something like that +X use it to repair saveBytes, saveStrings, etc +X put screenshots into their sketch folder +o http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1046185738;start=0 +X full casting operations on primitives and arrays of them +X text(String text, x, y, width, height) // based on rectMode +X textMode() for align left, center, right (no justify.. har!) +X hex(), binary(), unhex(), unbinary() + +040725 +X fix array functions not returning a value + +040726 +X noiseSeed and randomSeed +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1090749784;start=0 + +040727 +X incorporated NO_FLYING_POO line/poly hack developed for axel + +040902 +X sort() should return an array, rather than sort in place +X fix binary function, had wrong offset number +X casey: i wan't able to get binary() to work at all: +o Typography: Helix won't compile +o works fine, just needs BFont -> PFont +X standalone 'alpha' function for PImage (static methods for alpha fxns) +X Image: Edge, Image: Blur: Alpha not set? The error is easier to see on Blur +X turns out bounds checking wasn't working properly on colors + +040903 +X fix mouse/key events, make properly public for the package stuff +X The biggest problem was the key and mouse functions not working. +X Input: Mouse_Functions +X Input: Keyboard_Functions +X processing.net -> PClient, PServer +X write client/server implementations for new-style api +X basic test with old net server has things working fine + +040908 +X inputFile, outputFile, reader, writer commands +X also loadStrings(File file) + +040913 +X printarr instead of print/println for arrays +X println(Object o) conflicts with println(int a[]) +X but println(Object o) is very needed + +040919 +X loop/noLoop setup + +040920 +X make loop/noLoop work properly +X fixes/changes to key and mousehandling +X tab key not working? +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1091853942;start=0 +X mousePressed, keyPressed, others.. queue them all +X queue multiple times +X http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1079555200;start=0 +X strangeness with key codes on keyPressed +X http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083406438;start=0 +X key codes not properly coming through for UP/DOWN/etc +X had to bring back keyCode +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1075138932;start=0 +X add redraw() function +X call redraw() on the first time through (to force initial draw) +X otherwise noLoop() in setup means no drawing happens at all + +040920 evening +X defaults for PApplet and PGraphics are different +o PGraphics has none.. PApplet has fill/stroke +X actually not the case, only that wasn't calling decent superclass +X set PImage.format as RGB by default? +X this was problem with rendering an image from PGraphics on board +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1091798655;start=0 +X http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1080671926;start=0 + +040921 morning +X bug in get() that was removing the high bits (rather than adding) + +040921 evening +X lots of work on libraries, figuring out PLibrary api + +040922 +X get library stuff debugged +X port arcball and finish up dxf writer +X beginCamera() no longer sets an identity matrix + +040925 +X make savePath() and createPath() accessible to the outside world +X useful for libraries saving files etc. + + +0070p8 +X sizing bug fix to fonts, they now match platform standards +X however, *this will break people's code* +X text in a box not written +X make sure to note in the docs that text/textrect position differently +o for this reason, should it be called textrect()? +X font heights and leading are bad +X get good values for ascent and descent +X if ScreenFont subclasses PFont.. can that be used in textFont()? +X check to make sure the tops of fonts not getting chopped in font builder + + +0069 bagel +X text(x, y, z) +X fixed camera modes / replaced how isometric is handled +X whoa.. BGraphics.screenX() et al had the camera stuff shut off +X and that's what shipped in 67. shite. +X need to get things fixed up properly so camera is properly set +X ISOMETRIC was completely broken.. need to implement properly +X also, the default camera is perspective +X cameraMode(PERSPECTIVE) and cameraMode(ORTHOGRAPHIC) setup basic cameras +X if the user wants a custom camera, call cameraMode(CUSTOM); before begin() +X printMatrix() and printCamera() to output the matrices for each +X more functions made static (loadStrings, loadBytes) that could be +X print() commands in BApplet were among these +X die() command to exit an application or just stall out an applet +X die(String error) and die(String error, Exception e) +X more documentation in comments for functions +X chop() function that properly also handles nbsp +X join() was handled weird +X run nf() and nfs() on arrays +X nfp() to show plus sign +X toInt, toFloat, toDouble (nf is for toString.. inconsistent) +o split() function splits strings instead of splitStrings() +o ints() converts an array of strings/doubles/floats to an int array +o split() should also use StringTokenizer +o to do countTokens() and then stuff into an array +o shave() or chomp() or trim() method to remove whitespace on either side +o including unicode nbsp +X min() and max() with three values were broken (now fixed) +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1076804172 +X CONTROL wasn't properly set in BConstants +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077058788 +X macosx.. flickering several times on startup +X fixed this, along with other sluggishness related threading issues +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1073111031 +X bug with charset table on older fonts +X index_hunt was look through the table, not what was in the font +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077475307;start=0 +X seems to be some difficult threading problems still present +X fixed many threading issues across macosx and linux +X side-porting changes +X new(er) line code is not in the main 'processing' +X making perlin non-static not in the main bagel +X polygon stroking hack code from the end of 68 +X erikb found a bug inside split(), it would die on empty strings +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077664736 +X fixed it, also modified behavior of split() with a delimeter +X previously, it would remove the final delimeter and an empty entry +X but that's now disabled, since the split cmd is very specific +X code from toxi to support .tga files in loadImage +X http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1078459847;start=0 +X fix bug where single pixel points were ignoring their alpha values +X static loadStrings and loadBytes aren't being added to BApplet +X (the versions that use an inputstream) +X added support for handling static functions in make.pl +X threading is broken again on windows +X windows needs a sleep(1) instead of the yield() +X random(3) should be non-inclusive of the 3 +X http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1079935258;start=5 + +api changes +X loadStream -> openStream for better consistency + +jdf +X dynamic loading of code for setting cursor (removed JDK13 ifdef) +X why aren't cursors working on the mac? +X fix from jdf to just set size to 0,0 diff --git a/core/license.txt b/core/license.txt new file mode 100644 index 000000000..16f1ad162 --- /dev/null +++ b/core/license.txt @@ -0,0 +1,456 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[ This is the first released version of the Lesser GPL. + It also counts as the successor of the GNU Library Public + License, version 2, hence the version number 2.1. ] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. \ No newline at end of file diff --git a/core/make.sh b/core/make.sh new file mode 100755 index 000000000..78d91b33a --- /dev/null +++ b/core/make.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +#javadoc -public -d doc *.java +#javadoc -private -d doc *.java +chmod +x preproc.pl +./preproc.pl +jikes -d . +D *.java diff --git a/core/preproc.pl b/core/preproc.pl new file mode 100755 index 000000000..40ba9bba2 --- /dev/null +++ b/core/preproc.pl @@ -0,0 +1,186 @@ +#!/usr/bin/perl -w + +$basedir = 'src/processing/core'; + +@contents = (); + +# next slurp methods from PGraphics +open(F, "$basedir/PGraphics.java") || die $!; +foreach $line () { + push @contents, $line; +} +close(F); + +# PGraphics subclasses PImage.. now get those methods +open(F, "$basedir/PImage.java") || die $!; +foreach $line () { + push @contents, $line; +} +close(F); + +#open(DEBUG, ">debug.java") || die $!; +#print DEBUG @contents; +#close(DEBUG); +#exit; + + +open(APPLET, "$basedir/PApplet.java") || die $!; +@applet = ; +close(APPLET); + + +$insert = 'public functions for processing.core'; + +# an improved version of this would only rewrite if changes made +open(OUT, ">$basedir/PApplet.new") || die $!; +foreach $line (@applet) { + print OUT $line; + last if ($line =~ /$insert/); +} + +$comments = 0; + +while ($line = shift(@contents)) { + $decl = ""; + + if ($line =~ /\/\*/) { + $comments++; + #print "+[$comments] $line"; + } + if ($line =~ /\*\//) { + $comments--; + #print "-[$comments] $line"; + } + next if ($comments > 0); + + $got_something = 0; # so it's ugly, back off + $got_static = 0; + $got_interface = 0; + + if ($line =~ /^\s*public ([\w\[\]]+) [a-zA-z_]+\(.*$/) { + $got_something = 1; + $got_interface = 1; + } elsif ($line =~ /^\s*abstract public ([\w\[\]]+) [a-zA-z_]+\(.*$/) { + $got_something = 1; + } elsif ($line =~ /^\s*public final ([\w\[\]]+) [a-zA-z_]+\(.*$/) { + $got_something = 1; + } elsif ($line =~ /^\s*static public ([\w\[\]]+) [a-zA-z_]+\(.*$/) { + $got_something = 1; + $got_static = 1; + } + # if function is marked "// ignore" then, uh, ignore it. + if (($got_something == 1) && ($line =~ /\/\/ ignore/)) { + $got_something = 0; + } + #if ($line =~ /^\s*public (\w+) [a-zA-z_]+\(.*$/) { + if ($got_something == 1) { + if ($1 ne 'void') { + $returns = 'return '; + } else { + $returns = ''; + } + +# if ($line =~ /^(\s+)abstract\s+([^;]+);/) { +# $line = $1 . $2 . " {\n"; +# #print "found $1\n"; +# # hrm +# } + # remove the 'abstract' modifier + $line =~ s/\sabstract\s/ /; + + # replace semicolons with a start def + $line =~ s/\;\s*$/ {\n/; + + print OUT "\n\n$line"; + +# if ($got_interface == 1) { +# $iline = $line; +# $iline =~ s/ \{/\;/; +## print INTF "\n$iline"; +# } + + $decl .= $line; + while (!($line =~ /\)/)) { + $line = shift (@contents); + $decl .= $line; + $line =~ s/\;\s*$/ {\n/; + print OUT $line; + +# if ($got_interface == 1) { +# $iline = $line; +# $iline =~ s/ \{/\;/; +## print INTF $iline; +# } + } + + #$g_line = ''; + #$r_line = ''; + + $decl =~ /\s(\S+)\(/; + $decl_name = $1; + if ($got_static == 1) { + #print OUT " ${returns}PGraphics.${decl_name}("; + $g_line = " ${returns}PGraphics.${decl_name}("; + } else { + #if ($returns eq '') { + #print OUT " if (recorder != null) recorder.${decl_name}("; + $r_line = " if (recorder != null) recorder.${decl_name}("; + #} + #print OUT " ${returns}g.${decl_name}("; + $g_line = " ${returns}g.${decl_name}("; + } + + $decl =~ s/\s+/ /g; # smush onto a single line + $decl =~ s/^.*\(//; + $decl =~ s/\).*$//; + + $prev = 0; + @parts = split(', ', $decl); + foreach $part (@parts) { + #($the_type, $the_arg) = split(' ', $part); + @blargh = split(' ', $part); + $the_arg = $blargh[1]; + $the_arg =~ s/[\[\]]//g; + if ($prev != 0) { + #print OUT ", "; + $g_line .= ", "; + $r_line .= ", "; + } + #print OUT "${the_arg}"; + $g_line .= "${the_arg}"; + $r_line .= "${the_arg}"; + $prev = 1; + } + #print OUT ");\n"; + $g_line .= ");\n"; + $r_line .= ");\n"; + + if (($got_static != 1) && ($returns eq '')) { + print OUT $r_line; + } + print OUT $g_line; + print OUT " }\n"; + } +} +print OUT "}\n"; +#print INTF "}\n"; + +close(OUT); +#close(INTF); + +$oldguy = join(' ', @applet); + +open(NEWGUY, "$basedir/PApplet.new") || die $!; +@newbie = ; +$newguy = join(' ', @newbie); +close(NEWGUY); + +if ($oldguy ne $newguy) { + # replace him + print "updating PApplet with PGraphics api changes\n"; + `mv $basedir/PApplet.new $basedir/PApplet.java`; +} else { + # just kill the new guy + #print "no changes to applet\n"; + `rm -f $basedir/PApplet.new`; +} diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java new file mode 100644 index 000000000..4e1cff550 --- /dev/null +++ b/core/src/processing/core/PApplet.java @@ -0,0 +1,8076 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.applet.*; +import java.awt.*; +import java.awt.event.*; +import java.awt.image.*; +import java.io.*; +import java.lang.reflect.*; +import java.net.*; +import java.text.*; +import java.util.*; +import java.util.regex.*; +import java.util.zip.*; + +import javax.imageio.ImageIO; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; + + +/** + * Base class for all sketches that use processing.core. + *

+ * Note that you should not use AWT or Swing components inside a Processing + * applet. The surface is made to automatically update itself, and will cause + * problems with redraw of components drawn above it. If you'd like to + * integrate other Java components, see below. + *

+ * As of release 0145, Processing uses active mode rendering in all cases. + * All animation tasks happen on the "Processing Animation Thread". The + * setup() and draw() methods are handled by that thread, and events (like + * mouse movement and key presses, which are fired by the event dispatch + * thread or EDT) are queued to be (safely) handled at the end of draw(). + * For code that needs to run on the EDT, use SwingUtilities.invokeLater(). + * When doing so, be careful to synchronize between that code (since + * invokeLater() will make your code run from the EDT) and the Processing + * animation thread. Use of a callback function or the registerXxx() methods + * in PApplet can help ensure that your code doesn't do something naughty. + *

+ * As of release 0136 of Processing, we have discontinued support for versions + * of Java prior to 1.5. We don't have enough people to support it, and for a + * project of our size, we should be focusing on the future, rather than + * working around legacy Java code. In addition, Java 1.5 gives us access to + * better timing facilities which will improve the steadiness of animation. + *

+ * This class extends Applet instead of JApplet because 1) historically, + * we supported Java 1.1, which does not include Swing (without an + * additional, sizable, download), and 2) Swing is a bloated piece of crap. + * A Processing applet is a heavyweight AWT component, and can be used the + * same as any other AWT component, with or without Swing. + *

+ * Similarly, Processing runs in a Frame and not a JFrame. However, there's + * nothing to prevent you from embedding a PApplet into a JFrame, it's just + * that the base version uses a regular AWT frame because there's simply + * no need for swing in that context. If people want to use Swing, they can + * embed themselves as they wish. + *

+ * It is possible to use PApplet, along with core.jar in other projects. + * In addition to enabling you to use Java 1.5+ features with your sketch, + * this also allows you to embed a Processing drawing area into another Java + * application. This means you can use standard GUI controls with a Processing + * sketch. Because AWT and Swing GUI components cannot be used on top of a + * PApplet, you can instead embed the PApplet inside another GUI the way you + * would any other Component. + *

+ * It is also possible to resize the Processing window by including + * frame.setResizable(true) inside your setup() method. + * Note that the Java method frame.setSize() will not work unless + * you first set the frame to be resizable. + *

+ * Because the default animation thread will run at 60 frames per second, + * an embedded PApplet can make the parent sluggish. You can use frameRate() + * to make it update less often, or you can use noLoop() and loop() to disable + * and then re-enable looping. If you want to only update the sketch + * intermittently, use noLoop() inside setup(), and redraw() whenever + * the screen needs to be updated once (or loop() to re-enable the animation + * thread). The following example embeds a sketch and also uses the noLoop() + * and redraw() methods. You need not use noLoop() and redraw() when embedding + * if you want your application to animate continuously. + *

+ * public class ExampleFrame extends Frame {
+ *
+ *     public ExampleFrame() {
+ *         super("Embedded PApplet");
+ *
+ *         setLayout(new BorderLayout());
+ *         PApplet embed = new Embedded();
+ *         add(embed, BorderLayout.CENTER);
+ *
+ *         // important to call this whenever embedding a PApplet.
+ *         // It ensures that the animation thread is started and
+ *         // that other internal variables are properly set.
+ *         embed.init();
+ *     }
+ * }
+ *
+ * public class Embedded extends PApplet {
+ *
+ *     public void setup() {
+ *         // original setup code here ...
+ *         size(400, 400);
+ *
+ *         // prevent thread from starving everything else
+ *         noLoop();
+ *     }
+ *
+ *     public void draw() {
+ *         // drawing code goes here
+ *     }
+ *
+ *     public void mousePressed() {
+ *         // do something based on mouse movement
+ *
+ *         // update the screen (run draw once)
+ *         redraw();
+ *     }
+ * }
+ * 
+ * + *

Processing on multiple displays

+ *

I was asked about Processing with multiple displays, and for lack of a + * better place to document it, things will go here.

+ *

You can address both screens by making a window the width of both, + * and the height of the maximum of both screens. In this case, do not use + * present mode, because that's exclusive to one screen. Basically it'll + * give you a PApplet that spans both screens. If using one half to control + * and the other half for graphics, you'd just have to put the 'live' stuff + * on one half of the canvas, the control stuff on the other. This works + * better in windows because on the mac we can't get rid of the menu bar + * unless it's running in present mode.

+ *

For more control, you need to write straight java code that uses p5. + * You can create two windows, that are shown on two separate screens, + * that have their own PApplet. this is just one of the tradeoffs of one of + * the things that we don't support in p5 from within the environment + * itself (we must draw the line somewhere), because of how messy it would + * get to start talking about multiple screens. It's also not that tough to + * do by hand w/ some Java code.

+ */ +public class PApplet extends Applet + implements PConstants, Runnable, + MouseListener, MouseMotionListener, KeyListener, FocusListener +{ + /** + * Full name of the Java version (i.e. 1.5.0_11). + * Prior to 0125, this was only the first three digits. + */ + public static final String javaVersionName = + System.getProperty("java.version"); + + /** + * Version of Java that's in use, whether 1.1 or 1.3 or whatever, + * stored as a float. + *

+ * Note that because this is stored as a float, the values may + * not be exactly 1.3 or 1.4. Instead, make sure you're + * comparing against 1.3f or 1.4f, which will have the same amount + * of error (i.e. 1.40000001). This could just be a double, but + * since Processing only uses floats, it's safer for this to be a float + * because there's no good way to specify a double with the preproc. + */ + public static final float javaVersion = + new Float(javaVersionName.substring(0, 3)).floatValue(); + + /** + * Current platform in use. + *

+ * Equivalent to System.getProperty("os.name"), just used internally. + */ + + /** + * Current platform in use, one of the + * PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER. + */ + static public int platform; + + /** + * Name associated with the current 'platform' (see PConstants.platformNames) + */ + //static public String platformName; + + static { + String osname = System.getProperty("os.name"); + + if (osname.indexOf("Mac") != -1) { + platform = MACOSX; + + } else if (osname.indexOf("Windows") != -1) { + platform = WINDOWS; + + } else if (osname.equals("Linux")) { // true for the ibm vm + platform = LINUX; + + } else { + platform = OTHER; + } + } + + /** + * Modifier flags for the shortcut key used to trigger menus. + * (Cmd on Mac OS X, Ctrl on Linux and Windows) + */ + static public final int MENU_SHORTCUT = + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + + /** The PGraphics renderer associated with this PApplet */ + public PGraphics g; + + //protected Object glock = new Object(); // for sync + + /** The frame containing this applet (if any) */ + public Frame frame; + + /** + * The screen size when the applet was started. + *

+ * Access this via screen.width and screen.height. To make an applet + * run at full screen, use size(screen.width, screen.height). + *

+ * If you have multiple displays, this will be the size of the main + * display. Running full screen across multiple displays isn't + * particularly supported, and requires more monkeying with the values. + * This probably can't/won't be fixed until/unless I get a dual head + * system. + *

+ * Note that this won't update if you change the resolution + * of your screen once the the applet is running. + *

+ * This variable is not static, because future releases need to be better + * at handling multiple displays. + */ + public Dimension screen = + Toolkit.getDefaultToolkit().getScreenSize(); + + /** + * A leech graphics object that is echoing all events. + */ + public PGraphics recorder; + + /** + * Command line options passed in from main(). + *

+ * This does not include the arguments passed in to PApplet itself. + */ + public String args[]; + + /** Path to sketch folder */ + public String sketchPath; //folder; + + /** When debugging headaches */ + static final boolean THREAD_DEBUG = false; + + /** Default width and height for applet when not specified */ + static public final int DEFAULT_WIDTH = 100; + static public final int DEFAULT_HEIGHT = 100; + + /** + * Minimum dimensions for the window holding an applet. + * This varies between platforms, Mac OS X 10.3 can do any height + * but requires at least 128 pixels width. Windows XP has another + * set of limitations. And for all I know, Linux probably lets you + * make windows with negative sizes. + */ + static public final int MIN_WINDOW_WIDTH = 128; + static public final int MIN_WINDOW_HEIGHT = 128; + + /** + * Exception thrown when size() is called the first time. + *

+ * This is used internally so that setup() is forced to run twice + * when the renderer is changed. This is the only way for us to handle + * invoking the new renderer while also in the midst of rendering. + */ + static public class RendererChangeException extends RuntimeException { } + + /** + * true if no size() command has been executed. This is used to wait until + * a size has been set before placing in the window and showing it. + */ + public boolean defaultSize; + + volatile boolean resizeRequest; + volatile int resizeWidth; + volatile int resizeHeight; + + /** + * Pixel buffer from this applet's PGraphics. + *

+ * When used with OpenGL or Java2D, this value will + * be null until loadPixels() has been called. + */ + public int pixels[]; + + /** width of this applet's associated PGraphics */ + public int width; + + /** height of this applet's associated PGraphics */ + public int height; + + /** current x position of the mouse */ + public int mouseX; + + /** current y position of the mouse */ + public int mouseY; + + /** + * Previous x/y position of the mouse. This will be a different value + * when inside a mouse handler (like the mouseMoved() method) versus + * when inside draw(). Inside draw(), pmouseX is updated once each + * frame, but inside mousePressed() and friends, it's updated each time + * an event comes through. Be sure to use only one or the other type of + * means for tracking pmouseX and pmouseY within your sketch, otherwise + * you're gonna run into trouble. + */ + public int pmouseX, pmouseY; + + /** + * previous mouseX/Y for the draw loop, separated out because this is + * separate from the pmouseX/Y when inside the mouse event handlers. + */ + protected int dmouseX, dmouseY; + + /** + * pmouseX/Y for the event handlers (mousePressed(), mouseDragged() etc) + * these are different because mouse events are queued to the end of + * draw, so the previous position has to be updated on each event, + * as opposed to the pmouseX/Y that's used inside draw, which is expected + * to be updated once per trip through draw(). + */ + protected int emouseX, emouseY; + + /** + * Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, + * otherwise pmouseX/Y are always zero, causing a nasty jump. + *

+ * Just using (frameCount == 0) won't work since mouseXxxxx() + * may not be called until a couple frames into things. + */ + public boolean firstMouse; + + /** + * Last mouse button pressed, one of LEFT, CENTER, or RIGHT. + *

+ * If running on Mac OS, a ctrl-click will be interpreted as + * the righthand mouse button (unlike Java, which reports it as + * the left mouse). + */ + public int mouseButton; + + public boolean mousePressed; + public MouseEvent mouseEvent; + + /** + * Last key pressed. + *

+ * If it's a coded key, i.e. UP/DOWN/CTRL/SHIFT/ALT, + * this will be set to CODED (0xffff or 65535). + */ + public char key; + + /** + * When "key" is set to CODED, this will contain a Java key code. + *

+ * For the arrow keys, keyCode will be one of UP, DOWN, LEFT and RIGHT. + * Also available are ALT, CONTROL and SHIFT. A full set of constants + * can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables. + */ + public int keyCode; + + /** + * true if the mouse is currently pressed. + */ + public boolean keyPressed; + + /** + * the last KeyEvent object passed into a mouse function. + */ + public KeyEvent keyEvent; + + /** + * Gets set to true/false as the applet gains/loses focus. + */ + public boolean focused = false; + + /** + * true if the applet is online. + *

+ * This can be used to test how the applet should behave + * since online situations are different (no file writing, etc). + */ + public boolean online = false; + + /** + * Time in milliseconds when the applet was started. + *

+ * Used by the millis() function. + */ + long millisOffset; + + /** + * The current value of frames per second. + *

+ * The initial value will be 10 fps, and will be updated with each + * frame thereafter. The value is not instantaneous (since that + * wouldn't be very useful since it would jump around so much), + * but is instead averaged (integrated) over several frames. + * As such, this value won't be valid until after 5-10 frames. + */ + public float frameRate = 10; + /** Last time in nanoseconds that frameRate was checked */ + protected long frameRateLastNanos = 0; + + /** As of release 0116, frameRate(60) is called as a default */ + protected float frameRateTarget = 60; + protected long frameRatePeriod = 1000000000L / 60L; + + protected boolean looping; + + /** flag set to true when a redraw is asked for by the user */ + protected boolean redraw; + + /** + * How many frames have been displayed since the applet started. + *

+ * This value is read-only do not attempt to set it, + * otherwise bad things will happen. + *

+ * Inside setup(), frameCount is 0. + * For the first iteration of draw(), frameCount will equal 1. + */ + public int frameCount; + + /** + * true if this applet has had it. + */ + public boolean finished; + + /** + * true if exit() has been called so that things shut down + * once the main thread kicks off. + */ + protected boolean exitCalled; + + Thread thread; + + protected RegisteredMethods sizeMethods; + protected RegisteredMethods preMethods, drawMethods, postMethods; + protected RegisteredMethods mouseEventMethods, keyEventMethods; + protected RegisteredMethods disposeMethods; + + // messages to send if attached as an external vm + + /** + * Position of the upper-lefthand corner of the editor window + * that launched this applet. + */ + static public final String ARGS_EDITOR_LOCATION = "--editor-location"; + + /** + * Location for where to position the applet window on screen. + *

+ * This is used by the editor to when saving the previous applet + * location, or could be used by other classes to launch at a + * specific position on-screen. + */ + static public final String ARGS_EXTERNAL = "--external"; + + static public final String ARGS_LOCATION = "--location"; + + static public final String ARGS_DISPLAY = "--display"; + + static public final String ARGS_BGCOLOR = "--bgcolor"; + + static public final String ARGS_PRESENT = "--present"; + + static public final String ARGS_EXCLUSIVE = "--exclusive"; + + static public final String ARGS_STOP_COLOR = "--stop-color"; + + static public final String ARGS_HIDE_STOP = "--hide-stop"; + + /** + * Allows the user or PdeEditor to set a specific sketch folder path. + *

+ * Used by PdeEditor to pass in the location where saveFrame() + * and all that stuff should write things. + */ + static public final String ARGS_SKETCH_FOLDER = "--sketch-path"; + + /** + * When run externally to a PdeEditor, + * this is sent by the applet when it quits. + */ + //static public final String EXTERNAL_QUIT = "__QUIT__"; + static public final String EXTERNAL_STOP = "__STOP__"; + + /** + * When run externally to a PDE Editor, this is sent by the applet + * whenever the window is moved. + *

+ * This is used so that the editor can re-open the sketch window + * in the same position as the user last left it. + */ + static public final String EXTERNAL_MOVE = "__MOVE__"; + + /** true if this sketch is being run by the PDE */ + boolean external = false; + + + static final String ERROR_MIN_MAX = + "Cannot use min() or max() on an empty array."; + + + // during rev 0100 dev cycle, working on new threading model, + // but need to disable and go conservative with changes in order + // to get pdf and audio working properly first. + // for 0116, the CRUSTY_THREADS are being disabled to fix lots of bugs. + //static final boolean CRUSTY_THREADS = false; //true; + + + public void init() { +// println("Calling init()"); + + // send tab keys through to the PApplet + setFocusTraversalKeysEnabled(false); + + millisOffset = System.currentTimeMillis(); + + finished = false; // just for clarity + + // this will be cleared by draw() if it is not overridden + looping = true; + redraw = true; // draw this guy once + firstMouse = true; + + // these need to be inited before setup + sizeMethods = new RegisteredMethods(); + preMethods = new RegisteredMethods(); + drawMethods = new RegisteredMethods(); + postMethods = new RegisteredMethods(); + mouseEventMethods = new RegisteredMethods(); + keyEventMethods = new RegisteredMethods(); + disposeMethods = new RegisteredMethods(); + + try { + getAppletContext(); + online = true; + } catch (NullPointerException e) { + online = false; + } + + try { + if (sketchPath == null) { + sketchPath = System.getProperty("user.dir"); + } + } catch (Exception e) { } // may be a security problem + + Dimension size = getSize(); + if ((size.width != 0) && (size.height != 0)) { + // When this PApplet is embedded inside a Java application with other + // Component objects, its size() may already be set externally (perhaps + // by a LayoutManager). In this case, honor that size as the default. + // Size of the component is set, just create a renderer. + g = makeGraphics(size.width, size.height, getSketchRenderer(), null, true); + // This doesn't call setSize() or setPreferredSize() because the fact + // that a size was already set means that someone is already doing it. + + } else { + // Set the default size, until the user specifies otherwise + this.defaultSize = true; + int w = getSketchWidth(); + int h = getSketchHeight(); + g = makeGraphics(w, h, getSketchRenderer(), null, true); + // Fire component resize event + setSize(w, h); + setPreferredSize(new Dimension(w, h)); + } + width = g.width; + height = g.height; + + addListeners(); + + // this is automatically called in applets + // though it's here for applications anyway + start(); + } + + + public int getSketchWidth() { + return DEFAULT_WIDTH; + } + + + public int getSketchHeight() { + return DEFAULT_HEIGHT; + } + + + public String getSketchRenderer() { + return JAVA2D; + } + + + /** + * Called by the browser or applet viewer to inform this applet that it + * should start its execution. It is called after the init method and + * each time the applet is revisited in a Web page. + *

+ * Called explicitly via the first call to PApplet.paint(), because + * PAppletGL needs to have a usable screen before getting things rolling. + */ + public void start() { + // When running inside a browser, start() will be called when someone + // returns to a page containing this applet. + // http://dev.processing.org/bugs/show_bug.cgi?id=581 + finished = false; + + if (thread != null) return; + thread = new Thread(this, "Animation Thread"); + thread.start(); + } + + + /** + * Called by the browser or applet viewer to inform + * this applet that it should stop its execution. + *

+ * Unfortunately, there are no guarantees from the Java spec + * when or if stop() will be called (i.e. on browser quit, + * or when moving between web pages), and it's not always called. + */ + public void stop() { + // bringing this back for 0111, hoping it'll help opengl shutdown + finished = true; // why did i comment this out? + + // don't run stop and disposers twice + if (thread == null) return; + thread = null; + + // call to shut down renderer, in case it needs it (pdf does) + if (g != null) g.dispose(); + + // maybe this should be done earlier? might help ensure it gets called + // before the vm just craps out since 1.5 craps out so aggressively. + disposeMethods.handle(); + } + + + /** + * Called by the browser or applet viewer to inform this applet + * that it is being reclaimed and that it should destroy + * any resources that it has allocated. + *

+ * This also attempts to call PApplet.stop(), in case there + * was an inadvertent override of the stop() function by a user. + *

+ * destroy() supposedly gets called as the applet viewer + * is shutting down the applet. stop() is called + * first, and then destroy() to really get rid of things. + * no guarantees on when they're run (on browser quit, or + * when moving between pages), though. + */ + public void destroy() { + ((PApplet)this).stop(); + } + + + /** + * This returns the last width and height specified by the user + * via the size() command. + */ +// public Dimension getPreferredSize() { +// return new Dimension(width, height); +// } + + +// public void addNotify() { +// super.addNotify(); +// println("addNotify()"); +// } + + + + ////////////////////////////////////////////////////////////// + + + public class RegisteredMethods { + int count; + Object objects[]; + Method methods[]; + + + // convenience version for no args + public void handle() { + handle(new Object[] { }); + } + + public void handle(Object oargs[]) { + for (int i = 0; i < count; i++) { + try { + //System.out.println(objects[i] + " " + args); + methods[i].invoke(objects[i], oargs); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public void add(Object object, Method method) { + if (objects == null) { + objects = new Object[5]; + methods = new Method[5]; + } + if (count == objects.length) { + objects = (Object[]) PApplet.expand(objects); + methods = (Method[]) PApplet.expand(methods); +// Object otemp[] = new Object[count << 1]; +// System.arraycopy(objects, 0, otemp, 0, count); +// objects = otemp; +// Method mtemp[] = new Method[count << 1]; +// System.arraycopy(methods, 0, mtemp, 0, count); +// methods = mtemp; + } + objects[count] = object; + methods[count] = method; + count++; + } + + + /** + * Removes first object/method pair matched (and only the first, + * must be called multiple times if object is registered multiple times). + * Does not shrink array afterwards, silently returns if method not found. + */ + public void remove(Object object, Method method) { + int index = findIndex(object, method); + if (index != -1) { + // shift remaining methods by one to preserve ordering + count--; + for (int i = index; i < count; i++) { + objects[i] = objects[i+1]; + methods[i] = methods[i+1]; + } + // clean things out for the gc's sake + objects[count] = null; + methods[count] = null; + } + } + + protected int findIndex(Object object, Method method) { + for (int i = 0; i < count; i++) { + if (objects[i] == object && methods[i].equals(method)) { + //objects[i].equals() might be overridden, so use == for safety + // since here we do care about actual object identity + //methods[i]==method is never true even for same method, so must use + // equals(), this should be safe because of object identity + return i; + } + } + return -1; + } + } + + + public void registerSize(Object o) { + Class methodArgs[] = new Class[] { Integer.TYPE, Integer.TYPE }; + registerWithArgs(sizeMethods, "size", o, methodArgs); + } + + public void registerPre(Object o) { + registerNoArgs(preMethods, "pre", o); + } + + public void registerDraw(Object o) { + registerNoArgs(drawMethods, "draw", o); + } + + public void registerPost(Object o) { + registerNoArgs(postMethods, "post", o); + } + + public void registerMouseEvent(Object o) { + Class methodArgs[] = new Class[] { MouseEvent.class }; + registerWithArgs(mouseEventMethods, "mouseEvent", o, methodArgs); + } + + + public void registerKeyEvent(Object o) { + Class methodArgs[] = new Class[] { KeyEvent.class }; + registerWithArgs(keyEventMethods, "keyEvent", o, methodArgs); + } + + public void registerDispose(Object o) { + registerNoArgs(disposeMethods, "dispose", o); + } + + + protected void registerNoArgs(RegisteredMethods meth, + String name, Object o) { + Class c = o.getClass(); + try { + Method method = c.getMethod(name, new Class[] {}); + meth.add(o, method); + + } catch (NoSuchMethodException nsme) { + die("There is no " + name + "() method in the class " + + o.getClass().getName()); + + } catch (Exception e) { + die("Could not register " + name + " + () for " + o, e); + } + } + + + protected void registerWithArgs(RegisteredMethods meth, + String name, Object o, Class cargs[]) { + Class c = o.getClass(); + try { + Method method = c.getMethod(name, cargs); + meth.add(o, method); + + } catch (NoSuchMethodException nsme) { + die("There is no " + name + "() method in the class " + + o.getClass().getName()); + + } catch (Exception e) { + die("Could not register " + name + " + () for " + o, e); + } + } + + + public void unregisterSize(Object o) { + Class methodArgs[] = new Class[] { Integer.TYPE, Integer.TYPE }; + unregisterWithArgs(sizeMethods, "size", o, methodArgs); + } + + public void unregisterPre(Object o) { + unregisterNoArgs(preMethods, "pre", o); + } + + public void unregisterDraw(Object o) { + unregisterNoArgs(drawMethods, "draw", o); + } + + public void unregisterPost(Object o) { + unregisterNoArgs(postMethods, "post", o); + } + + public void unregisterMouseEvent(Object o) { + Class methodArgs[] = new Class[] { MouseEvent.class }; + unregisterWithArgs(mouseEventMethods, "mouseEvent", o, methodArgs); + } + + public void unregisterKeyEvent(Object o) { + Class methodArgs[] = new Class[] { KeyEvent.class }; + unregisterWithArgs(keyEventMethods, "keyEvent", o, methodArgs); + } + + public void unregisterDispose(Object o) { + unregisterNoArgs(disposeMethods, "dispose", o); + } + + + protected void unregisterNoArgs(RegisteredMethods meth, + String name, Object o) { + Class c = o.getClass(); + try { + Method method = c.getMethod(name, new Class[] {}); + meth.remove(o, method); + } catch (Exception e) { + die("Could not unregister " + name + "() for " + o, e); + } + } + + + protected void unregisterWithArgs(RegisteredMethods meth, + String name, Object o, Class cargs[]) { + Class c = o.getClass(); + try { + Method method = c.getMethod(name, cargs); + meth.remove(o, method); + } catch (Exception e) { + die("Could not unregister " + name + "() for " + o, e); + } + } + + + ////////////////////////////////////////////////////////////// + + + public void setup() { + } + + + public void draw() { + // if no draw method, then shut things down + //System.out.println("no draw method, goodbye"); + finished = true; + } + + + ////////////////////////////////////////////////////////////// + + + protected void resizeRenderer(int iwidth, int iheight) { +// println("resizeRenderer request for " + iwidth + " " + iheight); + if (width != iwidth || height != iheight) { +// println(" former size was " + width + " " + height); + g.setSize(iwidth, iheight); + width = iwidth; + height = iheight; + } + } + + + /** + * Starts up and creates a two-dimensional drawing surface, + * or resizes the current drawing surface. + *

+ * This should be the first thing called inside of setup(). + *

+ * If using Java 1.3 or later, this will default to using + * PGraphics2, the Java2D-based renderer. If using Java 1.1, + * or if PGraphics2 is not available, then PGraphics will be used. + * To set your own renderer, use the other version of the size() + * method that takes a renderer as its last parameter. + *

+ * If called once a renderer has already been set, this will + * use the previous renderer and simply resize it. + */ + public void size(int iwidth, int iheight) { + size(iwidth, iheight, JAVA2D, null); + } + + + public void size(int iwidth, int iheight, String irenderer) { + size(iwidth, iheight, irenderer, null); + } + + + /** + * Creates a new PGraphics object and sets it to the specified size. + * + * Note that you cannot change the renderer once outside of setup(). + * In most cases, you can call size() to give it a new size, + * but you need to always ask for the same renderer, otherwise + * you're gonna run into trouble. + * + * The size() method should *only* be called from inside the setup() or + * draw() methods, so that it is properly run on the main animation thread. + * To change the size of a PApplet externally, use setSize(), which will + * update the component size, and queue a resize of the renderer as well. + */ + public void size(final int iwidth, final int iheight, + String irenderer, String ipath) { + // Run this from the EDT, just cuz it's AWT stuff (or maybe later Swing) + SwingUtilities.invokeLater(new Runnable() { + public void run() { + // Set the preferred size so that the layout managers can handle it + setPreferredSize(new Dimension(iwidth, iheight)); + setSize(iwidth, iheight); + } + }); + + // ensure that this is an absolute path + if (ipath != null) ipath = savePath(ipath); + + String currentRenderer = g.getClass().getName(); + if (currentRenderer.equals(irenderer)) { + // Avoid infinite loop of throwing exception to reset renderer + resizeRenderer(iwidth, iheight); + //redraw(); // will only be called insize draw() + + } else { // renderer is being changed + // otherwise ok to fall through and create renderer below + // the renderer is changing, so need to create a new object + g = makeGraphics(iwidth, iheight, irenderer, ipath, true); + width = iwidth; + height = iheight; + + // fire resize event to make sure the applet is the proper size +// setSize(iwidth, iheight); + // this is the function that will run if the user does their own + // size() command inside setup, so set defaultSize to false. + defaultSize = false; + + // throw an exception so that setup() is called again + // but with a properly sized render + // this is for opengl, which needs a valid, properly sized + // display before calling anything inside setup(). + throw new RendererChangeException(); + } + } + + + /** + * Create an offscreen PGraphics object for drawing. This can be used + * for bitmap or vector images drawing or rendering. + *

    + *
  • Do not use "new PGraphicsXxxx()", use this method. This method + * ensures that internal variables are set up properly that tie the + * new graphics context back to its parent PApplet. + *
  • The basic way to create bitmap images is to use the saveFrame() + * function. + *
  • If you want to create a really large scene and write that, + * first make sure that you've allocated a lot of memory in the Preferences. + *
  • If you want to create images that are larger than the screen, + * you should create your own PGraphics object, draw to that, and use + * save(). + * For now, it's best to use P3D in this scenario. + * P2D is currently disabled, and the JAVA2D default will give mixed + * results. An example of using P3D: + *
    +   *
    +   * PGraphics big;
    +   *
    +   * void setup() {
    +   *   big = createGraphics(3000, 3000, P3D);
    +   *
    +   *   big.beginDraw();
    +   *   big.background(128);
    +   *   big.line(20, 1800, 1800, 900);
    +   *   // etc..
    +   *   big.endDraw();
    +   *
    +   *   // make sure the file is written to the sketch folder
    +   *   big.save("big.tif");
    +   * }
    +   *
    +   * 
    + *
  • It's important to always wrap drawing to createGraphics() with + * beginDraw() and endDraw() (beginFrame() and endFrame() prior to + * revision 0115). The reason is that the renderer needs to know when + * drawing has stopped, so that it can update itself internally. + * This also handles calling the defaults() method, for people familiar + * with that. + *
  • It's not possible to use createGraphics() with the OPENGL renderer, + * because it doesn't allow offscreen use. + *
  • With Processing 0115 and later, it's possible to write images in + * formats other than the default .tga and .tiff. The exact formats and + * background information can be found in the developer's reference for + * PImage.save(). + *
+ */ + public PGraphics createGraphics(int iwidth, int iheight, + String irenderer) { + PGraphics pg = makeGraphics(iwidth, iheight, irenderer, null, false); + //pg.parent = this; // make save() work + return pg; + } + + + /** + * Create an offscreen graphics surface for drawing, in this case + * for a renderer that writes to a file (such as PDF or DXF). + * @param ipath can be an absolute or relative path + */ + public PGraphics createGraphics(int iwidth, int iheight, + String irenderer, String ipath) { + if (ipath != null) { + ipath = savePath(ipath); + } + PGraphics pg = makeGraphics(iwidth, iheight, irenderer, ipath, false); + pg.parent = this; // make save() work + return pg; + } + + + /** + * Version of createGraphics() used internally. + * + * @param ipath must be an absolute path, usually set via savePath() + * @oaram applet the parent applet object, this should only be non-null + * in cases where this is the main drawing surface object. + */ + protected PGraphics makeGraphics(int iwidth, int iheight, + String irenderer, String ipath, + boolean iprimary) { + if (irenderer.equals(OPENGL)) { + if (PApplet.platform == WINDOWS) { + String s = System.getProperty("java.version"); + if (s != null) { + if (s.equals("1.5.0_10")) { + System.err.println("OpenGL support is broken with Java 1.5.0_10"); + System.err.println("See http://dev.processing.org" + + "/bugs/show_bug.cgi?id=513 for more info."); + throw new RuntimeException("Please update your Java " + + "installation (see bug #513)"); + } + } + } + } + +// if (irenderer.equals(P2D)) { +// throw new RuntimeException("The P2D renderer is currently disabled, " + +// "please use P3D or JAVA2D."); +// } + + String openglError = + "Before using OpenGL, first select " + + "Import Library > opengl from the Sketch menu."; + + try { + /* + Class rendererClass = Class.forName(irenderer); + + Class constructorParams[] = null; + Object constructorValues[] = null; + + if (ipath == null) { + constructorParams = new Class[] { + Integer.TYPE, Integer.TYPE, PApplet.class + }; + constructorValues = new Object[] { + new Integer(iwidth), new Integer(iheight), this + }; + } else { + constructorParams = new Class[] { + Integer.TYPE, Integer.TYPE, PApplet.class, String.class + }; + constructorValues = new Object[] { + new Integer(iwidth), new Integer(iheight), this, ipath + }; + } + + Constructor constructor = + rendererClass.getConstructor(constructorParams); + PGraphics pg = (PGraphics) constructor.newInstance(constructorValues); + */ + + Class rendererClass = + Thread.currentThread().getContextClassLoader().loadClass(irenderer); + + //Class params[] = null; + //PApplet.println(rendererClass.getConstructors()); + Constructor constructor = rendererClass.getConstructor(new Class[] { }); + PGraphics pg = (PGraphics) constructor.newInstance(); + + pg.setParent(this); + pg.setPrimary(iprimary); + if (ipath != null) pg.setPath(ipath); + pg.setSize(iwidth, iheight); + + // everything worked, return it + return pg; + + } catch (InvocationTargetException ite) { + String msg = ite.getTargetException().getMessage(); + if ((msg != null) && + (msg.indexOf("no jogl in java.library.path") != -1)) { + throw new RuntimeException(openglError + + " (The native library is missing.)"); + + } else { + ite.getTargetException().printStackTrace(); + Throwable target = ite.getTargetException(); + if (platform == MACOSX) target.printStackTrace(System.out); // bug + // neither of these help, or work + //target.printStackTrace(System.err); + //System.err.flush(); + //System.out.println(System.err); // and the object isn't null + throw new RuntimeException(target.getMessage()); + } + + } catch (ClassNotFoundException cnfe) { + if (cnfe.getMessage().indexOf("processing.opengl.PGraphicsGL") != -1) { + throw new RuntimeException(openglError + + " (The library .jar file is missing.)"); + } else { + throw new RuntimeException("You need to use \"Import Library\" " + + "to add " + irenderer + " to your sketch."); + } + + } catch (Exception e) { + //System.out.println("ex3"); + if ((e instanceof IllegalArgumentException) || + (e instanceof NoSuchMethodException) || + (e instanceof IllegalAccessException)) { + e.printStackTrace(); + /* + String msg = "public " + + irenderer.substring(irenderer.lastIndexOf('.') + 1) + + "(int width, int height, PApplet parent" + + ((ipath == null) ? "" : ", String filename") + + ") does not exist."; + */ + String msg = irenderer + " needs to be updated " + + "for the current release of Processing."; + throw new RuntimeException(msg); + + } else { + if (platform == MACOSX) e.printStackTrace(System.out); + throw new RuntimeException(e.getMessage()); + } + } + } + + + /** + * Preferred method of creating new PImage objects, ensures that a + * reference to the parent PApplet is included, which makes save() work + * without needing an absolute path. + */ + public PImage createImage(int wide, int high, int format) { + PImage image = new PImage(wide, high, format); + image.parent = this; // make save() work + return image; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public void update(Graphics screen) { + paint(screen); + } + + + //synchronized public void paint(Graphics screen) { // shutting off for 0146 + public void paint(Graphics screen) { + // ignore the very first call to paint, since it's coming + // from the o.s., and the applet will soon update itself anyway. + if (frameCount == 0) { +// println("Skipping frame"); + // paint() may be called more than once before things + // are finally painted to the screen and the thread gets going + return; + } + + // without ignoring the first call, the first several frames + // are confused because paint() gets called in the midst of + // the initial nextFrame() call, so there are multiple + // updates fighting with one another. + + // g.image is synchronized so that draw/loop and paint don't + // try to fight over it. this was causing a randomized slowdown + // that would cut the frameRate into a third on macosx, + // and is probably related to the windows sluggishness bug too + + // make sure the screen is visible and usable + // (also prevents over-drawing when using PGraphicsOpenGL) + if ((g != null) && (g.image != null)) { +// println("inside paint(), screen.drawImage()"); + screen.drawImage(g.image, 0, 0, null); + } + } + + + // active paint method + protected void paint() { + try { + Graphics screen = this.getGraphics(); + if (screen != null) { + if ((g != null) && (g.image != null)) { + screen.drawImage(g.image, 0, 0, null); + } + Toolkit.getDefaultToolkit().sync(); + } + } catch (Exception e) { + // Seen on applet destroy, maybe can ignore? + e.printStackTrace(); + +// } finally { +// if (g != null) { +// g.dispose(); +// } + } + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Main method for the primary animation thread. + * + * Painting in AWT and Swing + */ + public void run() { // not good to make this synchronized, locks things up + long beforeTime = System.nanoTime(); + long overSleepTime = 0L; + + int noDelays = 0; + // Number of frames with a delay of 0 ms before the + // animation thread yields to other running threads. + final int NO_DELAYS_PER_YIELD = 15; + + /* + // this has to be called after the exception is thrown, + // otherwise the supporting libs won't have a valid context to draw to + Object methodArgs[] = + new Object[] { new Integer(width), new Integer(height) }; + sizeMethods.handle(methodArgs); + */ + + while ((Thread.currentThread() == thread) && !finished) { + // Don't resize the renderer from the EDT (i.e. from a ComponentEvent), + // otherwise it may attempt a resize mid-render. + if (resizeRequest) { + resizeRenderer(resizeWidth, resizeHeight); + resizeRequest = false; + } + + // render a single frame + handleDraw(); + + if (frameCount == 1) { + // Call the request focus event once the image is sure to be on + // screen and the component is valid. The OpenGL renderer will + // request focus for its canvas inside beginDraw(). + // http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/FocusSpec.html + //println("requesting focus"); + requestFocus(); + } + + // wait for update & paint to happen before drawing next frame + // this is necessary since the drawing is sometimes in a + // separate thread, meaning that the next frame will start + // before the update/paint is completed + + long afterTime = System.nanoTime(); + long timeDiff = afterTime - beforeTime; + //System.out.println("time diff is " + timeDiff); + long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; + + if (sleepTime > 0) { // some time left in this cycle + try { +// Thread.sleep(sleepTime / 1000000L); // nanoseconds -> milliseconds + Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L)); + noDelays = 0; // Got some sleep, not delaying anymore + } catch (InterruptedException ex) { } + + overSleepTime = (System.nanoTime() - afterTime) - sleepTime; + //System.out.println(" oversleep is " + overSleepTime); + + } else { // sleepTime <= 0; the frame took longer than the period +// excess -= sleepTime; // store excess time value + overSleepTime = 0L; + + if (noDelays > NO_DELAYS_PER_YIELD) { + Thread.yield(); // give another thread a chance to run + noDelays = 0; + } + } + + beforeTime = System.nanoTime(); + } + + stop(); // call to shutdown libs? + + // If the user called the exit() function, the window should close, + // rather than the sketch just halting. + if (exitCalled) { + exit2(); + } + } + + + //synchronized public void handleDisplay() { + public void handleDraw() { + if (g != null && (looping || redraw)) { + if (!g.canDraw()) { + // Don't draw if the renderer is not yet ready. + // (e.g. OpenGL has to wait for a peer to be on screen) + return; + } + + //System.out.println("handleDraw() " + frameCount); + + g.beginDraw(); + + long now = System.nanoTime(); + + if (frameCount == 0) { + try { + //println("Calling setup()"); + setup(); + //println("Done with setup()"); + + } catch (RendererChangeException e) { + // Give up, instead set the new renderer and re-attempt setup() + return; + } + this.defaultSize = false; + + } else { // frameCount > 0, meaning an actual draw() + // update the current frameRate + double rate = 1000000.0 / ((now - frameRateLastNanos) / 1000000.0); + float instantaneousRate = (float) rate / 1000.0f; + frameRate = (frameRate * 0.9f) + (instantaneousRate * 0.1f); + + preMethods.handle(); + + // use dmouseX/Y as previous mouse pos, since this is the + // last position the mouse was in during the previous draw. + pmouseX = dmouseX; + pmouseY = dmouseY; + + //println("Calling draw()"); + draw(); + //println("Done calling draw()"); + + // dmouseX/Y is updated only once per frame (unlike emouseX/Y) + dmouseX = mouseX; + dmouseY = mouseY; + + // these are called *after* loop so that valid + // drawing commands can be run inside them. it can't + // be before, since a call to background() would wipe + // out anything that had been drawn so far. + dequeueMouseEvents(); + dequeueKeyEvents(); + + drawMethods.handle(); + + redraw = false; // unset 'redraw' flag in case it was set + // (only do this once draw() has run, not just setup()) + + } + + g.endDraw(); + + frameRateLastNanos = now; + frameCount++; + + // Actively render the screen + paint(); + +// repaint(); +// getToolkit().sync(); // force repaint now (proper method) + + postMethods.handle(); + } + } + + + ////////////////////////////////////////////////////////////// + + + + synchronized public void redraw() { + if (!looping) { + redraw = true; +// if (thread != null) { +// // wake from sleep (necessary otherwise it'll be +// // up to 10 seconds before update) +// if (CRUSTY_THREADS) { +// thread.interrupt(); +// } else { +// synchronized (blocker) { +// blocker.notifyAll(); +// } +// } +// } + } + } + + + synchronized public void loop() { + if (!looping) { + looping = true; + } + } + + + synchronized public void noLoop() { + if (looping) { + looping = false; + } + } + + + ////////////////////////////////////////////////////////////// + + + public void addListeners() { + addMouseListener(this); + addMouseMotionListener(this); + addKeyListener(this); + addFocusListener(this); + + addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + Component c = e.getComponent(); + //System.out.println("componentResized() " + c); + Rectangle bounds = c.getBounds(); + resizeRequest = true; + resizeWidth = bounds.width; + resizeHeight = bounds.height; + } + }); + } + + + ////////////////////////////////////////////////////////////// + + + MouseEvent mouseEventQueue[] = new MouseEvent[10]; + int mouseEventCount; + + protected void enqueueMouseEvent(MouseEvent e) { + synchronized (mouseEventQueue) { + if (mouseEventCount == mouseEventQueue.length) { + MouseEvent temp[] = new MouseEvent[mouseEventCount << 1]; + System.arraycopy(mouseEventQueue, 0, temp, 0, mouseEventCount); + mouseEventQueue = temp; + } + mouseEventQueue[mouseEventCount++] = e; + } + } + + protected void dequeueMouseEvents() { + synchronized (mouseEventQueue) { + for (int i = 0; i < mouseEventCount; i++) { + mouseEvent = mouseEventQueue[i]; + handleMouseEvent(mouseEvent); + } + mouseEventCount = 0; + } + } + + + /** + * Actually take action based on a mouse event. + * Internally updates mouseX, mouseY, mousePressed, and mouseEvent. + * Then it calls the event type with no params, + * i.e. mousePressed() or mouseReleased() that the user may have + * overloaded to do something more useful. + */ + protected void handleMouseEvent(MouseEvent event) { + int id = event.getID(); + + // http://dev.processing.org/bugs/show_bug.cgi?id=170 + // also prevents mouseExited() on the mac from hosing the mouse + // position, because x/y are bizarre values on the exit event. + // see also the id check below.. both of these go together + if ((id == MouseEvent.MOUSE_DRAGGED) || + (id == MouseEvent.MOUSE_MOVED)) { + pmouseX = emouseX; + pmouseY = emouseY; + mouseX = event.getX(); + mouseY = event.getY(); + } + + mouseEvent = event; + + int modifiers = event.getModifiers(); + if ((modifiers & InputEvent.BUTTON1_MASK) != 0) { + mouseButton = LEFT; + } else if ((modifiers & InputEvent.BUTTON2_MASK) != 0) { + mouseButton = CENTER; + } else if ((modifiers & InputEvent.BUTTON3_MASK) != 0) { + mouseButton = RIGHT; + } + // if running on macos, allow ctrl-click as right mouse + if (platform == MACOSX) { + if (mouseEvent.isPopupTrigger()) { + mouseButton = RIGHT; + } + } + + mouseEventMethods.handle(new Object[] { event }); + + // this used to only be called on mouseMoved and mouseDragged + // change it back if people run into trouble + if (firstMouse) { + pmouseX = mouseX; + pmouseY = mouseY; + dmouseX = mouseX; + dmouseY = mouseY; + firstMouse = false; + } + + //println(event); + + switch (id) { + case MouseEvent.MOUSE_PRESSED: + mousePressed = true; + mousePressed(); + break; + case MouseEvent.MOUSE_RELEASED: + mousePressed = false; + mouseReleased(); + break; + case MouseEvent.MOUSE_CLICKED: + mouseClicked(); + break; + case MouseEvent.MOUSE_DRAGGED: + mouseDragged(); + break; + case MouseEvent.MOUSE_MOVED: + mouseMoved(); + break; + } + + if ((id == MouseEvent.MOUSE_DRAGGED) || + (id == MouseEvent.MOUSE_MOVED)) { + emouseX = mouseX; + emouseY = mouseY; + } + } + + + /** + * Figure out how to process a mouse event. When loop() has been + * called, the events will be queued up until drawing is complete. + * If noLoop() has been called, then events will happen immediately. + */ + protected void checkMouseEvent(MouseEvent event) { + if (looping) { + enqueueMouseEvent(event); + } else { + handleMouseEvent(event); + } + } + + + /** + * If you override this or any function that takes a "MouseEvent e" + * without calling its super.mouseXxxx() then mouseX, mouseY, + * mousePressed, and mouseEvent will no longer be set. + */ + public void mousePressed(MouseEvent e) { + checkMouseEvent(e); + } + + public void mouseReleased(MouseEvent e) { + checkMouseEvent(e); + } + + public void mouseClicked(MouseEvent e) { + checkMouseEvent(e); + } + + public void mouseEntered(MouseEvent e) { + checkMouseEvent(e); + } + + public void mouseExited(MouseEvent e) { + checkMouseEvent(e); + } + + public void mouseDragged(MouseEvent e) { + checkMouseEvent(e); + } + + public void mouseMoved(MouseEvent e) { + checkMouseEvent(e); + } + + + /** + * Mouse has been pressed, and should be considered "down" + * until mouseReleased() is called. If you must, use + * int button = mouseEvent.getButton(); + * to figure out which button was clicked. It will be one of: + * MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3 + * Note, however, that this is completely inconsistent across + * platforms. + */ + public void mousePressed() { } + + /** + * Mouse button has been released. + */ + public void mouseReleased() { } + + /** + * When the mouse is clicked, mousePressed() will be called, + * then mouseReleased(), then mouseClicked(). Note that + * mousePressed is already false inside of mouseClicked(). + */ + public void mouseClicked() { } + + /** + * Mouse button is pressed and the mouse has been dragged. + */ + public void mouseDragged() { } + + /** + * Mouse button is not pressed but the mouse has changed locations. + */ + public void mouseMoved() { } + + + ////////////////////////////////////////////////////////////// + + + KeyEvent keyEventQueue[] = new KeyEvent[10]; + int keyEventCount; + + protected void enqueueKeyEvent(KeyEvent e) { + synchronized (keyEventQueue) { + if (keyEventCount == keyEventQueue.length) { + KeyEvent temp[] = new KeyEvent[keyEventCount << 1]; + System.arraycopy(keyEventQueue, 0, temp, 0, keyEventCount); + keyEventQueue = temp; + } + keyEventQueue[keyEventCount++] = e; + } + } + + protected void dequeueKeyEvents() { + synchronized (keyEventQueue) { + for (int i = 0; i < keyEventCount; i++) { + keyEvent = keyEventQueue[i]; + handleKeyEvent(keyEvent); + } + keyEventCount = 0; + } + } + + + protected void handleKeyEvent(KeyEvent event) { + keyEvent = event; + key = event.getKeyChar(); + keyCode = event.getKeyCode(); + + keyEventMethods.handle(new Object[] { event }); + + switch (event.getID()) { + case KeyEvent.KEY_PRESSED: + keyPressed = true; + keyPressed(); + break; + case KeyEvent.KEY_RELEASED: + keyPressed = false; + keyReleased(); + break; + case KeyEvent.KEY_TYPED: + keyTyped(); + break; + } + + // if someone else wants to intercept the key, they should + // set key to zero (or something besides the ESC). + if (event.getID() == KeyEvent.KEY_PRESSED) { + if (key == KeyEvent.VK_ESCAPE) { + exit(); + } + // When running tethered to the Processing application, respond to + // Ctrl-W (or Cmd-W) events by closing the sketch. Disable this behavior + // when running independently, because this sketch may be one component + // embedded inside an application that has its own close behavior. + if (external && + event.getModifiers() == MENU_SHORTCUT && + event.getKeyCode() == 'W') { + exit(); + } + } + } + + + protected void checkKeyEvent(KeyEvent event) { + if (looping) { + enqueueKeyEvent(event); + } else { + handleKeyEvent(event); + } + } + + + /** + * Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', + * 'keyCode', and 'keyEvent' variables to no longer work; + * key events will no longer be queued until the end of draw(); + * and the keyPressed(), keyReleased() and keyTyped() methods + * will no longer be called. + */ + public void keyPressed(KeyEvent e) { checkKeyEvent(e); } + public void keyReleased(KeyEvent e) { checkKeyEvent(e); } + public void keyTyped(KeyEvent e) { checkKeyEvent(e); } + + + /** + * Called each time a single key on the keyboard is pressed. + * Because of how operating systems handle key repeats, holding + * down a key will cause multiple calls to keyPressed(), because + * the OS repeat takes over. + *

+ * Examples for key handling: + * (Tested on Windows XP, please notify if different on other + * platforms, I have a feeling Mac OS and Linux may do otherwise) + *

+   * 1. Pressing 'a' on the keyboard:
+   *    keyPressed  with key == 'a' and keyCode == 'A'
+   *    keyTyped    with key == 'a' and keyCode ==  0
+   *    keyReleased with key == 'a' and keyCode == 'A'
+   *
+   * 2. Pressing 'A' on the keyboard:
+   *    keyPressed  with key == 'A' and keyCode == 'A'
+   *    keyTyped    with key == 'A' and keyCode ==  0
+   *    keyReleased with key == 'A' and keyCode == 'A'
+   *
+   * 3. Pressing 'shift', then 'a' on the keyboard (caps lock is off):
+   *    keyPressed  with key == CODED and keyCode == SHIFT
+   *    keyPressed  with key == 'A'   and keyCode == 'A'
+   *    keyTyped    with key == 'A'   and keyCode == 0
+   *    keyReleased with key == 'A'   and keyCode == 'A'
+   *    keyReleased with key == CODED and keyCode == SHIFT
+   *
+   * 4. Holding down the 'a' key.
+   *    The following will happen several times,
+   *    depending on your machine's "key repeat rate" settings:
+   *    keyPressed  with key == 'a' and keyCode == 'A'
+   *    keyTyped    with key == 'a' and keyCode ==  0
+   *    When you finally let go, you'll get:
+   *    keyReleased with key == 'a' and keyCode == 'A'
+   *
+   * 5. Pressing and releasing the 'shift' key
+   *    keyPressed  with key == CODED and keyCode == SHIFT
+   *    keyReleased with key == CODED and keyCode == SHIFT
+   *    (note there is no keyTyped)
+   *
+   * 6. Pressing the tab key in an applet with Java 1.4 will
+   *    normally do nothing, but PApplet dynamically shuts
+   *    this behavior off if Java 1.4 is in use (tested 1.4.2_05 Windows).
+   *    Java 1.1 (Microsoft VM) passes the TAB key through normally.
+   *    Not tested on other platforms or for 1.3.
+   * 
+ */ + public void keyPressed() { } + + + /** + * See keyPressed(). + */ + public void keyReleased() { } + + + /** + * Only called for "regular" keys like letters, + * see keyPressed() for full documentation. + */ + public void keyTyped() { } + + + ////////////////////////////////////////////////////////////// + + // i am focused man, and i'm not afraid of death. + // and i'm going all out. i circle the vultures in a van + // and i run the block. + + + public void focusGained() { } + + public void focusGained(FocusEvent e) { + focused = true; + focusGained(); + } + + + public void focusLost() { } + + public void focusLost(FocusEvent e) { + focused = false; + focusLost(); + } + + + ////////////////////////////////////////////////////////////// + + // getting the time + + + /** + * Get the number of milliseconds since the applet started. + *

+ * This is a function, rather than a variable, because it may + * change multiple times per frame. + */ + public int millis() { + return (int) (System.currentTimeMillis() - millisOffset); + } + + /** Seconds position of the current time. */ + static public int second() { + return Calendar.getInstance().get(Calendar.SECOND); + } + + /** Minutes position of the current time. */ + static public int minute() { + return Calendar.getInstance().get(Calendar.MINUTE); + } + + /** + * Hour position of the current time in international format (0-23). + *

+ * To convert this value to American time:
+ *

int yankeeHour = (hour() % 12);
+   * if (yankeeHour == 0) yankeeHour = 12;
+ */ + static public int hour() { + return Calendar.getInstance().get(Calendar.HOUR_OF_DAY); + } + + /** + * Get the current day of the month (1 through 31). + *

+ * If you're looking for the day of the week (M-F or whatever) + * or day of the year (1..365) then use java's Calendar.get() + */ + static public int day() { + return Calendar.getInstance().get(Calendar.DAY_OF_MONTH); + } + + /** + * Get the current month in range 1 through 12. + */ + static public int month() { + // months are number 0..11 so change to colloquial 1..12 + return Calendar.getInstance().get(Calendar.MONTH) + 1; + } + + /** + * Get the current year. + */ + static public int year() { + return Calendar.getInstance().get(Calendar.YEAR); + } + + + ////////////////////////////////////////////////////////////// + + // controlling time (playing god) + + + /** + * The delay() function causes the program to halt for a specified time. + * Delay times are specified in thousandths of a second. For example, + * running delay(3000) will stop the program for three seconds and + * delay(500) will stop the program for a half-second. Remember: the + * display window is updated only at the end of draw(), so putting more + * than one delay() inside draw() will simply add them together and the new + * frame will be drawn when the total delay is over. + *

+ * I'm not sure if this is even helpful anymore, as the screen isn't + * updated before or after the delay, meaning which means it just + * makes the app lock up temporarily. + */ + public void delay(int napTime) { + if (frameCount != 0) { + if (napTime > 0) { + try { + Thread.sleep(napTime); + } catch (InterruptedException e) { } + } + } + } + + + /** + * Set a target frameRate. This will cause delay() to be called + * after each frame so that the sketch synchronizes to a particular speed. + * Note that this only sets the maximum frame rate, it cannot be used to + * make a slow sketch go faster. Sketches have no default frame rate + * setting, and will attempt to use maximum processor power to achieve + * maximum speed. + */ + public void frameRate(float newRateTarget) { + frameRateTarget = newRateTarget; + frameRatePeriod = (long) (1000000000.0 / frameRateTarget); + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Get a param from the web page, or (eventually) + * from a properties file. + */ + public String param(String what) { + if (online) { + return getParameter(what); + + } else { + System.err.println("param() only works inside a web browser"); + } + return null; + } + + + /** + * Show status in the status bar of a web browser, or in the + * System.out console. Eventually this might show status in the + * p5 environment itself, rather than relying on the console. + */ + public void status(String what) { + if (online) { + showStatus(what); + + } else { + System.out.println(what); // something more interesting? + } + } + + + public void link(String here) { + link(here, null); + } + + + /** + * Link to an external page without all the muss. + *

+ * When run with an applet, uses the browser to open the url, + * for applications, attempts to launch a browser with the url. + *

+ * Works on Mac OS X and Windows. For Linux, use: + *

open(new String[] { "firefox", url });
+ * or whatever you want as your browser, since Linux doesn't + * yet have a standard method for launching URLs. + */ + public void link(String url, String frameTitle) { + if (online) { + try { + if (frameTitle == null) { + getAppletContext().showDocument(new URL(url)); + } else { + getAppletContext().showDocument(new URL(url), frameTitle); + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Could not open " + url); + } + } else { + try { + if (platform == WINDOWS) { + // the following uses a shell execute to launch the .html file + // note that under cygwin, the .html files have to be chmodded +x + // after they're unpacked from the zip file. i don't know why, + // and don't understand what this does in terms of windows + // permissions. without the chmod, the command prompt says + // "Access is denied" in both cygwin and the "dos" prompt. + //Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" + + // referenceFile + ".html"); + + // replace ampersands with control sequence for DOS. + // solution contributed by toxi on the bugs board. + url = url.replaceAll("&","^&"); + + // open dos prompt, give it 'start' command, which will + // open the url properly. start by itself won't work since + // it appears to need cmd + Runtime.getRuntime().exec("cmd /c start " + url); + + } else if (platform == MACOSX) { + //com.apple.mrj.MRJFileUtils.openURL(url); + try { + Class mrjFileUtils = Class.forName("com.apple.mrj.MRJFileUtils"); + Method openMethod = + mrjFileUtils.getMethod("openURL", new Class[] { String.class }); + openMethod.invoke(null, new Object[] { url }); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + //throw new RuntimeException("Can't open URLs for this platform"); + // Just pass it off to open() and hope for the best + open(url); + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("Could not open " + url); + } + } + } + + + /** + * Attempt to open a file using the platform's shell. + */ + static public void open(String filename) { + open(new String[] { filename }); + } + + + static String openLauncher; + + /** + * Launch a process using a platforms shell. This version uses an array + * to make it easier to deal with spaces in the individual elements. + * (This avoids the situation of trying to put single or double quotes + * around different bits). + */ + static public Process open(String argv[]) { + String[] params = null; + + if (platform == WINDOWS) { + // just launching the .html file via the shell works + // but make sure to chmod +x the .html files first + // also place quotes around it in case there's a space + // in the user.dir part of the url + params = new String[] { "cmd", "/c" }; + + } else if (platform == MACOSX) { + params = new String[] { "open" }; + + } else if (platform == LINUX) { + if (openLauncher == null) { + // Attempt to use gnome-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); + /*int result =*/ p.waitFor(); + // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) + openLauncher = "gnome-open"; + } catch (Exception e) { } + } + if (openLauncher == null) { + // Attempt with kde-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "kde-open" }); + /*int result =*/ p.waitFor(); + openLauncher = "kde-open"; + } catch (Exception e) { } + } + if (openLauncher == null) { + System.err.println("Could not find gnome-open or kde-open, " + + "the open() command may not work."); + } + if (openLauncher != null) { + params = new String[] { openLauncher }; + } + //} else { // give up and just pass it to Runtime.exec() + //open(new String[] { filename }); + //params = new String[] { filename }; + } + if (params != null) { + // If the 'open', 'gnome-open' or 'cmd' are already included + if (params[0].equals(argv[0])) { + // then don't prepend those params again + return exec(argv); + } else { + params = concat(params, argv); + return exec(params); + } + } else { + return exec(argv); + } + } + + + static public Process exec(String[] argv) { + try { + return Runtime.getRuntime().exec(argv); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Could not open " + join(argv, ' ')); + } + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Function for an applet/application to kill itself and + * display an error. Mostly this is here to be improved later. + */ + public void die(String what) { + stop(); + throw new RuntimeException(what); + } + + + /** + * Same as above but with an exception. Also needs work. + */ + public void die(String what, Exception e) { + if (e != null) e.printStackTrace(); + die(what); + } + + + /** + * Call to safely exit the sketch when finished. For instance, + * to render a single frame, save it, and quit. + */ + public void exit() { + if (thread == null) { + // exit immediately, stop() has already been called, + // meaning that the main thread has long since exited + exit2(); + + } else if (looping) { + // stop() will be called as the thread exits + finished = true; + // tell the code to call exit2() to do a System.exit() + // once the next draw() has completed + exitCalled = true; + + } else if (!looping) { + // if not looping, need to call stop explicitly, + // because the main thread will be sleeping + stop(); + + // now get out + exit2(); + } + } + + + void exit2() { + try { + System.exit(0); + } catch (SecurityException e) { + // don't care about applet security exceptions + } + } + + + ////////////////////////////////////////////////////////////// + + // SCREEN GRABASS + + + /** + * Intercepts any relative paths to make them absolute (relative + * to the sketch folder) before passing to save() in PImage. + * (Changed in 0100) + */ + public void save(String filename) { + g.save(savePath(filename)); + } + + + /** + * Grab an image of what's currently in the drawing area and save it + * as a .tif or .tga file. + *

+ * Best used just before endDraw() at the end of your draw(). + * This can only create .tif or .tga images, so if neither extension + * is specified it defaults to writing a tiff and adds a .tif suffix. + */ + public void saveFrame() { + try { + g.save(savePath("screen-" + nf(frameCount, 4) + ".tif")); + } catch (SecurityException se) { + System.err.println("Can't use saveFrame() when running in a browser, " + + "unless using a signed applet."); + } + } + + + /** + * Save the current frame as a .tif or .tga image. + *

+ * The String passed in can contain a series of # signs + * that will be replaced with the screengrab number. + *

+   * i.e. saveFrame("blah-####.tif");
+   *      // saves a numbered tiff image, replacing the
+   *      // #### signs with zeros and the frame number 
+ */ + public void saveFrame(String what) { + try { + g.save(savePath(insertFrame(what))); + } catch (SecurityException se) { + System.err.println("Can't use saveFrame() when running in a browser, " + + "unless using a signed applet."); + } + } + + + /** + * Check a string for #### signs to see if the frame number should be + * inserted. Used for functions like saveFrame() and beginRecord() to + * replace the # marks with the frame number. If only one # is used, + * it will be ignored, under the assumption that it's probably not + * intended to be the frame number. + */ + protected String insertFrame(String what) { + int first = what.indexOf('#'); + int last = what.lastIndexOf('#'); + + if ((first != -1) && (last - first > 0)) { + String prefix = what.substring(0, first); + int count = last - first + 1; + String suffix = what.substring(last + 1); + return prefix + nf(frameCount, count) + suffix; + } + return what; // no change + } + + + + ////////////////////////////////////////////////////////////// + + // CURSOR + + // + + + int cursorType = ARROW; // cursor type + boolean cursorVisible = true; // cursor visibility flag + PImage invisibleCursor; + + + /** + * Set the cursor type + */ + public void cursor(int cursorType) { + setCursor(Cursor.getPredefinedCursor(cursorType)); + cursorVisible = true; + this.cursorType = cursorType; + } + + + /** + * Replace the cursor with the specified PImage. The x- and y- + * coordinate of the center will be the center of the image. + */ + public void cursor(PImage image) { + cursor(image, image.width/2, image.height/2); + } + + + /** + * Set a custom cursor to an image with a specific hotspot. + * Only works with JDK 1.2 and later. + * Currently seems to be broken on Java 1.4 for Mac OS X + *

+ * Based on code contributed by Amit Pitaru, plus additional + * code to handle Java versions via reflection by Jonathan Feinberg. + * Reflection removed for release 0128 and later. + */ + public void cursor(PImage image, int hotspotX, int hotspotY) { + // don't set this as cursor type, instead use cursor_type + // to save the last cursor used in case cursor() is called + //cursor_type = Cursor.CUSTOM_CURSOR; + Image jimage = + createImage(new MemoryImageSource(image.width, image.height, + image.pixels, 0, image.width)); + Point hotspot = new Point(hotspotX, hotspotY); + Toolkit tk = Toolkit.getDefaultToolkit(); + Cursor cursor = tk.createCustomCursor(jimage, hotspot, "Custom Cursor"); + setCursor(cursor); + cursorVisible = true; + } + + + /** + * Show the cursor after noCursor() was called. + * Notice that the program remembers the last set cursor type + */ + public void cursor() { + // maybe should always set here? seems dangerous, since + // it's likely that java will set the cursor to something + // else on its own, and the applet will be stuck b/c bagel + // thinks that the cursor is set to one particular thing + if (!cursorVisible) { + cursorVisible = true; + setCursor(Cursor.getPredefinedCursor(cursorType)); + } + } + + + /** + * Hide the cursor by creating a transparent image + * and using it as a custom cursor. + */ + public void noCursor() { + if (!cursorVisible) return; // don't hide if already hidden. + + if (invisibleCursor == null) { + invisibleCursor = new PImage(16, 16, ARGB); + } + // was formerly 16x16, but the 0x0 was added by jdf as a fix + // for macosx, which wasn't honoring the invisible cursor + cursor(invisibleCursor, 8, 8); + cursorVisible = false; + } + + + ////////////////////////////////////////////////////////////// + + + static public void print(byte what) { + System.out.print(what); + System.out.flush(); + } + + static public void print(boolean what) { + System.out.print(what); + System.out.flush(); + } + + static public void print(char what) { + System.out.print(what); + System.out.flush(); + } + + static public void print(int what) { + System.out.print(what); + System.out.flush(); + } + + static public void print(float what) { + System.out.print(what); + System.out.flush(); + } + + static public void print(String what) { + System.out.print(what); + System.out.flush(); + } + + static public void print(Object what) { + if (what == null) { + // special case since this does fuggly things on > 1.1 + System.out.print("null"); + } else { + System.out.println(what.toString()); + } + } + + // + + static public void println() { + System.out.println(); + } + + // + + static public void println(byte what) { + print(what); System.out.println(); + } + + static public void println(boolean what) { + print(what); System.out.println(); + } + + static public void println(char what) { + print(what); System.out.println(); + } + + static public void println(int what) { + print(what); System.out.println(); + } + + static public void println(float what) { + print(what); System.out.println(); + } + + static public void println(String what) { + print(what); System.out.println(); + } + + static public void println(Object what) { + if (what == null) { + // special case since this does fuggly things on > 1.1 + System.out.println("null"); + + } else { + String name = what.getClass().getName(); + if (name.charAt(0) == '[') { + switch (name.charAt(1)) { + case '[': + // don't even mess with multi-dimensional arrays (case '[') + // or anything else that's not int, float, boolean, char + System.out.println(what); + break; + + case 'L': + // print a 1D array of objects as individual elements + Object poo[] = (Object[]) what; + for (int i = 0; i < poo.length; i++) { + if (poo[i] instanceof String) { + System.out.println("[" + i + "] \"" + poo[i] + "\""); + } else { + System.out.println("[" + i + "] " + poo[i]); + } + } + break; + + case 'Z': // boolean + boolean zz[] = (boolean[]) what; + for (int i = 0; i < zz.length; i++) { + System.out.println("[" + i + "] " + zz[i]); + } + break; + + case 'B': // byte + byte bb[] = (byte[]) what; + for (int i = 0; i < bb.length; i++) { + System.out.println("[" + i + "] " + bb[i]); + } + break; + + case 'C': // char + char cc[] = (char[]) what; + for (int i = 0; i < cc.length; i++) { + System.out.println("[" + i + "] '" + cc[i] + "'"); + } + break; + + case 'I': // int + int ii[] = (int[]) what; + for (int i = 0; i < ii.length; i++) { + System.out.println("[" + i + "] " + ii[i]); + } + break; + + case 'F': // float + float ff[] = (float[]) what; + for (int i = 0; i < ff.length; i++) { + System.out.println("[" + i + "] " + ff[i]); + } + break; + + /* + case 'D': // double + double dd[] = (double[]) what; + for (int i = 0; i < dd.length; i++) { + System.out.println("[" + i + "] " + dd[i]); + } + break; + */ + + default: + System.out.println(what); + } + } else { // not an array + System.out.println(what); + } + } + } + + // + + /* + // not very useful, because it only works for public (and protected?) + // fields of a class, not local variables to methods + public void printvar(String name) { + try { + Field field = getClass().getDeclaredField(name); + println(name + " = " + field.get(this)); + } catch (Exception e) { + e.printStackTrace(); + } + } + */ + + + ////////////////////////////////////////////////////////////// + + // MATH + + // lots of convenience methods for math with floats. + // doubles are overkill for processing applets, and casting + // things all the time is annoying, thus the functions below. + + + static public final float abs(float n) { + return (n < 0) ? -n : n; + } + + static public final int abs(int n) { + return (n < 0) ? -n : n; + } + + static public final float sq(float a) { + return a*a; + } + + static public final float sqrt(float a) { + return (float)Math.sqrt(a); + } + + static public final float log(float a) { + return (float)Math.log(a); + } + + static public final float exp(float a) { + return (float)Math.exp(a); + } + + static public final float pow(float a, float b) { + return (float)Math.pow(a, b); + } + + + static public final int max(int a, int b) { + return (a > b) ? a : b; + } + + static public final float max(float a, float b) { + return (a > b) ? a : b; + } + + + static public final int max(int a, int b, int c) { + return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c); + } + + static public final float max(float a, float b, float c) { + return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c); + } + + + /** + * Find the maximum value in an array. + * Throws an ArrayIndexOutOfBoundsException if the array is length 0. + * @param list the source array + * @return The maximum value + */ + static public final int max(int[] list) { + if (list.length == 0) { + throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX); + } + int max = list[0]; + for (int i = 1; i < list.length; i++) { + if (list[i] > max) max = list[i]; + } + return max; + } + + /** + * Find the maximum value in an array. + * Throws an ArrayIndexOutOfBoundsException if the array is length 0. + * @param list the source array + * @return The maximum value + */ + static public final float max(float[] list) { + if (list.length == 0) { + throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX); + } + float max = list[0]; + for (int i = 1; i < list.length; i++) { + if (list[i] > max) max = list[i]; + } + return max; + } + + + static public final int min(int a, int b) { + return (a < b) ? a : b; + } + + static public final float min(float a, float b) { + return (a < b) ? a : b; + } + + + static public final int min(int a, int b, int c) { + return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c); + } + + static public final float min(float a, float b, float c) { + return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c); + } + + + /** + * Find the minimum value in an array. + * Throws an ArrayIndexOutOfBoundsException if the array is length 0. + * @param list the source array + * @return The minimum value + */ + static public final int min(int[] list) { + if (list.length == 0) { + throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX); + } + int min = list[0]; + for (int i = 1; i < list.length; i++) { + if (list[i] < min) min = list[i]; + } + return min; + } + /** + * Find the minimum value in an array. + * Throws an ArrayIndexOutOfBoundsException if the array is length 0. + * @param list the source array + * @return The minimum value + */ + static public final float min(float[] list) { + if (list.length == 0) { + throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX); + } + float min = list[0]; + for (int i = 1; i < list.length; i++) { + if (list[i] < min) min = list[i]; + } + return min; + } + + + static public final int constrain(int amt, int low, int high) { + return (amt < low) ? low : ((amt > high) ? high : amt); + } + + static public final float constrain(float amt, float low, float high) { + return (amt < low) ? low : ((amt > high) ? high : amt); + } + + + static public final float sin(float angle) { + return (float)Math.sin(angle); + } + + static public final float cos(float angle) { + return (float)Math.cos(angle); + } + + static public final float tan(float angle) { + return (float)Math.tan(angle); + } + + + static public final float asin(float value) { + return (float)Math.asin(value); + } + + static public final float acos(float value) { + return (float)Math.acos(value); + } + + static public final float atan(float value) { + return (float)Math.atan(value); + } + + static public final float atan2(float a, float b) { + return (float)Math.atan2(a, b); + } + + + static public final float degrees(float radians) { + return radians * RAD_TO_DEG; + } + + static public final float radians(float degrees) { + return degrees * DEG_TO_RAD; + } + + + static public final int ceil(float what) { + return (int) Math.ceil(what); + } + + static public final int floor(float what) { + return (int) Math.floor(what); + } + + static public final int round(float what) { + return (int) Math.round(what); + } + + + static public final float mag(float a, float b) { + return (float)Math.sqrt(a*a + b*b); + } + + static public final float mag(float a, float b, float c) { + return (float)Math.sqrt(a*a + b*b + c*c); + } + + + static public final float dist(float x1, float y1, float x2, float y2) { + return sqrt(sq(x2-x1) + sq(y2-y1)); + } + + static public final float dist(float x1, float y1, float z1, + float x2, float y2, float z2) { + return sqrt(sq(x2-x1) + sq(y2-y1) + sq(z2-z1)); + } + + + static public final float lerp(float start, float stop, float amt) { + return start + (stop-start) * amt; + } + + /** + * Normalize a value to exist between 0 and 1 (inclusive). + * Mathematically the opposite of lerp(), figures out what proportion + * a particular value is relative to start and stop coordinates. + */ + static public final float norm(float value, float start, float stop) { + return (value - start) / (stop - start); + } + + /** + * Convenience function to map a variable from one coordinate space + * to another. Equivalent to unlerp() followed by lerp(). + */ + static public final float map(float value, + float istart, float istop, + float ostart, float ostop) { + return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); + } + + + + ////////////////////////////////////////////////////////////// + + // RANDOM NUMBERS + + + Random internalRandom; + + /** + * Return a random number in the range [0, howbig). + *

+ * The number returned will range from zero up to + * (but not including) 'howbig'. + */ + public final float random(float howbig) { + // for some reason (rounding error?) Math.random() * 3 + // can sometimes return '3' (once in ~30 million tries) + // so a check was added to avoid the inclusion of 'howbig' + + // avoid an infinite loop + if (howbig == 0) return 0; + + // internal random number object + if (internalRandom == null) internalRandom = new Random(); + + float value = 0; + do { + //value = (float)Math.random() * howbig; + value = internalRandom.nextFloat() * howbig; + } while (value == howbig); + return value; + } + + + /** + * Return a random number in the range [howsmall, howbig). + *

+ * The number returned will range from 'howsmall' up to + * (but not including 'howbig'. + *

+ * If howsmall is >= howbig, howsmall will be returned, + * meaning that random(5, 5) will return 5 (useful) + * and random(7, 4) will return 7 (not useful.. better idea?) + */ + public final float random(float howsmall, float howbig) { + if (howsmall >= howbig) return howsmall; + float diff = howbig - howsmall; + return random(diff) + howsmall; + } + + + public final void randomSeed(long what) { + // internal random number object + if (internalRandom == null) internalRandom = new Random(); + internalRandom.setSeed(what); + } + + + + ////////////////////////////////////////////////////////////// + + // PERLIN NOISE + + // [toxi 040903] + // octaves and amplitude amount per octave are now user controlled + // via the noiseDetail() function. + + // [toxi 030902] + // cleaned up code and now using bagel's cosine table to speed up + + // [toxi 030901] + // implementation by the german demo group farbrausch + // as used in their demo "art": http://www.farb-rausch.de/fr010src.zip + + static final int PERLIN_YWRAPB = 4; + static final int PERLIN_YWRAP = 1<>= 1; + } + + if (x<0) x=-x; + if (y<0) y=-y; + if (z<0) z=-z; + + int xi=(int)x, yi=(int)y, zi=(int)z; + float xf = (float)(x-xi); + float yf = (float)(y-yi); + float zf = (float)(z-zi); + float rxf, ryf; + + float r=0; + float ampl=0.5f; + + float n1,n2,n3; + + for (int i=0; i=1.0f) { xi++; xf--; } + if (yf>=1.0f) { yi++; yf--; } + if (zf>=1.0f) { zi++; zf--; } + } + return r; + } + + // [toxi 031112] + // now adjusts to the size of the cosLUT used via + // the new variables, defined above + private float noise_fsc(float i) { + // using bagel's cosine table instead + return 0.5f*(1.0f-perlin_cosTable[(int)(i*perlin_PI)%perlin_TWOPI]); + } + + // [toxi 040903] + // make perlin noise quality user controlled to allow + // for different levels of detail. lower values will produce + // smoother results as higher octaves are surpressed + + public void noiseDetail(int lod) { + if (lod>0) perlin_octaves=lod; + } + + public void noiseDetail(int lod, float falloff) { + if (lod>0) perlin_octaves=lod; + if (falloff>0) perlin_amp_falloff=falloff; + } + + public void noiseSeed(long what) { + if (perlinRandom == null) perlinRandom = new Random(); + perlinRandom.setSeed(what); + // force table reset after changing the random number seed [0122] + perlin = null; + } + + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + protected String[] loadImageFormats; + + + /** + * Load an image from the data folder or a local directory. + * Supports .gif (including transparency), .tga, and .jpg images. + * In Java 1.3 or later, .png images are + * + * also supported. + *

+ * Generally, loadImage() should only be used during setup, because + * re-loading images inside draw() is likely to cause a significant + * delay while memory is allocated and the thread blocks while waiting + * for the image to load because loading is not asynchronous. + *

+ * To load several images asynchronously, see more information in the + * FAQ about writing your own threaded image loading method. + *

+ * As of 0096, returns null if no image of that name is found, + * rather than an error. + *

+ * Release 0115 also provides support for reading TIFF and RLE-encoded + * Targa (.tga) files written by Processing via save() and saveFrame(). + * Other TIFF and Targa files will probably not load, use a different + * format (gif, jpg and png are safest bets) when creating images with + * another application to use with Processing. + *

+ * Also in release 0115, more image formats (BMP and others) can + * be read when using Java 1.4 and later. Because many people still + * use Java 1.1 and 1.3, these formats are not recommended for + * work that will be posted on the web. To get a list of possible + * image formats for use with Java 1.4 and later, use the following: + * println(javax.imageio.ImageIO.getReaderFormatNames()) + *

+ * Images are loaded via a byte array that is passed to + * Toolkit.createImage(). Unfortunately, we cannot use Applet.getImage() + * because it takes a URL argument, which would be a pain in the a-- + * to make work consistently for online and local sketches. + * Sometimes this causes problems, resulting in issues like + * Bug 279 + * and + * Bug 305. + * In release 0115, everything was instead run through javax.imageio, + * but that turned out to be very slow, see + * Bug 392. + * As a result, starting with 0116, the following happens: + *

    + *
  • TGA and TIFF images are loaded using the internal load methods. + *
  • JPG, GIF, and PNG images are loaded via loadBytes(). + *
  • If the image still isn't loaded, it's passed to javax.imageio. + *
+ * For releases 0116 and later, if you have problems such as those seen + * in Bugs 279 and 305, use Applet.getImage() instead. You'll be stuck + * with the limitations of getImage() (the headache of dealing with + * online/offline use). Set up your own MediaTracker, and pass the resulting + * java.awt.Image to the PImage constructor that takes an AWT image. + */ + public PImage loadImage(String filename) { + return loadImage(filename, null); + } + + + /** + * Identical to loadImage, but allows you to specify the type of + * image by its extension. Especially useful when downloading from + * CGI scripts. + *

+ * Use 'unknown' as the extension to pass off to the default + * image loader that handles gif, jpg, and png. + */ + public PImage loadImage(String filename, String extension) { + if (extension == null) { + String lower = filename.toLowerCase(); + int dot = filename.lastIndexOf('.'); + if (dot == -1) { + extension = "unknown"; // no extension found + } + extension = lower.substring(dot + 1); + + // check for, and strip any parameters on the url, i.e. + // filename.jpg?blah=blah&something=that + int question = extension.indexOf('?'); + if (question != -1) { + extension = extension.substring(0, question); + } + } + + // just in case. them users will try anything! + extension = extension.toLowerCase(); + + if (extension.equals("tga")) { + try { + return loadImageTGA(filename); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + if (extension.equals("tif") || extension.equals("tiff")) { + byte bytes[] = loadBytes(filename); + return (bytes == null) ? null : PImage.loadTIFF(bytes); + } + + // For jpeg, gif, and png, load them using createImage(), + // because the javax.imageio code was found to be much slower, see + // Bug 392. + try { + if (extension.equals("jpg") || extension.equals("jpeg") || + extension.equals("gif") || extension.equals("png") || + extension.equals("unknown")) { + byte bytes[] = loadBytes(filename); + if (bytes == null) { + return null; + } else { + Image awtImage = Toolkit.getDefaultToolkit().createImage(bytes); + PImage image = loadImageMT(awtImage); + if (image.width == -1) { + System.err.println("The file " + filename + + " contains bad image data, or may not be an image."); + } + // if it's a .gif image, test to see if it has transparency + if (extension.equals("gif") || extension.equals("png")) { + image.checkAlpha(); + } + return image; + } + } + } catch (Exception e) { + // show error, but move on to the stuff below, see if it'll work + e.printStackTrace(); + } + + if (loadImageFormats == null) { + loadImageFormats = ImageIO.getReaderFormatNames(); + } + if (loadImageFormats != null) { + for (int i = 0; i < loadImageFormats.length; i++) { + if (extension.equals(loadImageFormats[i])) { + return loadImageIO(filename); + } + } + } + + // failed, could not load image after all those attempts + System.err.println("Could not find a method to load " + filename); + return null; + } + + + public PImage requestImage(String filename) { + return requestImage(filename, null); + } + + + public PImage requestImage(String filename, String extension) { + PImage vessel = createImage(0, 0, ARGB); + AsyncImageLoader ail = + new AsyncImageLoader(filename, extension, vessel); + ail.start(); + return vessel; + } + + + /** + * By trial and error, four image loading threads seem to work best when + * loading images from online. This is consistent with the number of open + * connections that web browsers will maintain. The variable is made public + * (however no accessor has been added since it's esoteric) if you really + * want to have control over the value used. For instance, when loading local + * files, it might be better to only have a single thread (or two) loading + * images so that you're disk isn't simply jumping around. + */ + public int requestImageMax = 4; + volatile int requestImageCount; + + class AsyncImageLoader extends Thread { + String filename; + String extension; + PImage vessel; + + public AsyncImageLoader(String filename, String extension, PImage vessel) { + this.filename = filename; + this.extension = extension; + this.vessel = vessel; + } + + public void run() { + while (requestImageCount == requestImageMax) { + try { + Thread.sleep(10); + } catch (InterruptedException e) { } + } + requestImageCount++; + + PImage actual = loadImage(filename, extension); + + // An error message should have already printed + if (actual == null) { + vessel.width = -1; + vessel.height = -1; + + } else { + vessel.width = actual.width; + vessel.height = actual.height; + vessel.format = actual.format; + vessel.pixels = actual.pixels; + } + requestImageCount--; + } + } + + + /** + * Load an AWT image synchronously by setting up a MediaTracker for + * a single image, and blocking until it has loaded. + */ + protected PImage loadImageMT(Image awtImage) { + MediaTracker tracker = new MediaTracker(this); + tracker.addImage(awtImage, 0); + try { + tracker.waitForAll(); + } catch (InterruptedException e) { + //e.printStackTrace(); // non-fatal, right? + } + + PImage image = new PImage(awtImage); + image.parent = this; + return image; + } + + + /** + * Use Java 1.4 ImageIO methods to load an image. + */ + protected PImage loadImageIO(String filename) { + InputStream stream = createInput(filename); + if (stream == null) { + System.err.println("The image " + filename + " could not be found."); + return null; + } + + try { + BufferedImage bi = ImageIO.read(stream); + PImage outgoing = new PImage(bi.getWidth(), bi.getHeight()); + outgoing.parent = this; + + bi.getRGB(0, 0, outgoing.width, outgoing.height, + outgoing.pixels, 0, outgoing.width); + + // check the alpha for this image + // was gonna call getType() on the image to see if RGB or ARGB, + // but it's not actually useful, since gif images will come through + // as TYPE_BYTE_INDEXED, which means it'll still have to check for + // the transparency. also, would have to iterate through all the other + // types and guess whether alpha was in there, so.. just gonna stick + // with the old method. + outgoing.checkAlpha(); + + // return the image + return outgoing; + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * Targa image loader for RLE-compressed TGA files. + *

+ * Rewritten for 0115 to read/write RLE-encoded targa images. + * For 0125, non-RLE encoded images are now supported, along with + * images whose y-order is reversed (which is standard for TGA files). + */ + protected PImage loadImageTGA(String filename) throws IOException { + InputStream is = createInput(filename); + if (is == null) return null; + + byte header[] = new byte[18]; + int offset = 0; + do { + int count = is.read(header, offset, header.length - offset); + if (count == -1) return null; + offset += count; + } while (offset < 18); + + /* + header[2] image type code + 2 (0x02) - Uncompressed, RGB images. + 3 (0x03) - Uncompressed, black and white images. + 10 (0x0A) - Runlength encoded RGB images. + 11 (0x0B) - Compressed, black and white images. (grayscale?) + + header[16] is the bit depth (8, 24, 32) + + header[17] image descriptor (packed bits) + 0x20 is 32 = origin upper-left + 0x28 is 32 + 8 = origin upper-left + 32 bits + + 7 6 5 4 3 2 1 0 + 128 64 32 16 8 4 2 1 + */ + + int format = 0; + + if (((header[2] == 3) || (header[2] == 11)) && // B&W, plus RLE or not + (header[16] == 8) && // 8 bits + ((header[17] == 0x8) || (header[17] == 0x28))) { // origin, 32 bit + format = ALPHA; + + } else if (((header[2] == 2) || (header[2] == 10)) && // RGB, RLE or not + (header[16] == 24) && // 24 bits + ((header[17] == 0x20) || (header[17] == 0))) { // origin + format = RGB; + + } else if (((header[2] == 2) || (header[2] == 10)) && + (header[16] == 32) && + ((header[17] == 0x8) || (header[17] == 0x28))) { // origin, 32 + format = ARGB; + } + + if (format == 0) { + System.err.println("Unknown .tga file format for " + filename); + //" (" + header[2] + " " + + //(header[16] & 0xff) + " " + + //hex(header[17], 2) + ")"); + return null; + } + + int w = ((header[13] & 0xff) << 8) + (header[12] & 0xff); + int h = ((header[15] & 0xff) << 8) + (header[14] & 0xff); + PImage outgoing = createImage(w, h, format); + + // where "reversed" means upper-left corner (normal for most of + // the modernized world, but "reversed" for the tga spec) + boolean reversed = (header[17] & 0x20) != 0; + + if ((header[2] == 2) || (header[2] == 3)) { // not RLE encoded + if (reversed) { + int index = (h-1) * w; + switch (format) { + case ALPHA: + for (int y = h-1; y >= 0; y--) { + for (int x = 0; x < w; x++) { + outgoing.pixels[index + x] = is.read(); + } + index -= w; + } + break; + case RGB: + for (int y = h-1; y >= 0; y--) { + for (int x = 0; x < w; x++) { + outgoing.pixels[index + x] = + is.read() | (is.read() << 8) | (is.read() << 16) | + 0xff000000; + } + index -= w; + } + break; + case ARGB: + for (int y = h-1; y >= 0; y--) { + for (int x = 0; x < w; x++) { + outgoing.pixels[index + x] = + is.read() | (is.read() << 8) | (is.read() << 16) | + (is.read() << 24); + } + index -= w; + } + } + } else { // not reversed + int count = w * h; + switch (format) { + case ALPHA: + for (int i = 0; i < count; i++) { + outgoing.pixels[i] = is.read(); + } + break; + case RGB: + for (int i = 0; i < count; i++) { + outgoing.pixels[i] = + is.read() | (is.read() << 8) | (is.read() << 16) | + 0xff000000; + } + break; + case ARGB: + for (int i = 0; i < count; i++) { + outgoing.pixels[i] = + is.read() | (is.read() << 8) | (is.read() << 16) | + (is.read() << 24); + } + break; + } + } + + } else { // header[2] is 10 or 11 + int index = 0; + int px[] = outgoing.pixels; + + while (index < px.length) { + int num = is.read(); + boolean isRLE = (num & 0x80) != 0; + if (isRLE) { + num -= 127; // (num & 0x7F) + 1 + int pixel = 0; + switch (format) { + case ALPHA: + pixel = is.read(); + break; + case RGB: + pixel = 0xFF000000 | + is.read() | (is.read() << 8) | (is.read() << 16); + //(is.read() << 16) | (is.read() << 8) | is.read(); + break; + case ARGB: + pixel = is.read() | + (is.read() << 8) | (is.read() << 16) | (is.read() << 24); + break; + } + for (int i = 0; i < num; i++) { + px[index++] = pixel; + if (index == px.length) break; + } + } else { // write up to 127 bytes as uncompressed + num += 1; + switch (format) { + case ALPHA: + for (int i = 0; i < num; i++) { + px[index++] = is.read(); + } + break; + case RGB: + for (int i = 0; i < num; i++) { + px[index++] = 0xFF000000 | + is.read() | (is.read() << 8) | (is.read() << 16); + //(is.read() << 16) | (is.read() << 8) | is.read(); + } + break; + case ARGB: + for (int i = 0; i < num; i++) { + px[index++] = is.read() | //(is.read() << 24) | + (is.read() << 8) | (is.read() << 16) | (is.read() << 24); + //(is.read() << 16) | (is.read() << 8) | is.read(); + } + break; + } + } + } + + if (!reversed) { + int[] temp = new int[w]; + for (int y = 0; y < h/2; y++) { + int z = (h-1) - y; + System.arraycopy(px, y*w, temp, 0, w); + System.arraycopy(px, z*w, px, y*w, w); + System.arraycopy(temp, 0, px, z*w, w); + } + } + } + + return outgoing; + } + + + + ////////////////////////////////////////////////////////////// + + // SHAPE I/O + + + /** + * Load a geometry from a file as a PShape. Currently only supports SVG data. + */ + public PShape loadShape(String filename) { + if (filename.toLowerCase().endsWith(".svg")) { + return new PShapeSVG(this, filename); + } + return null; + } + + + + ////////////////////////////////////////////////////////////// + + // FONT I/O + + + public PFont loadFont(String filename) { + try { + InputStream input = createInput(filename); + return new PFont(input); + + } catch (Exception e) { + die("Could not load font " + filename + ". " + + "Make sure that the font has been copied " + + "to the data folder of your sketch.", e); + } + return null; + } + + + public PFont createFont(String name, float size) { + return createFont(name, size, true, PFont.DEFAULT_CHARSET); + } + + + public PFont createFont(String name, float size, boolean smooth) { + return createFont(name, size, smooth, PFont.DEFAULT_CHARSET); + } + + + /** + * Create a .vlw font on the fly from either a font name that's + * installed on the system, or from a .ttf or .otf that's inside + * the data folder of this sketch. + *

+ * Only works with Java 1.3 or later. Many .otf fonts don't seem + * to be supported by Java, perhaps because they're CFF based? + *

+ * Font names are inconsistent across platforms and Java versions. + * On Mac OS X, Java 1.3 uses the font menu name of the font, + * whereas Java 1.4 uses the PostScript name of the font. Java 1.4 + * on OS X will also accept the font menu name as well. On Windows, + * it appears that only the menu names are used, no matter what + * Java version is in use. Naming system unknown/untested for 1.5. + *

+ * Use 'null' for the charset if you want to use any of the 65,536 + * unicode characters that exist in the font. Note that this can + * produce an enormous file or may cause an OutOfMemoryError. + */ + public PFont createFont(String name, float size, + boolean smooth, char charset[]) { + String lowerName = name.toLowerCase(); + Font baseFont = null; + + try { + if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) { + InputStream stream = createInput(name); + if (stream == null) { + System.err.println("The font \"" + name + "\" " + + "is missing or inaccessible, make sure " + + "the URL is valid or that the file has been " + + "added to your sketch and is readable."); + return null; + } + baseFont = Font.createFont(Font.TRUETYPE_FONT, createInput(name)); + + } else { + //baseFont = new Font(name, Font.PLAIN, 1); + baseFont = PFont.findFont(name); + } + } catch (Exception e) { + System.err.println("Problem using createFont() with " + name); + e.printStackTrace(); + } + return new PFont(baseFont.deriveFont(size), smooth, charset); + } + + + + ////////////////////////////////////////////////////////////// + + // FILE/FOLDER SELECTION + + + public File selectedFile; + protected Frame parentFrame; + + + protected void checkParentFrame() { + if (parentFrame == null) { + Component comp = getParent(); + while (comp != null) { + if (comp instanceof Frame) { + parentFrame = (Frame) comp; + break; + } + comp = comp.getParent(); + } + // Who you callin' a hack? + if (parentFrame == null) { + parentFrame = new Frame(); + } + } + } + + + /** + * Open a platform-specific file chooser dialog to select a file for input. + * @return full path to the selected file, or null if no selection. + */ + public String selectInput() { + return selectInput("Select a file..."); + } + + + /** + * Open a platform-specific file chooser dialog to select a file for input. + * @param prompt Mesage to show the user when prompting for a file. + * @return full path to the selected file, or null if canceled. + */ + public String selectInput(String prompt) { + return selectFileImpl(prompt, FileDialog.LOAD); + } + + + /** + * Open a platform-specific file save dialog to select a file for output. + * @return full path to the file entered, or null if canceled. + */ + public String selectOutput() { + return selectOutput("Save as..."); + } + + + /** + * Open a platform-specific file save dialog to select a file for output. + * @param prompt Mesage to show the user when prompting for a file. + * @return full path to the file entered, or null if canceled. + */ + public String selectOutput(String prompt) { + return selectFileImpl(prompt, FileDialog.SAVE); + } + + + protected String selectFileImpl(final String prompt, final int mode) { + checkParentFrame(); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + FileDialog fileDialog = + new FileDialog(parentFrame, prompt, mode); + fileDialog.setVisible(true); + String directory = fileDialog.getDirectory(); + String filename = fileDialog.getFile(); + selectedFile = + (filename == null) ? null : new File(directory, filename); + } + }); + return (selectedFile == null) ? null : selectedFile.getAbsolutePath(); + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * Open a platform-specific folder chooser dialog. + * @return full path to the selected folder, or null if no selection. + */ + public String selectFolder() { + return selectFolder("Select a folder..."); + } + + + /** + * Open a platform-specific folder chooser dialog. + * @param prompt Mesage to show the user when prompting for a file. + * @return full path to the selected folder, or null if no selection. + */ + public String selectFolder(final String prompt) { + checkParentFrame(); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (platform == MACOSX) { + FileDialog fileDialog = + new FileDialog(parentFrame, prompt, FileDialog.LOAD); + System.setProperty("apple.awt.fileDialogForDirectories", "true"); + fileDialog.setVisible(true); + System.setProperty("apple.awt.fileDialogForDirectories", "false"); + String filename = fileDialog.getFile(); + selectedFile = (filename == null) ? null : + new File(fileDialog.getDirectory(), fileDialog.getFile()); + } else { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle(prompt); + fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + int returned = fileChooser.showOpenDialog(parentFrame); + System.out.println(returned); + if (returned == JFileChooser.CANCEL_OPTION) { + selectedFile = null; + } else { + selectedFile = fileChooser.getSelectedFile(); + } + } + } + }); + return (selectedFile == null) ? null : selectedFile.getAbsolutePath(); + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + + ////////////////////////////////////////////////////////////// + + // READERS AND WRITERS + + + /** + * I want to read lines from a file. I have RSI from typing these + * eight lines of code so many times. + */ + public BufferedReader createReader(String filename) { + try { + InputStream is = createInput(filename); + if (is == null) { + System.err.println(filename + " does not exist or could not be read"); + return null; + } + return createReader(is); + + } catch (Exception e) { + if (filename == null) { + System.err.println("Filename passed to reader() was null"); + } else { + System.err.println("Couldn't create a reader for " + filename); + } + } + return null; + } + + + /** + * I want to read lines from a file. And I'm still annoyed. + */ + static public BufferedReader createReader(File file) { + try { + InputStream is = new FileInputStream(file); + if (file.getName().toLowerCase().endsWith(".gz")) { + is = new GZIPInputStream(is); + } + return createReader(is); + + } catch (Exception e) { + if (file == null) { + throw new RuntimeException("File passed to createReader() was null"); + } else { + e.printStackTrace(); + throw new RuntimeException("Couldn't create a reader for " + + file.getAbsolutePath()); + } + } + //return null; + } + + + /** + * I want to read lines from a stream. If I have to type the + * following lines any more I'm gonna send Sun my medical bills. + */ + static public BufferedReader createReader(InputStream input) { + InputStreamReader isr = null; + try { + isr = new InputStreamReader(input, "UTF-8"); + } catch (UnsupportedEncodingException e) { } // not gonna happen + return new BufferedReader(isr); + } + + + /** + * I want to print lines to a file. Why can't I? + */ + public PrintWriter createWriter(String filename) { + return createWriter(saveFile(filename)); + } + + + /** + * I want to print lines to a file. I have RSI from typing these + * eight lines of code so many times. + */ + static public PrintWriter createWriter(File file) { + try { + createPath(file); // make sure in-between folders exist + OutputStream output = new FileOutputStream(file); + if (file.getName().toLowerCase().endsWith(".gz")) { + output = new GZIPOutputStream(output); + } + return createWriter(output); + + } catch (Exception e) { + if (file == null) { + throw new RuntimeException("File passed to createWriter() was null"); + } else { + e.printStackTrace(); + throw new RuntimeException("Couldn't create a writer for " + + file.getAbsolutePath()); + } + } + //return null; + } + + + /** + * I want to print lines to a file. Why am I always explaining myself? + * It's the JavaSoft API engineers who need to explain themselves. + */ + static public PrintWriter createWriter(OutputStream output) { + try { + OutputStreamWriter osw = new OutputStreamWriter(output, "UTF-8"); + return new PrintWriter(osw); + } catch (UnsupportedEncodingException e) { } // not gonna happen + return null; + } + + + ////////////////////////////////////////////////////////////// + + // FILE INPUT + + + /** + * @deprecated As of release 0136, use createInput() instead. + */ + public InputStream openStream(String filename) { + return createInput(filename); + } + + + /** + * Simplified method to open a Java InputStream. + *

+ * This method is useful if you want to use the facilities provided + * by PApplet to easily open things from the data folder or from a URL, + * but want an InputStream object so that you can use other Java + * methods to take more control of how the stream is read. + *

+ * If the requested item doesn't exist, null is returned. + * (Prior to 0096, die() would be called, killing the applet) + *

+ * For 0096+, the "data" folder is exported intact with subfolders, + * and openStream() properly handles subdirectories from the data folder + *

+ * If not online, this will also check to see if the user is asking + * for a file whose name isn't properly capitalized. This helps prevent + * issues when a sketch is exported to the web, where case sensitivity + * matters, as opposed to Windows and the Mac OS default where + * case sensitivity is preserved but ignored. + *

+ * It is strongly recommended that libraries use this method to open + * data files, so that the loading sequence is handled in the same way + * as functions like loadBytes(), loadImage(), etc. + *

+ * The filename passed in can be: + *

    + *
  • A URL, for instance openStream("http://processing.org/"); + *
  • A file in the sketch's data folder + *
  • Another file to be opened locally (when running as an application) + *
+ */ + public InputStream createInput(String filename) { + InputStream input = createInputRaw(filename); + if ((input != null) && filename.toLowerCase().endsWith(".gz")) { + try { + return new GZIPInputStream(input); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + return input; + } + + + /** + * Call openStream() without automatic gzip decompression. + */ + public InputStream createInputRaw(String filename) { + InputStream stream = null; + + if (filename == null) return null; + + if (filename.length() == 0) { + // an error will be called by the parent function + //System.err.println("The filename passed to openStream() was empty."); + return null; + } + + // safe to check for this as a url first. this will prevent online + // access logs from being spammed with GET /sketchfolder/http://blahblah + try { + URL url = new URL(filename); + stream = url.openStream(); + return stream; + + } catch (MalformedURLException mfue) { + // not a url, that's fine + + } catch (FileNotFoundException fnfe) { + // Java 1.5 likes to throw this when URL not available. (fix for 0119) + // http://dev.processing.org/bugs/show_bug.cgi?id=403 + + } catch (IOException e) { + // changed for 0117, shouldn't be throwing exception + e.printStackTrace(); + //System.err.println("Error downloading from URL " + filename); + return null; + //throw new RuntimeException("Error downloading from URL " + filename); + } + + // Moved this earlier than the getResourceAsStream() checks, because + // calling getResourceAsStream() on a directory lists its contents. + // http://dev.processing.org/bugs/show_bug.cgi?id=716 + try { + // First see if it's in a data folder. This may fail by throwing + // a SecurityException. If so, this whole block will be skipped. + File file = new File(dataPath(filename)); + if (!file.exists()) { + // next see if it's just in the sketch folder + file = new File(sketchPath, filename); + } + if (file.isDirectory()) { + return null; + } + if (file.exists()) { + try { + // handle case sensitivity check + String filePath = file.getCanonicalPath(); + String filenameActual = new File(filePath).getName(); + // make sure there isn't a subfolder prepended to the name + String filenameShort = new File(filename).getName(); + // if the actual filename is the same, but capitalized + // differently, warn the user. + //if (filenameActual.equalsIgnoreCase(filenameShort) && + //!filenameActual.equals(filenameShort)) { + if (!filenameActual.equals(filenameShort)) { + throw new RuntimeException("This file is named " + + filenameActual + " not " + + filename + ". Rename the file " + + "or change your code."); + } + } catch (IOException e) { } + } + + // if this file is ok, may as well just load it + stream = new FileInputStream(file); + if (stream != null) return stream; + + // have to break these out because a general Exception might + // catch the RuntimeException being thrown above + } catch (IOException ioe) { + } catch (SecurityException se) { } + + // Using getClassLoader() prevents java from converting dots + // to slashes or requiring a slash at the beginning. + // (a slash as a prefix means that it'll load from the root of + // the jar, rather than trying to dig into the package location) + ClassLoader cl = getClass().getClassLoader(); + + // by default, data files are exported to the root path of the jar. + // (not the data folder) so check there first. + stream = cl.getResourceAsStream("data/" + filename); + if (stream != null) { + String cn = stream.getClass().getName(); + // this is an irritation of sun's java plug-in, which will return + // a non-null stream for an object that doesn't exist. like all good + // things, this is probably introduced in java 1.5. awesome! + // http://dev.processing.org/bugs/show_bug.cgi?id=359 + if (!cn.equals("sun.plugin.cache.EmptyInputStream")) { + return stream; + } + } + + // When used with an online script, also need to check without the + // data folder, in case it's not in a subfolder called 'data'. + // http://dev.processing.org/bugs/show_bug.cgi?id=389 + stream = cl.getResourceAsStream(filename); + if (stream != null) { + String cn = stream.getClass().getName(); + if (!cn.equals("sun.plugin.cache.EmptyInputStream")) { + return stream; + } + } + + try { + // attempt to load from a local file, used when running as + // an application, or as a signed applet + try { // first try to catch any security exceptions + try { + stream = new FileInputStream(dataPath(filename)); + if (stream != null) return stream; + } catch (IOException e2) { } + + try { + stream = new FileInputStream(sketchPath(filename)); + if (stream != null) return stream; + } catch (Exception e) { } // ignored + + try { + stream = new FileInputStream(filename); + if (stream != null) return stream; + } catch (IOException e1) { } + + } catch (SecurityException se) { } // online, whups + + } catch (Exception e) { + //die(e.getMessage(), e); + e.printStackTrace(); + } + return null; + } + + + static public InputStream createInput(File file) { + try { + InputStream input = new FileInputStream(file); + if (file.getName().toLowerCase().endsWith(".gz")) { + return new GZIPInputStream(input); + } + return input; + + } catch (IOException e) { + if (file == null) { + throw new RuntimeException("File passed to openStream() was null"); + + } else { + e.printStackTrace(); + throw new RuntimeException("Couldn't openStream() for " + + file.getAbsolutePath()); + } + } + } + + + public byte[] loadBytes(String filename) { + InputStream is = createInput(filename); + if (is != null) return loadBytes(is); + + System.err.println("The file \"" + filename + "\" " + + "is missing or inaccessible, make sure " + + "the URL is valid or that the file has been " + + "added to your sketch and is readable."); + return null; + } + + + static public byte[] loadBytes(InputStream input) { + try { + BufferedInputStream bis = new BufferedInputStream(input); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + int c = bis.read(); + while (c != -1) { + out.write(c); + c = bis.read(); + } + return out.toByteArray(); + + } catch (IOException e) { + e.printStackTrace(); + //throw new RuntimeException("Couldn't load bytes from stream"); + } + return null; + } + + + static public byte[] loadBytes(File file) { + InputStream is = createInput(file); + return loadBytes(is); + } + + + static public String[] loadStrings(File file) { + InputStream is = createInput(file); + if (is != null) return loadStrings(is); + return null; + } + + + /** + * Load data from a file and shove it into a String array. + *

+ * Exceptions are handled internally, when an error, occurs, an + * exception is printed to the console and 'null' is returned, + * but the program continues running. This is a tradeoff between + * 1) showing the user that there was a problem but 2) not requiring + * that all i/o code is contained in try/catch blocks, for the sake + * of new users (or people who are just trying to get things done + * in a "scripting" fashion. If you want to handle exceptions, + * use Java methods for I/O. + */ + public String[] loadStrings(String filename) { + InputStream is = createInput(filename); + if (is != null) return loadStrings(is); + + System.err.println("The file \"" + filename + "\" " + + "is missing or inaccessible, make sure " + + "the URL is valid or that the file has been " + + "added to your sketch and is readable."); + return null; + } + + + static public String[] loadStrings(InputStream input) { + try { + BufferedReader reader = + new BufferedReader(new InputStreamReader(input, "UTF-8")); + + String lines[] = new String[100]; + int lineCount = 0; + String line = null; + while ((line = reader.readLine()) != null) { + if (lineCount == lines.length) { + String temp[] = new String[lineCount << 1]; + System.arraycopy(lines, 0, temp, 0, lineCount); + lines = temp; + } + lines[lineCount++] = line; + } + reader.close(); + + if (lineCount == lines.length) { + return lines; + } + + // resize array to appropriate amount for these lines + String output[] = new String[lineCount]; + System.arraycopy(lines, 0, output, 0, lineCount); + return output; + + } catch (IOException e) { + e.printStackTrace(); + //throw new RuntimeException("Error inside loadStrings()"); + } + return null; + } + + + + ////////////////////////////////////////////////////////////// + + // FILE OUTPUT + + + /** + * Similar to createInput() (formerly openStream), this creates a Java + * OutputStream for a given filename or path. The file will be created in + * the sketch folder, or in the same folder as an exported application. + *

+ * If the path does not exist, intermediate folders will be created. If an + * exception occurs, it will be printed to the console, and null will be + * returned. + *

+ * Future releases may also add support for handling HTTP POST via this + * method (for better symmetry with createInput), however that's maybe a + * little too clever (and then we'd have to add the same features to the + * other file functions like createWriter). Who you callin' bloated? + */ + public OutputStream createOutput(String filename) { + return createOutput(saveFile(filename)); + } + + + static public OutputStream createOutput(File file) { + try { + createPath(file); // make sure the path exists + FileOutputStream fos = new FileOutputStream(file); + if (file.getName().toLowerCase().endsWith(".gz")) { + return new GZIPOutputStream(fos); + } + return fos; + + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + + /** + * Save the contents of a stream to a file in the sketch folder. + * This is basically saveBytes(blah, loadBytes()), but done + * more efficiently (and with less confusing syntax). + */ + public void saveStream(String targetFilename, String sourceLocation) { + saveStream(saveFile(targetFilename), sourceLocation); + } + + + /** + * Identical to the other saveStream(), but writes to a File + * object, for greater control over the file location. + * Note that unlike other api methods, this will not automatically + * compress or uncompress gzip files. + */ + public void saveStream(File targetFile, String sourceLocation) { + saveStream(targetFile, createInputRaw(sourceLocation)); + } + + + static public void saveStream(File targetFile, InputStream sourceStream) { + File tempFile = null; + try { + File parentDir = targetFile.getParentFile(); + tempFile = File.createTempFile(targetFile.getName(), null, parentDir); + + BufferedInputStream bis = new BufferedInputStream(sourceStream, 16384); + FileOutputStream fos = new FileOutputStream(tempFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + + byte[] buffer = new byte[8192]; + int bytesRead; + while ((bytesRead = bis.read(buffer)) != -1) { + bos.write(buffer, 0, bytesRead); + } + + bos.flush(); + bos.close(); + bos = null; + + if (!tempFile.renameTo(targetFile)) { + System.err.println("Could not rename temporary file " + + tempFile.getAbsolutePath()); + } + } catch (IOException e) { + if (tempFile != null) { + tempFile.delete(); + } + e.printStackTrace(); + } + } + + + /** + * Saves bytes to a file to inside the sketch folder. + * The filename can be a relative path, i.e. "poo/bytefun.txt" + * would save to a file named "bytefun.txt" to a subfolder + * called 'poo' inside the sketch folder. If the in-between + * subfolders don't exist, they'll be created. + */ + public void saveBytes(String filename, byte buffer[]) { + saveBytes(saveFile(filename), buffer); + } + + + /** + * Saves bytes to a specific File location specified by the user. + */ + static public void saveBytes(File file, byte buffer[]) { + try { + String filename = file.getAbsolutePath(); + createPath(filename); + OutputStream output = new FileOutputStream(file); + if (file.getName().toLowerCase().endsWith(".gz")) { + output = new GZIPOutputStream(output); + } + saveBytes(output, buffer); + output.close(); + + } catch (IOException e) { + System.err.println("error saving bytes to " + file); + e.printStackTrace(); + } + } + + + /** + * Spews a buffer of bytes to an OutputStream. + */ + static public void saveBytes(OutputStream output, byte buffer[]) { + try { + output.write(buffer); + output.flush(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + + // + + public void saveStrings(String filename, String strings[]) { + saveStrings(saveFile(filename), strings); + } + + + static public void saveStrings(File file, String strings[]) { + try { + String location = file.getAbsolutePath(); + createPath(location); + OutputStream output = new FileOutputStream(location); + if (file.getName().toLowerCase().endsWith(".gz")) { + output = new GZIPOutputStream(output); + } + saveStrings(output, strings); + output.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + + + static public void saveStrings(OutputStream output, String strings[]) { + try { + OutputStreamWriter osw = new OutputStreamWriter(output, "UTF-8"); + PrintWriter writer = new PrintWriter(osw); + for (int i = 0; i < strings.length; i++) { + writer.println(strings[i]); + } + writer.flush(); + } catch (UnsupportedEncodingException e) { } // will not happen + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Prepend the sketch folder path to the filename (or path) that is + * passed in. External libraries should use this function to save to + * the sketch folder. + *

+ * Note that when running as an applet inside a web browser, + * the sketchPath will be set to null, because security restrictions + * prevent applets from accessing that information. + *

+ * This will also cause an error if the sketch is not inited properly, + * meaning that init() was never called on the PApplet when hosted + * my some other main() or by other code. For proper use of init(), + * see the examples in the main description text for PApplet. + */ + public String sketchPath(String where) { + if (sketchPath == null) { + return where; +// throw new RuntimeException("The applet was not inited properly, " + +// "or security restrictions prevented " + +// "it from determining its path."); + } + // isAbsolute() could throw an access exception, but so will writing + // to the local disk using the sketch path, so this is safe here. + // for 0120, added a try/catch anyways. + try { + if (new File(where).isAbsolute()) return where; + } catch (Exception e) { } + + return sketchPath + File.separator + where; + } + + + public File sketchFile(String where) { + return new File(sketchPath(where)); + } + + + /** + * Returns a path inside the applet folder to save to. Like sketchPath(), + * but creates any in-between folders so that things save properly. + *

+ * All saveXxxx() functions use the path to the sketch folder, rather than + * its data folder. Once exported, the data folder will be found inside the + * jar file of the exported application or applet. In this case, it's not + * possible to save data into the jar file, because it will often be running + * from a server, or marked in-use if running from a local file system. + * With this in mind, saving to the data path doesn't make sense anyway. + * If you know you're running locally, and want to save to the data folder, + * use saveXxxx("data/blah.dat"). + */ + public String savePath(String where) { + if (where == null) return null; + String filename = sketchPath(where); + createPath(filename); + return filename; + } + + + /** + * Identical to savePath(), but returns a File object. + */ + public File saveFile(String where) { + return new File(savePath(where)); + } + + + /** + * Return a full path to an item in the data folder. + *

+ * In this method, the data path is defined not as the applet's actual + * data path, but a folder titled "data" in the sketch's working + * directory. When running inside the PDE, this will be the sketch's + * "data" folder. However, when exported (as application or applet), + * sketch's data folder is exported as part of the applications jar file, + * and it's not possible to read/write from the jar file in a generic way. + * If you need to read data from the jar file, you should use createInput(). + */ + public String dataPath(String where) { + // isAbsolute() could throw an access exception, but so will writing + // to the local disk using the sketch path, so this is safe here. + if (new File(where).isAbsolute()) return where; + + return sketchPath + File.separator + "data" + File.separator + where; + } + + + /** + * Return a full path to an item in the data folder as a File object. + * See the dataPath() method for more information. + */ + public File dataFile(String where) { + return new File(dataPath(where)); + } + + + /** + * Takes a path and creates any in-between folders if they don't + * already exist. Useful when trying to save to a subfolder that + * may not actually exist. + */ + static public void createPath(String path) { + createPath(new File(path)); + } + + + static public void createPath(File file) { + try { + String parent = file.getParent(); + if (parent != null) { + File unit = new File(parent); + if (!unit.exists()) unit.mkdirs(); + } + } catch (SecurityException se) { + System.err.println("You don't have permissions to create " + + file.getAbsolutePath()); + } + } + + + + ////////////////////////////////////////////////////////////// + + // SORT + + + static public byte[] sort(byte what[]) { + return sort(what, what.length); + } + + + static public byte[] sort(byte[] what, int count) { + byte[] outgoing = new byte[what.length]; + System.arraycopy(what, 0, outgoing, 0, what.length); + Arrays.sort(outgoing, 0, count); + return outgoing; + } + + + static public char[] sort(char what[]) { + return sort(what, what.length); + } + + + static public char[] sort(char[] what, int count) { + char[] outgoing = new char[what.length]; + System.arraycopy(what, 0, outgoing, 0, what.length); + Arrays.sort(outgoing, 0, count); + return outgoing; + } + + + static public int[] sort(int what[]) { + return sort(what, what.length); + } + + + static public int[] sort(int[] what, int count) { + int[] outgoing = new int[what.length]; + System.arraycopy(what, 0, outgoing, 0, what.length); + Arrays.sort(outgoing, 0, count); + return outgoing; + } + + + static public float[] sort(float what[]) { + return sort(what, what.length); + } + + + static public float[] sort(float[] what, int count) { + float[] outgoing = new float[what.length]; + System.arraycopy(what, 0, outgoing, 0, what.length); + Arrays.sort(outgoing, 0, count); + return outgoing; + } + + + static public String[] sort(String what[]) { + return sort(what, what.length); + } + + + static public String[] sort(String[] what, int count) { + String[] outgoing = new String[what.length]; + System.arraycopy(what, 0, outgoing, 0, what.length); + Arrays.sort(outgoing, 0, count); + return outgoing; + } + + + + ////////////////////////////////////////////////////////////// + + // ARRAY UTILITIES + + + /** + * Calls System.arraycopy(), included here so that we can + * avoid people needing to learn about the System object + * before they can just copy an array. + */ + static public void arrayCopy(Object src, int srcPosition, + Object dst, int dstPosition, + int length) { + System.arraycopy(src, srcPosition, dst, dstPosition, length); + } + + + /** + * Convenience method for arraycopy(). + * Identical to arraycopy(src, 0, dst, 0, length); + */ + static public void arrayCopy(Object src, Object dst, int length) { + System.arraycopy(src, 0, dst, 0, length); + } + + + /** + * Shortcut to copy the entire contents of + * the source into the destination array. + * Identical to arraycopy(src, 0, dst, 0, src.length); + */ + static public void arrayCopy(Object src, Object dst) { + System.arraycopy(src, 0, dst, 0, Array.getLength(src)); + } + + // + + /** + * @deprecated Use arrayCopy() instead. + */ + static public void arraycopy(Object src, int srcPosition, + Object dst, int dstPosition, + int length) { + System.arraycopy(src, srcPosition, dst, dstPosition, length); + } + + /** + * @deprecated Use arrayCopy() instead. + */ + static public void arraycopy(Object src, Object dst, int length) { + System.arraycopy(src, 0, dst, 0, length); + } + + /** + * @deprecated Use arrayCopy() instead. + */ + static public void arraycopy(Object src, Object dst) { + System.arraycopy(src, 0, dst, 0, Array.getLength(src)); + } + + // + + static public boolean[] expand(boolean list[]) { + return expand(list, list.length << 1); + } + + static public boolean[] expand(boolean list[], int newSize) { + boolean temp[] = new boolean[newSize]; + System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length)); + return temp; + } + + + static public byte[] expand(byte list[]) { + return expand(list, list.length << 1); + } + + static public byte[] expand(byte list[], int newSize) { + byte temp[] = new byte[newSize]; + System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length)); + return temp; + } + + + static public char[] expand(char list[]) { + return expand(list, list.length << 1); + } + + static public char[] expand(char list[], int newSize) { + char temp[] = new char[newSize]; + System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length)); + return temp; + } + + + static public int[] expand(int list[]) { + return expand(list, list.length << 1); + } + + static public int[] expand(int list[], int newSize) { + int temp[] = new int[newSize]; + System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length)); + return temp; + } + + + static public float[] expand(float list[]) { + return expand(list, list.length << 1); + } + + static public float[] expand(float list[], int newSize) { + float temp[] = new float[newSize]; + System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length)); + return temp; + } + + + static public String[] expand(String list[]) { + return expand(list, list.length << 1); + } + + static public String[] expand(String list[], int newSize) { + String temp[] = new String[newSize]; + // in case the new size is smaller than list.length + System.arraycopy(list, 0, temp, 0, Math.min(newSize, list.length)); + return temp; + } + + + static public Object expand(Object array) { + return expand(array, Array.getLength(array) << 1); + } + + static public Object expand(Object list, int newSize) { + Class type = list.getClass().getComponentType(); + Object temp = Array.newInstance(type, newSize); + System.arraycopy(list, 0, temp, 0, + Math.min(Array.getLength(list), newSize)); + return temp; + } + + // + + // contract() has been removed in revision 0124, use subset() instead. + // (expand() is also functionally equivalent) + + // + + static public byte[] append(byte b[], byte value) { + b = expand(b, b.length + 1); + b[b.length-1] = value; + return b; + } + + static public char[] append(char b[], char value) { + b = expand(b, b.length + 1); + b[b.length-1] = value; + return b; + } + + static public int[] append(int b[], int value) { + b = expand(b, b.length + 1); + b[b.length-1] = value; + return b; + } + + static public float[] append(float b[], float value) { + b = expand(b, b.length + 1); + b[b.length-1] = value; + return b; + } + + static public String[] append(String b[], String value) { + b = expand(b, b.length + 1); + b[b.length-1] = value; + return b; + } + + static public Object append(Object b, Object value) { + int length = Array.getLength(b); + b = expand(b, length + 1); + Array.set(b, length, value); + return b; + } + + // + + static public boolean[] shorten(boolean list[]) { + return subset(list, 0, list.length-1); + } + + static public byte[] shorten(byte list[]) { + return subset(list, 0, list.length-1); + } + + static public char[] shorten(char list[]) { + return subset(list, 0, list.length-1); + } + + static public int[] shorten(int list[]) { + return subset(list, 0, list.length-1); + } + + static public float[] shorten(float list[]) { + return subset(list, 0, list.length-1); + } + + static public String[] shorten(String list[]) { + return subset(list, 0, list.length-1); + } + + static public Object shorten(Object list) { + int length = Array.getLength(list); + return subset(list, 0, length - 1); + } + + // + + static final public boolean[] splice(boolean list[], + boolean v, int index) { + boolean outgoing[] = new boolean[list.length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + outgoing[index] = v; + System.arraycopy(list, index, outgoing, index + 1, + list.length - index); + return outgoing; + } + + static final public boolean[] splice(boolean list[], + boolean v[], int index) { + boolean outgoing[] = new boolean[list.length + v.length]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, v.length); + System.arraycopy(list, index, outgoing, index + v.length, + list.length - index); + return outgoing; + } + + + static final public byte[] splice(byte list[], + byte v, int index) { + byte outgoing[] = new byte[list.length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + outgoing[index] = v; + System.arraycopy(list, index, outgoing, index + 1, + list.length - index); + return outgoing; + } + + static final public byte[] splice(byte list[], + byte v[], int index) { + byte outgoing[] = new byte[list.length + v.length]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, v.length); + System.arraycopy(list, index, outgoing, index + v.length, + list.length - index); + return outgoing; + } + + + static final public char[] splice(char list[], + char v, int index) { + char outgoing[] = new char[list.length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + outgoing[index] = v; + System.arraycopy(list, index, outgoing, index + 1, + list.length - index); + return outgoing; + } + + static final public char[] splice(char list[], + char v[], int index) { + char outgoing[] = new char[list.length + v.length]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, v.length); + System.arraycopy(list, index, outgoing, index + v.length, + list.length - index); + return outgoing; + } + + + static final public int[] splice(int list[], + int v, int index) { + int outgoing[] = new int[list.length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + outgoing[index] = v; + System.arraycopy(list, index, outgoing, index + 1, + list.length - index); + return outgoing; + } + + static final public int[] splice(int list[], + int v[], int index) { + int outgoing[] = new int[list.length + v.length]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, v.length); + System.arraycopy(list, index, outgoing, index + v.length, + list.length - index); + return outgoing; + } + + + static final public float[] splice(float list[], + float v, int index) { + float outgoing[] = new float[list.length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + outgoing[index] = v; + System.arraycopy(list, index, outgoing, index + 1, + list.length - index); + return outgoing; + } + + static final public float[] splice(float list[], + float v[], int index) { + float outgoing[] = new float[list.length + v.length]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, v.length); + System.arraycopy(list, index, outgoing, index + v.length, + list.length - index); + return outgoing; + } + + + static final public String[] splice(String list[], + String v, int index) { + String outgoing[] = new String[list.length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + outgoing[index] = v; + System.arraycopy(list, index, outgoing, index + 1, + list.length - index); + return outgoing; + } + + static final public String[] splice(String list[], + String v[], int index) { + String outgoing[] = new String[list.length + v.length]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, v.length); + System.arraycopy(list, index, outgoing, index + v.length, + list.length - index); + return outgoing; + } + + + static final public Object splice(Object list, Object v, int index) { + Object[] outgoing = null; + int length = Array.getLength(list); + + // check whether item being spliced in is an array + if (v.getClass().getName().charAt(0) == '[') { + int vlength = Array.getLength(v); + outgoing = new Object[length + vlength]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, vlength); + System.arraycopy(list, index, outgoing, index + vlength, length - index); + + } else { + outgoing = new Object[length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + Array.set(outgoing, index, v); + System.arraycopy(list, index, outgoing, index + 1, length - index); + } + return outgoing; + } + + // + + static public boolean[] subset(boolean list[], int start) { + return subset(list, start, list.length - start); + } + + static public boolean[] subset(boolean list[], int start, int count) { + boolean output[] = new boolean[count]; + System.arraycopy(list, start, output, 0, count); + return output; + } + + + static public byte[] subset(byte list[], int start) { + return subset(list, start, list.length - start); + } + + static public byte[] subset(byte list[], int start, int count) { + byte output[] = new byte[count]; + System.arraycopy(list, start, output, 0, count); + return output; + } + + + static public char[] subset(char list[], int start) { + return subset(list, start, list.length - start); + } + + static public char[] subset(char list[], int start, int count) { + char output[] = new char[count]; + System.arraycopy(list, start, output, 0, count); + return output; + } + + + static public int[] subset(int list[], int start) { + return subset(list, start, list.length - start); + } + + static public int[] subset(int list[], int start, int count) { + int output[] = new int[count]; + System.arraycopy(list, start, output, 0, count); + return output; + } + + + static public float[] subset(float list[], int start) { + return subset(list, start, list.length - start); + } + + static public float[] subset(float list[], int start, int count) { + float output[] = new float[count]; + System.arraycopy(list, start, output, 0, count); + return output; + } + + + static public String[] subset(String list[], int start) { + return subset(list, start, list.length - start); + } + + static public String[] subset(String list[], int start, int count) { + String output[] = new String[count]; + System.arraycopy(list, start, output, 0, count); + return output; + } + + + static public Object subset(Object list, int start) { + int length = Array.getLength(list); + return subset(list, start, length - start); + } + + static public Object subset(Object list, int start, int count) { + Class type = list.getClass().getComponentType(); + Object outgoing = Array.newInstance(type, count); + System.arraycopy(list, start, outgoing, 0, count); + return outgoing; + } + + // + + static public boolean[] concat(boolean a[], boolean b[]) { + boolean c[] = new boolean[a.length + b.length]; + System.arraycopy(a, 0, c, 0, a.length); + System.arraycopy(b, 0, c, a.length, b.length); + return c; + } + + static public byte[] concat(byte a[], byte b[]) { + byte c[] = new byte[a.length + b.length]; + System.arraycopy(a, 0, c, 0, a.length); + System.arraycopy(b, 0, c, a.length, b.length); + return c; + } + + static public char[] concat(char a[], char b[]) { + char c[] = new char[a.length + b.length]; + System.arraycopy(a, 0, c, 0, a.length); + System.arraycopy(b, 0, c, a.length, b.length); + return c; + } + + static public int[] concat(int a[], int b[]) { + int c[] = new int[a.length + b.length]; + System.arraycopy(a, 0, c, 0, a.length); + System.arraycopy(b, 0, c, a.length, b.length); + return c; + } + + static public float[] concat(float a[], float b[]) { + float c[] = new float[a.length + b.length]; + System.arraycopy(a, 0, c, 0, a.length); + System.arraycopy(b, 0, c, a.length, b.length); + return c; + } + + static public String[] concat(String a[], String b[]) { + String c[] = new String[a.length + b.length]; + System.arraycopy(a, 0, c, 0, a.length); + System.arraycopy(b, 0, c, a.length, b.length); + return c; + } + + static public Object concat(Object a, Object b) { + Class type = a.getClass().getComponentType(); + int alength = Array.getLength(a); + int blength = Array.getLength(b); + Object outgoing = Array.newInstance(type, alength + blength); + System.arraycopy(a, 0, outgoing, 0, alength); + System.arraycopy(b, 0, outgoing, alength, blength); + return outgoing; + } + + // + + static public boolean[] reverse(boolean list[]) { + boolean outgoing[] = new boolean[list.length]; + int length1 = list.length - 1; + for (int i = 0; i < list.length; i++) { + outgoing[i] = list[length1 - i]; + } + return outgoing; + } + + static public byte[] reverse(byte list[]) { + byte outgoing[] = new byte[list.length]; + int length1 = list.length - 1; + for (int i = 0; i < list.length; i++) { + outgoing[i] = list[length1 - i]; + } + return outgoing; + } + + static public char[] reverse(char list[]) { + char outgoing[] = new char[list.length]; + int length1 = list.length - 1; + for (int i = 0; i < list.length; i++) { + outgoing[i] = list[length1 - i]; + } + return outgoing; + } + + static public int[] reverse(int list[]) { + int outgoing[] = new int[list.length]; + int length1 = list.length - 1; + for (int i = 0; i < list.length; i++) { + outgoing[i] = list[length1 - i]; + } + return outgoing; + } + + static public float[] reverse(float list[]) { + float outgoing[] = new float[list.length]; + int length1 = list.length - 1; + for (int i = 0; i < list.length; i++) { + outgoing[i] = list[length1 - i]; + } + return outgoing; + } + + static public String[] reverse(String list[]) { + String outgoing[] = new String[list.length]; + int length1 = list.length - 1; + for (int i = 0; i < list.length; i++) { + outgoing[i] = list[length1 - i]; + } + return outgoing; + } + + static public Object reverse(Object list) { + Class type = list.getClass().getComponentType(); + int length = Array.getLength(list); + Object outgoing = Array.newInstance(type, length); + for (int i = 0; i < length; i++) { + Array.set(outgoing, i, Array.get(list, (length - 1) - i)); + } + return outgoing; + } + + + + ////////////////////////////////////////////////////////////// + + // STRINGS + + + /** + * Remove whitespace characters from the beginning and ending + * of a String. Works like String.trim() but includes the + * unicode nbsp character as well. + */ + static public String trim(String str) { + return str.replace('\u00A0', ' ').trim(); + } + + + /** + * Trim the whitespace from a String array. This returns a new + * array and does not affect the passed-in array. + */ + static public String[] trim(String[] array) { + String[] outgoing = new String[array.length]; + for (int i = 0; i < array.length; i++) { + outgoing[i] = array[i].replace('\u00A0', ' ').trim(); + } + return outgoing; + } + + + /** + * Join an array of Strings together as a single String, + * separated by the whatever's passed in for the separator. + */ + static public String join(String str[], char separator) { + return join(str, String.valueOf(separator)); + } + + + /** + * Join an array of Strings together as a single String, + * separated by the whatever's passed in for the separator. + *

+ * To use this on numbers, first pass the array to nf() or nfs() + * to get a list of String objects, then use join on that. + *

+   * e.g. String stuff[] = { "apple", "bear", "cat" };
+   *      String list = join(stuff, ", ");
+   *      // list is now "apple, bear, cat"
+ */ + static public String join(String str[], String separator) { + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < str.length; i++) { + if (i != 0) buffer.append(separator); + buffer.append(str[i]); + } + return buffer.toString(); + } + + + /** + * Split the provided String at wherever whitespace occurs. + * Multiple whitespace (extra spaces or tabs or whatever) + * between items will count as a single break. + *

+ * The whitespace characters are "\t\n\r\f", which are the defaults + * for java.util.StringTokenizer, plus the unicode non-breaking space + * character, which is found commonly on files created by or used + * in conjunction with Mac OS X (character 160, or 0x00A0 in hex). + *

+   * i.e. splitTokens("a b") -> { "a", "b" }
+   *      splitTokens("a    b") -> { "a", "b" }
+   *      splitTokens("a\tb") -> { "a", "b" }
+   *      splitTokens("a \t  b  ") -> { "a", "b" }
+ */ + static public String[] splitTokens(String what) { + return splitTokens(what, WHITESPACE); + } + + + /** + * Splits a string into pieces, using any of the chars in the + * String 'delim' as separator characters. For instance, + * in addition to white space, you might want to treat commas + * as a separator. The delimeter characters won't appear in + * the returned String array. + *
+   * i.e. splitTokens("a, b", " ,") -> { "a", "b" }
+   * 
+ * To include all the whitespace possibilities, use the variable + * WHITESPACE, found in PConstants: + *
+   * i.e. splitTokens("a   | b", WHITESPACE + "|");  ->  { "a", "b" }
+ */ + static public String[] splitTokens(String what, String delim) { + StringTokenizer toker = new StringTokenizer(what, delim); + String pieces[] = new String[toker.countTokens()]; + + int index = 0; + while (toker.hasMoreTokens()) { + pieces[index++] = toker.nextToken(); + } + return pieces; + } + + + /** + * Split a string into pieces along a specific character. + * Most commonly used to break up a String along a space or a tab + * character. + *

+ * This operates differently than the others, where the + * single delimeter is the only breaking point, and consecutive + * delimeters will produce an empty string (""). This way, + * one can split on tab characters, but maintain the column + * alignments (of say an excel file) where there are empty columns. + */ + static public String[] split(String what, char delim) { + // do this so that the exception occurs inside the user's + // program, rather than appearing to be a bug inside split() + if (what == null) return null; + //return split(what, String.valueOf(delim)); // huh + + char chars[] = what.toCharArray(); + int splitCount = 0; //1; + for (int i = 0; i < chars.length; i++) { + if (chars[i] == delim) splitCount++; + } + // make sure that there is something in the input string + //if (chars.length > 0) { + // if the last char is a delimeter, get rid of it.. + //if (chars[chars.length-1] == delim) splitCount--; + // on second thought, i don't agree with this, will disable + //} + if (splitCount == 0) { + String splits[] = new String[1]; + splits[0] = new String(what); + return splits; + } + //int pieceCount = splitCount + 1; + String splits[] = new String[splitCount + 1]; + int splitIndex = 0; + int startIndex = 0; + for (int i = 0; i < chars.length; i++) { + if (chars[i] == delim) { + splits[splitIndex++] = + new String(chars, startIndex, i-startIndex); + startIndex = i + 1; + } + } + //if (startIndex != chars.length) { + splits[splitIndex] = + new String(chars, startIndex, chars.length-startIndex); + //} + return splits; + } + + + /** + * Split a String on a specific delimiter. Unlike Java's String.split() + * method, this does not parse the delimiter as a regexp because it's more + * confusing than necessary, and String.split() is always available for + * those who want regexp. + */ + static public String[] split(String what, String delim) { + ArrayList items = new ArrayList(); + int index; + int offset = 0; + while ((index = what.indexOf(delim, offset)) != -1) { + items.add(what.substring(offset, index)); + offset = index + delim.length(); + } + items.add(what.substring(offset)); + String[] outgoing = new String[items.size()]; + items.toArray(outgoing); + return outgoing; + } + + + /** + * Match a string with a regular expression, and returns the match as an + * array. The first index is the matching expression, and array elements + * [1] and higher represent each of the groups (sequences found in parens). + * + * This uses multiline matching (Pattern.MULTILINE) and dotall mode + * (Pattern.DOTALL) by default, so that ^ and $ match the beginning and + * end of any lines found in the source, and the . operator will also + * pick up newline characters. + */ + static public String[] match(String what, String regexp) { + Pattern p = Pattern.compile(regexp, Pattern.MULTILINE | Pattern.DOTALL); + Matcher m = p.matcher(what); + if (m.find()) { + int count = m.groupCount() + 1; + String[] groups = new String[count]; + for (int i = 0; i < count; i++) { + groups[i] = m.group(i); + } + return groups; + } + return null; + } + + + /** + * Identical to match(), except that it returns an array of all matches in + * the specified String, rather than just the first. + */ + static public String[][] matchAll(String what, String regexp) { + Pattern p = Pattern.compile(regexp, Pattern.MULTILINE | Pattern.DOTALL); + Matcher m = p.matcher(what); + ArrayList results = new ArrayList(); + int count = m.groupCount() + 1; + while (m.find()) { + String[] groups = new String[count]; + for (int i = 0; i < count; i++) { + groups[i] = m.group(i); + } + results.add(groups); + } + if (results.isEmpty()) { + return null; + } + String[][] matches = new String[results.size()][count]; + for (int i = 0; i < matches.length; i++) { + matches[i] = (String[]) results.get(i); + } + return matches; + } + + + + ////////////////////////////////////////////////////////////// + + // CASTING FUNCTIONS, INSERTED BY PREPROC + + + /** + * Convert a char to a boolean. 'T', 't', and '1' will become the + * boolean value true, while 'F', 'f', or '0' will become false. + */ + /* + static final public boolean parseBoolean(char what) { + return ((what == 't') || (what == 'T') || (what == '1')); + } + */ + + /** + *

Convert an integer to a boolean. Because of how Java handles upgrading + * numbers, this will also cover byte and char (as they will upgrade to + * an int without any sort of explicit cast).

+ *

The preprocessor will convert boolean(what) to parseBoolean(what).

+ * @return false if 0, true if any other number + */ + static final public boolean parseBoolean(int what) { + return (what != 0); + } + + /* + // removed because this makes no useful sense + static final public boolean parseBoolean(float what) { + return (what != 0); + } + */ + + /** + * Convert the string "true" or "false" to a boolean. + * @return true if 'what' is "true" or "TRUE", false otherwise + */ + static final public boolean parseBoolean(String what) { + return new Boolean(what).booleanValue(); + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + /* + // removed, no need to introduce strange syntax from other languages + static final public boolean[] parseBoolean(char what[]) { + boolean outgoing[] = new boolean[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = + ((what[i] == 't') || (what[i] == 'T') || (what[i] == '1')); + } + return outgoing; + } + */ + + /** + * Convert a byte array to a boolean array. Each element will be + * evaluated identical to the integer case, where a byte equal + * to zero will return false, and any other value will return true. + * @return array of boolean elements + */ + static final public boolean[] parseBoolean(byte what[]) { + boolean outgoing[] = new boolean[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (what[i] != 0); + } + return outgoing; + } + + /** + * Convert an int array to a boolean array. An int equal + * to zero will return false, and any other value will return true. + * @return array of boolean elements + */ + static final public boolean[] parseBoolean(int what[]) { + boolean outgoing[] = new boolean[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (what[i] != 0); + } + return outgoing; + } + + /* + // removed, not necessary... if necessary, convert to int array first + static final public boolean[] parseBoolean(float what[]) { + boolean outgoing[] = new boolean[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (what[i] != 0); + } + return outgoing; + } + */ + + static final public boolean[] parseBoolean(String what[]) { + boolean outgoing[] = new boolean[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = new Boolean(what[i]).booleanValue(); + } + return outgoing; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static final public byte parseByte(boolean what) { + return what ? (byte)1 : 0; + } + + static final public byte parseByte(char what) { + return (byte) what; + } + + static final public byte parseByte(int what) { + return (byte) what; + } + + static final public byte parseByte(float what) { + return (byte) what; + } + + /* + // nixed, no precedent + static final public byte[] parseByte(String what) { // note: array[] + return what.getBytes(); + } + */ + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static final public byte[] parseByte(boolean what[]) { + byte outgoing[] = new byte[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = what[i] ? (byte)1 : 0; + } + return outgoing; + } + + static final public byte[] parseByte(char what[]) { + byte outgoing[] = new byte[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (byte) what[i]; + } + return outgoing; + } + + static final public byte[] parseByte(int what[]) { + byte outgoing[] = new byte[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (byte) what[i]; + } + return outgoing; + } + + static final public byte[] parseByte(float what[]) { + byte outgoing[] = new byte[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (byte) what[i]; + } + return outgoing; + } + + /* + static final public byte[][] parseByte(String what[]) { // note: array[][] + byte outgoing[][] = new byte[what.length][]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = what[i].getBytes(); + } + return outgoing; + } + */ + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + /* + static final public char parseChar(boolean what) { // 0/1 or T/F ? + return what ? 't' : 'f'; + } + */ + + static final public char parseChar(byte what) { + return (char) (what & 0xff); + } + + static final public char parseChar(int what) { + return (char) what; + } + + /* + static final public char parseChar(float what) { // nonsensical + return (char) what; + } + + static final public char[] parseChar(String what) { // note: array[] + return what.toCharArray(); + } + */ + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + /* + static final public char[] parseChar(boolean what[]) { // 0/1 or T/F ? + char outgoing[] = new char[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = what[i] ? 't' : 'f'; + } + return outgoing; + } + */ + + static final public char[] parseChar(byte what[]) { + char outgoing[] = new char[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (char) (what[i] & 0xff); + } + return outgoing; + } + + static final public char[] parseChar(int what[]) { + char outgoing[] = new char[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (char) what[i]; + } + return outgoing; + } + + /* + static final public char[] parseChar(float what[]) { // nonsensical + char outgoing[] = new char[what.length]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = (char) what[i]; + } + return outgoing; + } + + static final public char[][] parseChar(String what[]) { // note: array[][] + char outgoing[][] = new char[what.length][]; + for (int i = 0; i < what.length; i++) { + outgoing[i] = what[i].toCharArray(); + } + return outgoing; + } + */ + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static final public int parseInt(boolean what) { + return what ? 1 : 0; + } + + /** + * Note that parseInt() will un-sign a signed byte value. + */ + static final public int parseInt(byte what) { + return what & 0xff; + } + + /** + * Note that parseInt('5') is unlike String in the sense that it + * won't return 5, but the ascii value. This is because ((int) someChar) + * returns the ascii value, and parseInt() is just longhand for the cast. + */ + static final public int parseInt(char what) { + return what; + } + + /** + * Same as floor(), or an (int) cast. + */ + static final public int parseInt(float what) { + return (int) what; + } + + /** + * Parse a String into an int value. Returns 0 if the value is bad. + */ + static final public int parseInt(String what) { + return parseInt(what, 0); + } + + /** + * Parse a String to an int, and provide an alternate value that + * should be used when the number is invalid. + */ + static final public int parseInt(String what, int otherwise) { + try { + int offset = what.indexOf('.'); + if (offset == -1) { + return Integer.parseInt(what); + } else { + return Integer.parseInt(what.substring(0, offset)); + } + } catch (NumberFormatException e) { } + return otherwise; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static final public int[] parseInt(boolean what[]) { + int list[] = new int[what.length]; + for (int i = 0; i < what.length; i++) { + list[i] = what[i] ? 1 : 0; + } + return list; + } + + static final public int[] parseInt(byte what[]) { // note this unsigns + int list[] = new int[what.length]; + for (int i = 0; i < what.length; i++) { + list[i] = (what[i] & 0xff); + } + return list; + } + + static final public int[] parseInt(char what[]) { + int list[] = new int[what.length]; + for (int i = 0; i < what.length; i++) { + list[i] = what[i]; + } + return list; + } + + static public int[] parseInt(float what[]) { + int inties[] = new int[what.length]; + for (int i = 0; i < what.length; i++) { + inties[i] = (int)what[i]; + } + return inties; + } + + /** + * Make an array of int elements from an array of String objects. + * If the String can't be parsed as a number, it will be set to zero. + * + * String s[] = { "1", "300", "44" }; + * int numbers[] = parseInt(s); + * + * numbers will contain { 1, 300, 44 } + */ + static public int[] parseInt(String what[]) { + return parseInt(what, 0); + } + + /** + * Make an array of int elements from an array of String objects. + * If the String can't be parsed as a number, its entry in the + * array will be set to the value of the "missing" parameter. + * + * String s[] = { "1", "300", "apple", "44" }; + * int numbers[] = parseInt(s, 9999); + * + * numbers will contain { 1, 300, 9999, 44 } + */ + static public int[] parseInt(String what[], int missing) { + int output[] = new int[what.length]; + for (int i = 0; i < what.length; i++) { + try { + output[i] = Integer.parseInt(what[i]); + } catch (NumberFormatException e) { + output[i] = missing; + } + } + return output; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + /* + static final public float parseFloat(boolean what) { + return what ? 1 : 0; + } + */ + + /** + * Convert an int to a float value. Also handles bytes because of + * Java's rules for upgrading values. + */ + static final public float parseFloat(int what) { // also handles byte + return (float)what; + } + + static final public float parseFloat(String what) { + return parseFloat(what, Float.NaN); + } + + static final public float parseFloat(String what, float otherwise) { + try { + return new Float(what).floatValue(); + } catch (NumberFormatException e) { } + + return otherwise; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + /* + static final public float[] parseFloat(boolean what[]) { + float floaties[] = new float[what.length]; + for (int i = 0; i < what.length; i++) { + floaties[i] = what[i] ? 1 : 0; + } + return floaties; + } + + static final public float[] parseFloat(char what[]) { + float floaties[] = new float[what.length]; + for (int i = 0; i < what.length; i++) { + floaties[i] = (char) what[i]; + } + return floaties; + } + */ + + static final public float[] parseByte(byte what[]) { + float floaties[] = new float[what.length]; + for (int i = 0; i < what.length; i++) { + floaties[i] = what[i]; + } + return floaties; + } + + static final public float[] parseFloat(int what[]) { + float floaties[] = new float[what.length]; + for (int i = 0; i < what.length; i++) { + floaties[i] = what[i]; + } + return floaties; + } + + static final public float[] parseFloat(String what[]) { + return parseFloat(what, Float.NaN); + } + + static final public float[] parseFloat(String what[], float missing) { + float output[] = new float[what.length]; + for (int i = 0; i < what.length; i++) { + try { + output[i] = new Float(what[i]).floatValue(); + } catch (NumberFormatException e) { + output[i] = missing; + } + } + return output; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static final public String str(boolean x) { + return String.valueOf(x); + } + + static final public String str(byte x) { + return String.valueOf(x); + } + + static final public String str(char x) { + return String.valueOf(x); + } + + static final public String str(int x) { + return String.valueOf(x); + } + + static final public String str(float x) { + return String.valueOf(x); + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + static final public String[] str(boolean x[]) { + String s[] = new String[x.length]; + for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]); + return s; + } + + static final public String[] str(byte x[]) { + String s[] = new String[x.length]; + for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]); + return s; + } + + static final public String[] str(char x[]) { + String s[] = new String[x.length]; + for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]); + return s; + } + + static final public String[] str(int x[]) { + String s[] = new String[x.length]; + for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]); + return s; + } + + static final public String[] str(float x[]) { + String s[] = new String[x.length]; + for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x[i]); + return s; + } + + + ////////////////////////////////////////////////////////////// + + // INT NUMBER FORMATTING + + + /** + * Integer number formatter. + */ + static private NumberFormat int_nf; + static private int int_nf_digits; + static private boolean int_nf_commas; + + + static public String[] nf(int num[], int digits) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nf(num[i], digits); + } + return formatted; + } + + + static public String nf(int num, int digits) { + if ((int_nf != null) && + (int_nf_digits == digits) && + !int_nf_commas) { + return int_nf.format(num); + } + + int_nf = NumberFormat.getInstance(); + int_nf.setGroupingUsed(false); // no commas + int_nf_commas = false; + int_nf.setMinimumIntegerDigits(digits); + int_nf_digits = digits; + return int_nf.format(num); + } + + + static public String[] nfc(int num[]) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nfc(num[i]); + } + return formatted; + } + + + static public String nfc(int num) { + if ((int_nf != null) && + (int_nf_digits == 0) && + int_nf_commas) { + return int_nf.format(num); + } + + int_nf = NumberFormat.getInstance(); + int_nf.setGroupingUsed(true); + int_nf_commas = true; + int_nf.setMinimumIntegerDigits(0); + int_nf_digits = 0; + return int_nf.format(num); + } + + + /** + * number format signed (or space) + * Formats a number but leaves a blank space in the front + * when it's positive so that it can be properly aligned with + * numbers that have a negative sign in front of them. + */ + static public String nfs(int num, int digits) { + return (num < 0) ? nf(num, digits) : (' ' + nf(num, digits)); + } + + static public String[] nfs(int num[], int digits) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nfs(num[i], digits); + } + return formatted; + } + + // + + /** + * number format positive (or plus) + * Formats a number, always placing a - or + sign + * in the front when it's negative or positive. + */ + static public String nfp(int num, int digits) { + return (num < 0) ? nf(num, digits) : ('+' + nf(num, digits)); + } + + static public String[] nfp(int num[], int digits) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nfp(num[i], digits); + } + return formatted; + } + + + + ////////////////////////////////////////////////////////////// + + // FLOAT NUMBER FORMATTING + + + static private NumberFormat float_nf; + static private int float_nf_left, float_nf_right; + static private boolean float_nf_commas; + + + static public String[] nf(float num[], int left, int right) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nf(num[i], left, right); + } + return formatted; + } + + + static public String nf(float num, int left, int right) { + if ((float_nf != null) && + (float_nf_left == left) && + (float_nf_right == right) && + !float_nf_commas) { + return float_nf.format(num); + } + + float_nf = NumberFormat.getInstance(); + float_nf.setGroupingUsed(false); + float_nf_commas = false; + + if (left != 0) float_nf.setMinimumIntegerDigits(left); + if (right != 0) { + float_nf.setMinimumFractionDigits(right); + float_nf.setMaximumFractionDigits(right); + } + float_nf_left = left; + float_nf_right = right; + return float_nf.format(num); + } + + + static public String[] nfc(float num[], int right) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nfc(num[i], right); + } + return formatted; + } + + + static public String nfc(float num, int right) { + if ((float_nf != null) && + (float_nf_left == 0) && + (float_nf_right == right) && + float_nf_commas) { + return float_nf.format(num); + } + + float_nf = NumberFormat.getInstance(); + float_nf.setGroupingUsed(true); + float_nf_commas = true; + + if (right != 0) { + float_nf.setMinimumFractionDigits(right); + float_nf.setMaximumFractionDigits(right); + } + float_nf_left = 0; + float_nf_right = right; + return float_nf.format(num); + } + + + /** + * Number formatter that takes into account whether the number + * has a sign (positive, negative, etc) in front of it. + */ + static public String[] nfs(float num[], int left, int right) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nfs(num[i], left, right); + } + return formatted; + } + + static public String nfs(float num, int left, int right) { + return (num < 0) ? nf(num, left, right) : (' ' + nf(num, left, right)); + } + + + static public String[] nfp(float num[], int left, int right) { + String formatted[] = new String[num.length]; + for (int i = 0; i < formatted.length; i++) { + formatted[i] = nfp(num[i], left, right); + } + return formatted; + } + + static public String nfp(float num, int left, int right) { + return (num < 0) ? nf(num, left, right) : ('+' + nf(num, left, right)); + } + + + + ////////////////////////////////////////////////////////////// + + // HEX/BINARY CONVERSION + + + static final public String hex(byte what) { + return hex(what, 2); + } + + static final public String hex(char what) { + return hex(what, 4); + } + + static final public String hex(int what) { + return hex(what, 8); + } + + static final public String hex(int what, int digits) { + String stuff = Integer.toHexString(what).toUpperCase(); + + int length = stuff.length(); + if (length > digits) { + return stuff.substring(length - digits); + + } else if (length < digits) { + return "00000000".substring(8 - (digits-length)) + stuff; + } + return stuff; + } + + static final public int unhex(String what) { + // has to parse as a Long so that it'll work for numbers bigger than 2^31 + return (int) (Long.parseLong(what, 16)); + } + + // + + /** + * Returns a String that contains the binary value of a byte. + * The returned value will always have 8 digits. + */ + static final public String binary(byte what) { + return binary(what, 8); + } + + /** + * Returns a String that contains the binary value of a char. + * The returned value will always have 16 digits because chars + * are two bytes long. + */ + static final public String binary(char what) { + return binary(what, 16); + } + + /** + * Returns a String that contains the binary value of an int. + * The length depends on the size of the number itself. + * An int can be up to 32 binary digits, but that seems like + * overkill for almost any situation, so this function just + * auto-size. If you want a specific number of digits (like all 32) + * use binary(int what, int digits) to specify how many digits. + */ + static final public String binary(int what) { + return Integer.toBinaryString(what); + //return binary(what, 32); + } + + /** + * Returns a String that contains the binary value of an int. + * The digits parameter determines how many digits will be used. + */ + static final public String binary(int what, int digits) { + String stuff = Integer.toBinaryString(what); + + int length = stuff.length(); + if (length > digits) { + return stuff.substring(length - digits); + + } else if (length < digits) { + int offset = 32 - (digits-length); + return "00000000000000000000000000000000".substring(offset) + stuff; + } + return stuff; + } + + + /** + * Unpack a binary String into an int. + * i.e. unbinary("00001000") would return 8. + */ + static final public int unbinary(String what) { + return Integer.parseInt(what, 2); + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR FUNCTIONS + + // moved here so that they can work without + // the graphics actually being instantiated (outside setup) + + + public final int color(int gray) { + if (g == null) { + if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + return 0xff000000 | (gray << 16) | (gray << 8) | gray; + } + return g.color(gray); + } + + + public final int color(float fgray) { + if (g == null) { + int gray = (int) fgray; + if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + return 0xff000000 | (gray << 16) | (gray << 8) | gray; + } + return g.color(fgray); + } + + + /** + * As of 0116 this also takes color(#FF8800, alpha) + */ + public final int color(int gray, int alpha) { + if (g == null) { + if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0; + if (gray > 255) { + // then assume this is actually a #FF8800 + return (alpha << 24) | (gray & 0xFFFFFF); + } else { + //if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + return (alpha << 24) | (gray << 16) | (gray << 8) | gray; + } + } + return g.color(gray, alpha); + } + + + public final int color(float fgray, float falpha) { + if (g == null) { + int gray = (int) fgray; + int alpha = (int) falpha; + if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0; + return 0xff000000 | (gray << 16) | (gray << 8) | gray; + } + return g.color(fgray, falpha); + } + + + public final int color(int x, int y, int z) { + if (g == null) { + if (x > 255) x = 255; else if (x < 0) x = 0; + if (y > 255) y = 255; else if (y < 0) y = 0; + if (z > 255) z = 255; else if (z < 0) z = 0; + + return 0xff000000 | (x << 16) | (y << 8) | z; + } + return g.color(x, y, z); + } + + + public final int color(float x, float y, float z) { + if (g == null) { + if (x > 255) x = 255; else if (x < 0) x = 0; + if (y > 255) y = 255; else if (y < 0) y = 0; + if (z > 255) z = 255; else if (z < 0) z = 0; + + return 0xff000000 | ((int)x << 16) | ((int)y << 8) | (int)z; + } + return g.color(x, y, z); + } + + + public final int color(int x, int y, int z, int a) { + if (g == null) { + if (a > 255) a = 255; else if (a < 0) a = 0; + if (x > 255) x = 255; else if (x < 0) x = 0; + if (y > 255) y = 255; else if (y < 0) y = 0; + if (z > 255) z = 255; else if (z < 0) z = 0; + + return (a << 24) | (x << 16) | (y << 8) | z; + } + return g.color(x, y, z, a); + } + + + public final int color(float x, float y, float z, float a) { + if (g == null) { + if (a > 255) a = 255; else if (a < 0) a = 0; + if (x > 255) x = 255; else if (x < 0) x = 0; + if (y > 255) y = 255; else if (y < 0) y = 0; + if (z > 255) z = 255; else if (z < 0) z = 0; + + return ((int)a << 24) | ((int)x << 16) | ((int)y << 8) | (int)z; + } + return g.color(x, y, z, a); + } + + + + ////////////////////////////////////////////////////////////// + + // MAIN + + + /** + * Set this sketch to communicate its state back to the PDE. + *

+ * This uses the stderr stream to write positions of the window + * (so that it will be saved by the PDE for the next run) and + * notify on quit. See more notes in the Worker class. + */ + public void setupExternalMessages() { + + frame.addComponentListener(new ComponentAdapter() { + public void componentMoved(ComponentEvent e) { + Point where = ((Frame) e.getSource()).getLocation(); + System.err.println(PApplet.EXTERNAL_MOVE + " " + + where.x + " " + where.y); + System.err.flush(); // doesn't seem to help or hurt + } + }); + + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { +// System.err.println(PApplet.EXTERNAL_QUIT); +// System.err.flush(); // important +// System.exit(0); + exit(); // don't quit, need to just shut everything down (0133) + } + }); + } + + + /** + * Set up a listener that will fire proper component resize events + * in cases where frame.setResizable(true) is called. + */ + public void setupFrameResizeListener() { + frame.addComponentListener(new ComponentAdapter() { + + public void componentResized(ComponentEvent e) { + // Ignore bad resize events fired during setup to fix + // http://dev.processing.org/bugs/show_bug.cgi?id=341 + // This should also fix the blank screen on Linux bug + // http://dev.processing.org/bugs/show_bug.cgi?id=282 + if (frame.isResizable()) { + // might be multiple resize calls before visible (i.e. first + // when pack() is called, then when it's resized for use). + // ignore them because it's not the user resizing things. + Frame farm = (Frame) e.getComponent(); + if (farm.isVisible()) { + Insets insets = farm.getInsets(); + Dimension windowSize = farm.getSize(); + int usableW = windowSize.width - insets.left - insets.right; + int usableH = windowSize.height - insets.top - insets.bottom; + + // the ComponentListener in PApplet will handle calling size() + setBounds(insets.left, insets.top, usableW, usableH); + } + } + } + }); + } + + + /** + * GIF image of the Processing logo. + */ + static public final byte[] ICON_IMAGE = { + 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -77, 0, 0, 0, 0, 0, -1, -1, -1, 12, + 12, 13, -15, -15, -14, 45, 57, 74, 54, 80, 111, 47, 71, 97, 62, 88, 117, + 1, 14, 27, 7, 41, 73, 15, 52, 85, 2, 31, 55, 4, 54, 94, 18, 69, 109, 37, + 87, 126, -1, -1, -1, 33, -7, 4, 1, 0, 0, 15, 0, 44, 0, 0, 0, 0, 16, 0, 16, + 0, 0, 4, 122, -16, -107, 114, -86, -67, 83, 30, -42, 26, -17, -100, -45, + 56, -57, -108, 48, 40, 122, -90, 104, 67, -91, -51, 32, -53, 77, -78, -100, + 47, -86, 12, 76, -110, -20, -74, -101, 97, -93, 27, 40, 20, -65, 65, 48, + -111, 99, -20, -112, -117, -123, -47, -105, 24, 114, -112, 74, 69, 84, 25, + 93, 88, -75, 9, 46, 2, 49, 88, -116, -67, 7, -19, -83, 60, 38, 3, -34, 2, + 66, -95, 27, -98, 13, 4, -17, 55, 33, 109, 11, 11, -2, -128, 121, 123, 62, + 91, 120, -128, 127, 122, 115, 102, 2, 119, 0, -116, -113, -119, 6, 102, + 121, -108, -126, 5, 18, 6, 4, -102, -101, -100, 114, 15, 17, 0, 59 + }; + + + /** + * main() method for running this class from the command line. + *

+ * The options shown here are not yet finalized and will be + * changing over the next several releases. + *

+ * The simplest way to turn and applet into an application is to + * add the following code to your program: + *

static public void main(String args[]) {
+   *   PApplet.main(new String[] { "YourSketchName" });
+   * }
+ * This will properly launch your applet from a double-clickable + * .jar or from the command line. + *
+   * Parameters useful for launching or also used by the PDE:
+   *
+   * --location=x,y        upper-lefthand corner of where the applet
+   *                       should appear on screen. if not used,
+   *                       the default is to center on the main screen.
+   *
+   * --present             put the applet into full screen presentation
+   *                       mode. requires java 1.4 or later.
+   *                       
+   * --exclusive           use full screen exclusive mode when presenting.
+   *                       disables new windows or interaction with other 
+   *                       monitors, this is like a "game" mode.
+   *
+   * --hide-stop           use to hide the stop button in situations where
+   *                       you don't want to allow users to exit. also
+   *                       see the FAQ on information for capturing the ESC
+   *                       key when running in presentation mode.
+   *
+   * --stop-color=#xxxxxx  color of the 'stop' text used to quit an
+   *                       sketch when it's in present mode.
+   *
+   * --bgcolor=#xxxxxx     background color of the window.
+   *
+   * --sketch-path         location of where to save files from functions
+   *                       like saveStrings() or saveFrame(). defaults to
+   *                       the folder that the java application was
+   *                       launched from, which means if this isn't set by
+   *                       the pde, everything goes into the same folder
+   *                       as processing.exe.
+   *
+   * --display=n           set what display should be used by this applet.
+   *                       displays are numbered starting from 1.
+   *
+   * Parameters used by Processing when running via the PDE
+   *
+   * --external            set when the applet is being used by the PDE
+   *
+   * --editor-location=x,y position of the upper-lefthand corner of the
+   *                       editor window, for placement of applet window
+   * 
+ */ + static public void main(String args[]) { + // Disable abyssmally slow Sun renderer on OS X 10.5. + if (platform == MACOSX) { + // Only run this on OS X otherwise it can cause a permissions error. + // http://dev.processing.org/bugs/show_bug.cgi?id=976 + System.setProperty("apple.awt.graphics.UseQuartz", "true"); + } + + // This doesn't do anything. +// if (platform == WINDOWS) { +// // For now, disable the D3D renderer on Java 6u10 because +// // it causes problems with Present mode. +// // http://dev.processing.org/bugs/show_bug.cgi?id=1009 +// System.setProperty("sun.java2d.d3d", "false"); +// } + + if (args.length < 1) { + System.err.println("Usage: PApplet "); + System.err.println("For additional options, " + + "see the Javadoc for PApplet"); + System.exit(1); + } + + try { + boolean external = false; + int[] location = null; + int[] editorLocation = null; + + String name = null; + boolean present = false; + boolean exclusive = false; + Color backgroundColor = Color.BLACK; + Color stopColor = Color.GRAY; + GraphicsDevice displayDevice = null; + boolean hideStop = false; + + String param = null, value = null; + + // try to get the user folder. if running under java web start, + // this may cause a security exception if the code is not signed. + // http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Integrate;action=display;num=1159386274 + String folder = null; + try { + folder = System.getProperty("user.dir"); + } catch (Exception e) { } + + int argIndex = 0; + while (argIndex < args.length) { + int equals = args[argIndex].indexOf('='); + if (equals != -1) { + param = args[argIndex].substring(0, equals); + value = args[argIndex].substring(equals + 1); + + if (param.equals(ARGS_EDITOR_LOCATION)) { + external = true; + editorLocation = parseInt(split(value, ',')); + + } else if (param.equals(ARGS_DISPLAY)) { + int deviceIndex = Integer.parseInt(value) - 1; + + //DisplayMode dm = device.getDisplayMode(); + //if ((dm.getWidth() == 1024) && (dm.getHeight() == 768)) { + + GraphicsEnvironment environment = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice devices[] = environment.getScreenDevices(); + if ((deviceIndex >= 0) && (deviceIndex < devices.length)) { + displayDevice = devices[deviceIndex]; + } else { + System.err.println("Display " + value + " does not exist, " + + "using the default display instead."); + } + + } else if (param.equals(ARGS_BGCOLOR)) { + if (value.charAt(0) == '#') value = value.substring(1); + backgroundColor = new Color(Integer.parseInt(value, 16)); + + } else if (param.equals(ARGS_STOP_COLOR)) { + if (value.charAt(0) == '#') value = value.substring(1); + stopColor = new Color(Integer.parseInt(value, 16)); + + } else if (param.equals(ARGS_SKETCH_FOLDER)) { + folder = value; + + } else if (param.equals(ARGS_LOCATION)) { + location = parseInt(split(value, ',')); + } + + } else { + if (args[argIndex].equals(ARGS_PRESENT)) { + present = true; + + } else if (args[argIndex].equals(ARGS_EXCLUSIVE)) { + exclusive = true; + + } else if (args[argIndex].equals(ARGS_HIDE_STOP)) { + hideStop = true; + + } else if (args[argIndex].equals(ARGS_EXTERNAL)) { + external = true; + + } else { + name = args[argIndex]; + break; + } + } + argIndex++; + } + + // Set this property before getting into any GUI init code + //System.setProperty("com.apple.mrj.application.apple.menu.about.name", name); + // This )*)(*@#$ Apple crap don't work no matter where you put it + // (static method of the class, at the top of main, wherever) + + if (displayDevice == null) { + GraphicsEnvironment environment = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + displayDevice = environment.getDefaultScreenDevice(); + } + + Frame frame = new Frame(displayDevice.getDefaultConfiguration()); + /* + Frame frame = null; + if (displayDevice != null) { + frame = new Frame(displayDevice.getDefaultConfiguration()); + } else { + frame = new Frame(); + } + */ + //Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + + // remove the grow box by default + // users who want it back can call frame.setResizable(true) + frame.setResizable(false); + + // Set the trimmings around the image + Image image = Toolkit.getDefaultToolkit().createImage(ICON_IMAGE); + frame.setIconImage(image); + frame.setTitle(name); + +// Class c = Class.forName(name); + Class c = Thread.currentThread().getContextClassLoader().loadClass(name); + final PApplet applet = (PApplet) c.newInstance(); + + // these are needed before init/start + applet.frame = frame; + applet.sketchPath = folder; + applet.args = PApplet.subset(args, 1); + applet.external = external; + + // Need to save the window bounds at full screen, + // because pack() will cause the bounds to go to zero. + // http://dev.processing.org/bugs/show_bug.cgi?id=923 + Rectangle fullScreenRect = null; + + // For 0149, moving this code (up to the pack() method) before init(). + // For OpenGL (and perhaps other renderers in the future), a peer is + // needed before a GLDrawable can be created. So pack() needs to be + // called on the Frame before applet.init(), which itself calls size(), + // and launches the Thread that will kick off setup(). + // http://dev.processing.org/bugs/show_bug.cgi?id=891 + // http://dev.processing.org/bugs/show_bug.cgi?id=908 + if (present) { + frame.setUndecorated(true); + frame.setBackground(backgroundColor); + if (exclusive) { + displayDevice.setFullScreenWindow(frame); + fullScreenRect = frame.getBounds(); + } else { + DisplayMode mode = displayDevice.getDisplayMode(); + fullScreenRect = new Rectangle(0, 0, mode.getWidth(), mode.getHeight()); + frame.setBounds(fullScreenRect); + frame.setVisible(true); + } + } + frame.setLayout(null); + frame.add(applet); + if (present) { + frame.invalidate(); + } else { + frame.pack(); + } + // insufficient, places the 100x100 sketches offset strangely + //frame.validate(); + + applet.init(); + + // Wait until the applet has figured out its width. + // In a static mode app, this will be after setup() has completed, + // and the empty draw() has set "finished" to true. + // TODO make sure this won't hang if the applet has an exception. + while (applet.defaultSize && !applet.finished) { + //System.out.println("default size"); + try { + Thread.sleep(5); + + } catch (InterruptedException e) { + //System.out.println("interrupt"); + } + } + //println("not default size " + applet.width + " " + applet.height); + //println(" (g width/height is " + applet.g.width + "x" + applet.g.height + ")"); + + if (present) { + // After the pack(), the screen bounds are gonna be 0s + frame.setBounds(fullScreenRect); + applet.setBounds((fullScreenRect.width - applet.width) / 2, + (fullScreenRect.height - applet.height) / 2, + applet.width, applet.height); + + if (!hideStop) { + Label label = new Label("stop"); + label.setForeground(stopColor); + label.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + System.exit(0); + } + }); + frame.add(label); + + Dimension labelSize = label.getPreferredSize(); + // sometimes shows up truncated on mac + //System.out.println("label width is " + labelSize.width); + labelSize = new Dimension(100, labelSize.height); + label.setSize(labelSize); + label.setLocation(20, fullScreenRect.height - labelSize.height - 20); + } + + // not always running externally when in present mode + if (external) { + applet.setupExternalMessages(); + } + + } else { // if not presenting + // can't do pack earlier cuz present mode don't like it + // (can't go full screen with a frame after calling pack) +// frame.pack(); // get insets. get more. + Insets insets = frame.getInsets(); + + int windowW = Math.max(applet.width, MIN_WINDOW_WIDTH) + + insets.left + insets.right; + int windowH = Math.max(applet.height, MIN_WINDOW_HEIGHT) + + insets.top + insets.bottom; + + frame.setSize(windowW, windowH); + + if (location != null) { + // a specific location was received from PdeRuntime + // (applet has been run more than once, user placed window) + frame.setLocation(location[0], location[1]); + + } else if (external) { + int locationX = editorLocation[0] - 20; + int locationY = editorLocation[1]; + + if (locationX - windowW > 10) { + // if it fits to the left of the window + frame.setLocation(locationX - windowW, locationY); + + } else { // doesn't fit + // if it fits inside the editor window, + // offset slightly from upper lefthand corner + // so that it's plunked inside the text area + locationX = editorLocation[0] + 66; + locationY = editorLocation[1] + 66; + + if ((locationX + windowW > applet.screen.width - 33) || + (locationY + windowH > applet.screen.height - 33)) { + // otherwise center on screen + locationX = (applet.screen.width - windowW) / 2; + locationY = (applet.screen.height - windowH) / 2; + } + frame.setLocation(locationX, locationY); + } + } else { // just center on screen + frame.setLocation((applet.screen.width - applet.width) / 2, + (applet.screen.height - applet.height) / 2); + } + +// frame.setLayout(null); +// frame.add(applet); + + if (backgroundColor == Color.black) { //BLACK) { + // this means no bg color unless specified + backgroundColor = SystemColor.control; + } + frame.setBackground(backgroundColor); + + int usableWindowH = windowH - insets.top - insets.bottom; + applet.setBounds((windowW - applet.width)/2, + insets.top + (usableWindowH - applet.height)/2, + applet.width, applet.height); + + if (external) { + applet.setupExternalMessages(); + + } else { // !external + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + } + + // handle frame resizing events + applet.setupFrameResizeListener(); + + // all set for rockin + if (applet.displayable()) { + frame.setVisible(true); + } + } + + applet.requestFocus(); // ask for keydowns + //System.out.println("exiting main()"); + + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Begin recording to a new renderer of the specified type, using the width + * and height of the main drawing surface. + */ + public PGraphics beginRecord(String renderer, String filename) { + filename = insertFrame(filename); + PGraphics rec = createGraphics(width, height, renderer, filename); + beginRecord(rec); + return rec; + } + + + /** + * Begin recording (echoing) commands to the specified PGraphics object. + */ + public void beginRecord(PGraphics recorder) { + this.recorder = recorder; + recorder.beginDraw(); + } + + + public void endRecord() { + if (recorder != null) { + recorder.endDraw(); + recorder.dispose(); + recorder = null; + } + } + + + /** + * Begin recording raw shape data to a renderer of the specified type, + * using the width and height of the main drawing surface. + * + * If hashmarks (###) are found in the filename, they'll be replaced + * by the current frame number (frameCount). + */ + public PGraphics beginRaw(String renderer, String filename) { + filename = insertFrame(filename); + PGraphics rec = createGraphics(width, height, renderer, filename); + g.beginRaw(rec); + return rec; + } + + + /** + * Begin recording raw shape data to the specified renderer. + * + * This simply echoes to g.beginRaw(), but since is placed here (rather than + * generated by preproc.pl) for clarity and so that it doesn't echo the + * command should beginRecord() be in use. + */ + public void beginRaw(PGraphics rawGraphics) { + g.beginRaw(rawGraphics); + } + + + /** + * Stop recording raw shape data to the specified renderer. + * + * This simply echoes to g.beginRaw(), but since is placed here (rather than + * generated by preproc.pl) for clarity and so that it doesn't echo the + * command should beginRecord() be in use. + */ + public void endRaw() { + g.endRaw(); + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Override the g.pixels[] function to set the pixels[] array + * that's part of the PApplet object. Allows the use of + * pixels[] in the code, rather than g.pixels[]. + */ + public void loadPixels() { + g.loadPixels(); + pixels = g.pixels; + } + + + public void updatePixels() { + g.updatePixels(); + } + + + public void updatePixels(int x1, int y1, int x2, int y2) { + g.updatePixels(x1, y1, x2, y2); + } + + + ////////////////////////////////////////////////////////////// + + // everything below this line is automatically generated. no touch. + // public functions for processing.core + + + public void flush() { + if (recorder != null) recorder.flush(); + g.flush(); + } + + + public void hint(int which) { + if (recorder != null) recorder.hint(which); + g.hint(which); + } + + + public void beginShape() { + if (recorder != null) recorder.beginShape(); + g.beginShape(); + } + + + public void beginShape(int kind) { + if (recorder != null) recorder.beginShape(kind); + g.beginShape(kind); + } + + + public void edge(boolean edge) { + if (recorder != null) recorder.edge(edge); + g.edge(edge); + } + + + public void normal(float nx, float ny, float nz) { + if (recorder != null) recorder.normal(nx, ny, nz); + g.normal(nx, ny, nz); + } + + + public void textureMode(int mode) { + if (recorder != null) recorder.textureMode(mode); + g.textureMode(mode); + } + + + public void texture(PImage image) { + if (recorder != null) recorder.texture(image); + g.texture(image); + } + + + public void vertex(float x, float y) { + if (recorder != null) recorder.vertex(x, y); + g.vertex(x, y); + } + + + public void vertex(float x, float y, float z) { + if (recorder != null) recorder.vertex(x, y, z); + g.vertex(x, y, z); + } + + + public void vertex(float[] v) { + if (recorder != null) recorder.vertex(v); + g.vertex(v); + } + + + public void vertex(float x, float y, float u, float v) { + if (recorder != null) recorder.vertex(x, y, u, v); + g.vertex(x, y, u, v); + } + + + public void vertex(float x, float y, float z, float u, float v) { + if (recorder != null) recorder.vertex(x, y, z, u, v); + g.vertex(x, y, z, u, v); + } + + + public void breakShape() { + if (recorder != null) recorder.breakShape(); + g.breakShape(); + } + + + public void endShape() { + if (recorder != null) recorder.endShape(); + g.endShape(); + } + + + public void endShape(int mode) { + if (recorder != null) recorder.endShape(mode); + g.endShape(mode); + } + + + public void bezierVertex(float x2, float y2, + float x3, float y3, + float x4, float y4) { + if (recorder != null) recorder.bezierVertex(x2, y2, x3, y3, x4, y4); + g.bezierVertex(x2, y2, x3, y3, x4, y4); + } + + + public void bezierVertex(float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + if (recorder != null) recorder.bezierVertex(x2, y2, z2, x3, y3, z3, x4, y4, z4); + g.bezierVertex(x2, y2, z2, x3, y3, z3, x4, y4, z4); + } + + + public void curveVertex(float x, float y) { + if (recorder != null) recorder.curveVertex(x, y); + g.curveVertex(x, y); + } + + + public void curveVertex(float x, float y, float z) { + if (recorder != null) recorder.curveVertex(x, y, z); + g.curveVertex(x, y, z); + } + + + public void point(float x, float y) { + if (recorder != null) recorder.point(x, y); + g.point(x, y); + } + + + public void point(float x, float y, float z) { + if (recorder != null) recorder.point(x, y, z); + g.point(x, y, z); + } + + + public void line(float x1, float y1, float x2, float y2) { + if (recorder != null) recorder.line(x1, y1, x2, y2); + g.line(x1, y1, x2, y2); + } + + + public void line(float x1, float y1, float z1, + float x2, float y2, float z2) { + if (recorder != null) recorder.line(x1, y1, z1, x2, y2, z2); + g.line(x1, y1, z1, x2, y2, z2); + } + + + public void triangle(float x1, float y1, float x2, float y2, + float x3, float y3) { + if (recorder != null) recorder.triangle(x1, y1, x2, y2, x3, y3); + g.triangle(x1, y1, x2, y2, x3, y3); + } + + + public void quad(float x1, float y1, float x2, float y2, + float x3, float y3, float x4, float y4) { + if (recorder != null) recorder.quad(x1, y1, x2, y2, x3, y3, x4, y4); + g.quad(x1, y1, x2, y2, x3, y3, x4, y4); + } + + + public void rectMode(int mode) { + if (recorder != null) recorder.rectMode(mode); + g.rectMode(mode); + } + + + public void rect(float a, float b, float c, float d) { + if (recorder != null) recorder.rect(a, b, c, d); + g.rect(a, b, c, d); + } + + + public void ellipseMode(int mode) { + if (recorder != null) recorder.ellipseMode(mode); + g.ellipseMode(mode); + } + + + public void ellipse(float a, float b, float c, float d) { + if (recorder != null) recorder.ellipse(a, b, c, d); + g.ellipse(a, b, c, d); + } + + + public void arc(float a, float b, float c, float d, + float start, float stop) { + if (recorder != null) recorder.arc(a, b, c, d, start, stop); + g.arc(a, b, c, d, start, stop); + } + + + public void box(float size) { + if (recorder != null) recorder.box(size); + g.box(size); + } + + + public void box(float w, float h, float d) { + if (recorder != null) recorder.box(w, h, d); + g.box(w, h, d); + } + + + public void sphereDetail(int res) { + if (recorder != null) recorder.sphereDetail(res); + g.sphereDetail(res); + } + + + public void sphereDetail(int ures, int vres) { + if (recorder != null) recorder.sphereDetail(ures, vres); + g.sphereDetail(ures, vres); + } + + + public void sphere(float r) { + if (recorder != null) recorder.sphere(r); + g.sphere(r); + } + + + public float bezierPoint(float a, float b, float c, float d, float t) { + return g.bezierPoint(a, b, c, d, t); + } + + + public float bezierTangent(float a, float b, float c, float d, float t) { + return g.bezierTangent(a, b, c, d, t); + } + + + public void bezierDetail(int detail) { + if (recorder != null) recorder.bezierDetail(detail); + g.bezierDetail(detail); + } + + + public void bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + if (recorder != null) recorder.bezier(x1, y1, x2, y2, x3, y3, x4, y4); + g.bezier(x1, y1, x2, y2, x3, y3, x4, y4); + } + + + public void bezier(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + if (recorder != null) recorder.bezier(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4); + g.bezier(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4); + } + + + public float curvePoint(float a, float b, float c, float d, float t) { + return g.curvePoint(a, b, c, d, t); + } + + + public float curveTangent(float a, float b, float c, float d, float t) { + return g.curveTangent(a, b, c, d, t); + } + + + public void curveDetail(int detail) { + if (recorder != null) recorder.curveDetail(detail); + g.curveDetail(detail); + } + + + public void curveTightness(float tightness) { + if (recorder != null) recorder.curveTightness(tightness); + g.curveTightness(tightness); + } + + + public void curve(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + if (recorder != null) recorder.curve(x1, y1, x2, y2, x3, y3, x4, y4); + g.curve(x1, y1, x2, y2, x3, y3, x4, y4); + } + + + public void curve(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + if (recorder != null) recorder.curve(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4); + g.curve(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4); + } + + + public void smooth() { + if (recorder != null) recorder.smooth(); + g.smooth(); + } + + + public void noSmooth() { + if (recorder != null) recorder.noSmooth(); + g.noSmooth(); + } + + + public void imageMode(int mode) { + if (recorder != null) recorder.imageMode(mode); + g.imageMode(mode); + } + + + public void image(PImage image, float x, float y) { + if (recorder != null) recorder.image(image, x, y); + g.image(image, x, y); + } + + + public void image(PImage image, float x, float y, float c, float d) { + if (recorder != null) recorder.image(image, x, y, c, d); + g.image(image, x, y, c, d); + } + + + public void image(PImage image, + float a, float b, float c, float d, + int u1, int v1, int u2, int v2) { + if (recorder != null) recorder.image(image, a, b, c, d, u1, v1, u2, v2); + g.image(image, a, b, c, d, u1, v1, u2, v2); + } + + + public void shapeMode(int mode) { + if (recorder != null) recorder.shapeMode(mode); + g.shapeMode(mode); + } + + + public void shape(PShape shape) { + if (recorder != null) recorder.shape(shape); + g.shape(shape); + } + + + public void shape(PShape shape, float x, float y) { + if (recorder != null) recorder.shape(shape, x, y); + g.shape(shape, x, y); + } + + + public void shape(PShape shape, float x, float y, float c, float d) { + if (recorder != null) recorder.shape(shape, x, y, c, d); + g.shape(shape, x, y, c, d); + } + + + public void textAlign(int align) { + if (recorder != null) recorder.textAlign(align); + g.textAlign(align); + } + + + public void textAlign(int alignX, int alignY) { + if (recorder != null) recorder.textAlign(alignX, alignY); + g.textAlign(alignX, alignY); + } + + + public float textAscent() { + return g.textAscent(); + } + + + public float textDescent() { + return g.textDescent(); + } + + + public void textFont(PFont which) { + if (recorder != null) recorder.textFont(which); + g.textFont(which); + } + + + public void textFont(PFont which, float size) { + if (recorder != null) recorder.textFont(which, size); + g.textFont(which, size); + } + + + public void textLeading(float leading) { + if (recorder != null) recorder.textLeading(leading); + g.textLeading(leading); + } + + + public void textMode(int mode) { + if (recorder != null) recorder.textMode(mode); + g.textMode(mode); + } + + + public void textSize(float size) { + if (recorder != null) recorder.textSize(size); + g.textSize(size); + } + + + public float textWidth(char c) { + return g.textWidth(c); + } + + + public float textWidth(String str) { + return g.textWidth(str); + } + + + public void text(char c) { + if (recorder != null) recorder.text(c); + g.text(c); + } + + + public void text(char c, float x, float y) { + if (recorder != null) recorder.text(c, x, y); + g.text(c, x, y); + } + + + public void text(char c, float x, float y, float z) { + if (recorder != null) recorder.text(c, x, y, z); + g.text(c, x, y, z); + } + + + public void text(String str) { + if (recorder != null) recorder.text(str); + g.text(str); + } + + + public void text(String str, float x, float y) { + if (recorder != null) recorder.text(str, x, y); + g.text(str, x, y); + } + + + public void text(char[] chars, int start, int stop, float x, float y) { + if (recorder != null) recorder.text(chars, start, stop, x, y); + g.text(chars, start, stop, x, y); + } + + + public void text(String str, float x, float y, float z) { + if (recorder != null) recorder.text(str, x, y, z); + g.text(str, x, y, z); + } + + + public void text(char[] chars, int start, int stop, + float x, float y, float z) { + if (recorder != null) recorder.text(chars, start, stop, x, y, z); + g.text(chars, start, stop, x, y, z); + } + + + public void text(String str, float x1, float y1, float x2, float y2) { + if (recorder != null) recorder.text(str, x1, y1, x2, y2); + g.text(str, x1, y1, x2, y2); + } + + + public void text(String s, float x1, float y1, float x2, float y2, float z) { + if (recorder != null) recorder.text(s, x1, y1, x2, y2, z); + g.text(s, x1, y1, x2, y2, z); + } + + + public void text(int num, float x, float y) { + if (recorder != null) recorder.text(num, x, y); + g.text(num, x, y); + } + + + public void text(int num, float x, float y, float z) { + if (recorder != null) recorder.text(num, x, y, z); + g.text(num, x, y, z); + } + + + public void text(float num, float x, float y) { + if (recorder != null) recorder.text(num, x, y); + g.text(num, x, y); + } + + + public void text(float num, float x, float y, float z) { + if (recorder != null) recorder.text(num, x, y, z); + g.text(num, x, y, z); + } + + + public void pushMatrix() { + if (recorder != null) recorder.pushMatrix(); + g.pushMatrix(); + } + + + public void popMatrix() { + if (recorder != null) recorder.popMatrix(); + g.popMatrix(); + } + + + public void translate(float tx, float ty) { + if (recorder != null) recorder.translate(tx, ty); + g.translate(tx, ty); + } + + + public void translate(float tx, float ty, float tz) { + if (recorder != null) recorder.translate(tx, ty, tz); + g.translate(tx, ty, tz); + } + + + public void rotate(float angle) { + if (recorder != null) recorder.rotate(angle); + g.rotate(angle); + } + + + public void rotateX(float angle) { + if (recorder != null) recorder.rotateX(angle); + g.rotateX(angle); + } + + + public void rotateY(float angle) { + if (recorder != null) recorder.rotateY(angle); + g.rotateY(angle); + } + + + public void rotateZ(float angle) { + if (recorder != null) recorder.rotateZ(angle); + g.rotateZ(angle); + } + + + public void rotate(float angle, float vx, float vy, float vz) { + if (recorder != null) recorder.rotate(angle, vx, vy, vz); + g.rotate(angle, vx, vy, vz); + } + + + public void scale(float s) { + if (recorder != null) recorder.scale(s); + g.scale(s); + } + + + public void scale(float sx, float sy) { + if (recorder != null) recorder.scale(sx, sy); + g.scale(sx, sy); + } + + + public void scale(float x, float y, float z) { + if (recorder != null) recorder.scale(x, y, z); + g.scale(x, y, z); + } + + + public void resetMatrix() { + if (recorder != null) recorder.resetMatrix(); + g.resetMatrix(); + } + + + public void applyMatrix(PMatrix source) { + if (recorder != null) recorder.applyMatrix(source); + g.applyMatrix(source); + } + + + public void applyMatrix(PMatrix2D source) { + if (recorder != null) recorder.applyMatrix(source); + g.applyMatrix(source); + } + + + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) { + if (recorder != null) recorder.applyMatrix(n00, n01, n02, n10, n11, n12); + g.applyMatrix(n00, n01, n02, n10, n11, n12); + } + + + public void applyMatrix(PMatrix3D source) { + if (recorder != null) recorder.applyMatrix(source); + g.applyMatrix(source); + } + + + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + if (recorder != null) recorder.applyMatrix(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33); + g.applyMatrix(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33); + } + + + public PMatrix getMatrix() { + return g.getMatrix(); + } + + + public PMatrix2D getMatrix(PMatrix2D target) { + return g.getMatrix(target); + } + + + public PMatrix3D getMatrix(PMatrix3D target) { + return g.getMatrix(target); + } + + + public void setMatrix(PMatrix source) { + if (recorder != null) recorder.setMatrix(source); + g.setMatrix(source); + } + + + public void setMatrix(PMatrix2D source) { + if (recorder != null) recorder.setMatrix(source); + g.setMatrix(source); + } + + + public void setMatrix(PMatrix3D source) { + if (recorder != null) recorder.setMatrix(source); + g.setMatrix(source); + } + + + public void printMatrix() { + if (recorder != null) recorder.printMatrix(); + g.printMatrix(); + } + + + public void beginCamera() { + if (recorder != null) recorder.beginCamera(); + g.beginCamera(); + } + + + public void endCamera() { + if (recorder != null) recorder.endCamera(); + g.endCamera(); + } + + + public void camera() { + if (recorder != null) recorder.camera(); + g.camera(); + } + + + public void camera(float eyeX, float eyeY, float eyeZ, + float centerX, float centerY, float centerZ, + float upX, float upY, float upZ) { + if (recorder != null) recorder.camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); + g.camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); + } + + + public void printCamera() { + if (recorder != null) recorder.printCamera(); + g.printCamera(); + } + + + public void ortho() { + if (recorder != null) recorder.ortho(); + g.ortho(); + } + + + public void ortho(float left, float right, + float bottom, float top, + float near, float far) { + if (recorder != null) recorder.ortho(left, right, bottom, top, near, far); + g.ortho(left, right, bottom, top, near, far); + } + + + public void perspective() { + if (recorder != null) recorder.perspective(); + g.perspective(); + } + + + public void perspective(float fovy, float aspect, float zNear, float zFar) { + if (recorder != null) recorder.perspective(fovy, aspect, zNear, zFar); + g.perspective(fovy, aspect, zNear, zFar); + } + + + public void frustum(float left, float right, + float bottom, float top, + float near, float far) { + if (recorder != null) recorder.frustum(left, right, bottom, top, near, far); + g.frustum(left, right, bottom, top, near, far); + } + + + public void printProjection() { + if (recorder != null) recorder.printProjection(); + g.printProjection(); + } + + + public float screenX(float x, float y) { + return g.screenX(x, y); + } + + + public float screenY(float x, float y) { + return g.screenY(x, y); + } + + + public float screenX(float x, float y, float z) { + return g.screenX(x, y, z); + } + + + public float screenY(float x, float y, float z) { + return g.screenY(x, y, z); + } + + + public float screenZ(float x, float y, float z) { + return g.screenZ(x, y, z); + } + + + public float modelX(float x, float y, float z) { + return g.modelX(x, y, z); + } + + + public float modelY(float x, float y, float z) { + return g.modelY(x, y, z); + } + + + public float modelZ(float x, float y, float z) { + return g.modelZ(x, y, z); + } + + + public void pushStyle() { + if (recorder != null) recorder.pushStyle(); + g.pushStyle(); + } + + + public void popStyle() { + if (recorder != null) recorder.popStyle(); + g.popStyle(); + } + + + public void style(PStyle s) { + if (recorder != null) recorder.style(s); + g.style(s); + } + + + public void strokeWeight(float weight) { + if (recorder != null) recorder.strokeWeight(weight); + g.strokeWeight(weight); + } + + + public void strokeJoin(int join) { + if (recorder != null) recorder.strokeJoin(join); + g.strokeJoin(join); + } + + + public void strokeCap(int cap) { + if (recorder != null) recorder.strokeCap(cap); + g.strokeCap(cap); + } + + + public void noStroke() { + if (recorder != null) recorder.noStroke(); + g.noStroke(); + } + + + public void stroke(int rgb) { + if (recorder != null) recorder.stroke(rgb); + g.stroke(rgb); + } + + + public void stroke(int rgb, float alpha) { + if (recorder != null) recorder.stroke(rgb, alpha); + g.stroke(rgb, alpha); + } + + + public void stroke(float gray) { + if (recorder != null) recorder.stroke(gray); + g.stroke(gray); + } + + + public void stroke(float gray, float alpha) { + if (recorder != null) recorder.stroke(gray, alpha); + g.stroke(gray, alpha); + } + + + public void stroke(float x, float y, float z) { + if (recorder != null) recorder.stroke(x, y, z); + g.stroke(x, y, z); + } + + + public void stroke(float x, float y, float z, float a) { + if (recorder != null) recorder.stroke(x, y, z, a); + g.stroke(x, y, z, a); + } + + + public void noTint() { + if (recorder != null) recorder.noTint(); + g.noTint(); + } + + + public void tint(int rgb) { + if (recorder != null) recorder.tint(rgb); + g.tint(rgb); + } + + + public void tint(int rgb, float alpha) { + if (recorder != null) recorder.tint(rgb, alpha); + g.tint(rgb, alpha); + } + + + public void tint(float gray) { + if (recorder != null) recorder.tint(gray); + g.tint(gray); + } + + + public void tint(float gray, float alpha) { + if (recorder != null) recorder.tint(gray, alpha); + g.tint(gray, alpha); + } + + + public void tint(float x, float y, float z) { + if (recorder != null) recorder.tint(x, y, z); + g.tint(x, y, z); + } + + + public void tint(float x, float y, float z, float a) { + if (recorder != null) recorder.tint(x, y, z, a); + g.tint(x, y, z, a); + } + + + public void noFill() { + if (recorder != null) recorder.noFill(); + g.noFill(); + } + + + public void fill(int rgb) { + if (recorder != null) recorder.fill(rgb); + g.fill(rgb); + } + + + public void fill(int rgb, float alpha) { + if (recorder != null) recorder.fill(rgb, alpha); + g.fill(rgb, alpha); + } + + + public void fill(float gray) { + if (recorder != null) recorder.fill(gray); + g.fill(gray); + } + + + public void fill(float gray, float alpha) { + if (recorder != null) recorder.fill(gray, alpha); + g.fill(gray, alpha); + } + + + public void fill(float x, float y, float z) { + if (recorder != null) recorder.fill(x, y, z); + g.fill(x, y, z); + } + + + public void fill(float x, float y, float z, float a) { + if (recorder != null) recorder.fill(x, y, z, a); + g.fill(x, y, z, a); + } + + + public void ambient(int rgb) { + if (recorder != null) recorder.ambient(rgb); + g.ambient(rgb); + } + + + public void ambient(float gray) { + if (recorder != null) recorder.ambient(gray); + g.ambient(gray); + } + + + public void ambient(float x, float y, float z) { + if (recorder != null) recorder.ambient(x, y, z); + g.ambient(x, y, z); + } + + + public void specular(int rgb) { + if (recorder != null) recorder.specular(rgb); + g.specular(rgb); + } + + + public void specular(float gray) { + if (recorder != null) recorder.specular(gray); + g.specular(gray); + } + + + public void specular(float x, float y, float z) { + if (recorder != null) recorder.specular(x, y, z); + g.specular(x, y, z); + } + + + public void shininess(float shine) { + if (recorder != null) recorder.shininess(shine); + g.shininess(shine); + } + + + public void emissive(int rgb) { + if (recorder != null) recorder.emissive(rgb); + g.emissive(rgb); + } + + + public void emissive(float gray) { + if (recorder != null) recorder.emissive(gray); + g.emissive(gray); + } + + + public void emissive(float x, float y, float z) { + if (recorder != null) recorder.emissive(x, y, z); + g.emissive(x, y, z); + } + + + public void lights() { + if (recorder != null) recorder.lights(); + g.lights(); + } + + + public void noLights() { + if (recorder != null) recorder.noLights(); + g.noLights(); + } + + + public void ambientLight(float red, float green, float blue) { + if (recorder != null) recorder.ambientLight(red, green, blue); + g.ambientLight(red, green, blue); + } + + + public void ambientLight(float red, float green, float blue, + float x, float y, float z) { + if (recorder != null) recorder.ambientLight(red, green, blue, x, y, z); + g.ambientLight(red, green, blue, x, y, z); + } + + + public void directionalLight(float red, float green, float blue, + float nx, float ny, float nz) { + if (recorder != null) recorder.directionalLight(red, green, blue, nx, ny, nz); + g.directionalLight(red, green, blue, nx, ny, nz); + } + + + public void pointLight(float red, float green, float blue, + float x, float y, float z) { + if (recorder != null) recorder.pointLight(red, green, blue, x, y, z); + g.pointLight(red, green, blue, x, y, z); + } + + + public void spotLight(float red, float green, float blue, + float x, float y, float z, + float nx, float ny, float nz, + float angle, float concentration) { + if (recorder != null) recorder.spotLight(red, green, blue, x, y, z, nx, ny, nz, angle, concentration); + g.spotLight(red, green, blue, x, y, z, nx, ny, nz, angle, concentration); + } + + + public void lightFalloff(float constant, float linear, float quadratic) { + if (recorder != null) recorder.lightFalloff(constant, linear, quadratic); + g.lightFalloff(constant, linear, quadratic); + } + + + public void lightSpecular(float x, float y, float z) { + if (recorder != null) recorder.lightSpecular(x, y, z); + g.lightSpecular(x, y, z); + } + + + public void background(int rgb) { + if (recorder != null) recorder.background(rgb); + g.background(rgb); + } + + + public void background(int rgb, float alpha) { + if (recorder != null) recorder.background(rgb, alpha); + g.background(rgb, alpha); + } + + + public void background(float gray) { + if (recorder != null) recorder.background(gray); + g.background(gray); + } + + + public void background(float gray, float alpha) { + if (recorder != null) recorder.background(gray, alpha); + g.background(gray, alpha); + } + + + public void background(float x, float y, float z) { + if (recorder != null) recorder.background(x, y, z); + g.background(x, y, z); + } + + + public void background(float x, float y, float z, float a) { + if (recorder != null) recorder.background(x, y, z, a); + g.background(x, y, z, a); + } + + + public void background(PImage image) { + if (recorder != null) recorder.background(image); + g.background(image); + } + + + public void colorMode(int mode) { + if (recorder != null) recorder.colorMode(mode); + g.colorMode(mode); + } + + + public void colorMode(int mode, float max) { + if (recorder != null) recorder.colorMode(mode, max); + g.colorMode(mode, max); + } + + + public void colorMode(int mode, float maxX, float maxY, float maxZ) { + if (recorder != null) recorder.colorMode(mode, maxX, maxY, maxZ); + g.colorMode(mode, maxX, maxY, maxZ); + } + + + public void colorMode(int mode, + float maxX, float maxY, float maxZ, float maxA) { + if (recorder != null) recorder.colorMode(mode, maxX, maxY, maxZ, maxA); + g.colorMode(mode, maxX, maxY, maxZ, maxA); + } + + + public final float alpha(int what) { + return g.alpha(what); + } + + + public final float red(int what) { + return g.red(what); + } + + + public final float green(int what) { + return g.green(what); + } + + + public final float blue(int what) { + return g.blue(what); + } + + + public final float hue(int what) { + return g.hue(what); + } + + + public final float saturation(int what) { + return g.saturation(what); + } + + + public final float brightness(int what) { + return g.brightness(what); + } + + + public int lerpColor(int c1, int c2, float amt) { + return g.lerpColor(c1, c2, amt); + } + + + static public int lerpColor(int c1, int c2, float amt, int mode) { + return PGraphics.lerpColor(c1, c2, amt, mode); + } + + + public boolean displayable() { + return g.displayable(); + } + + + public void setCache(Object parent, Object storage) { + if (recorder != null) recorder.setCache(parent, storage); + g.setCache(parent, storage); + } + + + public Object getCache(Object parent) { + return g.getCache(parent); + } + + + public void removeCache(Object parent) { + if (recorder != null) recorder.removeCache(parent); + g.removeCache(parent); + } + + + public int get(int x, int y) { + return g.get(x, y); + } + + + public PImage get(int x, int y, int w, int h) { + return g.get(x, y, w, h); + } + + + public PImage get() { + return g.get(); + } + + + public void set(int x, int y, int c) { + if (recorder != null) recorder.set(x, y, c); + g.set(x, y, c); + } + + + public void set(int x, int y, PImage src) { + if (recorder != null) recorder.set(x, y, src); + g.set(x, y, src); + } + + + public void mask(int alpha[]) { + if (recorder != null) recorder.mask(alpha); + g.mask(alpha); + } + + + public void mask(PImage alpha) { + if (recorder != null) recorder.mask(alpha); + g.mask(alpha); + } + + + public void filter(int kind) { + if (recorder != null) recorder.filter(kind); + g.filter(kind); + } + + + public void filter(int kind, float param) { + if (recorder != null) recorder.filter(kind, param); + g.filter(kind, param); + } + + + public void copy(int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh) { + if (recorder != null) recorder.copy(sx, sy, sw, sh, dx, dy, dw, dh); + g.copy(sx, sy, sw, sh, dx, dy, dw, dh); + } + + + public void copy(PImage src, + int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh) { + if (recorder != null) recorder.copy(src, sx, sy, sw, sh, dx, dy, dw, dh); + g.copy(src, sx, sy, sw, sh, dx, dy, dw, dh); + } + + + static public int blendColor(int c1, int c2, int mode) { + return PGraphics.blendColor(c1, c2, mode); + } + + + public void blend(int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh, int mode) { + if (recorder != null) recorder.blend(sx, sy, sw, sh, dx, dy, dw, dh, mode); + g.blend(sx, sy, sw, sh, dx, dy, dw, dh, mode); + } + + + public void blend(PImage src, + int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh, int mode) { + if (recorder != null) recorder.blend(src, sx, sy, sw, sh, dx, dy, dw, dh, mode); + g.blend(src, sx, sy, sw, sh, dx, dy, dw, dh, mode); + } +} diff --git a/core/src/processing/core/PConstants.java b/core/src/processing/core/PConstants.java new file mode 100644 index 000000000..24f0b9fa8 --- /dev/null +++ b/core/src/processing/core/PConstants.java @@ -0,0 +1,461 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.Cursor; +import java.awt.event.KeyEvent; + + +/** + * Numbers shared throughout processing.core. + *

+ * An attempt is made to keep the constants as short/non-verbose + * as possible. For instance, the constant is TIFF instead of + * FILE_TYPE_TIFF. We'll do this as long as we can get away with it. + */ +public interface PConstants { + + static public final int X = 0; // model coords xyz (formerly MX/MY/MZ) + static public final int Y = 1; + static public final int Z = 2; + + static public final int R = 3; // actual rgb, after lighting + static public final int G = 4; // fill stored here, transform in place + static public final int B = 5; // TODO don't do that anymore (?) + static public final int A = 6; + + static public final int U = 7; // texture + static public final int V = 8; + + static public final int NX = 9; // normal + static public final int NY = 10; + static public final int NZ = 11; + + static public final int EDGE = 12; + + + // stroke + + /** stroke argb values */ + static public final int SR = 13; + static public final int SG = 14; + static public final int SB = 15; + static public final int SA = 16; + + /** stroke weight */ + static public final int SW = 17; + + + // transformations (2D and 3D) + + static public final int TX = 18; // transformed xyzw + static public final int TY = 19; + static public final int TZ = 20; + + static public final int VX = 21; // view space coords + static public final int VY = 22; + static public final int VZ = 23; + static public final int VW = 24; + + + // material properties + + // Ambient color (usually to be kept the same as diffuse) + // fill(_) sets both ambient and diffuse. + static public final int AR = 25; + static public final int AG = 26; + static public final int AB = 27; + + // Diffuse is shared with fill. + static public final int DR = 3; // TODO needs to not be shared, this is a material property + static public final int DG = 4; + static public final int DB = 5; + static public final int DA = 6; + + // specular (by default kept white) + static public final int SPR = 28; + static public final int SPG = 29; + static public final int SPB = 30; + + static public final int SHINE = 31; + + // emissive (by default kept black) + static public final int ER = 32; + static public final int EG = 33; + static public final int EB = 34; + + // has this vertex been lit yet + static public final int BEEN_LIT = 35; + + static public final int VERTEX_FIELD_COUNT = 36; + + + // renderers known to processing.core + + static final String P2D = "processing.core.PGraphics2D"; + static final String P3D = "processing.core.PGraphics3D"; + static final String JAVA2D = "processing.core.PGraphicsJava2D"; + static final String OPENGL = "processing.opengl.PGraphicsOpenGL"; + static final String PDF = "processing.pdf.PGraphicsPDF"; + static final String DXF = "processing.dxf.RawDXF"; + + + // platform IDs for PApplet.platform + + static final int OTHER = 0; + static final int WINDOWS = 1; + static final int MACOSX = 2; + static final int LINUX = 3; + + static final String[] platformNames = { + "other", "windows", "macosx", "linux" + }; + + + static final float EPSILON = 0.0001f; + + + // max/min values for numbers + + /** + * Same as Float.MAX_VALUE, but included for parity with MIN_VALUE, + * and to avoid teaching static methods on the first day. + */ + static final float MAX_FLOAT = Float.MAX_VALUE; + /** + * Note that Float.MIN_VALUE is the smallest positive value + * for a floating point number, not actually the minimum (negative) value + * for a float. This constant equals 0xFF7FFFFF, the smallest (farthest + * negative) value a float can have before it hits NaN. + */ + static final float MIN_FLOAT = -Float.MAX_VALUE; + /** Largest possible (positive) integer value */ + static final int MAX_INT = Integer.MAX_VALUE; + /** Smallest possible (negative) integer value */ + static final int MIN_INT = Integer.MIN_VALUE; + + + // useful goodness + + static final float PI = (float) Math.PI; + static final float HALF_PI = PI / 2.0f; + static final float THIRD_PI = PI / 3.0f; + static final float QUARTER_PI = PI / 4.0f; + static final float TWO_PI = PI * 2.0f; + + static final float DEG_TO_RAD = PI/180.0f; + static final float RAD_TO_DEG = 180.0f/PI; + + + // angle modes + + //static final int RADIANS = 0; + //static final int DEGREES = 1; + + + // used by split, all the standard whitespace chars + // (also includes unicode nbsp, that little bostage) + + static final String WHITESPACE = " \t\n\r\f\u00A0"; + + + // for colors and/or images + + static final int RGB = 1; // image & color + static final int ARGB = 2; // image + static final int HSB = 3; // color + static final int ALPHA = 4; // image + static final int CMYK = 5; // image & color (someday) + + + // image file types + + static final int TIFF = 0; + static final int TARGA = 1; + static final int JPEG = 2; + static final int GIF = 3; + + + // filter/convert types + + static final int BLUR = 11; + static final int GRAY = 12; + static final int INVERT = 13; + static final int OPAQUE = 14; + static final int POSTERIZE = 15; + static final int THRESHOLD = 16; + static final int ERODE = 17; + static final int DILATE = 18; + + + // blend mode keyword definitions + // @see processing.core.PImage#blendColor(int,int,int) + + public final static int REPLACE = 0; + public final static int BLEND = 1 << 0; + public final static int ADD = 1 << 1; + public final static int SUBTRACT = 1 << 2; + public final static int LIGHTEST = 1 << 3; + public final static int DARKEST = 1 << 4; + public final static int DIFFERENCE = 1 << 5; + public final static int EXCLUSION = 1 << 6; + public final static int MULTIPLY = 1 << 7; + public final static int SCREEN = 1 << 8; + public final static int OVERLAY = 1 << 9; + public final static int HARD_LIGHT = 1 << 10; + public final static int SOFT_LIGHT = 1 << 11; + public final static int DODGE = 1 << 12; + public final static int BURN = 1 << 13; + + // colour component bitmasks + + public static final int ALPHA_MASK = 0xff000000; + public static final int RED_MASK = 0x00ff0000; + public static final int GREEN_MASK = 0x0000ff00; + public static final int BLUE_MASK = 0x000000ff; + + + // for messages + + static final int CHATTER = 0; + static final int COMPLAINT = 1; + static final int PROBLEM = 2; + + + // types of projection matrices + + static final int CUSTOM = 0; // user-specified fanciness + static final int ORTHOGRAPHIC = 2; // 2D isometric projection + static final int PERSPECTIVE = 3; // perspective matrix + + + // shapes + + // the low four bits set the variety, + // higher bits set the specific shape type + + //static final int GROUP = (1 << 2); + + static final int POINT = 2; // shared with light (!) + static final int POINTS = 2; + + static final int LINE = 4; + static final int LINES = 4; + + static final int TRIANGLE = 8; + static final int TRIANGLES = 9; + static final int TRIANGLE_STRIP = 10; + static final int TRIANGLE_FAN = 11; + + static final int QUAD = 16; + static final int QUADS = 16; + static final int QUAD_STRIP = 17; + + static final int POLYGON = 20; + static final int PATH = 21; + + static final int RECT = 30; + static final int ELLIPSE = 31; + static final int ARC = 32; + + static final int SPHERE = 40; + static final int BOX = 41; + + + // shape closing modes + + static final int OPEN = 1; + static final int CLOSE = 2; + + + // shape drawing modes + + /** Draw mode convention to use (x, y) to (width, height) */ + static final int CORNER = 0; + /** Draw mode convention to use (x1, y1) to (x2, y2) coordinates */ + static final int CORNERS = 1; + /** Draw mode from the center, and using the radius */ + static final int RADIUS = 2; + /** @deprecated Use RADIUS instead. */ + static final int CENTER_RADIUS = 2; + /** + * Draw from the center, using second pair of values as the diameter. + * Formerly called CENTER_DIAMETER in alpha releases. + */ + static final int CENTER = 3; + /** + * Synonym for the CENTER constant. Draw from the center, + * using second pair of values as the diameter. + */ + static final int DIAMETER = 3; + /** @deprecated Use DIAMETER instead. */ + static final int CENTER_DIAMETER = 3; + + + // vertically alignment modes for text + + /** Default vertical alignment for text placement */ + static final int BASELINE = 0; + /** Align text to the top */ + static final int TOP = 101; + /** Align text from the bottom, using the baseline. */ + static final int BOTTOM = 102; + + + // uv texture orientation modes + + /** texture coordinates in 0..1 range */ + static final int NORMAL = 1; + /** @deprecated use NORMAL instead */ + static final int NORMALIZED = 1; + /** texture coordinates based on image width/height */ + static final int IMAGE = 2; + + + // text placement modes + + /** + * textMode(MODEL) is the default, meaning that characters + * will be affected by transformations like any other shapes. + *

+ * Changed value in 0093 to not interfere with LEFT, CENTER, and RIGHT. + */ + static final int MODEL = 4; + + /** + * textMode(SHAPE) draws text using the the glyph outlines of + * individual characters rather than as textures. If the outlines are + * not available, then textMode(SHAPE) will be ignored and textMode(MODEL) + * will be used instead. For this reason, be sure to call textMode() + * after calling textFont(). + *

+ * Currently, textMode(SHAPE) is only supported by OPENGL mode. + * It also requires Java 1.2 or higher (OPENGL requires 1.4 anyway) + */ + static final int SHAPE = 5; + + + // text alignment modes + // are inherited from LEFT, CENTER, RIGHT + + + // stroke modes + + static final int SQUARE = 1 << 0; // called 'butt' in the svg spec + static final int ROUND = 1 << 1; + static final int PROJECT = 1 << 2; // called 'square' in the svg spec + static final int MITER = 1 << 3; + static final int BEVEL = 1 << 5; + + + // lighting + + static final int AMBIENT = 0; + static final int DIRECTIONAL = 1; + //static final int POINT = 2; // shared with shape feature + static final int SPOT = 3; + + + // key constants + + // only including the most-used of these guys + // if people need more esoteric keys, they can learn about + // the esoteric java KeyEvent api and of virtual keys + + // both key and keyCode will equal these values + // for 0125, these were changed to 'char' values, because they + // can be upgraded to ints automatically by Java, but having them + // as ints prevented split(blah, TAB) from working + static final char BACKSPACE = 8; + static final char TAB = 9; + static final char ENTER = 10; + static final char RETURN = 13; + static final char ESC = 27; + static final char DELETE = 127; + + // i.e. if ((key == CODED) && (keyCode == UP)) + static final int CODED = 0xffff; + + // key will be CODED and keyCode will be this value + static final int UP = KeyEvent.VK_UP; + static final int DOWN = KeyEvent.VK_DOWN; + static final int LEFT = KeyEvent.VK_LEFT; + static final int RIGHT = KeyEvent.VK_RIGHT; + + // key will be CODED and keyCode will be this value + static final int ALT = KeyEvent.VK_ALT; + static final int CONTROL = KeyEvent.VK_CONTROL; + static final int SHIFT = KeyEvent.VK_SHIFT; + + + // cursor types + + static final int ARROW = Cursor.DEFAULT_CURSOR; + static final int CROSS = Cursor.CROSSHAIR_CURSOR; + static final int HAND = Cursor.HAND_CURSOR; + static final int MOVE = Cursor.MOVE_CURSOR; + static final int TEXT = Cursor.TEXT_CURSOR; + static final int WAIT = Cursor.WAIT_CURSOR; + + + // hints - hint values are positive for the alternate version, + // negative of the same value returns to the normal/default state + + static final int DISABLE_OPENGL_2X_SMOOTH = 1; + static final int ENABLE_OPENGL_2X_SMOOTH = -1; + static final int ENABLE_OPENGL_4X_SMOOTH = 2; + + static final int ENABLE_NATIVE_FONTS = 3; + + static final int DISABLE_DEPTH_TEST = 4; + static final int ENABLE_DEPTH_TEST = -4; + + static final int ENABLE_DEPTH_SORT = 5; + static final int DISABLE_DEPTH_SORT = -5; + + static final int DISABLE_OPENGL_ERROR_REPORT = 6; + static final int ENABLE_OPENGL_ERROR_REPORT = -6; + + static final int ENABLE_ACCURATE_TEXTURES = 7; + static final int DISABLE_ACCURATE_TEXTURES = -7; + + static final int HINT_COUNT = 10; + + + // error messages + + static final String ERROR_BACKGROUND_IMAGE_SIZE = + "background image must be the same size as your application"; + static final String ERROR_BACKGROUND_IMAGE_FORMAT = + "background images should be RGB or ARGB"; + + static final String ERROR_TEXTFONT_NULL_PFONT = + "A null PFont was passed to textFont()"; + + static final String ERROR_PUSHMATRIX_OVERFLOW = + "Too many calls to pushMatrix()."; + static final String ERROR_PUSHMATRIX_UNDERFLOW = + "Too many calls to popMatrix(), and not enough to pushMatrix()."; +} diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java new file mode 100644 index 000000000..74da5cb18 --- /dev/null +++ b/core/src/processing/core/PFont.java @@ -0,0 +1,711 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-07 Ben Fry & Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.awt.image.Raster; +import java.io.*; +//import java.lang.reflect.*; +import java.util.Arrays; + + +/** + * Grayscale bitmap font class used by Processing. + *

+ * Awful (and by that, I mean awesome) ascii (non)art for how this works: + *

+ *   |
+ *   |                   height is the full used height of the image
+ *   |
+ *   |   ..XX..       }
+ *   |   ..XX..       }
+ *   |   ......       }
+ *   |   XXXX..       }  topExtent (top y is baseline - topExtent)
+ *   |   ..XX..       }
+ *   |   ..XX..       }  dotted areas are where the image data
+ *   |   ..XX..       }  is actually located for the character
+ *   +---XXXXXX----   }  (it extends to the right and down
+ *   |                   for power of two texture sizes)
+ *   ^^^^ leftExtent (amount to move over before drawing the image
+ *
+ *   ^^^^^^^^^^^^^^ setWidth (width displaced by char)
+ * 
+ */ +public class PFont implements PConstants { + + public int charCount; + public PImage images[]; + + /** + * Native Java version of the font. If possible, this allows the + * PGraphics subclass to just use Java's font rendering stuff + * in situations where that's faster. + */ + protected Font font; + protected boolean fontSearched; + + /** + * Name of the font as seen by Java when it was created. + * If the font is available, the native version will be used. + */ + public String name; + + /** + * Postscript name of the font that this bitmap was created from. + */ + public String psname; + + /** "natural" size of the font (most often 48) */ + public int size; + + /** true if smoothing was enabled for this font, used for native impl */ + public boolean smooth; + + /** next power of 2 over the max image size (usually 64) */ + public int mbox2; + + /** floating point width (convenience) */ + protected float fwidth; + + /** floating point width (convenience) */ + protected float fheight; + + /** texture width, same as mbox2, but reserved for future use */ + public int twidth; + + /** texture height, same as mbox2, but reserved for future use */ + public int theight; + + public int value[]; // char code + public int height[]; // height of the bitmap data + public int width[]; // width of bitmap data + public int setWidth[]; // width displaced by the char + public int topExtent[]; // offset for the top + public int leftExtent[]; // offset for the left + + public int ascent; + public int descent; + + protected int ascii[]; // quick lookup for the ascii chars + + // shared by the text() functions to avoid incessant allocation of memory + //protected char textBuffer[] = new char[8 * 1024]; + //protected char widthBuffer[] = new char[8 * 1024]; + + static protected Font[] fonts; + + + public PFont() { } // for subclasses + + + public PFont(InputStream input) throws IOException { + DataInputStream is = new DataInputStream(input); + + // number of character images stored in this font + charCount = is.readInt(); + + // bit count is ignored since this is always 8 + //int numBits = is.readInt(); + // used to be the bitCount, but now used for version number. + // version 8 is any font before 69, so 9 is anything from 83+ + // 9 was buggy so gonna increment to 10. + int version = is.readInt(); + + // this was formerly ignored, now it's the actual font size + //mbox = is.readInt(); + size = is.readInt(); + // this was formerly mboxY, the one that was used + // this will make new fonts downward compatible + //mbox2 = is.readInt(); + mbox2 = is.readInt(); + + fwidth = size; //mbox; + fheight = size; //mbox; + + // size for image ("texture") is next power of 2 + // over the font size. for most vlw fonts, the size is 48 + // so the next power of 2 is 64. + // double-check to make sure that mbox2 is a power of 2 + // there was a bug in the old font generator that broke this + //mbox2 = (int) Math.pow(2, Math.ceil(Math.log(mbox2) / Math.log(2))); + mbox2 = (int) Math.pow(2, Math.ceil(Math.log(mbox2) / Math.log(2))); + // size for the texture is stored in the font + twidth = theight = mbox2; //mbox2; + + ascent = is.readInt(); // formerly baseHt (zero/ignored) + descent = is.readInt(); // formerly ignored struct padding + + // allocate enough space for the character info + value = new int[charCount]; + height = new int[charCount]; + width = new int[charCount]; + setWidth = new int[charCount]; + topExtent = new int[charCount]; + leftExtent = new int[charCount]; + + ascii = new int[128]; + for (int i = 0; i < 128; i++) ascii[i] = -1; + + // read the information about the individual characters + for (int i = 0; i < charCount; i++) { + value[i] = is.readInt(); + height[i] = is.readInt(); + width[i] = is.readInt(); + setWidth[i] = is.readInt(); + topExtent[i] = is.readInt(); + leftExtent[i] = is.readInt(); + + // pointer in the c version, ignored + is.readInt(); + + // cache locations of the ascii charset + if (value[i] < 128) ascii[value[i]] = i; + + // the values for getAscent() and getDescent() from FontMetrics + // seem to be way too large.. perhaps they're the max? + // as such, use a more traditional marker for ascent/descent + if (value[i] == 'd') { + if (ascent == 0) ascent = topExtent[i]; + } + if (value[i] == 'p') { + if (descent == 0) descent = -topExtent[i] + height[i]; + } + } + + // not a roman font, so throw an error and ask to re-build. + // that way can avoid a bunch of error checking hacks in here. + if ((ascent == 0) && (descent == 0)) { + throw new RuntimeException("Please use \"Create Font\" to " + + "re-create this font."); + } + + images = new PImage[charCount]; + for (int i = 0; i < charCount; i++) { + images[i] = new PImage(twidth, theight, ALPHA); + int bitmapSize = height[i] * width[i]; + + byte temp[] = new byte[bitmapSize]; + is.readFully(temp); + + // convert the bitmap to an alpha channel + int w = width[i]; + int h = height[i]; + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + int valu = temp[y*w + x] & 0xff; + images[i].pixels[y * twidth + x] = valu; + //(valu << 24) | 0xFFFFFF; // windows + //0xFFFFFF00 | valu; // macosx + + //System.out.print((images[i].pixels[y*64+x] > 128) ? "*" : "."); + } + //System.out.println(); + } + //System.out.println(); + } + + if (version >= 10) { // includes the font name at the end of the file + name = is.readUTF(); + psname = is.readUTF(); + } + if (version == 11) { + smooth = is.readBoolean(); + } + } + + + /** + * Set the native complement of this font. + */ + public void setFont(Font font) { + this.font = font; + } + + + /** + * Return the native java.awt.Font associated with this PFont (if any). + */ + public Font getFont() { +// if (font == null && !fontSearched) { +// font = findFont(); +// } + return font; + } + + + /** + * Attempt to find the native version of this font. + * (Public so that it can be used by OpenGL or other renderers.) + */ + public Font findFont() { + if (font == null) { + if (!fontSearched) { + // this font may or may not be installed + font = new Font(name, Font.PLAIN, size); + // if the ps name matches, then we're in fine shape + if (!font.getPSName().equals(psname)) { + // on osx java 1.4 (not 1.3.. ugh), you can specify the ps name + // of the font, so try that in case this .vlw font was created on pc + // and the name is different, but the ps name is found on the + // java 1.4 mac that's currently running this sketch. + font = new Font(psname, Font.PLAIN, size); + } + // check again, and if still bad, screw em + if (!font.getPSName().equals(psname)) { + font = null; + } + fontSearched = true; + } + } + return font; + } + + + /** + * Write this PFont to an OutputStream. + *

+ * This is used by the Create Font tool, or whatever anyone else dreams + * up for messing with fonts themselves. + *

+ * It is assumed that the calling class will handle closing + * the stream when finished. + */ + public void save(OutputStream output) throws IOException { + DataOutputStream os = new DataOutputStream(output); + + os.writeInt(charCount); + + if ((name == null) || (psname == null)) { + name = ""; + psname = ""; + } + // formerly numBits, now used for version number + //os.writeInt((name != null) ? 11 : 8); + os.writeInt(11); + + os.writeInt(size); // formerly mboxX (was 64, now 48) + os.writeInt(mbox2); // formerly mboxY (was 64, still 64) + os.writeInt(ascent); // formerly baseHt (was ignored) + os.writeInt(descent); // formerly struct padding for c version + + for (int i = 0; i < charCount; i++) { + os.writeInt(value[i]); + os.writeInt(height[i]); + os.writeInt(width[i]); + os.writeInt(setWidth[i]); + os.writeInt(topExtent[i]); + os.writeInt(leftExtent[i]); + os.writeInt(0); // padding + } + + for (int i = 0; i < charCount; i++) { + for (int y = 0; y < height[i]; y++) { + for (int x = 0; x < width[i]; x++) { + os.write(images[i].pixels[y * mbox2 + x] & 0xff); + } + } + } + + //if (name != null) { // version 11 + os.writeUTF(name); + os.writeUTF(psname); + os.writeBoolean(smooth); + //} + + os.flush(); + } + + + /** + * Get index for the char (convert from unicode to bagel charset). + * @return index into arrays or -1 if not found + */ + public int index(char c) { + // degenerate case, but the find function will have trouble + // if there are somehow zero chars in the lookup + //if (value.length == 0) return -1; + if (charCount == 0) return -1; + + // quicker lookup for the ascii fellers + if (c < 128) return ascii[c]; + + // some other unicode char, hunt it out + //return index_hunt(c, 0, value.length-1); + return indexHunt(c, 0, charCount-1); + } + + + protected int indexHunt(int c, int start, int stop) { + int pivot = (start + stop) / 2; + + // if this is the char, then return it + if (c == value[pivot]) return pivot; + + // char doesn't exist, otherwise would have been the pivot + //if (start == stop) return -1; + if (start >= stop) return -1; + + // if it's in the lower half, continue searching that + if (c < value[pivot]) return indexHunt(c, start, pivot-1); + + // if it's in the upper half, continue there + return indexHunt(c, pivot+1, stop); + } + + + /** + * Currently un-implemented for .vlw fonts, + * but honored for layout in case subclasses use it. + */ + public float kern(char a, char b) { + return 0; + } + + + /** + * Returns the ascent of this font from the baseline. + * The value is based on a font of size 1. + */ + public float ascent() { + return ((float)ascent / fheight); + } + + + /** + * Returns how far this font descends from the baseline. + * The value is based on a font size of 1. + */ + public float descent() { + return ((float)descent / fheight); + } + + + /** + * Width of this character for a font of size 1. + */ + public float width(char c) { + if (c == 32) return width('i'); + + int cc = index(c); + if (cc == -1) return 0; + + return ((float)setWidth[cc] / fwidth); + } + + + ////////////////////////////////////////////////////////////// + + + static final char[] EXTRA_CHARS = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00BA, + 0x00BB, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, + 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, + 0x00CE, 0x00CF, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, + 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, + 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FF, 0x0102, 0x0103, + 0x0104, 0x0105, 0x0106, 0x0107, 0x010C, 0x010D, 0x010E, 0x010F, + 0x0110, 0x0111, 0x0118, 0x0119, 0x011A, 0x011B, 0x0131, 0x0139, + 0x013A, 0x013D, 0x013E, 0x0141, 0x0142, 0x0143, 0x0144, 0x0147, + 0x0148, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, 0x0158, + 0x0159, 0x015A, 0x015B, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162, + 0x0163, 0x0164, 0x0165, 0x016E, 0x016F, 0x0170, 0x0171, 0x0178, + 0x0179, 0x017A, 0x017B, 0x017C, 0x017D, 0x017E, 0x0192, 0x02C6, + 0x02C7, 0x02D8, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x03A9, + 0x03C0, 0x2013, 0x2014, 0x2018, 0x2019, 0x201A, 0x201C, 0x201D, + 0x201E, 0x2020, 0x2021, 0x2022, 0x2026, 0x2030, 0x2039, 0x203A, + 0x2044, 0x20AC, 0x2122, 0x2202, 0x2206, 0x220F, 0x2211, 0x221A, + 0x221E, 0x222B, 0x2248, 0x2260, 0x2264, 0x2265, 0x25CA, 0xF8FF, + 0xFB01, 0xFB02 + }; + + + /** + * The default Processing character set. + *

+ * This is the union of the Mac Roman and Windows ANSI (CP1250) + * character sets. ISO 8859-1 Latin 1 is Unicode characters 0x80 -> 0xFF, + * and would seem a good standard, but in practice, most P5 users would + * rather have characters that they expect from their platform's fonts. + *

+ * This is more of an interim solution until a much better + * font solution can be determined. (i.e. create fonts on + * the fly from some sort of vector format). + *

+ * Not that I expect that to happen. + */ + static public char[] DEFAULT_CHARSET; + static { + DEFAULT_CHARSET = new char[126-33+1 + EXTRA_CHARS.length]; + int index = 0; + for (int i = 33; i <= 126; i++) { + DEFAULT_CHARSET[index++] = (char)i; + } + for (int i = 0; i < EXTRA_CHARS.length; i++) { + DEFAULT_CHARSET[index++] = EXTRA_CHARS[i]; + } + }; + + + /** + * Create a new image-based font on the fly. + * + * @param font the font object to create from + * @param charset array of all unicode chars that should be included + * @param smooth true to enable smoothing/anti-aliasing + */ + public PFont(Font font, boolean smooth, char charset[]) { + // save this so that we can use the native version + this.font = font; + this.smooth = smooth; + + name = font.getName(); + psname = font.getPSName(); + + // fix regression from sorting (bug #564) + if (charset != null) { + // charset needs to be sorted to make index lookup run more quickly + // http://dev.processing.org/bugs/show_bug.cgi?id=494 + Arrays.sort(charset); + } + + // the count gets reset later based on how many of + // the chars are actually found inside the font. + this.charCount = (charset == null) ? 65536 : charset.length; + this.size = font.getSize(); + + fwidth = fheight = size; + + PImage bitmaps[] = new PImage[charCount]; + + // allocate enough space for the character info + value = new int[charCount]; + height = new int[charCount]; + width = new int[charCount]; + setWidth = new int[charCount]; + topExtent = new int[charCount]; + leftExtent = new int[charCount]; + + ascii = new int[128]; + for (int i = 0; i < 128; i++) ascii[i] = -1; + + int mbox3 = size * 3; + + BufferedImage playground = + new BufferedImage(mbox3, mbox3, BufferedImage.TYPE_INT_RGB); + + Graphics2D g = (Graphics2D) playground.getGraphics(); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + smooth ? + RenderingHints.VALUE_ANTIALIAS_ON : + RenderingHints.VALUE_ANTIALIAS_OFF); + + g.setFont(font); + FontMetrics metrics = g.getFontMetrics(); + + int samples[] = new int[mbox3 * mbox3]; + + int maxWidthHeight = 0; + int index = 0; + for (int i = 0; i < charCount; i++) { + char c = (charset == null) ? (char)i : charset[i]; + + if (!font.canDisplay(c)) { // skip chars not in the font + continue; + } + + g.setColor(Color.white); + g.fillRect(0, 0, mbox3, mbox3); + g.setColor(Color.black); + g.drawString(String.valueOf(c), size, size * 2); + + // grabs copy of the current data.. so no updates (do each time) + Raster raster = playground.getData(); + raster.getSamples(0, 0, mbox3, mbox3, 0, samples); + + int minX = 1000, maxX = 0; + int minY = 1000, maxY = 0; + boolean pixelFound = false; + + for (int y = 0; y < mbox3; y++) { + for (int x = 0; x < mbox3; x++) { + //int sample = raster.getSample(x, y, 0); // maybe? + int sample = samples[y * mbox3 + x] & 0xff; + // or int samples[] = raster.getPixel(x, y, null); + + //if (sample == 0) { // or just not white? hmm + if (sample != 255) { + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + pixelFound = true; + } + } + } + + if (!pixelFound) { + minX = minY = 0; + maxX = maxY = 0; + // this will create a 1 pixel white (clear) character.. + // maybe better to set one to -1 so nothing is added? + } + + value[index] = c; + height[index] = (maxY - minY) + 1; + width[index] = (maxX - minX) + 1; + setWidth[index] = metrics.charWidth(c); + //System.out.println((char)c + " " + setWidth[index]); + + // cache locations of the ascii charset + //if (value[i] < 128) ascii[value[i]] = i; + if (c < 128) ascii[c] = index; + + // offset from vertical location of baseline + // of where the char was drawn (size*2) + topExtent[index] = size*2 - minY; + + // offset from left of where coord was drawn + leftExtent[index] = minX - size; + + if (c == 'd') { + ascent = topExtent[index]; + } + if (c == 'p') { + descent = -topExtent[index] + height[index]; + } + + if (width[index] > maxWidthHeight) maxWidthHeight = width[index]; + if (height[index] > maxWidthHeight) maxWidthHeight = height[index]; + + bitmaps[index] = new PImage(width[index], height[index], ALPHA); + + for (int y = minY; y <= maxY; y++) { + for (int x = minX; x <= maxX; x++) { + int val = 255 - (samples[y * mbox3 + x] & 0xff); + int pindex = (y - minY) * width[index] + (x - minX); + bitmaps[index].pixels[pindex] = val; + } + } + index++; + } + charCount = index; + + // foreign font, so just make ascent the max topExtent + if ((ascent == 0) && (descent == 0)) { + for (int i = 0; i < charCount; i++) { + char cc = (char) value[i]; + if (Character.isWhitespace(cc) || + (cc == '\u00A0') || (cc == '\u2007') || (cc == '\u202F')) { + continue; + } + if (topExtent[i] > ascent) { + ascent = topExtent[i]; + } + int d = -topExtent[i] + height[i]; + if (d > descent) { + descent = d; + } + } + } + // size for image/texture is next power of 2 over largest char + mbox2 = (int) + Math.pow(2, Math.ceil(Math.log(maxWidthHeight) / Math.log(2))); + twidth = theight = mbox2; + + // shove the smaller PImage data into textures of next-power-of-2 size, + // so that this font can be used immediately by p5. + images = new PImage[charCount]; + for (int i = 0; i < charCount; i++) { + images[i] = new PImage(mbox2, mbox2, ALPHA); + for (int y = 0; y < height[i]; y++) { + System.arraycopy(bitmaps[i].pixels, y*width[i], + images[i].pixels, y*mbox2, + width[i]); + } + bitmaps[i] = null; + } + } + + + /** + * Get a list of the fonts installed on the system that can be used + * by Java. Not all fonts can be used in Java, in fact it's mostly + * only TrueType fonts. OpenType fonts with CFF data such as Adobe's + * OpenType fonts seem to have trouble (even though they're sort of + * TrueType fonts as well, or may have a .ttf extension). Regular + * PostScript fonts seem to work OK, however. + *

+ * Not recommended for use in applets, but this is implemented + * in PFont because the Java methods to access this information + * have changed between 1.1 and 1.4, and the 1.4 method is + * typical of the sort of undergraduate-level over-abstraction + * that the seems to have made its way into the Java API after 1.1. + */ + static public String[] list() { + loadFonts(); + String list[] = new String[fonts.length]; + for (int i = 0; i < list.length; i++) { + list[i] = fonts[i].getName(); + } + return list; + } + + + static public void loadFonts() { + if (fonts == null) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + fonts = ge.getAllFonts(); + } + } + + + /** + * Starting with Java 1.5, Apple broke the ability to specify most fonts. + * This has been filed as bug #4769141 at bugreporter.apple.com. More info at + * Bug 407. + */ + static public Font findFont(String name) { + loadFonts(); + if (PApplet.platform == PConstants.MACOSX) { + for (int i = 0; i < fonts.length; i++) { + if (name.equals(fonts[i].getName())) { + return fonts[i]; + } + } + } + return new Font(name, Font.PLAIN, 1); + } +} diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java new file mode 100644 index 000000000..fbee90fac --- /dev/null +++ b/core/src/processing/core/PGraphics.java @@ -0,0 +1,5043 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.*; +import java.util.HashMap; + + +/** + * Main graphics and rendering context, as well as the base API implementation. + * + *

Subclassing and initializing PGraphics objects

+ * Starting in release 0149, subclasses of PGraphics are handled differently. + * The constructor for subclasses takes no parameters, instead a series of + * functions are called by the hosting PApplet to specify its attributes. + *
    + *
  • setParent(PApplet) - is called to specify the parent PApplet. + *
  • setPrimary(boolean) - called with true if this PGraphics will be the + * primary drawing surface used by the sketch, or false if not. + *
  • setPath(String) - called when the renderer needs a filename or output + * path, such as with the PDF or DXF renderers. + *
  • setSize(int, int) - this is called last, at which point it's safe for + * the renderer to complete its initialization routine. + *
+ * The functions were broken out because of the growing number of parameters + * such as these that might be used by a renderer, yet with the exception of + * setSize(), it's not clear which will be necessary. So while the size could + * be passed in to the constructor instead of a setSize() function, a function + * would still be needed that would notify the renderer that it was time to + * finish its initialization. Thus, setSize() simply does both. + * + *

Know your rights: public vs. private methods

+ * Methods that are protected are often subclassed by other renderers, however + * they are not set 'public' because they shouldn't be part of the user-facing + * public API accessible from PApplet. That is, we don't want sketches calling + * textModeCheck() or vertexTexture() directly. + * + *

Handling warnings and exceptions

+ * Methods that are unavailable generally show a warning, unless their lack of + * availability will soon cause another exception. For instance, if a method + * like getMatrix() returns null because it is unavailable, an exception will + * be thrown stating that the method is unavailable, rather than waiting for + * the NullPointerException that will occur when the sketch tries to use that + * method. As of release 0149, warnings will only be shown once, and exceptions + * have been changed to warnings where possible. + * + *

Using xxxxImpl() for subclassing smoothness

+ * The xxxImpl() methods are generally renderer-specific handling for some + * subset if tasks for a particular function (vague enough for you?) For + * instance, imageImpl() handles drawing an image whose x/y/w/h and u/v coords + * have been specified, and screen placement (independent of imageMode) has + * been determined. There's no point in all renderers implementing the + * if (imageMode == BLAH) placement/sizing logic, so that's handled + * by PGraphics, which then calls imageImpl() once all that is figured out. + * + *

His brother PImage

+ * PGraphics subclasses PImage so that it can be drawn and manipulated in a + * similar fashion. As such, many methods are inherited from PGraphics, + * though many are unavailable: for instance, resize() is not likely to be + * implemented; the same goes for mask(), depending on the situation. + * + *

What's in PGraphics, what ain't

+ * For the benefit of subclasses, as much as possible has been placed inside + * PGraphics. For instance, bezier interpolation code and implementations of + * the strokeCap() method (that simply sets the strokeCap variable) are + * handled here. Features that will vary widely between renderers are located + * inside the subclasses themselves. For instance, all matrix handling code + * is per-renderer: Java 2D uses its own AffineTransform, P2D uses a PMatrix2D, + * and PGraphics3D needs to keep continually update forward and reverse + * transformations. A proper (future) OpenGL implementation will have all its + * matrix madness handled by the card. Lighting also falls under this + * category, however the base material property settings (emissive, specular, + * et al.) are handled in PGraphics because they use the standard colorMode() + * logic. Subclasses should override methods like emissiveFromCalc(), which + * is a point where a valid color has been defined internally, and can be + * applied in some manner based on the calcXxxx values. + * + *

What's in the PGraphics documentation, what ain't

+ * Some things are noted here, some things are not. For public API, always + * refer to the reference + * on Processing.org for proper explanations. No attempt has been made to + * keep the javadoc up to date or complete. It's an enormous task for + * which we simply do not have the time. That is, it's not something that + * to be done once—it's a matter of keeping the multiple references + * synchronized (to say nothing of the translation issues), while targeting + * them for their separate audiences. Ouch. + */ +public class PGraphics extends PImage implements PConstants { + + // ........................................................ + + // width and height are already inherited from PImage + + + /// width minus one (useful for many calculations) + protected int width1; + + /// height minus one (useful for many calculations) + protected int height1; + + /// width * height (useful for many calculations) + public int pixelCount; + + /// true if smoothing is enabled (read-only) + public boolean smooth = false; + + // ........................................................ + + /// true if defaults() has been called a first time + protected boolean settingsInited; + + /// set to a PGraphics object being used inside a beginRaw/endRaw() block + protected PGraphics raw; + + // ........................................................ + + /** path to the file being saved for this renderer (if any) */ + protected String path; + + /** + * true if this is the main drawing surface for a particular sketch. + * This would be set to false for an offscreen buffer or if it were + * created any other way than size(). When this is set, the listeners + * are also added to the sketch. + */ + protected boolean primarySurface; + + // ........................................................ + + /** + * Array of hint[] items. These are hacks to get around various + * temporary workarounds inside the environment. + *

+ * Note that this array cannot be static, as a hint() may result in a + * runtime change specific to a renderer. For instance, calling + * hint(DISABLE_DEPTH_TEST) has to call glDisable() right away on an + * instance of PGraphicsOpenGL. + *

+ * The hints[] array is allocated early on because it might + * be used inside beginDraw(), allocate(), etc. + */ + protected boolean[] hints = new boolean[HINT_COUNT]; + + + //////////////////////////////////////////////////////////// + + // STYLE PROPERTIES + + // Also inherits imageMode() and smooth() (among others) from PImage. + + /** The current colorMode */ + public int colorMode; // = RGB; + + /** Max value for red (or hue) set by colorMode */ + public float colorModeX; // = 255; + + /** Max value for green (or saturation) set by colorMode */ + public float colorModeY; // = 255; + + /** Max value for blue (or value) set by colorMode */ + public float colorModeZ; // = 255; + + /** Max value for alpha set by colorMode */ + public float colorModeA; // = 255; + + /** True if colors are not in the range 0..1 */ + boolean colorModeScale; // = true; + + /** True if colorMode(RGB, 255) */ + boolean colorModeDefault; // = true; + + // ........................................................ + + // Tint color for images + + /** + * True if tint() is enabled (read-only). + * + * Using tint/tintColor seems a better option for naming than + * tintEnabled/tint because the latter seems ugly, even though + * g.tint as the actual color seems a little more intuitive, + * it's just that g.tintEnabled is even more unintuitive. + * Same goes for fill and stroke, et al. + */ + public boolean tint; + + /** tint that was last set (read-only) */ + public int tintColor; + + protected boolean tintAlpha; + protected float tintR, tintG, tintB, tintA; + protected int tintRi, tintGi, tintBi, tintAi; + + // ........................................................ + + // Fill color + + /** true if fill() is enabled, (read-only) */ + public boolean fill; + + /** fill that was last set (read-only) */ + public int fillColor = 0xffFFFFFF; + + protected boolean fillAlpha; + protected float fillR, fillG, fillB, fillA; + protected int fillRi, fillGi, fillBi, fillAi; + + // ........................................................ + + // Stroke color + + /** true if stroke() is enabled, (read-only) */ + public boolean stroke; + + /** stroke that was last set (read-only) */ + public int strokeColor = 0xff000000; + + protected boolean strokeAlpha; + protected float strokeR, strokeG, strokeB, strokeA; + protected int strokeRi, strokeGi, strokeBi, strokeAi; + + // ........................................................ + + // Additional stroke properties + + static protected final float DEFAULT_STROKE_WEIGHT = 1; + static protected final int DEFAULT_STROKE_JOIN = MITER; + static protected final int DEFAULT_STROKE_CAP = ROUND; + + /** + * Last value set by strokeWeight() (read-only). This has a default + * setting, rather than fighting with renderers about whether that + * renderer supports thick lines. + */ + public float strokeWeight = DEFAULT_STROKE_WEIGHT; + + /** + * Set by strokeJoin() (read-only). This has a default setting + * so that strokeJoin() need not be called by defaults, + * because subclasses may not implement it (i.e. PGraphicsGL) + */ + public int strokeJoin = DEFAULT_STROKE_JOIN; + + /** + * Set by strokeCap() (read-only). This has a default setting + * so that strokeCap() need not be called by defaults, + * because subclasses may not implement it (i.e. PGraphicsGL) + */ + public int strokeCap = DEFAULT_STROKE_CAP; + + // ........................................................ + + // Shape placement properties + + // imageMode() is inherited from PImage + + /** The current rect mode (read-only) */ + public int rectMode; + + /** The current ellipse mode (read-only) */ + public int ellipseMode; + + /** The current shape alignment mode (read-only) */ + public int shapeMode; + + /** The current image alignment (read-only) */ + public int imageMode = CORNER; + + // ........................................................ + + // Text and font properties + + /** The current text font (read-only) */ + public PFont textFont; + + /** The current text align (read-only) */ + public int textAlign = LEFT; + + /** The current vertical text alignment (read-only) */ + public int textAlignY = BASELINE; + + /** The current text mode (read-only) */ + public int textMode = MODEL; + + /** The current text size (read-only) */ + public float textSize; + + /** The current text leading (read-only) */ + public float textLeading; + + // ........................................................ + + // Material properties + +// PMaterial material; +// PMaterial[] materialStack; +// int materialStackPointer; + + public float ambientR, ambientG, ambientB; + public float specularR, specularG, specularB; + public float emissiveR, emissiveG, emissiveB; + public float shininess; + + + // Style stack + + static final int STYLE_STACK_DEPTH = 64; + PStyle[] styleStack = new PStyle[STYLE_STACK_DEPTH]; + int styleStackDepth; + + + //////////////////////////////////////////////////////////// + + + /** Last background color that was set, zero if an image */ + public int backgroundColor = 0xffCCCCCC; + + protected boolean backgroundAlpha; + protected float backgroundR, backgroundG, backgroundB, backgroundA; + protected int backgroundRi, backgroundGi, backgroundBi, backgroundAi; + + // ........................................................ + + /** + * Current model-view matrix transformation of the form m[row][column], + * which is a "column vector" (as opposed to "row vector") matrix. + */ +// PMatrix matrix; +// public float m00, m01, m02, m03; +// public float m10, m11, m12, m13; +// public float m20, m21, m22, m23; +// public float m30, m31, m32, m33; + +// static final int MATRIX_STACK_DEPTH = 32; +// float[][] matrixStack = new float[MATRIX_STACK_DEPTH][16]; +// float[][] matrixInvStack = new float[MATRIX_STACK_DEPTH][16]; +// int matrixStackDepth; + + static final int MATRIX_STACK_DEPTH = 32; + + // ........................................................ + + /** + * Java AWT Image object associated with this renderer. For P2D and P3D, + * this will be associated with their MemoryImageSource. For PGraphicsJava2D, + * it will be the offscreen drawing buffer. + */ + public Image image; + + // ........................................................ + + // internal color for setting/calculating + protected float calcR, calcG, calcB, calcA; + protected int calcRi, calcGi, calcBi, calcAi; + protected int calcColor; + protected boolean calcAlpha; + + /** The last RGB value converted to HSB */ + int cacheHsbKey; + /** Result of the last conversion to HSB */ + float[] cacheHsbValue = new float[3]; + + // ........................................................ + + /** + * Type of shape passed to beginShape(), + * zero if no shape is currently being drawn. + */ + protected int shape; + + // vertices + static final int DEFAULT_VERTICES = 512; + protected float vertices[][] = + new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT]; + protected int vertexCount; // total number of vertices + + // ........................................................ + + protected boolean bezierInited = false; + public int bezierDetail = 20; + + // used by both curve and bezier, so just init here + protected PMatrix3D bezierBasisMatrix = + new PMatrix3D(-1, 3, -3, 1, + 3, -6, 3, 0, + -3, 3, 0, 0, + 1, 0, 0, 0); + + //protected PMatrix3D bezierForwardMatrix; + protected PMatrix3D bezierDrawMatrix; + + // ........................................................ + + protected boolean curveInited = false; + protected int curveDetail = 20; + public float curveTightness = 0; + // catmull-rom basis matrix, perhaps with optional s parameter + protected PMatrix3D curveBasisMatrix; + protected PMatrix3D curveDrawMatrix; + + protected PMatrix3D bezierBasisInverse; + protected PMatrix3D curveToBezierMatrix; + + // ........................................................ + + // spline vertices + + protected float curveVertices[][]; + protected int curveVertexCount; + + // ........................................................ + + // precalculate sin/cos lookup tables [toxi] + // circle resolution is determined from the actual used radii + // passed to ellipse() method. this will automatically take any + // scale transformations into account too + + // [toxi 031031] + // changed table's precision to 0.5 degree steps + // introduced new vars for more flexible code + static final protected float sinLUT[]; + static final protected float cosLUT[]; + static final protected float SINCOS_PRECISION = 0.5f; + static final protected int SINCOS_LENGTH = (int) (360f / SINCOS_PRECISION); + static { + 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); + } + } + + // ........................................................ + + /** The current font if a Java version of it is installed */ + //protected Font textFontNative; + + /** Metrics for the current native Java font */ + //protected FontMetrics textFontNativeMetrics; + + /** Last text position, because text often mixed on lines together */ + protected float textX, textY, textZ; + + /** + * Internal buffer used by the text() functions + * because the String object is slow + */ + protected char[] textBuffer = new char[8 * 1024]; + protected char[] textWidthBuffer = new char[8 * 1024]; + + protected int textBreakCount; + protected int[] textBreakStart; + protected int[] textBreakStop; + + // ........................................................ + + public boolean edge = true; + + // ........................................................ + + /// normal calculated per triangle + static protected final int NORMAL_MODE_AUTO = 0; + /// one normal manually specified per shape + static protected final int NORMAL_MODE_SHAPE = 1; + /// normals specified for each shape vertex + static protected final int NORMAL_MODE_VERTEX = 2; + + /// Current mode for normals, one of AUTO, SHAPE, or VERTEX + protected int normalMode; + + /// Keep track of how many calls to normal, to determine the mode. + //protected int normalCount; + + /** Current normal vector. */ + public float normalX, normalY, normalZ; + + // ........................................................ + + /** + * Sets whether texture coordinates passed to + * vertex() calls will be based on coordinates that are + * based on the IMAGE or NORMALIZED. + */ + public int textureMode; + + /** + * Current horizontal coordinate for texture, will always + * be between 0 and 1, even if using textureMode(IMAGE). + */ + public float textureU; + + /** Current vertical coordinate for texture, see above. */ + public float textureV; + + /** Current image being used as a texture */ + public PImage textureImage; + + // ........................................................ + + // [toxi031031] new & faster sphere code w/ support flexibile resolutions + // will be set by sphereDetail() or 1st call to sphere() + float sphereX[], sphereY[], sphereZ[]; + + /// Number of U steps (aka "theta") around longitudinally spanning 2*pi + public int sphereDetailU = 0; + /// Number of V steps (aka "phi") along latitudinally top-to-bottom spanning pi + public int sphereDetailV = 0; + + + ////////////////////////////////////////////////////////////// + + // INTERNAL + + + /** + * Constructor for the PGraphics object. Use this to ensure that + * the defaults get set properly. In a subclass, use this(w, h) + * as the first line of a subclass' constructor to properly set + * the internal fields and defaults. + */ + public PGraphics() { + } + + + public void setParent(PApplet parent) { // ignore + this.parent = parent; + } + + + /** + * Set (or unset) this as the main drawing surface. Meaning that it can + * safely be set to opaque (and given a default gray background), or anything + * else that goes along with that. + */ + public void setPrimary(boolean primary) { // ignore + this.primarySurface = primary; + + // base images must be opaque (for performance and general + // headache reasons.. argh, a semi-transparent opengl surface?) + // use createGraphics() if you want a transparent surface. + if (primarySurface) { + format = RGB; + } + } + + + public void setPath(String path) { // ignore + this.path = path; + } + + + /** + * The final step in setting up a renderer, set its size of this renderer. + * This was formerly handled by the constructor, but instead it's been broken + * out so that setParent/setPrimary/setPath can be handled differently. + * + * Important that this is ignored by preproc.pl because otherwise it will + * override setSize() in PApplet/Applet/Component, which will 1) not call + * super.setSize(), and 2) will cause the renderer to be resized from the + * event thread (EDT), causing a nasty crash as it collides with the + * animation thread. + */ + public void setSize(int w, int h) { // ignore + width = w; + height = h; + width1 = width - 1; + height1 = height - 1; + + allocate(); + reapplySettings(); + } + + + /** + * Allocate memory for this renderer. Generally will need to be implemented + * for all renderers. + */ + protected void allocate() { } + + + /** + * Handle any takedown for this graphics context. + *

+ * This is called when a sketch is shut down and this renderer was + * specified using the size() command, or inside endRecord() and + * endRaw(), in order to shut things off. + */ + public void dispose() { // ignore + } + + + + ////////////////////////////////////////////////////////////// + + // FRAME + + + /** + * Some renderers have requirements re: when they are ready to draw. + */ + public boolean canDraw() { // ignore + return true; + } + + + /** + * Prepares the PGraphics for drawing. + *

+ * When creating your own PGraphics, you should call this before + * drawing anything. + */ + public void beginDraw() { // ignore + } + + + /** + * This will finalize rendering so that it can be shown on-screen. + *

+ * When creating your own PGraphics, you should call this when + * you're finished drawing. + */ + public void endDraw() { // ignore + } + + + public void flush() { + // no-op, mostly for P3D to write sorted stuff + } + + + protected void checkSettings() { + if (!settingsInited) defaultSettings(); + } + + + /** + * Set engine's default values. This has to be called by PApplet, + * somewhere inside setup() or draw() because it talks to the + * graphics buffer, meaning that for subclasses like OpenGL, there + * needs to be a valid graphics context to mess with otherwise + * you'll get some good crashing action. + * + * This is currently called by checkSettings(), during beginDraw(). + */ + protected void defaultSettings() { // ignore +// System.out.println("PGraphics.defaultSettings() " + width + " " + height); + + noSmooth(); // 0149 + + colorMode(RGB, 255); + fill(255); + stroke(0); + // other stroke attributes are set in the initializers + // inside the class (see above, strokeWeight = 1 et al) + + // init shape stuff + shape = 0; + + // init matrices (must do before lights) + //matrixStackDepth = 0; + + rectMode(CORNER); + ellipseMode(DIAMETER); + + // no current font + textFont = null; + textSize = 12; + textLeading = 14; + textAlign = LEFT; + textMode = MODEL; + + // if this fella is associated with an applet, then clear its background. + // if it's been created by someone else through createGraphics, + // they have to call background() themselves, otherwise everything gets + // a gray background (when just a transparent surface or an empty pdf + // is what's desired). + // this background() call is for the Java 2D and OpenGL renderers. + if (primarySurface) { + //System.out.println("main drawing surface bg " + getClass().getName()); + background(backgroundColor); + } + + settingsInited = true; + // defaultSettings() overlaps reapplySettings(), don't do both + //reapplySettings = false; + } + + + /** + * Re-apply current settings. Some methods, such as textFont(), require that + * their methods be called (rather than simply setting the textFont variable) + * because they affect the graphics context, or they require parameters from + * the context (e.g. getting native fonts for text). + * + * This will only be called from an allocate(), which is only called from + * size(), which is safely called from inside beginDraw(). And it cannot be + * called before defaultSettings(), so we should be safe. + */ + protected void reapplySettings() { +// System.out.println("attempting reapplySettings()"); + if (!settingsInited) return; // if this is the initial setup, no need to reapply + +// System.out.println(" doing reapplySettings"); +// new Exception().printStackTrace(System.out); + + colorMode(colorMode, colorModeX, colorModeY, colorModeZ); + if (fill) { +// PApplet.println(" fill " + PApplet.hex(fillColor)); + fill(fillColor); + } else { + noFill(); + } + if (stroke) { + stroke(strokeColor); + + // The if() statements should be handled inside the functions, + // otherwise an actual reset/revert won't work properly. + //if (strokeWeight != DEFAULT_STROKE_WEIGHT) { + strokeWeight(strokeWeight); + //} +// if (strokeCap != DEFAULT_STROKE_CAP) { + strokeCap(strokeCap); +// } +// if (strokeJoin != DEFAULT_STROKE_JOIN) { + strokeJoin(strokeJoin); +// } + } else { + noStroke(); + } + if (tint) { + tint(tintColor); + } else { + noTint(); + } + if (smooth) { + smooth(); + } else { + // Don't bother setting this, cuz it'll anger P3D. + noSmooth(); + } + if (textFont != null) { +// System.out.println(" textFont in reapply is " + textFont); + // textFont() resets the leading, so save it in case it's changed + float saveLeading = textLeading; + textFont(textFont, textSize); + textLeading(saveLeading); + } + textMode(textMode); + textAlign(textAlign, textAlignY); + background(backgroundColor); + + //reapplySettings = false; + } + + + ////////////////////////////////////////////////////////////// + + // HINTS + + /** + * Enable a hint option. + *

+ * For the most part, hints are temporary api quirks, + * for which a proper api hasn't been properly worked out. + * for instance SMOOTH_IMAGES existed because smooth() + * wasn't yet implemented, but it will soon go away. + *

+ * They also exist for obscure features in the graphics + * engine, like enabling/disabling single pixel lines + * that ignore the zbuffer, the way they do in alphabot. + *

+ * Current hint options: + *

    + *
  • DISABLE_DEPTH_TEST - + * turns off the z-buffer in the P3D or OPENGL renderers. + *
+ */ + public void hint(int which) { + if (which > 0) { + hints[which] = true; + } else { + hints[-which] = false; + } + } + + + + ////////////////////////////////////////////////////////////// + + // VERTEX SHAPES + + /** + * Start a new shape of type POLYGON + */ + public void beginShape() { + beginShape(POLYGON); + } + + + /** + * Start a new shape. + *

+ * Differences between beginShape() and line() and point() methods. + *

+ * beginShape() is intended to be more flexible at the expense of being + * a little more complicated to use. it handles more complicated shapes + * that can consist of many connected lines (so you get joins) or lines + * mixed with curves. + *

+ * The line() and point() command are for the far more common cases + * (particularly for our audience) that simply need to draw a line + * or a point on the screen. + *

+ * From the code side of things, line() may or may not call beginShape() + * to do the drawing. In the beta code, they do, but in the alpha code, + * they did not. they might be implemented one way or the other depending + * on tradeoffs of runtime efficiency vs. implementation efficiency &mdash + * meaning the speed that things run at vs. the speed it takes me to write + * the code and maintain it. for beta, the latter is most important so + * that's how things are implemented. + */ + public void beginShape(int kind) { + shape = kind; + } + + + /** + * Sets whether the upcoming vertex is part of an edge. + * Equivalent to glEdgeFlag(), for people familiar with OpenGL. + */ + public void edge(boolean edge) { + this.edge = edge; + } + + + /** + * Sets the current normal vector. Only applies with 3D rendering + * and inside a beginShape/endShape block. + *

+ * This is for drawing three dimensional shapes and surfaces, + * allowing you to specify a vector perpendicular to the surface + * of the shape, which determines how lighting affects it. + *

+ * For the most part, PGraphics3D will attempt to automatically + * assign normals to shapes, but since that's imperfect, + * this is a better option when you want more control. + *

+ * For people familiar with OpenGL, this function is basically + * identical to glNormal3f(). + */ + public void normal(float nx, float ny, float nz) { + normalX = nx; + normalY = ny; + normalZ = nz; + + // if drawing a shape and the normal hasn't been set yet, + // then we need to set the normals for each vertex so far + if (shape != 0) { + if (normalMode == NORMAL_MODE_AUTO) { + // either they set the normals, or they don't [0149] +// for (int i = vertex_start; i < vertexCount; i++) { +// vertices[i][NX] = normalX; +// vertices[i][NY] = normalY; +// vertices[i][NZ] = normalZ; +// } + // One normal per begin/end shape + normalMode = NORMAL_MODE_SHAPE; + + } else if (normalMode == NORMAL_MODE_SHAPE) { + // a separate normal for each vertex + normalMode = NORMAL_MODE_VERTEX; + } + } + } + + + /** + * Set texture mode to either to use coordinates based on the IMAGE + * (more intuitive for new users) or NORMALIZED (better for advanced chaps) + */ + public void textureMode(int mode) { + this.textureMode = mode; + } + + + /** + * Set texture image for current shape. + * Needs to be called between @see beginShape and @see endShape + * + * @param image reference to a PImage object + */ + public void texture(PImage image) { + textureImage = image; + } + + + protected void vertexCheck() { + if (vertexCount == vertices.length) { + float temp[][] = new float[vertexCount << 1][VERTEX_FIELD_COUNT]; + System.arraycopy(vertices, 0, temp, 0, vertexCount); + vertices = temp; + } + } + + + public void vertex(float x, float y) { + vertexCheck(); + float[] vertex = vertices[vertexCount]; + + curveVertexCount = 0; + + vertex[X] = x; + vertex[Y] = y; + + vertex[EDGE] = edge ? 1 : 0; + +// if (fill) { +// vertex[R] = fillR; +// vertex[G] = fillG; +// vertex[B] = fillB; +// vertex[A] = fillA; +// } + if (fill || textureImage != null) { + if (textureImage == null) { + vertex[R] = fillR; + vertex[G] = fillG; + vertex[B] = fillB; + vertex[A] = fillA; + } else { + if (tint) { + vertex[R] = tintR; + vertex[G] = tintG; + vertex[B] = tintB; + vertex[A] = tintA; + } else { + vertex[R] = 1; + vertex[G] = 1; + vertex[B] = 1; + vertex[A] = 1; + } + } + } + + if (stroke) { + vertex[SR] = strokeR; + vertex[SG] = strokeG; + vertex[SB] = strokeB; + vertex[SA] = strokeA; + vertex[SW] = strokeWeight; + } + + if (textureImage != null) { + vertex[U] = textureU; + vertex[V] = textureV; + } + + vertexCount++; + } + + + public void vertex(float x, float y, float z) { + vertexCheck(); + float[] vertex = vertices[vertexCount]; + + // only do this if we're using an irregular (POLYGON) shape that + // will go through the triangulator. otherwise it'll do thinks like + // disappear in mathematically odd ways + // http://dev.processing.org/bugs/show_bug.cgi?id=444 + if (shape == POLYGON) { + if (vertexCount > 0) { + float pvertex[] = vertices[vertexCount-1]; + if ((Math.abs(pvertex[X] - x) < EPSILON) && + (Math.abs(pvertex[Y] - y) < EPSILON) && + (Math.abs(pvertex[Z] - z) < EPSILON)) { + // this vertex is identical, don't add it, + // because it will anger the triangulator + return; + } + } + } + + // User called vertex(), so that invalidates anything queued up for curve + // vertices. If this is internally called by curveVertexSegment, + // then curveVertexCount will be saved and restored. + curveVertexCount = 0; + + vertex[X] = x; + vertex[Y] = y; + vertex[Z] = z; + + vertex[EDGE] = edge ? 1 : 0; + + if (fill || textureImage != null) { + if (textureImage == null) { + vertex[R] = fillR; + vertex[G] = fillG; + vertex[B] = fillB; + vertex[A] = fillA; + } else { + if (tint) { + vertex[R] = tintR; + vertex[G] = tintG; + vertex[B] = tintB; + vertex[A] = tintA; + } else { + vertex[R] = 1; + vertex[G] = 1; + vertex[B] = 1; + vertex[A] = 1; + } + } + + vertex[AR] = ambientR; + vertex[AG] = ambientG; + vertex[AB] = ambientB; + + vertex[SPR] = specularR; + vertex[SPG] = specularG; + vertex[SPB] = specularB; + //vertex[SPA] = specularA; + + vertex[SHINE] = shininess; + + vertex[ER] = emissiveR; + vertex[EG] = emissiveG; + vertex[EB] = emissiveB; + } + + if (stroke) { + vertex[SR] = strokeR; + vertex[SG] = strokeG; + vertex[SB] = strokeB; + vertex[SA] = strokeA; + vertex[SW] = strokeWeight; + } + + if (textureImage != null) { + vertex[U] = textureU; + vertex[V] = textureV; + } + + vertex[NX] = normalX; + vertex[NY] = normalY; + vertex[NZ] = normalZ; + + vertex[BEEN_LIT] = 0; + + vertexCount++; + } + + + /** + * Used by renderer subclasses or PShape to efficiently pass in already + * formatted vertex information. + * @param v vertex parameters, as a float array of length VERTEX_FIELD_COUNT + */ + public void vertex(float[] v) { + vertexCheck(); + curveVertexCount = 0; + float[] vertex = vertices[vertexCount]; + System.arraycopy(v, 0, vertex, 0, VERTEX_FIELD_COUNT); + vertexCount++; + } + + + public void vertex(float x, float y, float u, float v) { + vertexTexture(u, v); + vertex(x, y); + } + + + public void vertex(float x, float y, float z, float u, float v) { + vertexTexture(u, v); + vertex(x, y, z); + } + + + /** + * Internal method to copy all style information for the given vertex. + * Can be overridden by subclasses to handle only properties pertinent to + * that renderer. (e.g. no need to copy the emissive color in P2D) + */ +// protected void vertexStyle() { +// } + + + /** + * Set (U, V) coords for the next vertex in the current shape. + * This is ugly as its own function, and will (almost?) always be + * coincident with a call to vertex. As of beta, this was moved to + * the protected method you see here, and called from an optional + * param of and overloaded vertex(). + *

+ * The parameters depend on the current textureMode. When using + * textureMode(IMAGE), the coordinates will be relative to the size + * of the image texture, when used with textureMode(NORMAL), + * they'll be in the range 0..1. + *

+ * Used by both PGraphics2D (for images) and PGraphics3D. + */ + protected void vertexTexture(float u, float v) { + if (textureImage == null) { + throw new RuntimeException("You must first call texture() before " + + "using u and v coordinates with vertex()"); + } + if (textureMode == IMAGE) { + u /= (float) textureImage.width; + v /= (float) textureImage.height; + } + + textureU = u; + textureV = v; + + if (textureU < 0) textureU = 0; + else if (textureU > 1) textureU = 1; + + if (textureV < 0) textureV = 0; + else if (textureV > 1) textureV = 1; + } + + + /** This feature is in testing, do not use or rely upon its implementation */ + public void breakShape() { + showWarning("This renderer cannot currently handle concave shapes, " + + "or shapes with holes."); + } + + + public void endShape() { + endShape(OPEN); + } + + + public void endShape(int mode) { + } + + + + ////////////////////////////////////////////////////////////// + + // CURVE/BEZIER VERTEX HANDLING + + + protected void bezierVertexCheck() { + if (shape == 0 || shape != POLYGON) { + throw new RuntimeException("beginShape() or beginShape(POLYGON) " + + "must be used before bezierVertex()"); + } + if (vertexCount == 0) { + throw new RuntimeException("vertex() must be used at least once" + + "before bezierVertex()"); + } + } + + + public void bezierVertex(float x2, float y2, + float x3, float y3, + float x4, float y4) { + bezierInitCheck(); + bezierVertexCheck(); + PMatrix3D draw = bezierDrawMatrix; + + float[] prev = vertices[vertexCount-1]; + float x1 = prev[X]; + float y1 = prev[Y]; + + float xplot1 = draw.m10*x1 + draw.m11*x2 + draw.m12*x3 + draw.m13*x4; + float xplot2 = draw.m20*x1 + draw.m21*x2 + draw.m22*x3 + draw.m23*x4; + float xplot3 = draw.m30*x1 + draw.m31*x2 + draw.m32*x3 + draw.m33*x4; + + float yplot1 = draw.m10*y1 + draw.m11*y2 + draw.m12*y3 + draw.m13*y4; + float yplot2 = draw.m20*y1 + draw.m21*y2 + draw.m22*y3 + draw.m23*y4; + float yplot3 = draw.m30*y1 + draw.m31*y2 + draw.m32*y3 + draw.m33*y4; + + for (int j = 0; j < bezierDetail; j++) { + x1 += xplot1; xplot1 += xplot2; xplot2 += xplot3; + y1 += yplot1; yplot1 += yplot2; yplot2 += yplot3; + vertex(x1, y1); + } + } + + + public void bezierVertex(float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + bezierInitCheck(); + bezierVertexCheck(); + PMatrix3D draw = bezierDrawMatrix; + + float[] prev = vertices[vertexCount-1]; + float x1 = prev[X]; + float y1 = prev[Y]; + float z1 = prev[Z]; + + float xplot1 = draw.m10*x1 + draw.m11*x2 + draw.m12*x3 + draw.m13*x4; + float xplot2 = draw.m20*x1 + draw.m21*x2 + draw.m22*x3 + draw.m23*x4; + float xplot3 = draw.m30*x1 + draw.m31*x2 + draw.m32*x3 + draw.m33*x4; + + float yplot1 = draw.m10*y1 + draw.m11*y2 + draw.m12*y3 + draw.m13*y4; + float yplot2 = draw.m20*y1 + draw.m21*y2 + draw.m22*y3 + draw.m23*y4; + float yplot3 = draw.m30*y1 + draw.m31*y2 + draw.m32*y3 + draw.m33*y4; + + float zplot1 = draw.m10*z1 + draw.m11*z2 + draw.m12*z3 + draw.m13*z4; + float zplot2 = draw.m20*z1 + draw.m21*z2 + draw.m22*z3 + draw.m23*z4; + float zplot3 = draw.m30*z1 + draw.m31*z2 + draw.m32*z3 + draw.m33*z4; + + for (int j = 0; j < bezierDetail; j++) { + x1 += xplot1; xplot1 += xplot2; xplot2 += xplot3; + y1 += yplot1; yplot1 += yplot2; yplot2 += yplot3; + z1 += zplot1; zplot1 += zplot2; zplot2 += zplot3; + vertex(x1, y1, z1); + } + } + + + /** + * Perform initialization specific to curveVertex(), and handle standard + * error modes. Can be overridden by subclasses that need the flexibility. + */ + protected void curveVertexCheck() { + if (shape != POLYGON) { + throw new RuntimeException("You must use beginShape() or " + + "beginShape(POLYGON) before curveVertex()"); + } + // to improve code init time, allocate on first use. + if (curveVertices == null) { + curveVertices = new float[128][3]; + } + + if (curveVertexCount == curveVertices.length) { + // Can't use PApplet.expand() cuz it doesn't do the copy properly + float[][] temp = new float[curveVertexCount << 1][3]; + System.arraycopy(curveVertices, 0, temp, 0, curveVertexCount); + curveVertices = temp; + } + curveInitCheck(); + } + + + public void curveVertex(float x, float y) { + curveVertexCheck(); + float[] vertex = curveVertices[curveVertexCount]; + vertex[X] = x; + vertex[Y] = y; + curveVertexCount++; + + // draw a segment if there are enough points + if (curveVertexCount > 3) { + curveVertexSegment(curveVertices[curveVertexCount-4][X], + curveVertices[curveVertexCount-4][Y], + curveVertices[curveVertexCount-3][X], + curveVertices[curveVertexCount-3][Y], + curveVertices[curveVertexCount-2][X], + curveVertices[curveVertexCount-2][Y], + curveVertices[curveVertexCount-1][X], + curveVertices[curveVertexCount-1][Y]); + } + } + + + public void curveVertex(float x, float y, float z) { + curveVertexCheck(); + float[] vertex = curveVertices[curveVertexCount]; + vertex[X] = x; + vertex[Y] = y; + vertex[Z] = z; + curveVertexCount++; + + // draw a segment if there are enough points + if (curveVertexCount > 3) { + curveVertexSegment(curveVertices[curveVertexCount-4][X], + curveVertices[curveVertexCount-4][Y], + curveVertices[curveVertexCount-4][Z], + curveVertices[curveVertexCount-3][X], + curveVertices[curveVertexCount-3][Y], + curveVertices[curveVertexCount-3][Z], + curveVertices[curveVertexCount-2][X], + curveVertices[curveVertexCount-2][Y], + curveVertices[curveVertexCount-2][Z], + curveVertices[curveVertexCount-1][X], + curveVertices[curveVertexCount-1][Y], + curveVertices[curveVertexCount-1][Z]); + } + } + + + /** + * Handle emitting a specific segment of Catmull-Rom curve. This can be + * overridden by subclasses that need more efficient rendering options. + */ + protected void curveVertexSegment(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + float x0 = x2; + float y0 = y2; + + PMatrix3D draw = curveDrawMatrix; + + float xplot1 = draw.m10*x1 + draw.m11*x2 + draw.m12*x3 + draw.m13*x4; + float xplot2 = draw.m20*x1 + draw.m21*x2 + draw.m22*x3 + draw.m23*x4; + float xplot3 = draw.m30*x1 + draw.m31*x2 + draw.m32*x3 + draw.m33*x4; + + float yplot1 = draw.m10*y1 + draw.m11*y2 + draw.m12*y3 + draw.m13*y4; + float yplot2 = draw.m20*y1 + draw.m21*y2 + draw.m22*y3 + draw.m23*y4; + float yplot3 = draw.m30*y1 + draw.m31*y2 + draw.m32*y3 + draw.m33*y4; + + // vertex() will reset splineVertexCount, so save it + int savedCount = curveVertexCount; + + vertex(x0, y0); + for (int j = 0; j < curveDetail; j++) { + x0 += xplot1; xplot1 += xplot2; xplot2 += xplot3; + y0 += yplot1; yplot1 += yplot2; yplot2 += yplot3; + vertex(x0, y0); + } + curveVertexCount = savedCount; + } + + + /** + * Handle emitting a specific segment of Catmull-Rom curve. This can be + * overridden by subclasses that need more efficient rendering options. + */ + protected void curveVertexSegment(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + float x0 = x2; + float y0 = y2; + float z0 = z2; + + PMatrix3D draw = curveDrawMatrix; + + float xplot1 = draw.m10*x1 + draw.m11*x2 + draw.m12*x3 + draw.m13*x4; + float xplot2 = draw.m20*x1 + draw.m21*x2 + draw.m22*x3 + draw.m23*x4; + float xplot3 = draw.m30*x1 + draw.m31*x2 + draw.m32*x3 + draw.m33*x4; + + float yplot1 = draw.m10*y1 + draw.m11*y2 + draw.m12*y3 + draw.m13*y4; + float yplot2 = draw.m20*y1 + draw.m21*y2 + draw.m22*y3 + draw.m23*y4; + float yplot3 = draw.m30*y1 + draw.m31*y2 + draw.m32*y3 + draw.m33*y4; + + // vertex() will reset splineVertexCount, so save it + int savedCount = curveVertexCount; + + float zplot1 = draw.m10*z1 + draw.m11*z2 + draw.m12*z3 + draw.m13*z4; + float zplot2 = draw.m20*z1 + draw.m21*z2 + draw.m22*z3 + draw.m23*z4; + float zplot3 = draw.m30*z1 + draw.m31*z2 + draw.m32*z3 + draw.m33*z4; + + vertex(x0, y0, z0); + for (int j = 0; j < curveDetail; j++) { + x0 += xplot1; xplot1 += xplot2; xplot2 += xplot3; + y0 += yplot1; yplot1 += yplot2; yplot2 += yplot3; + z0 += zplot1; zplot1 += zplot2; zplot2 += zplot3; + vertex(x0, y0, z0); + } + curveVertexCount = savedCount; + } + + + + ////////////////////////////////////////////////////////////// + + // SIMPLE SHAPES WITH ANALOGUES IN beginShape() + + + public void point(float x, float y) { + beginShape(POINTS); + vertex(x, y); + endShape(); + } + + + public void point(float x, float y, float z) { + beginShape(POINTS); + vertex(x, y, z); + endShape(); + } + + + public void line(float x1, float y1, float x2, float y2) { + beginShape(LINES); + vertex(x1, y1); + vertex(x2, y2); + endShape(); + } + + + public void line(float x1, float y1, float z1, + float x2, float y2, float z2) { + beginShape(LINES); + vertex(x1, y1, z1); + vertex(x2, y2, z2); + endShape(); + } + + + public void triangle(float x1, float y1, float x2, float y2, + float x3, float y3) { + beginShape(TRIANGLES); + vertex(x1, y1); + vertex(x2, y2); + vertex(x3, y3); + endShape(); + } + + + public void quad(float x1, float y1, float x2, float y2, + float x3, float y3, float x4, float y4) { + beginShape(QUADS); + vertex(x1, y1); + vertex(x2, y2); + vertex(x3, y3); + vertex(x4, y4); + endShape(); + } + + + + ////////////////////////////////////////////////////////////// + + // RECT + + + public void rectMode(int mode) { + rectMode = mode; + } + + + public void rect(float a, float b, float c, float d) { + float hradius, vradius; + switch (rectMode) { + case CORNERS: + break; + case CORNER: + c += a; d += b; + break; + case RADIUS: + hradius = c; + vradius = d; + c = a + hradius; + d = b + vradius; + a -= hradius; + b -= vradius; + break; + case CENTER: + hradius = c / 2.0f; + vradius = d / 2.0f; + c = a + hradius; + d = b + vradius; + a -= hradius; + b -= vradius; + } + + if (a > c) { + float temp = a; a = c; c = temp; + } + + if (b > d) { + float temp = b; b = d; d = temp; + } + + rectImpl(a, b, c, d); + } + + + protected void rectImpl(float x1, float y1, float x2, float y2) { + quad(x1, y1, x2, y1, x2, y2, x1, y2); + } + + + + ////////////////////////////////////////////////////////////// + + // ELLIPSE AND ARC + + + public void ellipseMode(int mode) { + ellipseMode = mode; + } + + + public void ellipse(float a, float b, float c, float d) { + float x = a; + float y = b; + float w = c; + float h = d; + + if (ellipseMode == CORNERS) { + w = c - a; + h = d - b; + + } else if (ellipseMode == RADIUS) { + x = a - c; + y = b - d; + w = c * 2; + h = d * 2; + + } else if (ellipseMode == DIAMETER) { + x = a - c/2f; + y = b - d/2f; + } + + if (w < 0) { // undo negative width + x += w; + w = -w; + } + + if (h < 0) { // undo negative height + y += h; + h = -h; + } + + ellipseImpl(x, y, w, h); + } + + + protected void ellipseImpl(float x, float y, float w, float h) { + } + + + /** + * Identical parameters and placement to ellipse, + * but draws only an arc of that ellipse. + *

+ * start and stop are always radians because angleMode() was goofy. + * ellipseMode() sets the placement. + *

+ * also tries to be smart about start < stop. + */ + public void arc(float a, float b, float c, float d, + float start, float stop) { + float x = a; + float y = b; + float w = c; + float h = d; + + if (ellipseMode == CORNERS) { + w = c - a; + h = d - b; + + } else if (ellipseMode == RADIUS) { + x = a - c; + y = b - d; + w = c * 2; + h = d * 2; + + } else if (ellipseMode == CENTER) { + x = a - c/2f; + y = b - d/2f; + } + + // make sure this loop will exit before starting while + if (Float.isInfinite(start) || Float.isInfinite(stop)) return; +// while (stop < start) stop += TWO_PI; + if (stop < start) return; // why bother + + // make sure that we're starting at a useful point + while (start < 0) { + start += TWO_PI; + stop += TWO_PI; + } + + if (stop - start > TWO_PI) { + start = 0; + stop = TWO_PI; + } + + arcImpl(x, y, w, h, start, stop); + } + + + /** + * Start and stop are in radians, converted by the parent function. + * Note that the radians can be greater (or less) than TWO_PI. + * This is so that an arc can be drawn that crosses zero mark, + * and the user will still collect $200. + */ + protected void arcImpl(float x, float y, float w, float h, + float start, float stop) { + } + + + + ////////////////////////////////////////////////////////////// + + // BOX + + + public void box(float size) { + box(size, size, size); + } + + + // TODO not the least bit efficient, it even redraws lines + // along the vertices. ugly ugly ugly! + public void box(float w, float h, float d) { + float x1 = -w/2f; float x2 = w/2f; + float y1 = -h/2f; float y2 = h/2f; + float z1 = -d/2f; float z2 = d/2f; + + beginShape(QUADS); + + // front + normal(0, 0, 1); + vertex(x1, y1, z1); + vertex(x2, y1, z1); + vertex(x2, y2, z1); + vertex(x1, y2, z1); + + // right + normal(1, 0, 0); + vertex(x2, y1, z1); + vertex(x2, y1, z2); + vertex(x2, y2, z2); + vertex(x2, y2, z1); + + // back + normal(0, 0, -1); + vertex(x2, y1, z2); + vertex(x1, y1, z2); + vertex(x1, y2, z2); + vertex(x2, y2, z2); + + // left + normal(-1, 0, 0); + vertex(x1, y1, z2); + vertex(x1, y1, z1); + vertex(x1, y2, z1); + vertex(x1, y2, z2); + + // top + normal(0, 1, 0); + vertex(x1, y1, z2); + vertex(x2, y1, z2); + vertex(x2, y1, z1); + vertex(x1, y1, z1); + + // bottom + normal(0, -1, 0); + vertex(x1, y2, z1); + vertex(x2, y2, z1); + vertex(x2, y2, z2); + vertex(x1, y2, z2); + + endShape(); + } + + + + ////////////////////////////////////////////////////////////// + + // SPHERE + + + public void sphereDetail(int res) { + sphereDetail(res, res); + } + + + /** + * Set the detail level for approximating a sphere. The ures and vres params + * control the horizontal and vertical resolution. + * + * Code for sphereDetail() submitted by toxi [031031]. + * Code for enhanced u/v version from davbol [080801]. + */ + public void sphereDetail(int ures, int vres) { + if (ures < 3) ures = 3; // force a minimum res + if (vres < 2) vres = 2; // force a minimum res + if ((ures == sphereDetailU) && (vres == sphereDetailV)) return; + + float delta = (float)SINCOS_LENGTH/ures; + float[] cx = new float[ures]; + float[] cz = new float[ures]; + // calc unit circle in XZ plane + for (int i = 0; i < ures; i++) { + cx[i] = cosLUT[(int) (i*delta) % SINCOS_LENGTH]; + cz[i] = sinLUT[(int) (i*delta) % SINCOS_LENGTH]; + } + // computing vertexlist + // vertexlist starts at south pole + int vertCount = ures * (vres-1) + 2; + int currVert = 0; + + // re-init arrays to store vertices + sphereX = new float[vertCount]; + sphereY = new float[vertCount]; + sphereZ = new float[vertCount]; + + float angle_step = (SINCOS_LENGTH*0.5f)/vres; + float angle = angle_step; + + // step along Y axis + for (int i = 1; i < vres; i++) { + float curradius = sinLUT[(int) angle % SINCOS_LENGTH]; + float currY = -cosLUT[(int) angle % SINCOS_LENGTH]; + for (int j = 0; j < ures; j++) { + sphereX[currVert] = cx[j] * curradius; + sphereY[currVert] = currY; + sphereZ[currVert++] = cz[j] * curradius; + } + angle += angle_step; + } + sphereDetailU = ures; + sphereDetailV = vres; + } + + + /** + * Draw a sphere with radius r centered at coordinate 0, 0, 0. + *

+ * Implementation notes: + *

+ * cache all the points of the sphere in a static array + * top and bottom are just a bunch of triangles that land + * in the center point + *

+ * sphere is a series of concentric circles who radii vary + * along the shape, based on, er.. cos or something + *

+   * [toxi 031031] new sphere code. removed all multiplies with
+   * radius, as scale() will take care of that anyway
+   *
+   * [toxi 031223] updated sphere code (removed modulos)
+   * and introduced sphereAt(x,y,z,r)
+   * to avoid additional translate()'s on the user/sketch side
+   *
+   * [davbol 080801] now using separate sphereDetailU/V
+   * 
+ */ + public void sphere(float r) { + if ((sphereDetailU < 3) || (sphereDetailV < 2)) { + sphereDetail(30); + } + + pushMatrix(); + scale(r); + edge(false); + + // 1st ring from south pole + beginShape(TRIANGLE_STRIP); + for (int i = 0; i < sphereDetailU; i++) { + normal(0, -1, 0); + vertex(0, -1, 0); + normal(sphereX[i], sphereY[i], sphereZ[i]); + vertex(sphereX[i], sphereY[i], sphereZ[i]); + } + //normal(0, -1, 0); + vertex(0, -1, 0); + normal(sphereX[0], sphereY[0], sphereZ[0]); + vertex(sphereX[0], sphereY[0], sphereZ[0]); + endShape(); + + int v1,v11,v2; + + // middle rings + int voff = 0; + for (int i = 2; i < sphereDetailV; i++) { + v1 = v11 = voff; + voff += sphereDetailU; + v2 = voff; + beginShape(TRIANGLE_STRIP); + for (int j = 0; j < sphereDetailU; j++) { + normal(sphereX[v1], sphereY[v1], sphereZ[v1]); + vertex(sphereX[v1], sphereY[v1], sphereZ[v1++]); + normal(sphereX[v2], sphereY[v2], sphereZ[v2]); + vertex(sphereX[v2], sphereY[v2], sphereZ[v2++]); + } + // close each ring + v1 = v11; + v2 = voff; + normal(sphereX[v1], sphereY[v1], sphereZ[v1]); + vertex(sphereX[v1], sphereY[v1], sphereZ[v1]); + normal(sphereX[v2], sphereY[v2], sphereZ[v2]); + vertex(sphereX[v2], sphereY[v2], sphereZ[v2]); + endShape(); + } + + // add the northern cap + beginShape(TRIANGLE_STRIP); + for (int i = 0; i < sphereDetailU; i++) { + v2 = voff + i; + normal(sphereX[v2], sphereY[v2], sphereZ[v2]); + vertex(sphereX[v2], sphereY[v2], sphereZ[v2]); + normal(0, 1, 0); + vertex(0, 1, 0); + } + normal(sphereX[voff], sphereY[voff], sphereZ[voff]); + vertex(sphereX[voff], sphereY[voff], sphereZ[voff]); + normal(0, 1, 0); + vertex(0, 1, 0); + endShape(); + + edge(true); + popMatrix(); + } + + + + ////////////////////////////////////////////////////////////// + + // BEZIER + + + /** + * Evalutes quadratic bezier at point t for points a, b, c, d. + * t varies between 0 and 1, and a and d are the on curve points, + * b and c are the control points. this can be done once with the + * x coordinates and a second time with the y coordinates to get + * the location of a bezier curve at t. + *

+ * For instance, to convert the following example:

+   * stroke(255, 102, 0);
+   * line(85, 20, 10, 10);
+   * line(90, 90, 15, 80);
+   * stroke(0, 0, 0);
+   * bezier(85, 20, 10, 10, 90, 90, 15, 80);
+   *
+   * // draw it in gray, using 10 steps instead of the default 20
+   * // this is a slower way to do it, but useful if you need
+   * // to do things with the coordinates at each step
+   * stroke(128);
+   * beginShape(LINE_STRIP);
+   * for (int i = 0; i <= 10; i++) {
+   *   float t = i / 10.0f;
+   *   float x = bezierPoint(85, 10, 90, 15, t);
+   *   float y = bezierPoint(20, 10, 90, 80, t);
+   *   vertex(x, y);
+   * }
+   * endShape();
+ */ + public float bezierPoint(float a, float b, float c, float d, float t) { + float t1 = 1.0f - t; + return a*t1*t1*t1 + 3*b*t*t1*t1 + 3*c*t*t*t1 + d*t*t*t; + } + + + /** + * Provide the tangent at the given point on the bezier curve. + * Fix from davbol for 0136. + */ + public float bezierTangent(float a, float b, float c, float d, float t) { + return (3*t*t * (-a+3*b-3*c+d) + + 6*t * (a-2*b+c) + + 3 * (-a+b)); + } + + + protected void bezierInitCheck() { + if (!bezierInited) { + bezierInit(); + } + } + + + protected void bezierInit() { + // overkill to be broken out, but better parity with the curve stuff below + bezierDetail(bezierDetail); + bezierInited = true; + } + + + public void bezierDetail(int detail) { + bezierDetail = detail; + + if (bezierDrawMatrix == null) { + bezierDrawMatrix = new PMatrix3D(); + } + + // setup matrix for forward differencing to speed up drawing + splineForward(detail, bezierDrawMatrix); + + // multiply the basis and forward diff matrices together + // saves much time since this needn't be done for each curve + //mult_spline_matrix(bezierForwardMatrix, bezier_basis, bezierDrawMatrix, 4); + //bezierDrawMatrix.set(bezierForwardMatrix); + bezierDrawMatrix.apply(bezierBasisMatrix); + } + + + /** + * Draw a cubic bezier curve. The first and last points are + * the on-curve points. The middle two are the 'control' points, + * or 'handles' in an application like Illustrator. + *

+ * Identical to typing: + *

beginShape();
+   * vertex(x1, y1);
+   * bezierVertex(x2, y2, x3, y3, x4, y4);
+   * endShape();
+   * 
+ * In Postscript-speak, this would be: + *
moveto(x1, y1);
+   * curveto(x2, y2, x3, y3, x4, y4);
+ * If you were to try and continue that curve like so: + *
curveto(x5, y5, x6, y6, x7, y7);
+ * This would be done in processing by adding these statements: + *
bezierVertex(x5, y5, x6, y6, x7, y7)
+   * 
+ * To draw a quadratic (instead of cubic) curve, + * use the control point twice by doubling it: + *
bezier(x1, y1, cx, cy, cx, cy, x2, y2);
+ */ + public void bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + beginShape(); + vertex(x1, y1); + bezierVertex(x2, y2, x3, y3, x4, y4); + endShape(); + } + + + public void bezier(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + beginShape(); + vertex(x1, y1, z1); + bezierVertex(x2, y2, z2, + x3, y3, z3, + x4, y4, z4); + endShape(); + } + + + + ////////////////////////////////////////////////////////////// + + // CATMULL-ROM CURVE + + + /** + * Get a location along a catmull-rom curve segment. + * + * @param t Value between zero and one for how far along the segment + */ + public float curvePoint(float a, float b, float c, float d, float t) { + curveInitCheck(); + + float tt = t * t; + float ttt = t * tt; + PMatrix3D cb = curveBasisMatrix; + + // not optimized (and probably need not be) + return (a * (ttt*cb.m00 + tt*cb.m10 + t*cb.m20 + cb.m30) + + b * (ttt*cb.m01 + tt*cb.m11 + t*cb.m21 + cb.m31) + + c * (ttt*cb.m02 + tt*cb.m12 + t*cb.m22 + cb.m32) + + d * (ttt*cb.m03 + tt*cb.m13 + t*cb.m23 + cb.m33)); + } + + + /** + * Calculate the tangent at a t value (0..1) on a Catmull-Rom curve. + * Code thanks to Dave Bollinger (Bug #715) + */ + public float curveTangent(float a, float b, float c, float d, float t) { + curveInitCheck(); + + float tt3 = t * t * 3; + float t2 = t * 2; + PMatrix3D cb = curveBasisMatrix; + + // not optimized (and probably need not be) + return (a * (tt3*cb.m00 + t2*cb.m10 + cb.m20) + + b * (tt3*cb.m01 + t2*cb.m11 + cb.m21) + + c * (tt3*cb.m02 + t2*cb.m12 + cb.m22) + + d * (tt3*cb.m03 + t2*cb.m13 + cb.m23) ); + } + + + public void curveDetail(int detail) { + curveDetail = detail; + curveInit(); + } + + + public void curveTightness(float tightness) { + curveTightness = tightness; + curveInit(); + } + + + protected void curveInitCheck() { + if (!curveInited) { + curveInit(); + } + } + + + /** + * Set the number of segments to use when drawing a Catmull-Rom + * curve, and setting the s parameter, which defines how tightly + * the curve fits to each vertex. Catmull-Rom curves are actually + * a subset of this curve type where the s is set to zero. + *

+ * (This function is not optimized, since it's not expected to + * be called all that often. there are many juicy and obvious + * opimizations in here, but it's probably better to keep the + * code more readable) + */ + protected void curveInit() { + // allocate only if/when used to save startup time + if (curveDrawMatrix == null) { + curveBasisMatrix = new PMatrix3D(); + curveDrawMatrix = new PMatrix3D(); + curveInited = true; + } + + float s = curveTightness; + curveBasisMatrix.set((s-1)/2f, (s+3)/2f, (-3-s)/2f, (1-s)/2f, + (1-s), (-5-s)/2f, (s+2), (s-1)/2f, + (s-1)/2f, 0, (1-s)/2f, 0, + 0, 1, 0, 0); + + //setup_spline_forward(segments, curveForwardMatrix); + splineForward(curveDetail, curveDrawMatrix); + + if (bezierBasisInverse == null) { + bezierBasisInverse = bezierBasisMatrix.get(); + bezierBasisInverse.invert(); + curveToBezierMatrix = new PMatrix3D(); + } + + // TODO only needed for PGraphicsJava2D? if so, move it there + // actually, it's generally useful for other renderers, so keep it + // or hide the implementation elsewhere. + curveToBezierMatrix.set(curveBasisMatrix); + curveToBezierMatrix.preApply(bezierBasisInverse); + + // multiply the basis and forward diff matrices together + // saves much time since this needn't be done for each curve + curveDrawMatrix.apply(curveBasisMatrix); + } + + + /** + * Draws a segment of Catmull-Rom curve. + *

+ * As of 0070, this function no longer doubles the first and + * last points. The curves are a bit more boring, but it's more + * mathematically correct, and properly mirrored in curvePoint(). + *

+ * Identical to typing out:

+   * beginShape();
+   * curveVertex(x1, y1);
+   * curveVertex(x2, y2);
+   * curveVertex(x3, y3);
+   * curveVertex(x4, y4);
+   * endShape();
+   * 
+ */ + public void curve(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + beginShape(); + curveVertex(x1, y1); + curveVertex(x2, y2); + curveVertex(x3, y3); + curveVertex(x4, y4); + endShape(); + } + + + public void curve(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + beginShape(); + curveVertex(x1, y1, z1); + curveVertex(x2, y2, z2); + curveVertex(x3, y3, z3); + curveVertex(x4, y4, z4); + endShape(); + } + + + + ////////////////////////////////////////////////////////////// + + // SPLINE UTILITY FUNCTIONS (used by both Bezier and Catmull-Rom) + + + /** + * Setup forward-differencing matrix to be used for speedy + * curve rendering. It's based on using a specific number + * of curve segments and just doing incremental adds for each + * vertex of the segment, rather than running the mathematically + * expensive cubic equation. + * @param segments number of curve segments to use when drawing + * @param matrix target object for the new matrix + */ + protected void splineForward(int segments, PMatrix3D matrix) { + float f = 1.0f / segments; + float ff = f * f; + float fff = ff * f; + + matrix.set(0, 0, 0, 1, + fff, ff, f, 0, + 6*fff, 2*ff, 0, 0, + 6*fff, 0, 0, 0); + } + + + + ////////////////////////////////////////////////////////////// + + // SMOOTHING + + + /** + * If true in PImage, use bilinear interpolation for copy() + * operations. When inherited by PGraphics, also controls shapes. + */ + public void smooth() { + smooth = true; + } + + + /** + * Disable smoothing. See smooth(). + */ + public void noSmooth() { + smooth = false; + } + + + + ////////////////////////////////////////////////////////////// + + // IMAGE + + + /** + * The mode can only be set to CORNERS, CORNER, and CENTER. + *

+ * Support for CENTER was added in release 0146. + */ + public void imageMode(int mode) { + if ((mode == CORNER) || (mode == CORNERS) || (mode == CENTER)) { + imageMode = mode; + } else { + String msg = + "imageMode() only works with CORNER, CORNERS, or CENTER"; + throw new RuntimeException(msg); + } + } + + + public void image(PImage image, float x, float y) { + // Starting in release 0144, image errors are simply ignored. + // loadImageAsync() sets width and height to -1 when loading fails. + if (image.width == -1 || image.height == -1) return; + + if (imageMode == CORNER || imageMode == CORNERS) { + imageImpl(image, + x, y, x+image.width, y+image.height, + 0, 0, image.width, image.height); + + } else if (imageMode == CENTER) { + float x1 = x - image.width/2; + float y1 = y - image.height/2; + imageImpl(image, + x1, y1, x1+image.width, y1+image.height, + 0, 0, image.width, image.height); + } + } + + + public void image(PImage image, float x, float y, float c, float d) { + image(image, x, y, c, d, 0, 0, image.width, image.height); + } + + + /** + * Draw an image(), also specifying u/v coordinates. + * In this method, the u, v coordinates are always based on image space + * location, regardless of the current textureMode(). + */ + public void image(PImage image, + float a, float b, float c, float d, + int u1, int v1, int u2, int v2) { + // Starting in release 0144, image errors are simply ignored. + // loadImageAsync() sets width and height to -1 when loading fails. + if (image.width == -1 || image.height == -1) return; + + if (imageMode == CORNER) { + if (c < 0) { // reset a negative width + a += c; c = -c; + } + if (d < 0) { // reset a negative height + b += d; d = -d; + } + + imageImpl(image, + a, b, a + c, b + d, + u1, v1, u2, v2); + + } else if (imageMode == CORNERS) { + if (c < a) { // reverse because x2 < x1 + float temp = a; a = c; c = temp; + } + if (d < b) { // reverse because y2 < y1 + float temp = b; b = d; d = temp; + } + + imageImpl(image, + a, b, c, d, + u1, v1, u2, v2); + + } else if (imageMode == CENTER) { + // c and d are width/height + if (c < 0) c = -c; + if (d < 0) d = -d; + float x1 = a - c/2; + float y1 = b - d/2; + + imageImpl(image, + x1, y1, x1 + c, y1 + d, + u1, v1, u2, v2); + } + } + + + /** + * Expects x1, y1, x2, y2 coordinates where (x2 >= x1) and (y2 >= y1). + * If tint() has been called, the image will be colored. + *

+ * The default implementation draws an image as a textured quad. + * The (u, v) coordinates are in image space (they're ints, after all..) + */ + protected void imageImpl(PImage image, + float x1, float y1, float x2, float y2, + int u1, int v1, int u2, int v2) { + boolean savedStroke = stroke; +// boolean savedFill = fill; + int savedTextureMode = textureMode; + + stroke = false; +// fill = true; + textureMode = IMAGE; + +// float savedFillR = fillR; +// float savedFillG = fillG; +// float savedFillB = fillB; +// float savedFillA = fillA; +// +// if (tint) { +// fillR = tintR; +// fillG = tintG; +// fillB = tintB; +// fillA = tintA; +// +// } else { +// fillR = 1; +// fillG = 1; +// fillB = 1; +// fillA = 1; +// } + + beginShape(QUADS); + texture(image); + vertex(x1, y1, u1, v1); + vertex(x1, y2, u1, v2); + vertex(x2, y2, u2, v2); + vertex(x2, y1, u2, v1); + endShape(); + + stroke = savedStroke; +// fill = savedFill; + textureMode = savedTextureMode; + +// fillR = savedFillR; +// fillG = savedFillG; +// fillB = savedFillB; +// fillA = savedFillA; + } + + + + ////////////////////////////////////////////////////////////// + + // SHAPE + + + /** + * Set the orientation for the shape() command (like imageMode() or rectMode()). + * @param mode Either CORNER, CORNERS, or CENTER. + */ + public void shapeMode(int mode) { + this.shapeMode = mode; + } + + + public void shape(PShape shape) { + if (shape.isVisible()) { // don't do expensive matrix ops if invisible + if (shapeMode == CENTER) { + pushMatrix(); + translate(-shape.getWidth()/2, -shape.getHeight()/2); + } + + shape.draw(this); // needs to handle recorder too + + if (shapeMode == CENTER) { + popMatrix(); + } + } + } + + + /** + * Convenience method to draw at a particular location. + */ + public void shape(PShape shape, float x, float y) { + if (shape.isVisible()) { // don't do expensive matrix ops if invisible + pushMatrix(); + + if (shapeMode == CENTER) { + translate(x - shape.getWidth()/2, y - shape.getHeight()/2); + + } else if ((shapeMode == CORNER) || (shapeMode == CORNERS)) { + translate(x, y); + } + shape.draw(this); + + popMatrix(); + } + } + + + public void shape(PShape shape, float x, float y, float c, float d) { + if (shape.isVisible()) { // don't do expensive matrix ops if invisible + pushMatrix(); + + if (shapeMode == CENTER) { + // x and y are center, c and d refer to a diameter + translate(x - c/2f, y - d/2f); + scale(c / shape.getWidth(), d / shape.getHeight()); + + } else if (shapeMode == CORNER) { + translate(x, y); + scale(c / shape.getWidth(), d / shape.getHeight()); + + } else if (shapeMode == CORNERS) { + // c and d are x2/y2, make them into width/height + c -= x; + d -= y; + // then same as above + translate(x, y); + scale(c / shape.getWidth(), d / shape.getHeight()); + } + shape.draw(this); + + popMatrix(); + } + } + + + + ////////////////////////////////////////////////////////////// + + // TEXT/FONTS + + + /** + * Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. + * This will also reset the vertical text alignment to BASELINE. + */ + public void textAlign(int align) { + textAlign(align, BASELINE); + } + + + /** + * Sets the horizontal and vertical alignment of the text. The horizontal + * alignment can be one of LEFT, CENTER, or RIGHT. The vertical alignment + * can be TOP, BOTTOM, CENTER, or the BASELINE (the default). + */ + public void textAlign(int alignX, int alignY) { + textAlign = alignX; + textAlignY = alignY; + } + + + /** + * Returns the ascent of the current font at the current size. + * This is a method, rather than a variable inside the PGraphics object + * because it requires calculation. + */ + public float textAscent() { + if (textFont == null) { + showTextFontException("textAscent"); + } + return textFont.ascent() * ((textMode == SCREEN) ? textFont.size : textSize); + } + + + /** + * Returns the descent of the current font at the current size. + * This is a method, rather than a variable inside the PGraphics object + * because it requires calculation. + */ + public float textDescent() { + if (textFont == null) { + showTextFontException("textDescent"); + } + return textFont.descent() * ((textMode == SCREEN) ? textFont.size : textSize); + } + + + /** + * Sets the current font. The font's size will be the "natural" + * size of this font (the size that was set when using "Create Font"). + * The leading will also be reset. + */ + public void textFont(PFont which) { + if (which != null) { + textFont = which; + if (hints[ENABLE_NATIVE_FONTS]) { + //if (which.font == null) { + which.findFont(); + //} + } + /* + textFontNative = which.font; + + //textFontNativeMetrics = null; + // changed for rev 0104 for textMode(SHAPE) in opengl + if (textFontNative != null) { + // TODO need a better way to handle this. could use reflection to get + // rid of the warning, but that'd be a little silly. supporting this is + // an artifact of supporting java 1.1, otherwise we'd use getLineMetrics, + // as recommended by the @deprecated flag. + textFontNativeMetrics = + Toolkit.getDefaultToolkit().getFontMetrics(textFontNative); + // The following is what needs to be done, however we need to be able + // to get the actual graphics context where the drawing is happening. + // For instance, parent.getGraphics() doesn't work for OpenGL since + // an OpenGL drawing surface is an embedded component. +// if (parent != null) { +// textFontNativeMetrics = parent.getGraphics().getFontMetrics(textFontNative); +// } + + // float w = font.getStringBounds(text, g2.getFontRenderContext()).getWidth(); + } + */ + textSize(which.size); + + } else { + throw new RuntimeException(ERROR_TEXTFONT_NULL_PFONT); + } + } + + + /** + * Useful function to set the font and size at the same time. + */ + public void textFont(PFont which, float size) { + textFont(which); + textSize(size); + } + + + /** + * Set the text leading to a specific value. If using a custom + * value for the text leading, you'll have to call textLeading() + * again after any calls to textSize(). + */ + public void textLeading(float leading) { + textLeading = leading; + } + + + /** + * Sets the text rendering/placement to be either SCREEN (direct + * to the screen, exact coordinates, only use the font's original size) + * or MODEL (the default, where text is manipulated by translate() and + * can have a textSize). The text size cannot be set when using + * textMode(SCREEN), because it uses the pixels directly from the font. + */ + public void textMode(int mode) { + // CENTER and MODEL overlap (they're both 3) + if ((mode == LEFT) || (mode == RIGHT)) { + showWarning("Since Processing beta, textMode() is now textAlign()."); + return; + } +// if ((mode != SCREEN) && (mode != MODEL)) { +// showError("Only textMode(SCREEN) and textMode(MODEL) " + +// "are available with this renderer."); +// } + + if (textModeCheck(mode)) { + textMode = mode; + } else { + String modeStr = String.valueOf(mode); + switch (mode) { + case SCREEN: modeStr = "SCREEN"; break; + case MODEL: modeStr = "MODEL"; break; + case SHAPE: modeStr = "SHAPE"; break; + } + showWarning("textMode(" + modeStr + ") is not supported by this renderer."); + } + + // reset the font to its natural size + // (helps with width calculations and all that) + //if (textMode == SCREEN) { + //textSize(textFont.size); + //} + + //} else { + //throw new RuntimeException("use textFont() before textMode()"); + //} + } + + + protected boolean textModeCheck(int mode) { + return true; + } + + + /** + * Sets the text size, also resets the value for the leading. + */ + public void textSize(float size) { + if (textFont != null) { +// if ((textMode == SCREEN) && (size != textFont.size)) { +// throw new RuntimeException("textSize() is ignored with " + +// "textMode(SCREEN)"); +// } + textSize = size; + textLeading = (textAscent() + textDescent()) * 1.275f; + + } else { + showTextFontException("textSize"); + } + } + + + // ........................................................ + + + public float textWidth(char c) { + textWidthBuffer[0] = c; + return textWidthImpl(textWidthBuffer, 0, 1); + } + + + /** + * Return the width of a line of text. If the text has multiple + * lines, this returns the length of the longest line. + */ + public float textWidth(String str) { + if (textFont == null) { + showTextFontException("textWidth"); + } + + int length = str.length(); + if (length > textWidthBuffer.length) { + textWidthBuffer = new char[length + 10]; + } + str.getChars(0, length, textWidthBuffer, 0); + + float wide = 0; + int index = 0; + int start = 0; + + while (index < length) { + if (textWidthBuffer[index] == '\n') { + wide = Math.max(wide, textWidthImpl(textWidthBuffer, start, index)); + start = index+1; + } + index++; + } + if (start < length) { + wide = Math.max(wide, textWidthImpl(textWidthBuffer, start, index)); + } + return wide; + } + + + /** + * Implementation of returning the text width of + * the chars [start, stop) in the buffer. + * Unlike the previous version that was inside PFont, this will + * return the size not of a 1 pixel font, but the actual current size. + */ + protected float textWidthImpl(char buffer[], int start, int stop) { + float wide = 0; + for (int i = start; i < stop; i++) { + // could add kerning here, but it just ain't implemented + wide += textFont.width(buffer[i]) * textSize; + } + return wide; + } + + + // ........................................................ + + + /** + * Write text where we just left off. + */ + public void text(char c) { + text(c, textX, textY, textZ); + } + + + /** + * Draw a single character on screen. + * Extremely slow when used with textMode(SCREEN) and Java 2D, + * because loadPixels has to be called first and updatePixels last. + */ + public void text(char c, float x, float y) { + if (textFont == null) { + showTextFontException("text"); + } + + if (textMode == SCREEN) loadPixels(); + + if (textAlignY == CENTER) { + y += textAscent() / 2; + } else if (textAlignY == TOP) { + y += textAscent(); + } else if (textAlignY == BOTTOM) { + y -= textDescent(); + //} else if (textAlignY == BASELINE) { + // do nothing + } + + textBuffer[0] = c; + textLineAlignImpl(textBuffer, 0, 1, x, y); + + if (textMode == SCREEN) updatePixels(); + } + + + /** + * Draw a single character on screen (with a z coordinate) + */ + public void text(char c, float x, float y, float z) { +// if ((z != 0) && (textMode == SCREEN)) { +// String msg = "textMode(SCREEN) cannot have a z coordinate"; +// throw new RuntimeException(msg); +// } + + if (z != 0) translate(0, 0, z); // slowness, badness + + text(c, x, y); + textZ = z; + + if (z != 0) translate(0, 0, -z); + } + + + /** + * Write text where we just left off. + */ + public void text(String str) { + text(str, textX, textY, textZ); + } + + + /** + * Draw a chunk of text. + * Newlines that are \n (Unix newline or linefeed char, ascii 10) + * are honored, but \r (carriage return, Windows and Mac OS) are + * ignored. + */ + public void text(String str, float x, float y) { + if (textFont == null) { + showTextFontException("text"); + } + + if (textMode == SCREEN) loadPixels(); + + int length = str.length(); + if (length > textBuffer.length) { + textBuffer = new char[length + 10]; + } + str.getChars(0, length, textBuffer, 0); + text(textBuffer, 0, length, x, y); + } + + + /** + * Method to draw text from an array of chars. This method will usually be + * more efficient than drawing from a String object, because the String will + * not be converted to a char array before drawing. + */ + public void text(char[] chars, int start, int stop, float x, float y) { + // If multiple lines, sum the height of the additional lines + float high = 0; //-textAscent(); + for (int i = start; i < stop; i++) { + if (chars[i] == '\n') { + high += textLeading; + } + } + if (textAlignY == CENTER) { + // for a single line, this adds half the textAscent to y + // for multiple lines, subtract half the additional height + //y += (textAscent() - textDescent() - high)/2; + y += (textAscent() - high)/2; + } else if (textAlignY == TOP) { + // for a single line, need to add textAscent to y + // for multiple lines, no different + y += textAscent(); + } else if (textAlignY == BOTTOM) { + // for a single line, this is just offset by the descent + // for multiple lines, subtract leading for each line + y -= textDescent() + high; + //} else if (textAlignY == BASELINE) { + // do nothing + } + +// int start = 0; + int index = 0; + while (index < stop) { //length) { + if (chars[index] == '\n') { + textLineAlignImpl(chars, start, index, x, y); + start = index + 1; + y += textLeading; + } + index++; + } + if (start < stop) { //length) { + textLineAlignImpl(chars, start, index, x, y); + } + if (textMode == SCREEN) updatePixels(); + } + + + /** + * Same as above but with a z coordinate. + */ + public void text(String str, float x, float y, float z) { + if (z != 0) translate(0, 0, z); // slow! + + text(str, x, y); + textZ = z; + + if (z != 0) translate(0, 0, -z); // inaccurate! + } + + + public void text(char[] chars, int start, int stop, + float x, float y, float z) { + if (z != 0) translate(0, 0, z); // slow! + + text(chars, start, stop, x, y); + textZ = z; + + if (z != 0) translate(0, 0, -z); // inaccurate! + } + + + /** + * Draw text in a box that is constrained to a particular size. + * The current rectMode() determines what the coordinates mean + * (whether x1/y1/x2/y2 or x/y/w/h). + *

+ * Note that the x,y coords of the start of the box + * will align with the *ascent* of the text, not the baseline, + * as is the case for the other text() functions. + *

+ * Newlines that are \n (Unix newline or linefeed char, ascii 10) + * are honored, and \r (carriage return, Windows and Mac OS) are + * ignored. + */ + public void text(String str, float x1, float y1, float x2, float y2) { + if (textFont == null) { + showTextFontException("text"); + } + + if (textMode == SCREEN) loadPixels(); + + float hradius, vradius; + switch (rectMode) { + case CORNER: + x2 += x1; y2 += y1; + break; + case RADIUS: + hradius = x2; + vradius = y2; + x2 = x1 + hradius; + y2 = y1 + vradius; + x1 -= hradius; + y1 -= vradius; + break; + case CENTER: + hradius = x2 / 2.0f; + vradius = y2 / 2.0f; + x2 = x1 + hradius; + y2 = y1 + vradius; + x1 -= hradius; + y1 -= vradius; + } + if (x2 < x1) { + float temp = x1; x1 = x2; x2 = temp; + } + if (y2 < y1) { + float temp = y1; y1 = y2; y2 = temp; + } + +// float currentY = y1; + float boxWidth = x2 - x1; + +// // ala illustrator, the text itself must fit inside the box +// currentY += textAscent(); //ascent() * textSize; +// // if the box is already too small, tell em to f off +// if (currentY > y2) return; + + float spaceWidth = textWidth(' '); + + if (textBreakStart == null) { + textBreakStart = new int[20]; + textBreakStop = new int[20]; + } + textBreakCount = 0; + + int length = str.length(); + if (length + 1 > textBuffer.length) { + textBuffer = new char[length + 1]; + } + str.getChars(0, length, textBuffer, 0); + // add a fake newline to simplify calculations + textBuffer[length++] = '\n'; + + int sentenceStart = 0; + for (int i = 0; i < length; i++) { + if (textBuffer[i] == '\n') { +// currentY = textSentence(textBuffer, sentenceStart, i, +// lineX, boxWidth, currentY, y2, spaceWidth); + boolean legit = + textSentence(textBuffer, sentenceStart, i, boxWidth, spaceWidth); + if (!legit) break; +// if (Float.isNaN(currentY)) break; // word too big (or error) +// if (currentY > y2) break; // past the box + sentenceStart = i + 1; + } + } + + // lineX is the position where the text starts, which is adjusted + // to left/center/right based on the current textAlign + float lineX = x1; //boxX1; + if (textAlign == CENTER) { + lineX = lineX + boxWidth/2f; + } else if (textAlign == RIGHT) { + lineX = x2; //boxX2; + } + + float boxHeight = y2 - y1; + //int lineFitCount = 1 + PApplet.floor((boxHeight - textAscent()) / textLeading); + // incorporate textAscent() for the top (baseline will be y1 + ascent) + // and textDescent() for the bottom, so that lower parts of letters aren't + // outside the box. [0151] + float topAndBottom = textAscent() + textDescent(); + int lineFitCount = 1 + PApplet.floor((boxHeight - topAndBottom) / textLeading); + int lineCount = Math.min(textBreakCount, lineFitCount); + + if (textAlignY == CENTER) { + float lineHigh = textAscent() + textLeading * (lineCount - 1); + float y = y1 + textAscent() + (boxHeight - lineHigh) / 2; + for (int i = 0; i < lineCount; i++) { + textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y); + y += textLeading; + } + + } else if (textAlignY == BOTTOM) { + float y = y2 - textDescent() - textLeading * (lineCount - 1); + for (int i = 0; i < lineCount; i++) { + textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y); + y += textLeading; + } + + } else { // TOP or BASELINE just go to the default + float y = y1 + textAscent(); + for (int i = 0; i < lineCount; i++) { + textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y); + y += textLeading; + } + } + + if (textMode == SCREEN) updatePixels(); + } + + + /** + * Emit a sentence of text, defined as a chunk of text without any newlines. + * @param stop non-inclusive, the end of the text in question + */ + private boolean textSentence(char[] buffer, int start, int stop, + float boxWidth, float spaceWidth) { + float runningX = 0; + + // Keep track of this separately from index, since we'll need to back up + // from index when breaking words that are too long to fit. + int lineStart = start; + int wordStart = start; + int index = start; + while (index <= stop) { + // boundary of a word or end of this sentence + if ((buffer[index] == ' ') || (index == stop)) { + float wordWidth = textWidthImpl(buffer, wordStart, index); + + if (runningX + wordWidth > boxWidth) { + if (runningX != 0) { + // Next word is too big, output the current line and advance + index = wordStart; + textSentenceBreak(lineStart, index); + // Eat whitespace because multiple spaces don't count for s* + // when they're at the end of a line. + while ((index < stop) && (buffer[index] == ' ')) { + index++; + } + } else { // (runningX == 0) + // If this is the first word on the line, and its width is greater + // than the width of the text box, then break the word where at the + // max width, and send the rest of the word to the next line. + do { + index--; + if (index == wordStart) { + // Not a single char will fit on this line. screw 'em. + //System.out.println("screw you"); + return false; //Float.NaN; + } + wordWidth = textWidthImpl(buffer, wordStart, index); + } while (wordWidth > boxWidth); + + //textLineImpl(buffer, lineStart, index, x, y); + textSentenceBreak(lineStart, index); + } + lineStart = index; + wordStart = index; + runningX = 0; + + } else if (index == stop) { + // last line in the block, time to unload + //textLineImpl(buffer, lineStart, index, x, y); + textSentenceBreak(lineStart, index); +// y += textLeading; + index++; + + } else { // this word will fit, just add it to the line + runningX += wordWidth + spaceWidth; + wordStart = index + 1; // move on to the next word + index++; + } + } else { // not a space or the last character + index++; // this is just another letter + } + } +// return y; + return true; + } + + + private void textSentenceBreak(int start, int stop) { + if (textBreakCount == textBreakStart.length) { + textBreakStart = PApplet.expand(textBreakStart); + textBreakStop = PApplet.expand(textBreakStop); + } + textBreakStart[textBreakCount] = start; + textBreakStop[textBreakCount] = stop; + textBreakCount++; + } + + + public void text(String s, float x1, float y1, float x2, float y2, float z) { + if (z != 0) translate(0, 0, z); // slowness, badness + + text(s, x1, y1, x2, y2); + textZ = z; + + if (z != 0) translate(0, 0, -z); // TEMPORARY HACK! SLOW! + } + + + public void text(int num, float x, float y) { + text(String.valueOf(num), x, y); + } + + + public void text(int num, float x, float y, float z) { + text(String.valueOf(num), x, y, z); + } + + + /** + * This does a basic number formatting, to avoid the + * generally ugly appearance of printing floats. + * Users who want more control should use their own nf() cmmand, + * or if they want the long, ugly version of float, + * use String.valueOf() to convert the float to a String first. + */ + public void text(float num, float x, float y) { + text(PApplet.nfs(num, 0, 3), x, y); + } + + + public void text(float num, float x, float y, float z) { + text(PApplet.nfs(num, 0, 3), x, y, z); + } + + + + ////////////////////////////////////////////////////////////// + + // TEXT IMPL + + // These are most likely to be overridden by subclasses, since the other + // (public) functions handle generic features like setting alignment. + + + /** + * Handles placement of a text line, then calls textLineImpl + * to actually render at the specific point. + */ + protected void textLineAlignImpl(char buffer[], int start, int stop, + float x, float y) { + if (textAlign == CENTER) { + x -= textWidthImpl(buffer, start, stop) / 2f; + + } else if (textAlign == RIGHT) { + x -= textWidthImpl(buffer, start, stop); + } + + textLineImpl(buffer, start, stop, x, y); + } + + + /** + * Implementation of actual drawing for a line of text. + */ + protected void textLineImpl(char buffer[], int start, int stop, + float x, float y) { + for (int index = start; index < stop; index++) { + textCharImpl(buffer[index], x, y); + + // this doesn't account for kerning + x += textWidth(buffer[index]); + } + textX = x; + textY = y; + textZ = 0; // this will get set by the caller if non-zero + } + + + protected void textCharImpl(char ch, float x, float y) { //, float z) { + int index = textFont.index(ch); + if (index == -1) return; + + PImage glyph = textFont.images[index]; + + if (textMode == MODEL) { + float high = (float) textFont.height[index] / textFont.fheight; + float bwidth = (float) textFont.width[index] / textFont.fwidth; + float lextent = (float) textFont.leftExtent[index] / textFont.fwidth; + float textent = (float) textFont.topExtent[index] / textFont.fheight; + + float x1 = x + lextent * textSize; + float y1 = y - textent * textSize; + float x2 = x1 + bwidth * textSize; + float y2 = y1 + high * textSize; + + textCharModelImpl(glyph, + x1, y1, x2, y2, + //x1, y1, z, x2, y2, z, + textFont.width[index], textFont.height[index]); + + } else if (textMode == SCREEN) { + int xx = (int) x + textFont.leftExtent[index];; + int yy = (int) y - textFont.topExtent[index]; + + int w0 = textFont.width[index]; + int h0 = textFont.height[index]; + + textCharScreenImpl(glyph, xx, yy, w0, h0); + } + } + + + protected void textCharModelImpl(PImage glyph, + float x1, float y1, //float z1, + float x2, float y2, //float z2, + int u2, int v2) { + boolean savedTint = tint; + int savedTintColor = tintColor; + float savedTintR = tintR; + float savedTintG = tintG; + float savedTintB = tintB; + float savedTintA = tintA; + boolean savedTintAlpha = tintAlpha; + + tint = true; + tintColor = fillColor; + tintR = fillR; + tintG = fillG; + tintB = fillB; + tintA = fillA; + tintAlpha = fillAlpha; + + imageImpl(glyph, x1, y1, x2, y2, 0, 0, u2, v2); + + tint = savedTint; + tintColor = savedTintColor; + tintR = savedTintR; + tintG = savedTintG; + tintB = savedTintB; + tintA = savedTintA; + tintAlpha = savedTintAlpha; + } + + + protected void textCharScreenImpl(PImage glyph, + int xx, int yy, + int w0, int h0) { + int x0 = 0; + int y0 = 0; + + if ((xx >= width) || (yy >= height) || + (xx + w0 < 0) || (yy + h0 < 0)) return; + + if (xx < 0) { + x0 -= xx; + w0 += xx; + xx = 0; + } + if (yy < 0) { + y0 -= yy; + h0 += yy; + yy = 0; + } + if (xx + w0 > width) { + w0 -= ((xx + w0) - width); + } + if (yy + h0 > height) { + h0 -= ((yy + h0) - height); + } + + int fr = fillRi; + int fg = fillGi; + int fb = fillBi; + int fa = fillAi; + + int pixels1[] = glyph.pixels; //images[glyph].pixels; + + // TODO this can be optimized a bit + for (int row = y0; row < y0 + h0; row++) { + for (int col = x0; col < x0 + w0; col++) { + int a1 = (fa * pixels1[row * textFont.twidth + col]) >> 8; + int a2 = a1 ^ 0xff; + //int p1 = pixels1[row * glyph.width + col]; + int p2 = pixels[(yy + row-y0)*width + (xx+col-x0)]; + + pixels[(yy + row-y0)*width + xx+col-x0] = + (0xff000000 | + (((a1 * fr + a2 * ((p2 >> 16) & 0xff)) & 0xff00) << 8) | + (( a1 * fg + a2 * ((p2 >> 8) & 0xff)) & 0xff00) | + (( a1 * fb + a2 * ( p2 & 0xff)) >> 8)); + } + } + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX STACK + + + /** + * Push a copy of the current transformation matrix onto the stack. + */ + public void pushMatrix() { + showMethodWarning("pushMatrix"); + } + + + /** + * Replace the current transformation matrix with the top of the stack. + */ + public void popMatrix() { + showMethodWarning("popMatrix"); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX TRANSFORMATIONS + + + /** + * Translate in X and Y. + */ + public void translate(float tx, float ty) { + showMissingWarning("translate"); + } + + + /** + * Translate in X, Y, and Z. + */ + public void translate(float tx, float ty, float tz) { + showMissingWarning("translate"); + } + + + /** + * Two dimensional rotation. + * + * Same as rotateZ (this is identical to a 3D rotation along the z-axis) + * but included for clarity. It'd be weird for people drawing 2D graphics + * to be using rotateZ. And they might kick our a-- for the confusion. + * + * Additional background. + */ + public void rotate(float angle) { + showMissingWarning("rotate"); + } + + + /** + * Rotate around the X axis. + */ + public void rotateX(float angle) { + showMethodWarning("rotateX"); + } + + + /** + * Rotate around the Y axis. + */ + public void rotateY(float angle) { + showMethodWarning("rotateY"); + } + + + /** + * Rotate around the Z axis. + * + * The functions rotate() and rotateZ() are identical, it's just that it make + * sense to have rotate() and then rotateX() and rotateY() when using 3D; + * nor does it make sense to use a function called rotateZ() if you're only + * doing things in 2D. so we just decided to have them both be the same. + */ + public void rotateZ(float angle) { + showMethodWarning("rotateZ"); + } + + + /** + * Rotate about a vector in space. Same as the glRotatef() function. + */ + public void rotate(float angle, float vx, float vy, float vz) { + showMissingWarning("rotate"); + } + + + /** + * Scale in all dimensions. + */ + public void scale(float s) { + showMissingWarning("scale"); + } + + + /** + * Scale in X and Y. Equivalent to scale(sx, sy, 1). + * + * Not recommended for use in 3D, because the z-dimension is just + * scaled by 1, since there's no way to know what else to scale it by. + */ + public void scale(float sx, float sy) { + showMissingWarning("scale"); + } + + + /** + * Scale in X, Y, and Z. + */ + public void scale(float x, float y, float z) { + showMissingWarning("scale"); + } + + + ////////////////////////////////////////////////////////////// + + // MATRIX FULL MONTY + + + /** + * Set the current transformation matrix to identity. + */ + public void resetMatrix() { + showMethodWarning("resetMatrix"); + } + + + public void applyMatrix(PMatrix source) { + if (source instanceof PMatrix2D) { + applyMatrix((PMatrix2D) source); + } else if (source instanceof PMatrix3D) { + applyMatrix((PMatrix3D) source); + } + } + + + public void applyMatrix(PMatrix2D source) { + applyMatrix(source.m00, source.m01, source.m02, + source.m10, source.m11, source.m12); + } + + + /** + * Apply a 3x2 affine transformation matrix. + */ + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) { + showMissingWarning("applyMatrix"); + } + + + public void applyMatrix(PMatrix3D source) { + applyMatrix(source.m00, source.m01, source.m02, source.m03, + source.m10, source.m11, source.m12, source.m13, + source.m20, source.m21, source.m22, source.m23, + source.m30, source.m31, source.m32, source.m33); + } + + + /** + * Apply a 4x4 transformation matrix. + */ + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + showMissingWarning("applyMatrix"); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX GET/SET/PRINT + + + public PMatrix getMatrix() { + showMissingWarning("getMatrix"); + return null; + } + + + /** + * Copy the current transformation matrix into the specified target. + * Pass in null to create a new matrix. + */ + public PMatrix2D getMatrix(PMatrix2D target) { + showMissingWarning("getMatrix"); + return null; + } + + + /** + * Copy the current transformation matrix into the specified target. + * Pass in null to create a new matrix. + */ + public PMatrix3D getMatrix(PMatrix3D target) { + showMissingWarning("getMatrix"); + return null; + } + + + /** + * Set the current transformation matrix to the contents of another. + */ + public void setMatrix(PMatrix source) { + if (source instanceof PMatrix2D) { + setMatrix((PMatrix2D) source); + } else if (source instanceof PMatrix3D) { + setMatrix((PMatrix3D) source); + } + } + + + /** + * Set the current transformation to the contents of the specified source. + */ + public void setMatrix(PMatrix2D source) { + showMissingWarning("setMatrix"); + } + + + /** + * Set the current transformation to the contents of the specified source. + */ + public void setMatrix(PMatrix3D source) { + showMissingWarning("setMatrix"); + } + + + /** + * Print the current model (or "transformation") matrix. + */ + public void printMatrix() { + showMethodWarning("printMatrix"); + } + + + + ////////////////////////////////////////////////////////////// + + // CAMERA + + + public void beginCamera() { + showMethodWarning("beginCamera"); + } + + + public void endCamera() { + showMethodWarning("endCamera"); + } + + + public void camera() { + showMissingWarning("camera"); + } + + + public void camera(float eyeX, float eyeY, float eyeZ, + float centerX, float centerY, float centerZ, + float upX, float upY, float upZ) { + showMissingWarning("camera"); + } + + + public void printCamera() { + showMethodWarning("printCamera"); + } + + + + ////////////////////////////////////////////////////////////// + + // PROJECTION + + + public void ortho() { + showMissingWarning("ortho"); + } + + + public void ortho(float left, float right, + float bottom, float top, + float near, float far) { + showMissingWarning("ortho"); + } + + + public void perspective() { + showMissingWarning("perspective"); + } + + + public void perspective(float fovy, float aspect, float zNear, float zFar) { + showMissingWarning("perspective"); + } + + + public void frustum(float left, float right, + float bottom, float top, + float near, float far) { + showMethodWarning("frustum"); + } + + + public void printProjection() { + showMethodWarning("printCamera"); + } + + + + ////////////////////////////////////////////////////////////// + + // SCREEN TRANSFORMS + + + /** + * Given an x and y coordinate, returns the x position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ + public float screenX(float x, float y) { + showMissingWarning("screenX"); + return 0; + } + + + /** + * Given an x and y coordinate, returns the y position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ + public float screenY(float x, float y) { + showMissingWarning("screenY"); + return 0; + } + + + /** + * Maps a three dimensional point to its placement on-screen. + *

+ * Given an (x, y, z) coordinate, returns the x position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ + public float screenX(float x, float y, float z) { + showMissingWarning("screenX"); + return 0; + } + + + /** + * Maps a three dimensional point to its placement on-screen. + *

+ * Given an (x, y, z) coordinate, returns the y position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ + public float screenY(float x, float y, float z) { + showMissingWarning("screenY"); + return 0; + } + + + /** + * Maps a three dimensional point to its placement on-screen. + *

+ * Given an (x, y, z) coordinate, returns its z value. + * This value can be used to determine if an (x, y, z) coordinate + * is in front or in back of another (x, y, z) coordinate. + * The units are based on how the zbuffer is set up, and don't + * relate to anything "real". They're only useful for in + * comparison to another value obtained from screenZ(), + * or directly out of the zbuffer[]. + */ + public float screenZ(float x, float y, float z) { + showMissingWarning("screenZ"); + return 0; + } + + + /** + * Returns the model space x value for an x, y, z coordinate. + *

+ * This will give you a coordinate after it has been transformed + * by translate(), rotate(), and camera(), but not yet transformed + * by the projection matrix. For instance, his can be useful for + * figuring out how points in 3D space relate to the edge + * coordinates of a shape. + */ + public float modelX(float x, float y, float z) { + showMissingWarning("modelX"); + return 0; + } + + + /** + * Returns the model space y value for an x, y, z coordinate. + */ + public float modelY(float x, float y, float z) { + showMissingWarning("modelY"); + return 0; + } + + + /** + * Returns the model space z value for an x, y, z coordinate. + */ + public float modelZ(float x, float y, float z) { + showMissingWarning("modelZ"); + return 0; + } + + + + ////////////////////////////////////////////////////////////// + + // STYLE + + + public void pushStyle() { + if (styleStackDepth == styleStack.length) { + styleStack = (PStyle[]) PApplet.expand(styleStack); + } + if (styleStack[styleStackDepth] == null) { + styleStack[styleStackDepth] = new PStyle(); + } + PStyle s = styleStack[styleStackDepth++]; + getStyle(s); + } + + + public void popStyle() { + if (styleStackDepth == 0) { + throw new RuntimeException("Too many popStyle() without enough pushStyle()"); + } + styleStackDepth--; + style(styleStack[styleStackDepth]); + } + + + public void style(PStyle s) { + // if (s.smooth) { + // smooth(); + // } else { + // noSmooth(); + // } + + imageMode(s.imageMode); + rectMode(s.rectMode); + ellipseMode(s.ellipseMode); + shapeMode(s.shapeMode); + + if (s.tint) { + tint(s.tintColor); + } else { + noTint(); + } + if (s.fill) { + fill(s.fillColor); + } else { + noFill(); + } + if (s.stroke) { + stroke(s.strokeColor); + } else { + noStroke(); + } + strokeWeight(s.strokeWeight); + strokeCap(s.strokeCap); + strokeJoin(s.strokeJoin); + + // Set the colorMode() for the material properties. + // TODO this is really inefficient, need to just have a material() method, + // but this has the least impact to the API. + colorMode(RGB, 1); + ambient(s.ambientR, s.ambientG, s.ambientB); + emissive(s.emissiveR, s.emissiveG, s.emissiveB); + specular(s.specularR, s.specularG, s.specularB); + shininess(s.shininess); + + /* + s.ambientR = ambientR; + s.ambientG = ambientG; + s.ambientB = ambientB; + s.specularR = specularR; + s.specularG = specularG; + s.specularB = specularB; + s.emissiveR = emissiveR; + s.emissiveG = emissiveG; + s.emissiveB = emissiveB; + s.shininess = shininess; + */ + // material(s.ambientR, s.ambientG, s.ambientB, + // s.emissiveR, s.emissiveG, s.emissiveB, + // s.specularR, s.specularG, s.specularB, + // s.shininess); + + // Set this after the material properties. + colorMode(s.colorMode, + s.colorModeX, s.colorModeY, s.colorModeZ, s.colorModeA); + + // This is a bit asymmetric, since there's no way to do "noFont()", + // and a null textFont will produce an error (since usually that means that + // the font couldn't load properly). So in some cases, the font won't be + // 'cleared' to null, even though that's technically correct. + if (s.textFont != null) { + textFont(s.textFont, s.textSize); + textLeading(s.textLeading); + } + // These don't require a font to be set. + textAlign(s.textAlign, s.textAlignY); + textMode(s.textMode); + } + + + public PStyle getStyle() { // ignore + return getStyle(null); + } + + + public PStyle getStyle(PStyle s) { // ignore + if (s == null) { + s = new PStyle(); + } + + s.imageMode = imageMode; + s.rectMode = rectMode; + s.ellipseMode = ellipseMode; + s.shapeMode = shapeMode; + + s.colorMode = colorMode; + s.colorModeX = colorModeX; + s.colorModeY = colorModeY; + s.colorModeZ = colorModeZ; + s.colorModeA = colorModeA; + + s.tint = tint; + s.tintColor = tintColor; + s.fill = fill; + s.fillColor = fillColor; + s.stroke = stroke; + s.strokeColor = strokeColor; + s.strokeWeight = strokeWeight; + s.strokeCap = strokeCap; + s.strokeJoin = strokeJoin; + + s.ambientR = ambientR; + s.ambientG = ambientG; + s.ambientB = ambientB; + s.specularR = specularR; + s.specularG = specularG; + s.specularB = specularB; + s.emissiveR = emissiveR; + s.emissiveG = emissiveG; + s.emissiveB = emissiveB; + s.shininess = shininess; + + s.textFont = textFont; + s.textAlign = textAlign; + s.textAlignY = textAlignY; + s.textMode = textMode; + s.textSize = textSize; + s.textLeading = textLeading; + + return s; + } + + + + ////////////////////////////////////////////////////////////// + + // STROKE CAP/JOIN/WEIGHT + + + public void strokeWeight(float weight) { + strokeWeight = weight; + } + + + public void strokeJoin(int join) { + strokeJoin = join; + } + + + public void strokeCap(int cap) { + strokeCap = cap; + } + + + + ////////////////////////////////////////////////////////////// + + // STROKE COLOR + + + public void noStroke() { + stroke = false; + } + + + /** + * Set the tint to either a grayscale or ARGB value. + * See notes attached to the fill() function. + */ + public void stroke(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above +// stroke((float) rgb); +// +// } else { +// colorCalcARGB(rgb, colorModeA); +// strokeFromCalc(); +// } + colorCalc(rgb); + strokeFromCalc(); + } + + + public void stroke(int rgb, float alpha) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// stroke((float) rgb, alpha); +// +// } else { +// colorCalcARGB(rgb, alpha); +// strokeFromCalc(); +// } + colorCalc(rgb, alpha); + strokeFromCalc(); + } + + + public void stroke(float gray) { + colorCalc(gray); + strokeFromCalc(); + } + + + public void stroke(float gray, float alpha) { + colorCalc(gray, alpha); + strokeFromCalc(); + } + + + public void stroke(float x, float y, float z) { + colorCalc(x, y, z); + strokeFromCalc(); + } + + + public void stroke(float x, float y, float z, float a) { + colorCalc(x, y, z, a); + strokeFromCalc(); + } + + + protected void strokeFromCalc() { + stroke = true; + strokeR = calcR; + strokeG = calcG; + strokeB = calcB; + strokeA = calcA; + strokeRi = calcRi; + strokeGi = calcGi; + strokeBi = calcBi; + strokeAi = calcAi; + strokeColor = calcColor; + strokeAlpha = calcAlpha; + } + + + + ////////////////////////////////////////////////////////////// + + // TINT COLOR + + + public void noTint() { + tint = false; + } + + + /** + * Set the tint to either a grayscale or ARGB value. + */ + public void tint(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// tint((float) rgb); +// +// } else { +// colorCalcARGB(rgb, colorModeA); +// tintFromCalc(); +// } + colorCalc(rgb); + tintFromCalc(); + } + + public void tint(int rgb, float alpha) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// tint((float) rgb, alpha); +// +// } else { +// colorCalcARGB(rgb, alpha); +// tintFromCalc(); +// } + colorCalc(rgb, alpha); + tintFromCalc(); + } + + public void tint(float gray) { + colorCalc(gray); + tintFromCalc(); + } + + + public void tint(float gray, float alpha) { + colorCalc(gray, alpha); + tintFromCalc(); + } + + + public void tint(float x, float y, float z) { + colorCalc(x, y, z); + tintFromCalc(); + } + + + public void tint(float x, float y, float z, float a) { + colorCalc(x, y, z, a); + tintFromCalc(); + } + + + protected void tintFromCalc() { + tint = true; + tintR = calcR; + tintG = calcG; + tintB = calcB; + tintA = calcA; + tintRi = calcRi; + tintGi = calcGi; + tintBi = calcBi; + tintAi = calcAi; + tintColor = calcColor; + tintAlpha = calcAlpha; + } + + + + ////////////////////////////////////////////////////////////// + + // FILL COLOR + + + public void noFill() { + fill = false; + } + + + /** + * Set the fill to either a grayscale value or an ARGB int. + */ + public void fill(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above +// fill((float) rgb); +// +// } else { +// colorCalcARGB(rgb, colorModeA); +// fillFromCalc(); +// } + colorCalc(rgb); + fillFromCalc(); + } + + + public void fill(int rgb, float alpha) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above +// fill((float) rgb, alpha); +// +// } else { +// colorCalcARGB(rgb, alpha); +// fillFromCalc(); +// } + colorCalc(rgb, alpha); + fillFromCalc(); + } + + + public void fill(float gray) { + colorCalc(gray); + fillFromCalc(); + } + + + public void fill(float gray, float alpha) { + colorCalc(gray, alpha); + fillFromCalc(); + } + + + public void fill(float x, float y, float z) { + colorCalc(x, y, z); + fillFromCalc(); + } + + + public void fill(float x, float y, float z, float a) { + colorCalc(x, y, z, a); + fillFromCalc(); + } + + + protected void fillFromCalc() { + fill = true; + fillR = calcR; + fillG = calcG; + fillB = calcB; + fillA = calcA; + fillRi = calcRi; + fillGi = calcGi; + fillBi = calcBi; + fillAi = calcAi; + fillColor = calcColor; + fillAlpha = calcAlpha; + } + + + + ////////////////////////////////////////////////////////////// + + // MATERIAL PROPERTIES + + + public void ambient(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// ambient((float) rgb); +// +// } else { +// colorCalcARGB(rgb, colorModeA); +// ambientFromCalc(); +// } + colorCalc(rgb); + ambientFromCalc(); + } + + + public void ambient(float gray) { + colorCalc(gray); + ambientFromCalc(); + } + + + public void ambient(float x, float y, float z) { + colorCalc(x, y, z); + ambientFromCalc(); + } + + + protected void ambientFromCalc() { + ambientR = calcR; + ambientG = calcG; + ambientB = calcB; + } + + + public void specular(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// specular((float) rgb); +// +// } else { +// colorCalcARGB(rgb, colorModeA); +// specularFromCalc(); +// } + colorCalc(rgb); + specularFromCalc(); + } + + + public void specular(float gray) { + colorCalc(gray); + specularFromCalc(); + } + + + public void specular(float x, float y, float z) { + colorCalc(x, y, z); + specularFromCalc(); + } + + + protected void specularFromCalc() { + specularR = calcR; + specularG = calcG; + specularB = calcB; + } + + + public void shininess(float shine) { + shininess = shine; + } + + + public void emissive(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// emissive((float) rgb); +// +// } else { +// colorCalcARGB(rgb, colorModeA); +// emissiveFromCalc(); +// } + colorCalc(rgb); + emissiveFromCalc(); + } + + + public void emissive(float gray) { + colorCalc(gray); + emissiveFromCalc(); + } + + + public void emissive(float x, float y, float z) { + colorCalc(x, y, z); + emissiveFromCalc(); + } + + + protected void emissiveFromCalc() { + emissiveR = calcR; + emissiveG = calcG; + emissiveB = calcB; + } + + + + ////////////////////////////////////////////////////////////// + + // LIGHTS + + // The details of lighting are very implementation-specific, so this base + // class does not handle any details of settings lights. It does however + // display warning messages that the functions are not available. + + + public void lights() { + showMethodWarning("lights"); + } + + public void noLights() { + showMethodWarning("noLights"); + } + + public void ambientLight(float red, float green, float blue) { + showMethodWarning("ambientLight"); + } + + public void ambientLight(float red, float green, float blue, + float x, float y, float z) { + showMethodWarning("ambientLight"); + } + + public void directionalLight(float red, float green, float blue, + float nx, float ny, float nz) { + showMethodWarning("directionalLight"); + } + + public void pointLight(float red, float green, float blue, + float x, float y, float z) { + showMethodWarning("pointLight"); + } + + public void spotLight(float red, float green, float blue, + float x, float y, float z, + float nx, float ny, float nz, + float angle, float concentration) { + showMethodWarning("spotLight"); + } + + public void lightFalloff(float constant, float linear, float quadratic) { + showMethodWarning("lightFalloff"); + } + + public void lightSpecular(float x, float y, float z) { + showMethodWarning("lightSpecular"); + } + + + + ////////////////////////////////////////////////////////////// + + // BACKGROUND + + /** + * Set the background to a gray or ARGB color. + *

+ * For the main drawing surface, the alpha value will be ignored. However, + * alpha can be used on PGraphics objects from createGraphics(). This is + * the only way to set all the pixels partially transparent, for instance. + *

+ * Note that background() should be called before any transformations occur, + * because some implementations may require the current transformation matrix + * to be identity before drawing. + */ + public void background(int rgb) { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// background((float) rgb); +// +// } else { +// if (format == RGB) { +// rgb |= 0xff000000; // ignore alpha for main drawing surface +// } +// colorCalcARGB(rgb, colorModeA); +// backgroundFromCalc(); +// backgroundImpl(); +// } + colorCalc(rgb); + backgroundFromCalc(); + } + + + /** + * See notes about alpha in background(x, y, z, a). + */ + public void background(int rgb, float alpha) { +// if (format == RGB) { +// background(rgb); // ignore alpha for main drawing surface +// +// } else { +// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { +// background((float) rgb, alpha); +// +// } else { +// colorCalcARGB(rgb, alpha); +// backgroundFromCalc(); +// backgroundImpl(); +// } +// } + colorCalc(rgb, alpha); + backgroundFromCalc(); + } + + + /** + * Set the background to a grayscale value, based on the + * current colorMode. + */ + public void background(float gray) { + colorCalc(gray); + backgroundFromCalc(); +// backgroundImpl(); + } + + + /** + * See notes about alpha in background(x, y, z, a). + */ + public void background(float gray, float alpha) { + if (format == RGB) { + background(gray); // ignore alpha for main drawing surface + + } else { + colorCalc(gray, alpha); + backgroundFromCalc(); +// backgroundImpl(); + } + } + + + /** + * Set the background to an r, g, b or h, s, b value, + * based on the current colorMode. + */ + public void background(float x, float y, float z) { + colorCalc(x, y, z); + backgroundFromCalc(); +// backgroundImpl(); + } + + + /** + * Clear the background with a color that includes an alpha value. This can + * only be used with objects created by createGraphics(), because the main + * drawing surface cannot be set transparent. + *

+ * It might be tempting to use this function to partially clear the screen + * on each frame, however that's not how this function works. When calling + * background(), the pixels will be replaced with pixels that have that level + * of transparency. To do a semi-transparent overlay, use fill() with alpha + * and draw a rectangle. + */ + public void background(float x, float y, float z, float a) { +// if (format == RGB) { +// background(x, y, z); // don't allow people to set alpha +// +// } else { +// colorCalc(x, y, z, a); +// backgroundFromCalc(); +// backgroundImpl(); +// } + colorCalc(x, y, z, a); + backgroundFromCalc(); + } + + + protected void backgroundFromCalc() { + backgroundR = calcR; + backgroundG = calcG; + backgroundB = calcB; + backgroundA = (format == RGB) ? colorModeA : calcA; + backgroundRi = calcRi; + backgroundGi = calcGi; + backgroundBi = calcBi; + backgroundAi = (format == RGB) ? 255 : calcAi; + backgroundAlpha = (format == RGB) ? false : calcAlpha; + backgroundColor = calcColor; + + backgroundImpl(); + } + + + /** + * Takes an RGB or ARGB image and sets it as the background. + * The width and height of the image must be the same size as the sketch. + * Use image.resize(width, height) to make short work of such a task. + *

+ * Note that even if the image is set as RGB, the high 8 bits of each pixel + * should be set opaque (0xFF000000), because the image data will be copied + * directly to the screen, and non-opaque background images may have strange + * behavior. Using image.filter(OPAQUE) will handle this easily. + *

+ * When using 3D, this will also clear the zbuffer (if it exists). + */ + public void background(PImage image) { + if ((image.width != width) || (image.height != height)) { + throw new RuntimeException(ERROR_BACKGROUND_IMAGE_SIZE); + } + if ((image.format != RGB) && (image.format != ARGB)) { + throw new RuntimeException(ERROR_BACKGROUND_IMAGE_FORMAT); + } + backgroundColor = 0; // just zero it out for images + backgroundImpl(image); + } + + + /** + * Actually set the background image. This is separated from the error + * handling and other semantic goofiness that is shared across renderers. + */ + protected void backgroundImpl(PImage image) { + // blit image to the screen + set(0, 0, image); + } + + + /** + * Actual implementation of clearing the background, now that the + * internal variables for background color have been set. Called by the + * backgroundFromCalc() method, which is what all the other background() + * methods call once the work is done. + */ + protected void backgroundImpl() { + pushStyle(); + pushMatrix(); + resetMatrix(); + fill(backgroundColor); + rect(0, 0, width, height); + popMatrix(); + popStyle(); + } + + + /** + * Callback to handle clearing the background when begin/endRaw is in use. + * Handled as separate function for OpenGL (or other) subclasses that + * override backgroundImpl() but still needs this to work properly. + */ +// protected void backgroundRawImpl() { +// if (raw != null) { +// raw.colorMode(RGB, 1); +// raw.noStroke(); +// raw.fill(backgroundR, backgroundG, backgroundB); +// raw.beginShape(TRIANGLES); +// +// raw.vertex(0, 0); +// raw.vertex(width, 0); +// raw.vertex(0, height); +// +// raw.vertex(width, 0); +// raw.vertex(width, height); +// raw.vertex(0, height); +// +// raw.endShape(); +// } +// } + + + + ////////////////////////////////////////////////////////////// + + // COLOR MODE + + + public void colorMode(int mode) { + colorMode(mode, colorModeX, colorModeY, colorModeZ, colorModeA); + } + + + public void colorMode(int mode, float max) { + colorMode(mode, max, max, max, max); + } + + + /** + * Set the colorMode and the maximum values for (r, g, b) + * or (h, s, b). + *

+ * Note that this doesn't set the maximum for the alpha value, + * which might be confusing if for instance you switched to + *

colorMode(HSB, 360, 100, 100);
+ * because the alpha values were still between 0 and 255. + */ + public void colorMode(int mode, float maxX, float maxY, float maxZ) { + colorMode(mode, maxX, maxY, maxZ, colorModeA); + } + + + public void colorMode(int mode, + float maxX, float maxY, float maxZ, float maxA) { + colorMode = mode; + + colorModeX = maxX; // still needs to be set for hsb + colorModeY = maxY; + colorModeZ = maxZ; + colorModeA = maxA; + + // if color max values are all 1, then no need to scale + colorModeScale = + ((maxA != 1) || (maxX != maxY) || (maxY != maxZ) || (maxZ != maxA)); + + // if color is rgb/0..255 this will make it easier for the + // red() green() etc functions + colorModeDefault = (colorMode == RGB) && + (colorModeA == 255) && (colorModeX == 255) && + (colorModeY == 255) && (colorModeZ == 255); + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR CALCULATIONS + + // Given input values for coloring, these functions will fill the calcXxxx + // variables with values that have been properly filtered through the + // current colorMode settings. + + // Renderers that need to subclass any drawing properties such as fill or + // stroke will usally want to override methods like fillFromCalc (or the + // same for stroke, ambient, etc.) That way the color calcuations are + // covered by this based PGraphics class, leaving only a single function + // to override/implement in the subclass. + + + /** + * Set the fill to either a grayscale value or an ARGB int. + *

+ * The problem with this code is that it has to detect between these two + * situations automatically. This is done by checking to see if the high bits + * (the alpha for 0xAA000000) is set, and if not, whether the color value + * that follows is less than colorModeX (first param passed to colorMode). + *

+ * This auto-detect would break in the following situation: + *

size(256, 256);
+   * for (int i = 0; i < 256; i++) {
+   *   color c = color(0, 0, 0, i);
+   *   stroke(c);
+   *   line(i, 0, i, 256);
+   * }
+ * ...on the first time through the loop, where (i == 0), since the color + * itself is zero (black) then it would appear indistinguishable from code + * that reads "fill(0)". The solution is to use the four parameter versions + * of stroke or fill to more directly specify the desired result. + */ + protected void colorCalc(int rgb) { + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { + colorCalc((float) rgb); + + } else { + colorCalcARGB(rgb, colorModeA); + } + } + + + protected void colorCalc(int rgb, float alpha) { + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above + colorCalc((float) rgb, alpha); + + } else { + colorCalcARGB(rgb, alpha); + } + } + + + protected void colorCalc(float gray) { + colorCalc(gray, colorModeA); + } + + + protected void colorCalc(float gray, float alpha) { + if (gray > colorModeX) gray = colorModeX; + if (alpha > colorModeA) alpha = colorModeA; + + if (gray < 0) gray = 0; + if (alpha < 0) alpha = 0; + + calcR = colorModeScale ? (gray / colorModeX) : gray; + calcG = calcR; + calcB = calcR; + calcA = colorModeScale ? (alpha / colorModeA) : alpha; + + calcRi = (int)(calcR*255); calcGi = (int)(calcG*255); + calcBi = (int)(calcB*255); calcAi = (int)(calcA*255); + calcColor = (calcAi << 24) | (calcRi << 16) | (calcGi << 8) | calcBi; + calcAlpha = (calcAi != 255); + } + + + protected void colorCalc(float x, float y, float z) { + colorCalc(x, y, z, colorModeA); + } + + + protected void colorCalc(float x, float y, float z, float a) { + if (x > colorModeX) x = colorModeX; + if (y > colorModeY) y = colorModeY; + if (z > colorModeZ) z = colorModeZ; + if (a > colorModeA) a = colorModeA; + + if (x < 0) x = 0; + if (y < 0) y = 0; + if (z < 0) z = 0; + if (a < 0) a = 0; + + switch (colorMode) { + case RGB: + if (colorModeScale) { + calcR = x / colorModeX; + calcG = y / colorModeY; + calcB = z / colorModeZ; + calcA = a / colorModeA; + } else { + calcR = x; calcG = y; calcB = z; calcA = a; + } + break; + + case HSB: + x /= colorModeX; // h + y /= colorModeY; // s + z /= colorModeZ; // b + + calcA = colorModeScale ? (a/colorModeA) : a; + + if (y == 0) { // saturation == 0 + calcR = calcG = calcB = z; + + } else { + float which = (x - (int)x) * 6.0f; + float f = which - (int)which; + float p = z * (1.0f - y); + float q = z * (1.0f - y * f); + float t = z * (1.0f - (y * (1.0f - f))); + + switch ((int)which) { + case 0: calcR = z; calcG = t; calcB = p; break; + case 1: calcR = q; calcG = z; calcB = p; break; + case 2: calcR = p; calcG = z; calcB = t; break; + case 3: calcR = p; calcG = q; calcB = z; break; + case 4: calcR = t; calcG = p; calcB = z; break; + case 5: calcR = z; calcG = p; calcB = q; break; + } + } + break; + } + calcRi = (int)(255*calcR); calcGi = (int)(255*calcG); + calcBi = (int)(255*calcB); calcAi = (int)(255*calcA); + calcColor = (calcAi << 24) | (calcRi << 16) | (calcGi << 8) | calcBi; + calcAlpha = (calcAi != 255); + } + + + /** + * Unpacks AARRGGBB color for direct use with colorCalc. + *

+ * Handled here with its own function since this is indepenent + * of the color mode. + *

+ * Strangely the old version of this code ignored the alpha + * value. not sure if that was a bug or what. + *

+ * Note, no need for a bounds check since it's a 32 bit number. + */ + protected void colorCalcARGB(int argb, float alpha) { + if (alpha == colorModeA) { + calcAi = (argb >> 24) & 0xff; + calcColor = argb; + } else { + calcAi = (int) (((argb >> 24) & 0xff) * (alpha / colorModeA)); + calcColor = (calcAi << 24) | (argb & 0xFFFFFF); + } + calcRi = (argb >> 16) & 0xff; + calcGi = (argb >> 8) & 0xff; + calcBi = argb & 0xff; + calcA = (float)calcAi / 255.0f; + calcR = (float)calcRi / 255.0f; + calcG = (float)calcGi / 255.0f; + calcB = (float)calcBi / 255.0f; + calcAlpha = (calcAi != 255); + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE STUFFING + + // The 'color' primitive type in Processing syntax is in fact a 32-bit int. + // These functions handle stuffing color values into a 32-bit cage based + // on the current colorMode settings. + + // These functions are really slow (because they take the current colorMode + // into account), but they're easy to use. Advanced users can write their + // own bit shifting operations to setup 'color' data types. + + + public final int color(int gray) { // ignore + if (((gray & 0xff000000) == 0) && (gray <= colorModeX)) { + if (colorModeDefault) { + // bounds checking to make sure the numbers aren't to high or low + if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + return 0xff000000 | (gray << 16) | (gray << 8) | gray; + } else { + colorCalc(gray); + } + } else { + colorCalcARGB(gray, colorModeA); + } + return calcColor; + } + + + public final int color(float gray) { // ignore + colorCalc(gray); + return calcColor; + } + + + /** + * @param gray can be packed ARGB or a gray in this case + */ + public final int color(int gray, int alpha) { // ignore + if (colorModeDefault) { + // bounds checking to make sure the numbers aren't to high or low + if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0; + + return ((alpha & 0xff) << 24) | (gray << 16) | (gray << 8) | gray; + } + colorCalc(gray, alpha); + return calcColor; + } + + + /** + * @param rgb can be packed ARGB or a gray in this case + */ + public final int color(int rgb, float alpha) { // ignore + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { + colorCalc(rgb, alpha); + } else { + colorCalcARGB(rgb, alpha); + } + return calcColor; + } + + + public final int color(float gray, float alpha) { // ignore + colorCalc(gray, alpha); + return calcColor; + } + + + public final int color(int x, int y, int z) { // ignore + if (colorModeDefault) { + // bounds checking to make sure the numbers aren't to high or low + if (x > 255) x = 255; else if (x < 0) x = 0; + if (y > 255) y = 255; else if (y < 0) y = 0; + if (z > 255) z = 255; else if (z < 0) z = 0; + + return 0xff000000 | (x << 16) | (y << 8) | z; + } + colorCalc(x, y, z); + return calcColor; + } + + + public final int color(float x, float y, float z) { // ignore + colorCalc(x, y, z); + return calcColor; + } + + + public final int color(int x, int y, int z, int a) { // ignore + if (colorModeDefault) { + // bounds checking to make sure the numbers aren't to high or low + if (a > 255) a = 255; else if (a < 0) a = 0; + if (x > 255) x = 255; else if (x < 0) x = 0; + if (y > 255) y = 255; else if (y < 0) y = 0; + if (z > 255) z = 255; else if (z < 0) z = 0; + + return (a << 24) | (x << 16) | (y << 8) | z; + } + colorCalc(x, y, z, a); + return calcColor; + } + + + public final int color(float x, float y, float z, float a) { // ignore + colorCalc(x, y, z, a); + return calcColor; + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE EXTRACTION + + // Vee have veys of making the colors talk. + + + public final float alpha(int what) { + float c = (what >> 24) & 0xff; + if (colorModeA == 255) return c; + return (c / 255.0f) * colorModeA; + } + + + public final float red(int what) { + float c = (what >> 16) & 0xff; + if (colorModeDefault) return c; + return (c / 255.0f) * colorModeX; + } + + + public final float green(int what) { + float c = (what >> 8) & 0xff; + if (colorModeDefault) return c; + return (c / 255.0f) * colorModeY; + } + + + public final float blue(int what) { + float c = (what) & 0xff; + if (colorModeDefault) return c; + return (c / 255.0f) * colorModeZ; + } + + + public final float hue(int what) { + if (what != cacheHsbKey) { + Color.RGBtoHSB((what >> 16) & 0xff, (what >> 8) & 0xff, + what & 0xff, cacheHsbValue); + cacheHsbKey = what; + } + return cacheHsbValue[0] * colorModeX; + } + + + public final float saturation(int what) { + if (what != cacheHsbKey) { + Color.RGBtoHSB((what >> 16) & 0xff, (what >> 8) & 0xff, + what & 0xff, cacheHsbValue); + cacheHsbKey = what; + } + return cacheHsbValue[1] * colorModeY; + } + + + public final float brightness(int what) { + if (what != cacheHsbKey) { + Color.RGBtoHSB((what >> 16) & 0xff, (what >> 8) & 0xff, + what & 0xff, cacheHsbValue); + cacheHsbKey = what; + } + return cacheHsbValue[2] * colorModeZ; + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE INTERPOLATION + + // Against our better judgement. + + + /** + * Interpolate between two colors, using the current color mode. + */ + public int lerpColor(int c1, int c2, float amt) { + return lerpColor(c1, c2, amt, colorMode); + } + + static float[] lerpColorHSB1; + static float[] lerpColorHSB2; + + /** + * Interpolate between two colors. Like lerp(), but for the + * individual color components of a color supplied as an int value. + */ + static public int lerpColor(int c1, int c2, float amt, int mode) { + if (mode == RGB) { + float a1 = ((c1 >> 24) & 0xff); + float r1 = (c1 >> 16) & 0xff; + float g1 = (c1 >> 8) & 0xff; + float b1 = c1 & 0xff; + float a2 = (c2 >> 24) & 0xff; + float r2 = (c2 >> 16) & 0xff; + float g2 = (c2 >> 8) & 0xff; + float b2 = c2 & 0xff; + + return (((int) (a1 + (a2-a1)*amt) << 24) | + ((int) (r1 + (r2-r1)*amt) << 16) | + ((int) (g1 + (g2-g1)*amt) << 8) | + ((int) (b1 + (b2-b1)*amt))); + + } else if (mode == HSB) { + if (lerpColorHSB1 == null) { + lerpColorHSB1 = new float[3]; + lerpColorHSB2 = new float[3]; + } + + float a1 = (c1 >> 24) & 0xff; + float a2 = (c2 >> 24) & 0xff; + int alfa = ((int) (a1 + (a2-a1)*amt)) << 24; + + Color.RGBtoHSB((c1 >> 16) & 0xff, (c1 >> 8) & 0xff, c1 & 0xff, + lerpColorHSB1); + Color.RGBtoHSB((c2 >> 16) & 0xff, (c2 >> 8) & 0xff, c2 & 0xff, + lerpColorHSB2); + + /* If mode is HSB, this will take the shortest path around the + * color wheel to find the new color. For instance, red to blue + * will go red violet blue (backwards in hue space) rather than + * cycling through ROYGBIV. + */ + // Disabling rollover (wasn't working anyway) for 0126. + // Otherwise it makes full spectrum scale impossible for + // those who might want it...in spite of how despicable + // a full spectrum scale might be. + // roll around when 0.9 to 0.1 + // more than 0.5 away means that it should roll in the other direction + /* + float h1 = lerpColorHSB1[0]; + float h2 = lerpColorHSB2[0]; + if (Math.abs(h1 - h2) > 0.5f) { + if (h1 > h2) { + // i.e. h1 is 0.7, h2 is 0.1 + h2 += 1; + } else { + // i.e. h1 is 0.1, h2 is 0.7 + h1 += 1; + } + } + float ho = (PApplet.lerp(lerpColorHSB1[0], lerpColorHSB2[0], amt)) % 1.0f; + */ + float ho = PApplet.lerp(lerpColorHSB1[0], lerpColorHSB2[0], amt); + float so = PApplet.lerp(lerpColorHSB1[1], lerpColorHSB2[1], amt); + float bo = PApplet.lerp(lerpColorHSB1[2], lerpColorHSB2[2], amt); + + return alfa | (Color.HSBtoRGB(ho, so, bo) & 0xFFFFFF); + } + return 0; + } + + + + ////////////////////////////////////////////////////////////// + + // BEGINRAW/ENDRAW + + + /** + * Record individual lines and triangles by echoing them to another renderer. + */ + public void beginRaw(PGraphics rawGraphics) { // ignore + this.raw = rawGraphics; + rawGraphics.beginDraw(); + } + + + public void endRaw() { // ignore + if (raw != null) { + // for 3D, need to flush any geometry that's been stored for sorting + // (particularly if the ENABLE_DEPTH_SORT hint is set) + flush(); + + // just like beginDraw, this will have to be called because + // endDraw() will be happening outside of draw() + raw.endDraw(); + raw.dispose(); + raw = null; + } + } + + + + ////////////////////////////////////////////////////////////// + + // WARNINGS and EXCEPTIONS + + + static protected HashMap warnings; + + + /** + * Show a renderer error, and keep track of it so that it's only shown once. + * @param msg the error message (which will be stored for later comparison) + */ + static public void showWarning(String msg) { // ignore + if (warnings == null) { + warnings = new HashMap(); + } + if (!warnings.containsKey(msg)) { + System.err.println(msg); + warnings.put(msg, new Object()); + } + } + + + /** + * Display a warning that the specified method is only available with 3D. + * @param method The method name (no parentheses) + */ + static protected void showDepthWarning(String method) { + showWarning(method + "() can only be used with a renderer that " + + "supports 3D, such as P3D or OPENGL."); + } + + + /** + * Display a warning that the specified method that takes x, y, z parameters + * can only be used with x and y parameters in this renderer. + * @param method The method name (no parentheses) + */ + static protected void showDepthWarningXYZ(String method) { + showWarning(method + "() with x, y, and z coordinates " + + "can only be used with a renderer that " + + "supports 3D, such as P3D or OPENGL. " + + "Use a version without a z-coordinate instead."); + } + + + /** + * Display a warning that the specified method is simply unavailable. + */ + static protected void showMethodWarning(String method) { + showWarning(method + "() is not available with this renderer."); + } + + + /** + * Error that a particular variation of a method is unavailable (even though + * other variations are). For instance, if vertex(x, y, u, v) is not + * available, but vertex(x, y) is just fine. + */ + static protected void showVariationWarning(String str) { + showWarning(str + " is not available with this renderer."); + } + + + /** + * Display a warning that the specified method is not implemented, meaning + * that it could be either a completely missing function, although other + * variations of it may still work properly. + */ + static protected void showMissingWarning(String method) { + showWarning(method + "(), or this particular variation of it, " + + "is not available with this renderer."); + } + + + /** + * Show an renderer-related exception that halts the program. Currently just + * wraps the message as a RuntimeException and throws it, but might do + * something more specific might be used in the future. + */ + static public void showException(String msg) { // ignore + throw new RuntimeException(msg); + } + + + /** + * Throw an exeption that halts the program because textFont() has not been + * used prior to the specified method. + */ + static protected void showTextFontException(String method) { + throw new RuntimeException("Use textFont() before " + method + "()"); + } + + + + ////////////////////////////////////////////////////////////// + + // RENDERER SUPPORT QUERIES + + + /** + * Return true if this renderer should be drawn to the screen. Defaults to + * returning true, since nearly all renderers are on-screen beasts. But can + * be overridden for subclasses like PDF so that a window doesn't open up. + *

+ * A better name? showFrame, displayable, isVisible, visible, shouldDisplay, + * what to call this? + */ + public boolean displayable() { + return true; + } + + + /** + * Return true if this renderer supports 2D drawing. Defaults to true. + */ + public boolean is2D() { + return true; + } + + + /** + * Return true if this renderer supports 2D drawing. Defaults to true. + */ + public boolean is3D() { + return false; + } +} diff --git a/core/src/processing/core/PGraphics2D.java b/core/src/processing/core/PGraphics2D.java new file mode 100644 index 000000000..69d857c10 --- /dev/null +++ b/core/src/processing/core/PGraphics2D.java @@ -0,0 +1,2149 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2006-08 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.Toolkit; +import java.awt.image.DirectColorModel; +import java.awt.image.MemoryImageSource; +import java.util.Arrays; + + +/** + * Subclass of PGraphics that handles fast 2D rendering using a + * MemoryImageSource. The renderer found in this class is not as accurate as + * PGraphicsJava2D, but offers certain speed tradeoffs, particular when + * messing with the pixels array, or displaying image or video data. + */ +public class PGraphics2D extends PGraphics { + + PMatrix2D ctm = new PMatrix2D(); + + //PPolygon polygon; // general polygon to use for shape + PPolygon fpolygon; // used to fill polys for tri or quad strips + PPolygon spolygon; // stroke/line polygon + float svertices[][]; // temp vertices used for stroking end of poly + + PPolygon tpolygon; + int[] vertexOrder; + + PLine line; + + float[][] matrixStack = new float[MATRIX_STACK_DEPTH][6]; + int matrixStackDepth; + + DirectColorModel cm; + MemoryImageSource mis; + + + ////////////////////////////////////////////////////////////// + + + public PGraphics2D() { } + + + //public void setParent(PApplet parent) + + + //public void setPrimary(boolean primary) + + + //public void setPath(String path) + + + //public void setSize(int iwidth, int iheight) + + + protected void allocate() { + pixelCount = width * height; + pixels = new int[pixelCount]; + + if (primarySurface) { + cm = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff);; + mis = new MemoryImageSource(width, height, pixels, 0, width); + mis.setFullBufferUpdates(true); + mis.setAnimated(true); + image = Toolkit.getDefaultToolkit().createImage(mis); + } + } + + + //public void dispose() + + + + ////////////////////////////////////////////////////////////// + + + public boolean canDraw() { + return true; + } + + + public void beginDraw() { + // need to call defaults(), but can only be done when it's ok to draw + // (i.e. for OpenGL, no drawing can be done outside beginDraw/endDraw). + if (!settingsInited) { + defaultSettings(); + +// polygon = new PPolygon(this); + fpolygon = new PPolygon(this); + spolygon = new PPolygon(this); + spolygon.vertexCount = 4; + svertices = new float[2][]; + } + + resetMatrix(); // reset model matrix + + // reset vertices + vertexCount = 0; + } + + + public void endDraw() { + if (mis != null) { + mis.newPixels(pixels, cm, 0, width); + } + // mark pixels as having been updated, so that they'll work properly + // when this PGraphics is drawn using image(). + updatePixels(); + } + + + // public void flush() + + + + ////////////////////////////////////////////////////////////// + + + //protected void checkSettings() + + + //protected void defaultSettings() + + + //protected void reapplySettings() + + + + ////////////////////////////////////////////////////////////// + + + //public void hint(int which) + + + + ////////////////////////////////////////////////////////////// + + + //public void beginShape() + + + public void beginShape(int kind) { + shape = kind; + vertexCount = 0; + curveVertexCount = 0; + +// polygon.reset(0); + fpolygon.reset(4); + spolygon.reset(4); + + textureImage = null; +// polygon.interpUV = false; + } + + + //public void edge(boolean e) + + + //public void normal(float nx, float ny, float nz) + + + //public void textureMode(int mode) + + + //public void texture(PImage image) + + + /* + public void vertex(float x, float y) { + if (shape == POINTS) { + point(x, y); + } else { + super.vertex(x, y); + } + } + */ + + + public void vertex(float x, float y, float z) { + showDepthWarningXYZ("vertex"); + } + + + //public void vertex(float x, float y, float u, float v) + + + public void vertex(float x, float y, float z, float u, float v) { + showDepthWarningXYZ("vertex"); + } + + + //protected void vertexTexture(float u, float v); + + + public void breakShape() { + showWarning("This renderer cannot handle concave shapes " + + "or shapes with holes."); + } + + + //public void endShape() + + + public void endShape(int mode) { + if (ctm.isIdentity()) { + for (int i = 0; i < vertexCount; i++) { + vertices[i][TX] = vertices[i][X]; + vertices[i][TY] = vertices[i][Y]; + } + } else { + for (int i = 0; i < vertexCount; i++) { + vertices[i][TX] = ctm.multX(vertices[i][X], vertices[i][Y]); + vertices[i][TY] = ctm.multY(vertices[i][X], vertices[i][Y]); + } + } + + // ------------------------------------------------------------------ + // TEXTURES + + fpolygon.texture(textureImage); + + // ------------------------------------------------------------------ + // COLORS + // calculate RGB for each vertex + + spolygon.interpARGB = true; //strokeChanged; //false; + fpolygon.interpARGB = true; //fillChanged; //false; + + // all the values for r, g, b have been set with calls to vertex() + // (no need to re-calculate anything here) + + // ------------------------------------------------------------------ + // RENDER SHAPES + + int increment; + + switch (shape) { + case POINTS: + // stroke cannot change inside beginShape(POINTS); + if (stroke) { + if ((ctm.m00 == ctm.m11) && (strokeWeight == 1)) { + for (int i = 0; i < vertexCount; i++) { + thin_point(vertices[i][TX], vertices[i][TY], strokeColor); + } + } else { + for (int i = 0; i < vertexCount; i++) { + float[] v = vertices[i]; + thick_point(v[TX], v[TY], v[TZ], v[SR], v[SG], v[SB], v[SA]); + } + } + } + break; + + case LINES: + if (stroke) { + // increment by two for individual lines + increment = (shape == LINES) ? 2 : 1; + draw_lines(vertices, vertexCount-1, 1, increment, 0); + } + break; + + case TRIANGLE_FAN: + // do fill and stroke separately because otherwise + // the lines will be stroked more than necessary + if (fill) { + fpolygon.vertexCount = 3; + + for (int i = 1; i < vertexCount-1; i++) { +// System.out.println(i + " of " + vertexCount); + + fpolygon.vertices[2][R] = vertices[0][R]; + fpolygon.vertices[2][G] = vertices[0][G]; + fpolygon.vertices[2][B] = vertices[0][B]; + fpolygon.vertices[2][A] = vertices[0][A]; + + fpolygon.vertices[2][TX] = vertices[0][TX]; + fpolygon.vertices[2][TY] = vertices[0][TY]; + + if (textureImage != null) { + fpolygon.vertices[2][U] = vertices[0][U]; + fpolygon.vertices[2][V] = vertices[0][V]; + } +// System.out.println(fpolygon.vertices[2][TX] + " " + fpolygon.vertices[2][TY]); + + for (int j = 0; j < 2; j++) { + fpolygon.vertices[j][R] = vertices[i+j][R]; + fpolygon.vertices[j][G] = vertices[i+j][G]; + fpolygon.vertices[j][B] = vertices[i+j][B]; + fpolygon.vertices[j][A] = vertices[i+j][A]; + + fpolygon.vertices[j][TX] = vertices[i+j][TX]; + fpolygon.vertices[j][TY] = vertices[i+j][TY]; + +// System.out.println(fpolygon.vertices[j][TX] + " " + fpolygon.vertices[j][TY]); + + if (textureImage != null) { + fpolygon.vertices[j][U] = vertices[i+j][U]; + fpolygon.vertices[j][V] = vertices[i+j][V]; + } + } +// System.out.println(); + fpolygon.render(); + } + } + if (stroke) { + // draw internal lines + for (int i = 1; i < vertexCount; i++) { + draw_line(vertices[0], vertices[i]); + } + // draw a ring around the outside + for (int i = 1; i < vertexCount-1; i++) { + draw_line(vertices[i], vertices[i+1]); + } + // close the shape + draw_line(vertices[vertexCount-1], vertices[1]); + } + break; + + case TRIANGLES: + case TRIANGLE_STRIP: + increment = (shape == TRIANGLES) ? 3 : 1; + // do fill and stroke separately because otherwise + // the lines will be stroked more than necessary + if (fill) { + fpolygon.vertexCount = 3; + for (int i = 0; i < vertexCount-2; i += increment) { + for (int j = 0; j < 3; j++) { + fpolygon.vertices[j][R] = vertices[i+j][R]; + fpolygon.vertices[j][G] = vertices[i+j][G]; + fpolygon.vertices[j][B] = vertices[i+j][B]; + fpolygon.vertices[j][A] = vertices[i+j][A]; + + fpolygon.vertices[j][TX] = vertices[i+j][TX]; + fpolygon.vertices[j][TY] = vertices[i+j][TY]; + fpolygon.vertices[j][TZ] = vertices[i+j][TZ]; + + if (textureImage != null) { + fpolygon.vertices[j][U] = vertices[i+j][U]; + fpolygon.vertices[j][V] = vertices[i+j][V]; + } + } + fpolygon.render(); + } + } + if (stroke) { + // first draw all vertices as a line strip + if (shape == TRIANGLE_STRIP) { + draw_lines(vertices, vertexCount-1, 1, 1, 0); + } else { + draw_lines(vertices, vertexCount-1, 1, 1, 3); + } + // then draw from vertex (n) to (n+2) + // incrementing n using the same as above + draw_lines(vertices, vertexCount-2, 2, increment, 0); + // changed this to vertexCount-2, because it seemed + // to be adding an extra (nonexistant) line + } + break; + + case QUADS: + if (fill) { + fpolygon.vertexCount = 4; + for (int i = 0; i < vertexCount-3; i += 4) { + for (int j = 0; j < 4; j++) { + int jj = i+j; + fpolygon.vertices[j][R] = vertices[jj][R]; + fpolygon.vertices[j][G] = vertices[jj][G]; + fpolygon.vertices[j][B] = vertices[jj][B]; + fpolygon.vertices[j][A] = vertices[jj][A]; + + fpolygon.vertices[j][TX] = vertices[jj][TX]; + fpolygon.vertices[j][TY] = vertices[jj][TY]; + fpolygon.vertices[j][TZ] = vertices[jj][TZ]; + + if (textureImage != null) { + fpolygon.vertices[j][U] = vertices[jj][U]; + fpolygon.vertices[j][V] = vertices[jj][V]; + } + } + fpolygon.render(); + } + } + if (stroke) { + for (int i = 0; i < vertexCount-3; i += 4) { + draw_line(vertices[i+0], vertices[i+1]); + draw_line(vertices[i+1], vertices[i+2]); + draw_line(vertices[i+2], vertices[i+3]); + draw_line(vertices[i+3], vertices[i+0]); + } + } + break; + + case QUAD_STRIP: + if (fill) { + fpolygon.vertexCount = 4; + for (int i = 0; i < vertexCount-3; i += 2) { + for (int j = 0; j < 4; j++) { + int jj = i+j; + if (j == 2) jj = i+3; // swap 2nd and 3rd vertex + if (j == 3) jj = i+2; + + fpolygon.vertices[j][R] = vertices[jj][R]; + fpolygon.vertices[j][G] = vertices[jj][G]; + fpolygon.vertices[j][B] = vertices[jj][B]; + fpolygon.vertices[j][A] = vertices[jj][A]; + + fpolygon.vertices[j][TX] = vertices[jj][TX]; + fpolygon.vertices[j][TY] = vertices[jj][TY]; + fpolygon.vertices[j][TZ] = vertices[jj][TZ]; + + if (textureImage != null) { + fpolygon.vertices[j][U] = vertices[jj][U]; + fpolygon.vertices[j][V] = vertices[jj][V]; + } + } + fpolygon.render(); + } + } + if (stroke) { + draw_lines(vertices, vertexCount-1, 1, 2, 0); // inner lines + draw_lines(vertices, vertexCount-2, 2, 1, 0); // outer lines + } + break; + + case POLYGON: + if (isConvex()) { + if (fill) { + //System.out.println("convex"); + fpolygon.renderPolygon(vertices, vertexCount); + //if (stroke) polygon.unexpand(); + } + + if (stroke) { + draw_lines(vertices, vertexCount-1, 1, 1, 0); + if (mode == CLOSE) { + // draw the last line connecting back to the first point in poly + //svertices[0] = vertices[vertexCount-1]; + //svertices[1] = vertices[0]; + //draw_lines(svertices, 1, 1, 1, 0); + draw_line(vertices[vertexCount-1], vertices[0]); + } + } + } else { // not convex + //System.out.println("concave"); + if (fill) { + // the triangulator produces polygons that don't align + // when smoothing is enabled. but if there is a stroke around + // the polygon, then smoothing can be temporarily disabled. + boolean smoov = smooth; + //if (stroke && !hints[DISABLE_SMOOTH_HACK]) smooth = false; + if (stroke) smooth = false; + concaveRender(); + //if (stroke && !hints[DISABLE_SMOOTH_HACK]) smooth = smoov; + if (stroke) smooth = smoov; + } + + if (stroke) { + draw_lines(vertices, vertexCount-1, 1, 1, 0); + if (mode == CLOSE) { + // draw the last line connecting back + // to the first point in poly +// svertices[0] = vertices[vertexCount-1]; +// svertices[1] = vertices[0]; +// draw_lines(svertices, 1, 1, 1, 0); + draw_line(vertices[vertexCount-1], vertices[0]); + } + } + } + break; + } + + // to signify no shape being drawn + shape = 0; + } + + + + ////////////////////////////////////////////////////////////// + + // CONCAVE/CONVEX POLYGONS + + + private boolean isConvex() { + //float v[][] = polygon.vertices; + //int n = polygon.vertexCount; + //int j,k; + //float tol = 0.001f; + + if (vertexCount < 3) { + // ERROR: this is a line or a point, render as convex + return true; + } + + int flag = 0; + // iterate along border doing dot product. + // if the sign of the result changes, then is concave + for (int i = 0; i < vertexCount; i++) { + float[] vi = vertices[i]; + float[] vj = vertices[(i + 1) % vertexCount]; + float[] vk = vertices[(i + 2) % vertexCount]; + float calc = ((vj[TX] - vi[TX]) * (vk[TY] - vj[TY]) - + (vj[TY] - vi[TY]) * (vk[TX] - vj[TX])); + if (calc < 0) { + flag |= 1; + } else if (calc > 0) { + flag |= 2; + } + if (flag == 3) { + return false; // CONCAVE + } + } + if (flag != 0) { + return true; // CONVEX + } else { + // ERROR: colinear points, self intersection + // treat as CONVEX + return true; + } + } + + + /** + * Triangulate the current polygon. + *

+ * Simple ear clipping polygon triangulation adapted from code by + * John W. Ratcliff (jratcliff at verant.com). Presumably + * this + * bit of code from the web. + */ + protected void concaveRender() { + if (vertexOrder == null || vertexOrder.length != vertices.length) { + vertexOrder = new int[vertices.length]; +// int[] temp = new int[vertices.length]; +// // since vertex_start may not be zero, might need to keep old stuff around +// PApplet.arrayCopy(vertexOrder, temp, vertexCount); +// vertexOrder = temp; + } + + if (tpolygon == null) { + tpolygon = new PPolygon(this); + } + tpolygon.reset(3); + + // first we check if the polygon goes clockwise or counterclockwise + float area = 0; + for (int p = vertexCount - 1, q = 0; q < vertexCount; p = q++) { + area += (vertices[q][X] * vertices[p][Y] - + vertices[p][X] * vertices[q][Y]); + } + // ain't nuthin there + if (area == 0) return; + + // don't allow polygons to come back and meet themselves, + // otherwise it will anger the triangulator + // http://dev.processing.org/bugs/show_bug.cgi?id=97 + float vfirst[] = vertices[0]; + float vlast[] = vertices[vertexCount-1]; + if ((Math.abs(vfirst[X] - vlast[X]) < EPSILON) && + (Math.abs(vfirst[Y] - vlast[Y]) < EPSILON) && + (Math.abs(vfirst[Z] - vlast[Z]) < EPSILON)) { + vertexCount--; + } + + // then sort the vertices so they are always in a counterclockwise order + for (int i = 0; i < vertexCount; i++) { + vertexOrder[i] = (area > 0) ? i : (vertexCount-1 - i); + } + + // remove vc-2 Vertices, creating 1 triangle every time + int vc = vertexCount; // vc will be decremented while working + int count = 2*vc; // complex polygon detection + + for (int m = 0, v = vc - 1; vc > 2; ) { + boolean snip = true; + + // if we start over again, is a complex polygon + if (0 >= (count--)) { + break; // triangulation failed + } + + // get 3 consecutive vertices + int u = v ; if (vc <= u) u = 0; // previous + v = u + 1; if (vc <= v) v = 0; // current + int w = v + 1; if (vc <= w) w = 0; // next + + // Upgrade values to doubles, and multiply by 10 so that we can have + // some better accuracy as we tessellate. This seems to have negligible + // speed differences on Windows and Intel Macs, but causes a 50% speed + // drop for PPC Macs with the bug's example code that draws ~200 points + // in a concave polygon. Apple has abandoned PPC so we may as well too. + // http://dev.processing.org/bugs/show_bug.cgi?id=774 + + // triangle A B C + double Ax = -10 * vertices[vertexOrder[u]][X]; + double Ay = 10 * vertices[vertexOrder[u]][Y]; + double Bx = -10 * vertices[vertexOrder[v]][X]; + double By = 10 * vertices[vertexOrder[v]][Y]; + double Cx = -10 * vertices[vertexOrder[w]][X]; + double Cy = 10 * vertices[vertexOrder[w]][Y]; + + // first we check if continues going ccw + if (EPSILON > (((Bx-Ax) * (Cy-Ay)) - ((By-Ay) * (Cx-Ax)))) { + continue; + } + + for (int p = 0; p < vc; p++) { + if ((p == u) || (p == v) || (p == w)) { + continue; + } + + double Px = -10 * vertices[vertexOrder[p]][X]; + double Py = 10 * vertices[vertexOrder[p]][Y]; + + double ax = Cx - Bx; double ay = Cy - By; + double bx = Ax - Cx; double by = Ay - Cy; + double cx = Bx - Ax; double cy = By - Ay; + double apx = Px - Ax; double apy = Py - Ay; + double bpx = Px - Bx; double bpy = Py - By; + double cpx = Px - Cx; double cpy = Py - Cy; + + double aCROSSbp = ax * bpy - ay * bpx; + double cCROSSap = cx * apy - cy * apx; + double bCROSScp = bx * cpy - by * cpx; + + if ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0)) { + snip = false; + } + } + + if (snip) { + tpolygon.renderTriangle(vertices[vertexOrder[u]], + vertices[vertexOrder[v]], + vertices[vertexOrder[w]]); + m++; + + // remove v from remaining polygon + for (int s = v, t = v + 1; t < vc; s++, t++) { + vertexOrder[s] = vertexOrder[t]; + } + vc--; + + // reset error detection counter + count = 2 * vc; + } + } + } + + + /* + // triangulate the current polygon + private void concaveRender() { + float polyVertices[][] = polygon.vertices; + + if (tpolygon == null) { + // allocate on first use, rather than slowing + // the startup of the class. + tpolygon = new PPolygon(this); + tpolygon_vertex_order = new int[TPOLYGON_MAX_VERTICES]; + } + tpolygon.reset(3); + + // copy render parameters + + if (textureImage != null) { + tpolygon.texture(textureImage); //polygon.timage); + } + + tpolygon.interpX = polygon.interpX; + tpolygon.interpUV = polygon.interpUV; + tpolygon.interpARGB = polygon.interpARGB; + + // simple ear clipping polygon triangulation + // addapted from code by john w. ratcliff (jratcliff@verant.com) + + // 1 - first we check if the polygon goes CW or CCW + // CW-CCW ordering adapted from code by + // Joseph O'Rourke orourke@cs.smith.edu + // 1A - we start by finding the lowest-right most vertex + + boolean ccw = false; // clockwise + + int n = polygon.vertexCount; + int mm; // postion for LR vertex + //float min[] = new float[2]; + float minX = polyVertices[0][TX]; + float minY = polyVertices[0][TY]; + mm = 0; + + for(int i = 0; i < n; i++ ) { + if ((polyVertices[i][TY] < minY) || + ((polyVertices[i][TY] == minY) && (polyVertices[i][TX] > minX) ) + ) { + mm = i; + minX = polyVertices[mm][TX]; + minY = polyVertices[mm][TY]; + } + } + + // 1B - now we compute the cross product of the edges of this vertex + float cp; + int mm1; + + // just for renaming + float a[] = new float[2]; + float b[] = new float[2]; + float c[] = new float[2]; + + mm1 = (mm + (n-1)) % n; + + // assign a[0] to point to poly[m1][0] etc. + for(int i = 0; i < 2; i++ ) { + a[i] = polyVertices[mm1][i]; + b[i] = polyVertices[mm][i]; + c[i] = polyVertices[(mm+1)%n][i]; + } + + cp = a[0] * b[1] - a[1] * b[0] + + a[1] * c[0] - a[0] * c[1] + + b[0] * c[1] - c[0] * b[1]; + + if ( cp > 0 ) + ccw = true; // CCW + else + ccw = false; // CW + + // 1C - then we sort the vertices so they + // are always in a counterclockwise order + //int j = 0; + if (!ccw) { + // keep the same order + for (int i = 0; i < n; i++) { + tpolygon_vertex_order[i] = i; + } + + } else { + // invert the order + for (int i = 0; i < n; i++) { + tpolygon_vertex_order[i] = (n - 1) - i; + } + } + + // 2 - begin triangulation + // resulting triangles are stored in the triangle array + // remove vc-2 Vertices, creating 1 triangle every time + int vc = n; + int count = 2*vc; // complex polygon detection + + for (int m = 0, v = vc - 1; vc > 2; ) { + boolean snip = true; + + // if we start over again, is a complex polygon + if (0 >= (count--)) { + break; // triangulation failed + } + + // get 3 consecutive vertices + int u = v ; if (vc <= u) u = 0; // previous + v = u+1; if (vc <= v) v = 0; // current + int w = v+1; if (vc <= w) w = 0; // next + + // triangle A B C + float Ax, Ay, Bx, By, Cx, Cy, Px, Py; + + Ax = -polyVertices[tpolygon_vertex_order[u]][TX]; + Ay = polyVertices[tpolygon_vertex_order[u]][TY]; + Bx = -polyVertices[tpolygon_vertex_order[v]][TX]; + By = polyVertices[tpolygon_vertex_order[v]][TY]; + Cx = -polyVertices[tpolygon_vertex_order[w]][TX]; + Cy = polyVertices[tpolygon_vertex_order[w]][TY]; + + if ( EPSILON > (((Bx-Ax) * (Cy-Ay)) - ((By-Ay) * (Cx-Ax)))) { + continue; + } + + for (int p = 0; p < vc; p++) { + + // this part is a bit osbscure, basically what it does + // is test if this tree vertices are and ear or not, looking for + // intersections with the remaining vertices using a cross product + float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy; + float cCROSSap, bCROSScp, aCROSSbp; + + if( (p == u) || (p == v) || (p == w) ) { + continue; + } + + Px = -polyVertices[tpolygon_vertex_order[p]][TX]; + Py = polyVertices[tpolygon_vertex_order[p]][TY]; + + ax = Cx - Bx; ay = Cy - By; + bx = Ax - Cx; by = Ay - Cy; + cx = Bx - Ax; cy = By - Ay; + apx= Px - Ax; apy= Py - Ay; + bpx= Px - Bx; bpy= Py - By; + cpx= Px - Cx; cpy= Py - Cy; + + aCROSSbp = ax * bpy - ay * bpx; + cCROSSap = cx * apy - cy * apx; + bCROSScp = bx * cpy - by * cpx; + + if ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f)) { + snip = false; + } + } + + if (snip) { + // yes, the trio is an ear, render it and cut it + + int triangle_vertices[] = new int[3]; + int s,t; + + // true names of the vertices + triangle_vertices[0] = tpolygon_vertex_order[u]; + triangle_vertices[1] = tpolygon_vertex_order[v]; + triangle_vertices[2] = tpolygon_vertex_order[w]; + + // create triangle + //render_triangle(triangle_vertices); + //private final void render_triangle(int[] triangle_vertices) { + // copy all fields of the triangle vertices + for (int i = 0; i < 3; i++) { + float[] src = polygon.vertices[triangle_vertices[i]]; + float[] dest = tpolygon.vertices[i]; + for (int k = 0; k < VERTEX_FIELD_COUNT; k++) { + dest[k] = src[k]; + } + } + // render triangle + tpolygon.render(); + //} + + m++; + + // remove v from remaining polygon + for( s = v, t = v + 1; t < vc; s++, t++) { + tpolygon_vertex_order[s] = tpolygon_vertex_order[t]; + } + + vc--; + + // resest error detection counter + count = 2 * vc; + } + } + } + */ + + + + ////////////////////////////////////////////////////////////// + + // BEZIER VERTICES + + + //public void bezierVertex(float x2, float y2, + // float x3, float y3, + // float x4, float y4) + + + //public void bezierVertex(float x2, float y2, float z2, + // float x3, float y3, float z3, + // float x4, float y4, float z4) + + + + ////////////////////////////////////////////////////////////// + + // CURVE VERTICES + + + //public void curveVertex(float x, float y) + + + //public void curveVertex(float x, float y, float z) + + + + ////////////////////////////////////////////////////////////// + + // FLUSH + + + //public void flush() + + + + ////////////////////////////////////////////////////////////// + + // PRIMITIVES + + + //public void point(float x, float y) + + + public void point(float x, float y, float z) { + showDepthWarningXYZ("point"); + } + + + //public void line(float x1, float y1, float x2, float y2) + + + //public void line(float x1, float y1, float z1, + // float x2, float y2, float z2) + + + //public void triangle(float x1, float y1, + // float x2, float y2, + // float x3, float y3) + + + //public void quad(float x1, float y1, float x2, float y2, + // float x3, float y3, float x4, float y4) + + + + ////////////////////////////////////////////////////////////// + + // RECT + + + protected void rectImpl(float x1f, float y1f, float x2f, float y2f) { + if (smooth || strokeAlpha || ctm.isWarped()) { + // screw the efficiency, send this off to beginShape(). + super.rectImpl(x1f, y1f, x2f, y2f); + + } else { + int x1 = (int) (x1f + ctm.m02); + int y1 = (int) (y1f + ctm.m12); + int x2 = (int) (x2f + ctm.m02); + int y2 = (int) (y2f + ctm.m12); + + if (fill) { + simple_rect_fill(x1, y1, x2, y2); + } + + if (stroke) { + if (strokeWeight == 1) { + thin_flat_line(x1, y1, x2, y1); + thin_flat_line(x2, y1, x2, y2); + thin_flat_line(x2, y2, x1, y2); + thin_flat_line(x1, y2, x1, y1); + + } else { + thick_flat_line(x1, y1, strokeR, strokeG, strokeB, strokeA, + x2, y1, strokeR, strokeG, strokeB, strokeA); + thick_flat_line(x2, y1, strokeR, strokeG, strokeB, strokeA, + x2, y2, strokeR, strokeG, strokeB, strokeA); + thick_flat_line(x2, y2, strokeR, strokeG, strokeB, strokeA, + x1, y2, strokeR, strokeG, strokeB, strokeA); + thick_flat_line(x1, y2, strokeR, strokeG, strokeB, strokeA, + x1, y1, strokeR, strokeG, strokeB, strokeA); + } + } + } + } + + + /** + * Draw a rectangle that hasn't been warped by the CTM (though it may be + * translated). Just fill a bunch of pixels, or blend them if there's alpha. + */ + private void simple_rect_fill(int x1, int y1, int x2, int y2) { + if (y2 < y1) { + int temp = y1; y1 = y2; y2 = temp; + } + if (x2 < x1) { + int temp = x1; x1 = x2; x2 = temp; + } + // check to see if completely off-screen (e.g. if the left edge of the + // rectangle is bigger than the width, and so on.) + if ((x1 > width1) || (x2 < 0) || + (y1 > height1) || (y2 < 0)) return; + + // these only affect the fill, not the stroke + // (otherwise strange boogers at edges b/c frame changes shape) + if (x1 < 0) x1 = 0; + if (x2 > width) x2 = width; + if (y1 < 0) y1 = 0; + if (y2 > height) y2 = height; + + int ww = x2 - x1; + + if (fillAlpha) { + for (int y = y1; y < y2; y++) { + int index = y*width + x1; + for (int x = 0; x < ww; x++) { + pixels[index] = blend_fill(pixels[index]); + index++; + } + } + + } else { + // on avg. 20-25% faster fill routine using System.arraycopy() [toxi 031223] + // removed temporary row[] array for (hopefully) better performance [fry 081117] + int hh = y2 - y1; + // int[] row = new int[ww]; + // for (int i = 0; i < ww; i++) row[i] = fillColor; + int index = y1 * width + x1; + int rowIndex = index; + for (int i = 0; i < ww; i++) { + pixels[index + i] = fillColor; + } + for (int y = 0; y < hh; y++) { + // System.arraycopy(row, 0, pixels, idx, ww); + System.arraycopy(pixels, rowIndex, pixels, index, ww); + index += width; + } + // row = null; + } + } + + + + ////////////////////////////////////////////////////////////// + + // ELLIPSE AND ARC + + + protected void ellipseImpl(float x, float y, float w, float h) { + if (smooth || (strokeWeight != 1) || + fillAlpha || strokeAlpha || ctm.isWarped()) { + // identical to PGraphics version, but uses POLYGON + // for the fill instead of a TRIANGLE_FAN + float radiusH = w / 2; + float radiusV = h / 2; + + float centerX = x + radiusH; + float centerY = y + radiusV; + + float sx1 = screenX(x, y); + float sy1 = screenY(x, y); + float sx2 = screenX(x+w, y+h); + float sy2 = screenY(x+w, y+h); + int accuracy = (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) / 8); + if (accuracy < 4) return; // don't bother? + //System.out.println("diameter " + w + " " + h + " -> " + accuracy); + + float inc = (float)SINCOS_LENGTH / accuracy; + + float val = 0; + + if (fill) { + boolean savedStroke = stroke; + stroke = false; + + beginShape(); + for (int i = 0; i < accuracy; i++) { + vertex(centerX + cosLUT[(int) val] * radiusH, + centerY + sinLUT[(int) val] * radiusV); + val += inc; + } + endShape(CLOSE); + + stroke = savedStroke; + } + + if (stroke) { + boolean savedFill = fill; + fill = false; + + val = 0; + beginShape(); + for (int i = 0; i < accuracy; i++) { + vertex(centerX + cosLUT[(int) val] * radiusH, + centerY + sinLUT[(int) val] * radiusV); + val += inc; + } + endShape(CLOSE); + + fill = savedFill; + } + } else { + float hradius = w / 2f; + float vradius = h / 2f; + + int centerX = (int) (x + hradius + ctm.m02); + int centerY = (int) (y + vradius + ctm.m12); + + int hradiusi = (int) hradius; + int vradiusi = (int) vradius; + + if (hradiusi == vradiusi) { + if (fill) flat_circle_fill(centerX, centerY, hradiusi); + if (stroke) flat_circle_stroke(centerX, centerY, hradiusi); + + } else { + if (fill) flat_ellipse_internal(centerX, centerY, hradiusi, vradiusi, true); + if (stroke) flat_ellipse_internal(centerX, centerY, hradiusi, vradiusi, false); + } + } + } + + + /** + * Draw the outline around a flat circle using a bresenham-style + * algorithm. Adapted from drawCircle function in "Computer Graphics + * for Java Programmers" by Leen Ammeraal, p. 110. + *

+ * This function is included because the quality is so much better, + * and the drawing significantly faster than with adaptive ellipses + * drawn using the sine/cosine tables. + *

+ * Circle quadrants break down like so: + *

+   *              |
+   *        \ NNW | NNE /
+   *          \   |   /
+   *       WNW  \ | /  ENE
+   *     -------------------
+   *       WSW  / | \  ESE
+   *          /   |   \
+   *        / SSW | SSE \
+   *              |
+   * 
+ * @param xc x center + * @param yc y center + * @param r radius + */ + private void flat_circle_stroke(int xC, int yC, int r) { + int x = 0, y = r, u = 1, v = 2 * r - 1, E = 0; + while (x < y) { + thin_point(xC + x, yC + y, strokeColor); // NNE + thin_point(xC + y, yC - x, strokeColor); // ESE + thin_point(xC - x, yC - y, strokeColor); // SSW + thin_point(xC - y, yC + x, strokeColor); // WNW + + x++; E += u; u += 2; + if (v < 2 * E) { + y--; E -= v; v -= 2; + } + if (x > y) break; + + thin_point(xC + y, yC + x, strokeColor); // ENE + thin_point(xC + x, yC - y, strokeColor); // SSE + thin_point(xC - y, yC - x, strokeColor); // WSW + thin_point(xC - x, yC + y, strokeColor); // NNW + } + } + + + /** + * Heavily adapted version of the above algorithm that handles + * filling the ellipse. Works by drawing from the center and + * outwards to the points themselves. Has to be done this way + * because the values for the points are changed halfway through + * the function, making it impossible to just store a series of + * left and right edges to be drawn more quickly. + * + * @param xc x center + * @param yc y center + * @param r radius + */ + private void flat_circle_fill(int xc, int yc, int r) { + int x = 0, y = r, u = 1, v = 2 * r - 1, E = 0; + while (x < y) { + for (int xx = xc; xx < xc + x; xx++) { // NNE + thin_point(xx, yc + y, fillColor); + } + for (int xx = xc; xx < xc + y; xx++) { // ESE + thin_point(xx, yc - x, fillColor); + } + for (int xx = xc - x; xx < xc; xx++) { // SSW + thin_point(xx, yc - y, fillColor); + } + for (int xx = xc - y; xx < xc; xx++) { // WNW + thin_point(xx, yc + x, fillColor); + } + + x++; E += u; u += 2; + if (v < 2 * E) { + y--; E -= v; v -= 2; + } + if (x > y) break; + + for (int xx = xc; xx < xc + y; xx++) { // ENE + thin_point(xx, yc + x, fillColor); + } + for (int xx = xc; xx < xc + x; xx++) { // SSE + thin_point(xx, yc - y, fillColor); + } + for (int xx = xc - y; xx < xc; xx++) { // WSW + thin_point(xx, yc - x, fillColor); + } + for (int xx = xc - x; xx < xc; xx++) { // NNW + thin_point(xx, yc + y, fillColor); + } + } + } + + + // unfortunately this can't handle fill and stroke simultaneously, + // because the fill will later replace some of the stroke points + + private final void flat_ellipse_symmetry(int centerX, int centerY, + int ellipseX, int ellipseY, + boolean filling) { + if (filling) { + for (int i = centerX - ellipseX + 1; i < centerX + ellipseX; i++) { + thin_point(i, centerY - ellipseY, fillColor); + thin_point(i, centerY + ellipseY, fillColor); + } + } else { + thin_point(centerX - ellipseX, centerY + ellipseY, strokeColor); + thin_point(centerX + ellipseX, centerY + ellipseY, strokeColor); + thin_point(centerX - ellipseX, centerY - ellipseY, strokeColor); + thin_point(centerX + ellipseX, centerY - ellipseY, strokeColor); + } + } + + + /** + * Bresenham-style ellipse drawing function, adapted from a posting to + * comp.graphics.algortihms. + * + * This function is included because the quality is so much better, + * and the drawing significantly faster than with adaptive ellipses + * drawn using the sine/cosine tables. + * + * @param centerX x coordinate of the center + * @param centerY y coordinate of the center + * @param a horizontal radius + * @param b vertical radius + */ + private void flat_ellipse_internal(int centerX, int centerY, + int a, int b, boolean filling) { + int x, y, a2, b2, s, t; + + a2 = a*a; + b2 = b*b; + x = 0; + y = b; + s = a2*(1-2*b) + 2*b2; + t = b2 - 2*a2*(2*b-1); + flat_ellipse_symmetry(centerX, centerY, x, y, filling); + + do { + if (s < 0) { + s += 2*b2*(2*x+3); + t += 4*b2*(x+1); + x++; + } else if (t < 0) { + s += 2*b2*(2*x+3) - 4*a2*(y-1); + t += 4*b2*(x+1) - 2*a2*(2*y-3); + x++; + y--; + } else { + s -= 4*a2*(y-1); + t -= 2*a2*(2*y-3); + y--; + } + flat_ellipse_symmetry(centerX, centerY, x, y, filling); + + } while (y > 0); + } + + + // TODO really need a decent arc function in here.. + + protected void arcImpl(float x, float y, float w, float h, + float start, float stop) { + float hr = w / 2f; + float vr = h / 2f; + + float centerX = x + hr; + float centerY = y + vr; + + if (fill) { + // shut off stroke for a minute + boolean savedStroke = stroke; + stroke = false; + + int startLUT = (int) (-0.5f + (start / TWO_PI) * SINCOS_LENGTH); + int stopLUT = (int) (0.5f + (stop / TWO_PI) * SINCOS_LENGTH); + + beginShape(); + vertex(centerX, centerY); + for (int i = startLUT; i < stopLUT; i++) { + int ii = i % SINCOS_LENGTH; + // modulo won't make the value positive + if (ii < 0) ii += SINCOS_LENGTH; + vertex(centerX + cosLUT[ii] * hr, + centerY + sinLUT[ii] * vr); + } + endShape(CLOSE); + + stroke = savedStroke; + } + + if (stroke) { + // Almost identical to above, but this uses a LINE_STRIP + // and doesn't include the first (center) vertex. + + boolean savedFill = fill; + fill = false; + + int startLUT = (int) (0.5f + (start / TWO_PI) * SINCOS_LENGTH); + int stopLUT = (int) (0.5f + (stop / TWO_PI) * SINCOS_LENGTH); + + beginShape(); //LINE_STRIP); + int increment = 1; // what's a good algorithm? stopLUT - startLUT; + for (int i = startLUT; i < stopLUT; i += increment) { + int ii = i % SINCOS_LENGTH; + if (ii < 0) ii += SINCOS_LENGTH; + vertex(centerX + cosLUT[ii] * hr, + centerY + sinLUT[ii] * vr); + } + // draw last point explicitly for accuracy + vertex(centerX + cosLUT[stopLUT % SINCOS_LENGTH] * hr, + centerY + sinLUT[stopLUT % SINCOS_LENGTH] * vr); + endShape(); + + fill = savedFill; + } + } + + + + ////////////////////////////////////////////////////////////// + + // BOX + + + public void box(float size) { + showDepthWarning("box"); + } + + public void box(float w, float h, float d) { + showDepthWarning("box"); + } + + + + ////////////////////////////////////////////////////////////// + + // SPHERE + + + public void sphereDetail(int res) { + showDepthWarning("sphereDetail"); + } + + public void sphereDetail(int ures, int vres) { + showDepthWarning("sphereDetail"); + } + + public void sphere(float r) { + showDepthWarning("sphere"); + } + + + + ////////////////////////////////////////////////////////////// + + // BEZIER & CURVE + + + public void bezier(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + showDepthWarningXYZ("bezier"); + } + + + public void curve(float x1, float y1, float z1, + float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + showDepthWarningXYZ("curve"); + } + + + + ////////////////////////////////////////////////////////////// + + // IMAGE + + + protected void imageImpl(PImage image, + float x1, float y1, float x2, float y2, + int u1, int v1, int u2, int v2) { + if ((x2 - x1 == image.width) && + (y2 - y1 == image.height) && + !tint && !ctm.isWarped()) { + simple_image(image, (int) (x1 + ctm.m02), (int) (y1 + ctm.m12), u1, v1, u2, v2); + + } else { + super.imageImpl(image, x1, y1, x2, y2, u1, v1, u2, v2); + } + } + + + /** + * Image drawn in flat "screen space", with no scaling or warping. + * this is so common that a special routine is included for it, + * because the alternative is much slower. + * + * @param image image to be drawn + * @param sx1 x coordinate of upper-lefthand corner in screen space + * @param sy1 y coordinate of upper-lefthand corner in screen space + */ + private void simple_image(PImage image, int sx1, int sy1, + int ix1, int iy1, int ix2, int iy2) { + if (imageMode == CENTER) { + sx1 -= image.width / 2; + sy1 -= image.height / 2; + } + + int sx2 = sx1 + image.width; + int sy2 = sy1 + image.height; + + // don't draw if completely offscreen + // (without this check, ArrayIndexOutOfBoundsException) + if ((sx1 > width1) || (sx2 < 0) || + (sy1 > height1) || (sy2 < 0)) return; + + if (sx1 < 0) { // off left edge + ix1 -= sx1; + sx1 = 0; + } + if (sy1 < 0) { // off top edge + iy1 -= sy1; + sy1 = 0; + } + if (sx2 > width) { // off right edge + ix2 -= sx2 - width; + sx2 = width; + } + if (sy2 > height) { // off bottom edge + iy2 -= sy2 - height; + sy2 = height; + } + + int source = iy1 * image.width + ix1; + int target = sy1 * width; + + if (image.format == ARGB) { + for (int y = sy1; y < sy2; y++) { + int tx = 0; + + for (int x = sx1; x < sx2; x++) { + pixels[target + x] = +// _blend(pixels[target + x], +// image.pixels[source + tx], +// image.pixels[source + tx++] >>> 24); + blend_color(pixels[target + x], + image.pixels[source + tx++]); + } + source += image.width; + target += width; + } + } else if (image.format == ALPHA) { + for (int y = sy1; y < sy2; y++) { + int tx = 0; + + for (int x = sx1; x < sx2; x++) { + pixels[target + x] = + blend_color_alpha(pixels[target + x], + fillColor, + image.pixels[source + tx++]); + } + source += image.width; + target += width; + } + + } else if (image.format == RGB) { + target += sx1; + int tw = sx2 - sx1; + for (int y = sy1; y < sy2; y++) { + System.arraycopy(image.pixels, source, pixels, target, tw); + // should set z coordinate in here + // or maybe not, since dims=0, meaning no relevant z + source += image.width; + target += width; + } + } + } + + + ////////////////////////////////////////////////////////////// + + // TEXT/FONTS + + + // These will be handled entirely by PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // UGLY RENDERING SHITE + + + // expects properly clipped coords, hence does + // NOT check if x/y are in bounds [toxi] + private void thin_point_at(int x, int y, float z, int color) { + int index = y*width+x; // offset values are pre-calced in constructor + pixels[index] = color; + } + + // expects offset/index in pixelbuffer array instead of x/y coords + // used by optimized parts of thin_flat_line() [toxi] + private void thin_point_at_index(int offset, float z, int color) { + pixels[offset] = color; + } + + + private void thick_point(float x, float y, float z, // note floats + float r, float g, float b, float a) { + spolygon.reset(4); + spolygon.interpARGB = false; // no changes for vertices of a point + + float strokeWidth2 = strokeWeight/2.0f; + + float svertex[] = spolygon.vertices[0]; + svertex[TX] = x - strokeWidth2; + svertex[TY] = y - strokeWidth2; + svertex[TZ] = z; + + svertex[R] = r; + svertex[G] = g; + svertex[B] = b; + svertex[A] = a; + + svertex = spolygon.vertices[1]; + svertex[TX] = x + strokeWidth2; + svertex[TY] = y - strokeWidth2; + svertex[TZ] = z; + + svertex = spolygon.vertices[2]; + svertex[TX] = x + strokeWidth2; + svertex[TY] = y + strokeWidth2; + svertex[TZ] = z; + + svertex = spolygon.vertices[3]; + svertex[TX] = x - strokeWidth2; + svertex[TY] = y + strokeWidth2; + svertex[TZ] = z; + + spolygon.render(); + } + + + // new bresenham clipping code, as old one was buggy [toxi] + private void thin_flat_line(int x1, int y1, int x2, int y2) { + int nx1,ny1,nx2,ny2; + + // get the "dips" for the points to clip + int code1 = thin_flat_line_clip_code(x1, y1); + int code2 = thin_flat_line_clip_code(x2, y2); + + if ((code1 & code2)!=0) { + return; + } else { + int dip = code1 | code2; + if (dip != 0) { + // now calculate the clipped points + float a1 = 0, a2 = 1, a = 0; + for (int i=0;i<4;i++) { + if (((dip>>i)%2)==1) { + a = thin_flat_line_slope((float)x1, (float)y1, + (float)x2, (float)y2, i+1); + if (((code1>>i)%2)==1) { + a1 = (float)Math.max(a, a1); + } else { + a2 = (float)Math.min(a, a2); + } + } + } + if (a1>a2) return; + else { + nx1=(int) (x1+a1*(x2-x1)); + ny1=(int) (y1+a1*(y2-y1)); + nx2=(int) (x1+a2*(x2-x1)); + ny2=(int) (y1+a2*(y2-y1)); + } + // line is fully visible/unclipped + } else { + nx1=x1; nx2=x2; + ny1=y1; ny2=y2; + } + } + + // new "extremely fast" line code + // adapted from http://www.edepot.com/linee.html + + boolean yLonger=false; + int shortLen=ny2-ny1; + int longLen=nx2-nx1; + if (Math.abs(shortLen)>Math.abs(longLen)) { + int swap=shortLen; + shortLen=longLen; + longLen=swap; + yLonger=true; + } + int decInc; + if (longLen==0) decInc=0; + else decInc = (shortLen << 16) / longLen; + + if (nx1==nx2) { + // special case: vertical line + if (ny1>ny2) { int ty=ny1; ny1=ny2; ny2=ty; } + int offset=ny1*width+nx1; + for(int j=ny1; j<=ny2; j++) { + thin_point_at_index(offset,0,strokeColor); + offset+=width; + } + return; + } else if (ny1==ny2) { + // special case: horizontal line + if (nx1>nx2) { int tx=nx1; nx1=nx2; nx2=tx; } + int offset=ny1*width+nx1; + for(int j=nx1; j<=nx2; j++) thin_point_at_index(offset++,0,strokeColor); + return; + } else if (yLonger) { + if (longLen>0) { + longLen+=ny1; + for (int j=0x8000+(nx1<<16);ny1<=longLen;++ny1) { + thin_point_at(j>>16, ny1, 0, strokeColor); + j+=decInc; + } + return; + } + longLen+=ny1; + for (int j=0x8000+(nx1<<16);ny1>=longLen;--ny1) { + thin_point_at(j>>16, ny1, 0, strokeColor); + j-=decInc; + } + return; + } else if (longLen>0) { + longLen+=nx1; + for (int j=0x8000+(ny1<<16);nx1<=longLen;++nx1) { + thin_point_at(nx1, j>>16, 0, strokeColor); + j+=decInc; + } + return; + } + longLen+=nx1; + for (int j=0x8000+(ny1<<16);nx1>=longLen;--nx1) { + thin_point_at(nx1, j>>16, 0, strokeColor); + j-=decInc; + } + } + + + private int thin_flat_line_clip_code(float x, float y) { + return ((y < 0 ? 8 : 0) | (y > height1 ? 4 : 0) | + (x < 0 ? 2 : 0) | (x > width1 ? 1 : 0)); + } + + + private float thin_flat_line_slope(float x1, float y1, + float x2, float y2, int border) { + switch (border) { + case 4: { + return (-y1)/(y2-y1); + } + case 3: { + return (height1-y1)/(y2-y1); + } + case 2: { + return (-x1)/(x2-x1); + } + case 1: { + return (width1-x1)/(x2-x1); + } + } + return -1f; + } + + + private void thick_flat_line(float ox1, float oy1, + float r1, float g1, float b1, float a1, + float ox2, float oy2, + float r2, float g2, float b2, float a2) { + spolygon.interpARGB = (r1 != r2) || (g1 != g2) || (b1 != b2) || (a1 != a2); +// spolygon.interpZ = false; + + float dX = ox2-ox1 + EPSILON; + float dY = oy2-oy1 + EPSILON; + float len = (float) Math.sqrt(dX*dX + dY*dY); + + // TODO stroke width should be transformed! + float rh = strokeWeight / len; + + float dx0 = rh * dY; + float dy0 = rh * dX; + float dx1 = rh * dY; + float dy1 = rh * dX; + + spolygon.reset(4); + + float svertex[] = spolygon.vertices[0]; + svertex[TX] = ox1+dx0; + svertex[TY] = oy1-dy0; + svertex[R] = r1; + svertex[G] = g1; + svertex[B] = b1; + svertex[A] = a1; + + svertex = spolygon.vertices[1]; + svertex[TX] = ox1-dx0; + svertex[TY] = oy1+dy0; + svertex[R] = r1; + svertex[G] = g1; + svertex[B] = b1; + svertex[A] = a1; + + svertex = spolygon.vertices[2]; + svertex[TX] = ox2-dx1; + svertex[TY] = oy2+dy1; + svertex[R] = r2; + svertex[G] = g2; + svertex[B] = b2; + svertex[A] = a2; + + svertex = spolygon.vertices[3]; + svertex[TX] = ox2+dx1; + svertex[TY] = oy2-dy1; + svertex[R] = r2; + svertex[G] = g2; + svertex[B] = b2; + svertex[A] = a2; + + spolygon.render(); + } + + + private void draw_line(float[] v1, float[] v2) { + if (strokeWeight == 1) { + if (line == null) line = new PLine(this); + + line.reset(); + line.setIntensities(v1[SR], v1[SG], v1[SB], v1[SA], + v2[SR], v2[SG], v2[SB], v2[SA]); + line.setVertices(v1[TX], v1[TY], v1[TZ], + v2[TX], v2[TY], v2[TZ]); + line.draw(); + + } else { // use old line code for thickness != 1 + thick_flat_line(v1[TX], v1[TY], v1[SR], v1[SG], v1[SB], v1[SA], + v2[TX], v2[TY], v2[SR], v2[SG], v2[SB], v2[SA]); + } + } + + + /** + * @param max is what to count to + * @param offset is offset to the 'next' vertex + * @param increment is how much to increment in the loop + */ + private void draw_lines(float vertices[][], int max, + int offset, int increment, int skip) { + + if (strokeWeight == 1) { + for (int i = 0; i < max; i += increment) { + if ((skip != 0) && (((i+offset) % skip) == 0)) continue; + + float a[] = vertices[i]; + float b[] = vertices[i+offset]; + + if (line == null) line = new PLine(this); + + line.reset(); + line.setIntensities(a[SR], a[SG], a[SB], a[SA], + b[SR], b[SG], b[SB], b[SA]); + line.setVertices(a[TX], a[TY], a[TZ], + b[TX], b[TY], b[TZ]); + line.draw(); + } + + } else { // use old line code for thickness != 1 + for (int i = 0; i < max; i += increment) { + if ((skip != 0) && (((i+offset) % skip) == 0)) continue; + + float v1[] = vertices[i]; + float v2[] = vertices[i+offset]; + thick_flat_line(v1[TX], v1[TY], v1[SR], v1[SG], v1[SB], v1[SA], + v2[TX], v2[TY], v2[SR], v2[SG], v2[SB], v2[SA]); + } + } + } + + + private void thin_point(float fx, float fy, int color) { + int x = (int) (fx + 0.4999f); + int y = (int) (fy + 0.4999f); + if (x < 0 || x > width1 || y < 0 || y > height1) return; + + int index = y*width + x; + if ((color & 0xff000000) == 0xff000000) { // opaque + pixels[index] = color; + + } else { // transparent + // a1 is how much of the orig pixel + int a2 = (color >> 24) & 0xff; + int a1 = a2 ^ 0xff; + + int p2 = strokeColor; + int p1 = pixels[index]; + + int r = (a1 * ((p1 >> 16) & 0xff) + a2 * ((p2 >> 16) & 0xff)) & 0xff00; + int g = (a1 * ((p1 >> 8) & 0xff) + a2 * ((p2 >> 8) & 0xff)) & 0xff00; + int b = (a1 * ( p1 & 0xff) + a2 * ( p2 & 0xff)) >> 8; + + pixels[index] = 0xff000000 | (r << 8) | g | b; + } + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX TRANSFORMATIONS + + + public void translate(float tx, float ty) { + ctm.translate(tx, ty); + } + + + public void translate(float tx, float ty, float tz) { + showDepthWarningXYZ("translate"); + } + + + public void rotate(float angle) { + ctm.rotate(angle); +// float c = (float) Math.cos(angle); +// float s = (float) Math.sin(angle); +// applyMatrix(c, -s, 0, s, c, 0); + } + + + public void rotateX(float angle) { + showDepthWarning("rotateX"); + } + + public void rotateY(float angle) { + showDepthWarning("rotateY"); + } + + + public void rotateZ(float angle) { + showDepthWarning("rotateZ"); + } + + + public void rotate(float angle, float vx, float vy, float vz) { + showVariationWarning("rotate(angle, x, y, z)"); + } + + + public void scale(float s) { + ctm.scale(s); +// applyMatrix(s, 0, 0, +// 0, s, 0); + } + + + public void scale(float sx, float sy) { + ctm.scale(sx, sy); +// applyMatrix(sx, 0, 0, +// 0, sy, 0); + } + + + public void scale(float x, float y, float z) { + showDepthWarningXYZ("scale"); + } + + + + ////////////////////////////////////////////////////////////// + + // TRANSFORMATION MATRIX + + + public void pushMatrix() { + if (matrixStackDepth == MATRIX_STACK_DEPTH) { + throw new RuntimeException(ERROR_PUSHMATRIX_OVERFLOW); + } + ctm.get(matrixStack[matrixStackDepth]); + matrixStackDepth++; + } + + + public void popMatrix() { + if (matrixStackDepth == 0) { + throw new RuntimeException(ERROR_PUSHMATRIX_UNDERFLOW); + } + matrixStackDepth--; + ctm.set(matrixStack[matrixStackDepth]); + } + + + /** + * Load identity as the transform/model matrix. + * Same as glLoadIdentity(). + */ + public void resetMatrix() { + ctm.reset(); +// m00 = 1; m01 = 0; m02 = 0; +// m10 = 0; m11 = 1; m12 = 0; + } + + + /** + * Apply a 3x2 affine transformation matrix. + */ + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) { + ctm.apply(n00, n01, n02, + n10, n11, n12); +// +// float r00 = m00*n00 + m01*n10; +// float r01 = m00*n01 + m01*n11; +// float r02 = m00*n02 + m01*n12 + m02; +// +// float r10 = m10*n00 + m11*n10; +// float r11 = m10*n01 + m11*n11; +// float r12 = m10*n02 + m11*n12 + m12; +// +// m00 = r00; m01 = r01; m02 = r02; +// m10 = r10; m11 = r11; m12 = r12; + } + + + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + showDepthWarningXYZ("applyMatrix"); + } + + + /** + * Loads the current matrix into m00, m01 etc (or modelview and + * projection when using 3D) so that the values can be read. + *

+ * Note that there is no "updateMatrix" because that gets too + * complicated (unnecessary) when considering the 3D matrices. + */ +// public void loadMatrix() { + // no-op on base PGraphics because they're used directly +// } + + + /** + * Print the current model (or "transformation") matrix. + */ + public void printMatrix() { + ctm.print(); + +// loadMatrix(); // just to make sure +// +// float big = Math.abs(m00); +// if (Math.abs(m01) > big) big = Math.abs(m01); +// if (Math.abs(m02) > big) big = Math.abs(m02); +// if (Math.abs(m10) > big) big = Math.abs(m10); +// if (Math.abs(m11) > big) big = Math.abs(m11); +// if (Math.abs(m12) > big) big = Math.abs(m12); +// +// // avoid infinite loop +// if (Float.isNaN(big) || Float.isInfinite(big)) { +// big = 1000000; // set to something arbitrary +// } +// +// int d = 1; +// int bigi = (int) big; +// while ((bigi /= 10) != 0) d++; // cheap log() +// +// System.out.println(PApplet.nfs(m00, d, 4) + " " + +// PApplet.nfs(m01, d, 4) + " " + +// PApplet.nfs(m02, d, 4)); +// +// System.out.println(PApplet.nfs(m10, d, 4) + " " + +// PApplet.nfs(m11, d, 4) + " " + +// PApplet.nfs(m12, d, 4)); +// +// System.out.println(); + } + + + + ////////////////////////////////////////////////////////////// + + // SCREEN TRANSFORMS + + + public float screenX(float x, float y) { + return ctm.m00 * x + ctm.m01 * y + ctm.m02; + } + + + public float screenY(float x, float y) { + return ctm.m10 * x + ctm.m11 * y + ctm.m12; + } + + + + ////////////////////////////////////////////////////////////// + + // BACKGROUND AND FRIENDS + + + /** + * Clear the pixel buffer. + */ + protected void backgroundImpl() { + Arrays.fill(pixels, backgroundColor); + } + + + + /* + public void ambient(int rgb) { + showDepthError("ambient"); + } + + public void ambient(float gray) { + showDepthError("ambient"); + } + + public void ambient(float x, float y, float z) { + // This doesn't take + if ((x != PMaterial.DEFAULT_AMBIENT) || + (y != PMaterial.DEFAULT_AMBIENT) || + (z != PMaterial.DEFAULT_AMBIENT)) { + showDepthError("ambient"); + } + } + + public void specular(int rgb) { + showDepthError("specular"); + } + + public void specular(float gray) { + showDepthError("specular"); + } + + public void specular(float x, float y, float z) { + showDepthError("specular"); + } + + public void shininess(float shine) { + showDepthError("shininess"); + } + + + public void emissive(int rgb) { + showDepthError("emissive"); + } + + public void emissive(float gray) { + showDepthError("emissive"); + } + + public void emissive(float x, float y, float z ) { + showDepthError("emissive"); + } + */ + + + + ////////////////////////////////////////////////////////////// + + // INTERNAL SCHIZZLE + + + // TODO make this more efficient, or move into PMatrix2D +// private boolean untransformed() { +// return ((ctm.m00 == 1) && (ctm.m01 == 0) && (ctm.m02 == 0) && +// (ctm.m10 == 0) && (ctm.m11 == 1) && (ctm.m12 == 0)); +// } +// +// +// // TODO make this more efficient, or move into PMatrix2D +// private boolean unwarped() { +// return ((ctm.m00 == 1) && (ctm.m01 == 0) && +// (ctm.m10 == 0) && (ctm.m11 == 1)); +// } + + + // only call this if there's an alpha in the fill + private final int blend_fill(int p1) { + int a2 = fillAi; + int a1 = a2 ^ 0xff; + + int r = (a1 * ((p1 >> 16) & 0xff)) + (a2 * fillRi) & 0xff00; + int g = (a1 * ((p1 >> 8) & 0xff)) + (a2 * fillGi) & 0xff00; + int b = (a1 * ( p1 & 0xff)) + (a2 * fillBi) & 0xff00; + + return 0xff000000 | (r << 8) | g | (b >> 8); + } + + + private final int blend_color(int p1, int p2) { + int a2 = (p2 >>> 24); + + if (a2 == 0xff) { + // full replacement + return p2; + + } else { + int a1 = a2 ^ 0xff; + int r = (a1 * ((p1 >> 16) & 0xff) + a2 * ((p2 >> 16) & 0xff)) & 0xff00; + int g = (a1 * ((p1 >> 8) & 0xff) + a2 * ((p2 >> 8) & 0xff)) & 0xff00; + int b = (a1 * ( p1 & 0xff) + a2 * ( p2 & 0xff)) >> 8; + + return 0xff000000 | (r << 8) | g | b; + } + } + + + private final int blend_color_alpha(int p1, int p2, int a2) { + // scale alpha by alpha of incoming pixel + a2 = (a2 * (p2 >>> 24)) >> 8; + + int a1 = a2 ^ 0xff; + int r = (a1 * ((p1 >> 16) & 0xff) + a2 * ((p2 >> 16) & 0xff)) & 0xff00; + int g = (a1 * ((p1 >> 8) & 0xff) + a2 * ((p2 >> 8) & 0xff)) & 0xff00; + int b = (a1 * ( p1 & 0xff) + a2 * ( p2 & 0xff)) >> 8; + + return 0xff000000 | (r << 8) | g | b; + } +} diff --git a/core/src/processing/core/PGraphics3D.java b/core/src/processing/core/PGraphics3D.java new file mode 100644 index 000000000..de615683d --- /dev/null +++ b/core/src/processing/core/PGraphics3D.java @@ -0,0 +1,4340 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.Toolkit; +import java.awt.image.*; +import java.util.*; + + +/** + * Subclass of PGraphics that handles 3D rendering. + * It can render 3D inside a browser window and requires no plug-ins. + *

+ * The renderer is mostly set up based on the structure of the OpenGL API, + * if you have questions about specifics that aren't covered here, + * look for reference on the OpenGL implementation of a similar feature. + *

+ * Lighting and camera implementation by Simon Greenwold. + */ +public class PGraphics3D extends PGraphics { + + /** The depth buffer. */ + public float[] zbuffer; + + // ........................................................ + + /** The modelview matrix. */ + public PMatrix3D modelview; + + /** Inverse modelview matrix, used for lighting. */ + public PMatrix3D modelviewInv; + + /** + * The camera matrix, the modelview will be set to this on beginDraw. + */ + public PMatrix3D camera; + + /** Inverse camera matrix */ + protected PMatrix3D cameraInv; + + /** Camera field of view. */ + public float cameraFOV; + + /** Position of the camera. */ + public float cameraX, cameraY, cameraZ; + public float cameraNear, cameraFar; + /** Aspect ratio of camera's view. */ + public float cameraAspect; + + /** Current projection matrix. */ + public PMatrix3D projection; + + + ////////////////////////////////////////////////////////////// + + + /** + * Maximum lights by default is 8, which is arbitrary for this renderer, + * but is the minimum defined by OpenGL + */ + public static final int MAX_LIGHTS = 8; + + public int lightCount = 0; + + /** Light types */ + public int[] lightType; + + /** Light positions */ + //public float[][] lightPosition; + public PVector[] lightPosition; + + /** Light direction (normalized vector) */ + //public float[][] lightNormal; + public PVector[] lightNormal; + + /** Light falloff */ + public float[] lightFalloffConstant; + public float[] lightFalloffLinear; + public float[] lightFalloffQuadratic; + + /** Light spot angle */ + public float[] lightSpotAngle; + + /** Cosine of light spot angle */ + public float[] lightSpotAngleCos; + + /** Light spot concentration */ + public float[] lightSpotConcentration; + + /** Diffuse colors for lights. + * For an ambient light, this will hold the ambient color. + * Internally these are stored as numbers between 0 and 1. */ + public float[][] lightDiffuse; + + /** Specular colors for lights. + Internally these are stored as numbers between 0 and 1. */ + public float[][] lightSpecular; + + /** Current specular color for lighting */ + public float[] currentLightSpecular; + + /** Current light falloff */ + public float currentLightFalloffConstant; + public float currentLightFalloffLinear; + public float currentLightFalloffQuadratic; + + + ////////////////////////////////////////////////////////////// + + + static public final int TRI_DIFFUSE_R = 0; + static public final int TRI_DIFFUSE_G = 1; + static public final int TRI_DIFFUSE_B = 2; + static public final int TRI_DIFFUSE_A = 3; + static public final int TRI_SPECULAR_R = 4; + static public final int TRI_SPECULAR_G = 5; + static public final int TRI_SPECULAR_B = 6; + static public final int TRI_COLOR_COUNT = 7; + + // ........................................................ + + // Whether or not we have to worry about vertex position for lighting calcs + private boolean lightingDependsOnVertexPosition; + + static final int LIGHT_AMBIENT_R = 0; + static final int LIGHT_AMBIENT_G = 1; + static final int LIGHT_AMBIENT_B = 2; + static final int LIGHT_DIFFUSE_R = 3; + static final int LIGHT_DIFFUSE_G = 4; + static final int LIGHT_DIFFUSE_B = 5; + static final int LIGHT_SPECULAR_R = 6; + static final int LIGHT_SPECULAR_G = 7; + static final int LIGHT_SPECULAR_B = 8; + static final int LIGHT_COLOR_COUNT = 9; + + // Used to shuttle lighting calcs around + // (no need to re-allocate all the time) + protected float[] tempLightingContribution = new float[LIGHT_COLOR_COUNT]; +// protected float[] worldNormal = new float[4]; + + /// Used in lightTriangle(). Allocated here once to avoid re-allocating + protected PVector lightTriangleNorm = new PVector(); + + // ........................................................ + + /** + * This is turned on at beginCamera, and off at endCamera + * Currently we don't support nested begin/end cameras. + * If we wanted to, this variable would have to become a stack. + */ + protected boolean manipulatingCamera; + + float[][] matrixStack = new float[MATRIX_STACK_DEPTH][16]; + float[][] matrixInvStack = new float[MATRIX_STACK_DEPTH][16]; + int matrixStackDepth; + + // These two matrices always point to either the modelview + // or the modelviewInv, but they are swapped during + // when in camera manipulation mode. That way camera transforms + // are automatically accumulated in inverse on the modelview matrix. + protected PMatrix3D forwardTransform; + protected PMatrix3D reverseTransform; + + // Added by ewjordan for accurate texturing purposes. Screen plane is + // not scaled to pixel-size, so these manually keep track of its size + // from frustum() calls. Sorry to add public vars, is there a way + // to compute these from something publicly available without matrix ops? + // (used once per triangle in PTriangle with ENABLE_ACCURATE_TEXTURES) + protected float leftScreen; + protected float rightScreen; + protected float topScreen; + protected float bottomScreen; + protected float nearPlane; //depth of near clipping plane + + /** true if frustum has been called to set perspective, false if ortho */ + private boolean frustumMode = false; + + /** + * Use PSmoothTriangle for rendering instead of PTriangle? + * Usually set by calling smooth() or noSmooth() + */ + static protected boolean s_enableAccurateTextures = false; //maybe just use smooth instead? + + /** Used for anti-aliased and perspective corrected rendering. */ + public PSmoothTriangle smoothTriangle; + + + // ........................................................ + + // pos of first vertex of current shape in vertices array + protected int shapeFirst; + + // i think vertex_end is actually the last vertex in the current shape + // and is separate from vertexCount for occasions where drawing happens + // on endDraw() with all the triangles being depth sorted + protected int shapeLast; + + // vertices may be added during clipping against the near plane. + protected int shapeLastPlusClipped; + + // used for sorting points when triangulating a polygon + // warning - maximum number of vertices for a polygon is DEFAULT_VERTICES + protected int vertexOrder[] = new int[DEFAULT_VERTICES]; + + // ........................................................ + + // This is done to keep track of start/stop information for lines in the + // line array, so that lines can be shown as a single path, rather than just + // individual segments. Currently only in use inside PGraphicsOpenGL. + protected int pathCount; + protected int[] pathOffset = new int[64]; + protected int[] pathLength = new int[64]; + + // ........................................................ + + // line & triangle fields (note that these overlap) +// static protected final int INDEX = 0; // shape index + static protected final int VERTEX1 = 0; + static protected final int VERTEX2 = 1; + static protected final int VERTEX3 = 2; // (triangles only) + /** used to store the strokeColor int for efficient drawing. */ + static protected final int STROKE_COLOR = 1; // (points only) + static protected final int TEXTURE_INDEX = 3; // (triangles only) + //static protected final int STROKE_MODE = 2; // (lines only) + //static protected final int STROKE_WEIGHT = 3; // (lines only) + + static protected final int POINT_FIELD_COUNT = 2; //4 + static protected final int LINE_FIELD_COUNT = 2; //4 + static protected final int TRIANGLE_FIELD_COUNT = 4; + + // points + static final int DEFAULT_POINTS = 512; + protected int[][] points = new int[DEFAULT_POINTS][POINT_FIELD_COUNT]; + protected int pointCount; + + // lines + static final int DEFAULT_LINES = 512; + public PLine line; // used for drawing + protected int[][] lines = new int[DEFAULT_LINES][LINE_FIELD_COUNT]; + protected int lineCount; + + // triangles + static final int DEFAULT_TRIANGLES = 256; + public PTriangle triangle; + protected int[][] triangles = + new int[DEFAULT_TRIANGLES][TRIANGLE_FIELD_COUNT]; + protected float triangleColors[][][] = + new float[DEFAULT_TRIANGLES][3][TRI_COLOR_COUNT]; + protected int triangleCount; // total number of triangles + + // cheap picking someday + //public int shape_index; + + // ........................................................ + + static final int DEFAULT_TEXTURES = 3; + protected PImage[] textures = new PImage[DEFAULT_TEXTURES]; + int textureIndex; + + // ........................................................ + + DirectColorModel cm; + MemoryImageSource mis; + + + ////////////////////////////////////////////////////////////// + + + public PGraphics3D() { } + + + //public void setParent(PApplet parent) + + + //public void setPrimary(boolean primary) + + + //public void setPath(String path) + + + /** + * Called in response to a resize event, handles setting the + * new width and height internally, as well as re-allocating + * the pixel buffer for the new size. + * + * Note that this will nuke any cameraMode() settings. + */ + public void setSize(int iwidth, int iheight) { // ignore + width = iwidth; + height = iheight; + width1 = width - 1; + height1 = height - 1; + + allocate(); + reapplySettings(); + + // init lights (in resize() instead of allocate() b/c needed by opengl) + lightType = new int[MAX_LIGHTS]; + lightPosition = new PVector[MAX_LIGHTS]; + lightNormal = new PVector[MAX_LIGHTS]; + for (int i = 0; i < MAX_LIGHTS; i++) { + lightPosition[i] = new PVector(); + lightNormal[i] = new PVector(); + } + lightDiffuse = new float[MAX_LIGHTS][3]; + lightSpecular = new float[MAX_LIGHTS][3]; + lightFalloffConstant = new float[MAX_LIGHTS]; + lightFalloffLinear = new float[MAX_LIGHTS]; + lightFalloffQuadratic = new float[MAX_LIGHTS]; + lightSpotAngle = new float[MAX_LIGHTS]; + lightSpotAngleCos = new float[MAX_LIGHTS]; + lightSpotConcentration = new float[MAX_LIGHTS]; + currentLightSpecular = new float[3]; + + projection = new PMatrix3D(); + modelview = new PMatrix3D(); + modelviewInv = new PMatrix3D(); + +// modelviewStack = new float[MATRIX_STACK_DEPTH][16]; +// modelviewInvStack = new float[MATRIX_STACK_DEPTH][16]; +// modelviewStackPointer = 0; + + forwardTransform = modelview; + reverseTransform = modelviewInv; + + // init perspective projection based on new dimensions + cameraFOV = 60 * DEG_TO_RAD; // at least for now + cameraX = width / 2.0f; + cameraY = height / 2.0f; + cameraZ = cameraY / ((float) Math.tan(cameraFOV / 2.0f)); + cameraNear = cameraZ / 10.0f; + cameraFar = cameraZ * 10.0f; + cameraAspect = (float)width / (float)height; + + camera = new PMatrix3D(); + cameraInv = new PMatrix3D(); + + // set up the default camera + camera(); + + // defaults to perspective, if the user has setup up their + // own projection, they'll need to fix it after resize anyway. + // this helps the people who haven't set up their own projection. + perspective(); + } + + + protected void allocate() { + //System.out.println(this + " allocating for " + width + " " + height); + //new Exception().printStackTrace(); + + pixelCount = width * height; + pixels = new int[pixelCount]; + zbuffer = new float[pixelCount]; + + if (primarySurface) { + cm = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff);; + mis = new MemoryImageSource(width, height, pixels, 0, width); + mis.setFullBufferUpdates(true); + mis.setAnimated(true); + image = Toolkit.getDefaultToolkit().createImage(mis); + + } else { + // when not the main drawing surface, need to set the zbuffer, + // because there's a possibility that background() will not be called + Arrays.fill(zbuffer, Float.MAX_VALUE); + } + + line = new PLine(this); + triangle = new PTriangle(this); + smoothTriangle = new PSmoothTriangle(this); + } + + + //public void dispose() + + + //////////////////////////////////////////////////////////// + + + //public boolean canDraw() + + + public void beginDraw() { + // need to call defaults(), but can only be done when it's ok + // to draw (i.e. for opengl, no drawing can be done outside + // beginDraw/endDraw). + if (!settingsInited) defaultSettings(); + + resetMatrix(); // reset model matrix + + // reset vertices + vertexCount = 0; + + modelview.set(camera); + modelviewInv.set(cameraInv); + + // clear out the lights, they'll have to be turned on again + lightCount = 0; + lightingDependsOnVertexPosition = false; + lightFalloff(1, 0, 0); + lightSpecular(0, 0, 0); + + /* + // reset lines + lineCount = 0; + if (line != null) line.reset(); // is this necessary? + pathCount = 0; + + // reset triangles + triangleCount = 0; + if (triangle != null) triangle.reset(); // necessary? + */ + + shapeFirst = 0; + + // reset textures + textureIndex = 0; + + normal(0, 0, 1); + } + + + /** + * See notes in PGraphics. + * If z-sorting has been turned on, then the triangles will + * all be quicksorted here (to make alpha work more properly) + * and then blit to the screen. + */ + public void endDraw() { + // no need to z order and render + // shapes were already rendered in endShape(); + // (but can't return, since needs to update memimgsrc) + if (hints[ENABLE_DEPTH_SORT]) { + flush(); + } + if (mis != null) { + mis.newPixels(pixels, cm, 0, width); + } + // mark pixels as having been updated, so that they'll work properly + // when this PGraphics is drawn using image(). + updatePixels(); + } + + + //////////////////////////////////////////////////////////// + + + //protected void checkSettings() + + + protected void defaultSettings() { + super.defaultSettings(); + + manipulatingCamera = false; + forwardTransform = modelview; + reverseTransform = modelviewInv; + + perspective(); + + // easiest for beginners + textureMode(IMAGE); + + emissive(0.0f); + specular(0.5f); + shininess(1.0f); + } + + + //protected void reapplySettings() + + + //////////////////////////////////////////////////////////// + + + public void hint(int which) { + if (which == DISABLE_DEPTH_SORT) { + flush(); + } else if (which == DISABLE_DEPTH_TEST) { + if (zbuffer != null) { // will be null in OpenGL and others + Arrays.fill(zbuffer, Float.MAX_VALUE); + } + } + super.hint(which); + } + + + ////////////////////////////////////////////////////////////// + + + //public void beginShape() + + + public void beginShape(int kind) { + shape = kind; + +// shape_index = shape_index + 1; +// if (shape_index == -1) { +// shape_index = 0; +// } + + if (hints[ENABLE_DEPTH_SORT]) { + // continue with previous vertex, line and triangle count + // all shapes are rendered at endDraw(); + shapeFirst = vertexCount; + shapeLast = 0; + + } else { + // reset vertex, line and triangle information + // every shape is rendered at endShape(); + vertexCount = 0; + if (line != null) line.reset(); // necessary? + lineCount = 0; +// pathCount = 0; + if (triangle != null) triangle.reset(); // necessary? + triangleCount = 0; + } + + textureImage = null; + curveVertexCount = 0; + normalMode = NORMAL_MODE_AUTO; +// normalCount = 0; + } + + + //public void normal(float nx, float ny, float nz) + + + //public void textureMode(int mode) + + + public void texture(PImage image) { + textureImage = image; + + if (textureIndex == textures.length - 1) { + textures = (PImage[]) PApplet.expand(textures); + } + if (textures[textureIndex] != null) { // ??? + textureIndex++; + } + textures[textureIndex] = image; + } + + + public void vertex(float x, float y) { + // override so that the default 3D implementation will be used, + // which will pick up all 3D settings (e.g. emissive, ambient) + vertex(x, y, 0); + } + + + //public void vertex(float x, float y, float z) + + + public void vertex(float x, float y, float u, float v) { + // see vertex(x, y) for note + vertex(x, y, 0, u, v); + } + + + //public void vertex(float x, float y, float z, float u, float v) + + + //public void breakShape() + + + //public void endShape() + + + public void endShape(int mode) { + shapeLast = vertexCount; + shapeLastPlusClipped = shapeLast; + + // don't try to draw if there are no vertices + // (fixes a bug in LINE_LOOP that re-adds a nonexistent vertex) + if (vertexCount == 0) { + shape = 0; + return; + } + + // convert points from model (X/Y/Z) to camera space (VX/VY/VZ). + // Do this now because we will be clipping them on add_triangle. + endShapeModelToCamera(shapeFirst, shapeLast); + + if (stroke) { + endShapeStroke(mode); + } + + if (fill) { + endShapeFill(); + } + + // transform, light, and clip + endShapeLighting(lightCount > 0 && fill); + + // convert points from camera space (VX, VY, VZ) to screen space (X, Y, Z) + // (this appears to be wasted time with the OpenGL renderer) + endShapeCameraToScreen(shapeFirst, shapeLastPlusClipped); + + // render shape and fill here if not saving the shapes for later + // if true, the shapes will be rendered on endDraw + if (!hints[ENABLE_DEPTH_SORT]) { + if (fill) { + if (triangleCount > 0) { + renderTriangles(0, triangleCount); + if (raw != null) { + rawTriangles(0, triangleCount); + } + triangleCount = 0; + } + } + if (stroke) { + if (pointCount > 0) { + renderPoints(0, pointCount); + if (raw != null) { + rawPoints(0, pointCount); + } + pointCount = 0; + } + + if (lineCount > 0) { + renderLines(0, lineCount); + if (raw != null) { + rawLines(0, lineCount); + } + lineCount = 0; + } + } + pathCount = 0; + } + + shape = 0; + } + + + protected void endShapeModelToCamera(int start, int stop) { + for (int i = start; i < stop; i++) { + float vertex[] = vertices[i]; + + vertex[VX] = + modelview.m00*vertex[X] + modelview.m01*vertex[Y] + + modelview.m02*vertex[Z] + modelview.m03; + vertex[VY] = + modelview.m10*vertex[X] + modelview.m11*vertex[Y] + + modelview.m12*vertex[Z] + modelview.m13; + vertex[VZ] = + modelview.m20*vertex[X] + modelview.m21*vertex[Y] + + modelview.m22*vertex[Z] + modelview.m23; + vertex[VW] = + modelview.m30*vertex[X] + modelview.m31*vertex[Y] + + modelview.m32*vertex[Z] + modelview.m33; + + // normalize + if (vertex[VW] != 0 && vertex[VW] != 1) { + vertex[VX] /= vertex[VW]; + vertex[VY] /= vertex[VW]; + vertex[VZ] /= vertex[VW]; + } + vertex[VW] = 1; + } + } + + + protected void endShapeStroke(int mode) { + switch (shape) { + case POINTS: + { + int stop = shapeLast; + for (int i = shapeFirst; i < stop; i++) { +// if (strokeWeight == 1) { + addPoint(i); +// } else { +// addLineBreak(); // total overkill for points +// addLine(i, i); +// } + } + } + break; + + case LINES: + { + // store index of first vertex + int first = lineCount; + int stop = shapeLast - 1; + //increment = (shape == LINES) ? 2 : 1; + + // for LINE_STRIP and LINE_LOOP, make this all one path + if (shape != LINES) addLineBreak(); + + for (int i = shapeFirst; i < stop; i += 2) { + // for LINES, make a new path for each segment + if (shape == LINES) addLineBreak(); + addLine(i, i+1); + } + + // for LINE_LOOP, close the loop with a final segment + //if (shape == LINE_LOOP) { + if (mode == CLOSE) { + addLine(stop, lines[first][VERTEX1]); + } + } + break; + + case TRIANGLES: + { + for (int i = shapeFirst; i < shapeLast-2; i += 3) { + addLineBreak(); + //counter = i - vertex_start; + addLine(i+0, i+1); + addLine(i+1, i+2); + addLine(i+2, i+0); + } + } + break; + + case TRIANGLE_STRIP: + { + // first draw all vertices as a line strip + int stop = shapeLast-1; + + addLineBreak(); + for (int i = shapeFirst; i < stop; i++) { + //counter = i - vertex_start; + addLine(i, i+1); + } + + // then draw from vertex (n) to (n+2) + stop = shapeLast-2; + for (int i = shapeFirst; i < stop; i++) { + addLineBreak(); + addLine(i, i+2); + } + } + break; + + case TRIANGLE_FAN: + { + // this just draws a series of line segments + // from the center to each exterior point + for (int i = shapeFirst + 1; i < shapeLast; i++) { + addLineBreak(); + addLine(shapeFirst, i); + } + + // then a single line loop around the outside. + addLineBreak(); + for (int i = shapeFirst + 1; i < shapeLast-1; i++) { + addLine(i, i+1); + } + // closing the loop + addLine(shapeLast-1, shapeFirst + 1); + } + break; + + case QUADS: + { + for (int i = shapeFirst; i < shapeLast; i += 4) { + addLineBreak(); + //counter = i - vertex_start; + addLine(i+0, i+1); + addLine(i+1, i+2); + addLine(i+2, i+3); + addLine(i+3, i+0); + } + } + break; + + case QUAD_STRIP: + { + for (int i = shapeFirst; i < shapeLast - 3; i += 2) { + addLineBreak(); + addLine(i+0, i+2); + addLine(i+2, i+3); + addLine(i+3, i+1); + addLine(i+1, i+0); + } + } + break; + + case POLYGON: + { + // store index of first vertex + int stop = shapeLast - 1; + + addLineBreak(); + for (int i = shapeFirst; i < stop; i++) { + addLine(i, i+1); + } + if (mode == CLOSE) { + // draw the last line connecting back to the first point in poly + addLine(stop, shapeFirst); //lines[first][VERTEX1]); + } + } + break; + } + } + + + protected void endShapeFill() { + switch (shape) { + case TRIANGLE_FAN: + { + int stop = shapeLast - 1; + for (int i = shapeFirst + 1; i < stop; i++) { + addTriangle(shapeFirst, i, i+1); + } + } + break; + + case TRIANGLES: + { + int stop = shapeLast - 2; + for (int i = shapeFirst; i < stop; i += 3) { + // have to switch between clockwise/counter-clockwise + // otherwise the feller is backwards and renderer won't draw + if ((i % 2) == 0) { + addTriangle(i, i+2, i+1); + } else { + addTriangle(i, i+1, i+2); + } + } + } + break; + + case TRIANGLE_STRIP: + { + int stop = shapeLast - 2; + for (int i = shapeFirst; i < stop; i++) { + // have to switch between clockwise/counter-clockwise + // otherwise the feller is backwards and renderer won't draw + if ((i % 2) == 0) { + addTriangle(i, i+2, i+1); + } else { + addTriangle(i, i+1, i+2); + } + } + } + break; + + case QUADS: + { + int stop = vertexCount-3; + for (int i = shapeFirst; i < stop; i += 4) { + // first triangle + addTriangle(i, i+1, i+2); + // second triangle + addTriangle(i, i+2, i+3); + } + } + break; + + case QUAD_STRIP: + { + int stop = vertexCount-3; + for (int i = shapeFirst; i < stop; i += 2) { + // first triangle + addTriangle(i+0, i+2, i+1); + // second triangle + addTriangle(i+2, i+3, i+1); + } + } + break; + + case POLYGON: + { + addPolygonTriangles(); + } + break; + } + } + + + protected void endShapeLighting(boolean lights) { + if (lights) { + // If the lighting does not depend on vertex position and there is a single + // normal specified for this shape, go ahead and apply the same lighting + // contribution to every vertex in this shape (one lighting calc!) + if (!lightingDependsOnVertexPosition && normalMode == NORMAL_MODE_SHAPE) { + calcLightingContribution(shapeFirst, tempLightingContribution); + for (int tri = 0; tri < triangleCount; tri++) { + lightTriangle(tri, tempLightingContribution); + } + } else { // Otherwise light each triangle individually... + for (int tri = 0; tri < triangleCount; tri++) { + lightTriangle(tri); + } + } + } else { + for (int tri = 0; tri < triangleCount; tri++) { + int index = triangles[tri][VERTEX1]; + copyPrelitVertexColor(tri, index, 0); + index = triangles[tri][VERTEX2]; + copyPrelitVertexColor(tri, index, 1); + index = triangles[tri][VERTEX3]; + copyPrelitVertexColor(tri, index, 2); + } + } + } + + + protected void endShapeCameraToScreen(int start, int stop) { + for (int i = start; i < stop; i++) { + float vx[] = vertices[i]; + + float ox = + projection.m00*vx[VX] + projection.m01*vx[VY] + + projection.m02*vx[VZ] + projection.m03*vx[VW]; + float oy = + projection.m10*vx[VX] + projection.m11*vx[VY] + + projection.m12*vx[VZ] + projection.m13*vx[VW]; + float oz = + projection.m20*vx[VX] + projection.m21*vx[VY] + + projection.m22*vx[VZ] + projection.m23*vx[VW]; + float ow = + projection.m30*vx[VX] + projection.m31*vx[VY] + + projection.m32*vx[VZ] + projection.m33*vx[VW]; + + if (ow != 0 && ow != 1) { + ox /= ow; oy /= ow; oz /= ow; + } + + vx[TX] = width * (1 + ox) / 2.0f; + vx[TY] = height * (1 + oy) / 2.0f; + vx[TZ] = (oz + 1) / 2.0f; + } + } + + + + ///////////////////////////////////////////////////////////////////////////// + + // POINTS + + + protected void addPoint(int a) { + if (pointCount == points.length) { + int[][] temp = new int[pointCount << 1][LINE_FIELD_COUNT]; + System.arraycopy(lines, 0, temp, 0, lineCount); + lines = temp; + } + points[pointCount][VERTEX1] = a; + //points[pointCount][STROKE_MODE] = strokeCap | strokeJoin; + points[pointCount][STROKE_COLOR] = strokeColor; + //points[pointCount][STROKE_WEIGHT] = (int) (strokeWeight + 0.5f); // hmm + pointCount++; + } + + + protected void renderPoints(int start, int stop) { + if (strokeWeight != 1) { + for (int i = start; i < stop; i++) { + float[] a = vertices[points[i][VERTEX1]]; + renderLineVertices(a, a); + } + } else { + for (int i = start; i < stop; i++) { + float[] a = vertices[points[i][VERTEX1]]; + int sx = (int) (a[TX] + 0.4999f); + int sy = (int) (a[TY] + 0.4999f); + if (sx >= 0 && sx < width && sy >= 0 && sy < height) { + int index = sy*width + sx; + pixels[index] = points[i][STROKE_COLOR]; + zbuffer[index] = a[TZ]; + } + } + } + } + + + // alternative implementations of point rendering code... + + /* + int sx = (int) (screenX(x, y, z) + 0.5f); + int sy = (int) (screenY(x, y, z) + 0.5f); + + int index = sy*width + sx; + pixels[index] = strokeColor; + zbuffer[index] = screenZ(x, y, z); + + */ + + /* + protected void renderPoints(int start, int stop) { + for (int i = start; i < stop; i++) { + float a[] = vertices[points[i][VERTEX1]]; + + line.reset(); + + line.setIntensities(a[SR], a[SG], a[SB], a[SA], + a[SR], a[SG], a[SB], a[SA]); + + line.setVertices(a[TX], a[TY], a[TZ], + a[TX] + 0.5f, a[TY] + 0.5f, a[TZ] + 0.5f); + + line.draw(); + } + } + */ + + /* + // handle points with an actual stroke weight (or scaled by renderer) + private void point3(float x, float y, float z, int color) { + // need to get scaled version of the stroke + float x1 = screenX(x - 0.5f, y - 0.5f, z); + float y1 = screenY(x - 0.5f, y - 0.5f, z); + float x2 = screenX(x + 0.5f, y + 0.5f, z); + float y2 = screenY(x + 0.5f, y + 0.5f, z); + + float weight = (abs(x2 - x1) + abs(y2 - y1)) / 2f; + if (weight < 1.5f) { + int xx = (int) ((x1 + x2) / 2f); + int yy = (int) ((y1 + y2) / 2f); + //point0(xx, yy, z, color); + zbuffer[yy*width + xx] = screenZ(x, y, z); + //stencil? + + } else { + // actually has some weight, need to draw shapes instead + // these will be + } + } + */ + + + protected void rawPoints(int start, int stop) { + raw.colorMode(RGB, 1); + raw.noFill(); + raw.strokeWeight(vertices[lines[start][VERTEX1]][SW]); + raw.beginShape(POINTS); + + for (int i = start; i < stop; i++) { + float a[] = vertices[lines[i][VERTEX1]]; + + if (raw.is3D()) { + if (a[VW] != 0) { + raw.stroke(a[SR], a[SG], a[SB], a[SA]); + raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]); + } + } else { // if is2D() + raw.stroke(a[SR], a[SG], a[SB], a[SA]); + raw.vertex(a[TX], a[TY]); + } + } + raw.endShape(); + } + + + + ///////////////////////////////////////////////////////////////////////////// + + // LINES + + + /** + * Begin a new section of stroked geometry. + */ + protected final void addLineBreak() { + if (pathCount == pathOffset.length) { + pathOffset = PApplet.expand(pathOffset); + pathLength = PApplet.expand(pathLength); + } + pathOffset[pathCount] = lineCount; + pathLength[pathCount] = 0; + pathCount++; + } + + + protected void addLine(int a, int b) { + addLineWithClip(a, b); + } + + + protected final void addLineWithClip(int a, int b) { + float az = vertices[a][VZ]; + float bz = vertices[b][VZ]; + if (az > cameraNear) { + if (bz > cameraNear) { + return; + } + int cb = interpolateClipVertex(a, b); + addLineWithoutClip(cb, b); + return; + } + else { + if (bz <= cameraNear) { + addLineWithoutClip(a, b); + return; + } + int cb = interpolateClipVertex(a, b); + addLineWithoutClip(a, cb); + return; + } + } + + + protected final void addLineWithoutClip(int a, int b) { + if (lineCount == lines.length) { + int temp[][] = new int[lineCount<<1][LINE_FIELD_COUNT]; + System.arraycopy(lines, 0, temp, 0, lineCount); + lines = temp; + } + lines[lineCount][VERTEX1] = a; + lines[lineCount][VERTEX2] = b; + + //lines[lineCount][STROKE_MODE] = strokeCap | strokeJoin; + //lines[lineCount][STROKE_WEIGHT] = (int) (strokeWeight + 0.5f); // hmm + lineCount++; + + // mark this piece as being part of the current path + pathLength[pathCount-1]++; + } + + + protected void renderLines(int start, int stop) { + for (int i = start; i < stop; i++) { + renderLineVertices(vertices[lines[i][VERTEX1]], + vertices[lines[i][VERTEX2]]); + } + } + + + protected void renderLineVertices(float[] a, float[] b) { + // 2D hack added by ewjordan 6/13/07 + // Offset coordinates by a little bit if drawing 2D graphics. + // http://dev.processing.org/bugs/show_bug.cgi?id=95 + + // This hack fixes a bug caused by numerical precision issues when + // applying the 3D transformations to coordinates in the screen plane + // that should actually not be altered under said transformations. + // It will not be applied if any transformations other than translations + // are active, nor should it apply in OpenGL mode (PGraphicsOpenGL + // overrides render_lines(), so this should be fine). + // This fix exposes a last-pixel bug in the lineClipCode() function + // of PLine.java, so that fix must remain in place if this one is used. + + // Note: the "true" fix for this bug is to change the pixel coverage + // model so that the threshold for display does not lie on an integer + // boundary. Search "diamond exit rule" for info the OpenGL approach. + + /* + // removing for 0149 with the return of P2D + if (drawing2D() && a[Z] == 0) { + a[TX] += 0.01; + a[TY] += 0.01; + a[VX] += 0.01*a[VW]; + a[VY] += 0.01*a[VW]; + b[TX] += 0.01; + b[TY] += 0.01; + b[VX] += 0.01*b[VW]; + b[VY] += 0.01*b[VW]; + } + */ + // end 2d-hack + + if (a[SW] > 1.25f || a[SW] < 0.75f) { + float ox1 = a[TX]; + float oy1 = a[TY]; + float ox2 = b[TX]; + float oy2 = b[TY]; + + // TODO strokeWeight should be transformed! + float weight = a[SW] / 2; + + // when drawing points with stroke weight, need to extend a bit + if (ox1 == ox2 && oy1 == oy2) { + oy1 -= weight; + oy2 += weight; + } + + float dX = ox2 - ox1 + EPSILON; + float dY = oy2 - oy1 + EPSILON; + float len = (float) Math.sqrt(dX*dX + dY*dY); + + float rh = weight / len; + + float dx0 = rh * dY; + float dy0 = rh * dX; + float dx1 = rh * dY; + float dy1 = rh * dX; + + float ax1 = ox1+dx0; + float ay1 = oy1-dy0; + + float ax2 = ox1-dx0; + float ay2 = oy1+dy0; + + float bx1 = ox2+dx1; + float by1 = oy2-dy1; + + float bx2 = ox2-dx1; + float by2 = oy2+dy1; + + if (smooth) { + smoothTriangle.reset(3); + smoothTriangle.smooth = true; + smoothTriangle.interpARGB = true; // ? + + // render first triangle for thick line + smoothTriangle.setVertices(ax1, ay1, a[TZ], + bx2, by2, b[TZ], + ax2, ay2, a[TZ]); + smoothTriangle.setIntensities(a[SR], a[SG], a[SB], a[SA], + b[SR], b[SG], b[SB], b[SA], + a[SR], a[SG], a[SB], a[SA]); + smoothTriangle.render(); + + // render second triangle for thick line + smoothTriangle.setVertices(ax1, ay1, a[TZ], + bx2, by2, b[TZ], + bx1, by1, b[TZ]); + smoothTriangle.setIntensities(a[SR], a[SG], a[SB], a[SA], + b[SR], b[SG], b[SB], b[SA], + b[SR], b[SG], b[SB], b[SA]); + smoothTriangle.render(); + + } else { + triangle.reset(); + + // render first triangle for thick line + triangle.setVertices(ax1, ay1, a[TZ], + bx2, by2, b[TZ], + ax2, ay2, a[TZ]); + triangle.setIntensities(a[SR], a[SG], a[SB], a[SA], + b[SR], b[SG], b[SB], b[SA], + a[SR], a[SG], a[SB], a[SA]); + triangle.render(); + + // render second triangle for thick line + triangle.setVertices(ax1, ay1, a[TZ], + bx2, by2, b[TZ], + bx1, by1, b[TZ]); + triangle.setIntensities(a[SR], a[SG], a[SB], a[SA], + b[SR], b[SG], b[SB], b[SA], + b[SR], b[SG], b[SB], b[SA]); + triangle.render(); + } + + } else { + line.reset(); + + line.setIntensities(a[SR], a[SG], a[SB], a[SA], + b[SR], b[SG], b[SB], b[SA]); + + line.setVertices(a[TX], a[TY], a[TZ], + b[TX], b[TY], b[TZ]); + + /* + // Seems okay to remove this because these vertices are not used again, + // but if problems arise, this needs to be uncommented because the above + // change is destructive and may need to be undone before proceeding. + if (drawing2D() && a[MZ] == 0) { + a[X] -= 0.01; + a[Y] -= 0.01; + a[VX] -= 0.01*a[VW]; + a[VY] -= 0.01*a[VW]; + b[X] -= 0.01; + b[Y] -= 0.01; + b[VX] -= 0.01*b[VW]; + b[VY] -= 0.01*b[VW]; + } + */ + + line.draw(); + } + } + + + /** + * Handle echoing line data to a raw shape recording renderer. This has been + * broken out of the renderLines() procedure so that renderLines() can be + * optimized per-renderer without having to deal with this code. This code, + * for instance, will stay the same when OpenGL is in use, but renderLines() + * can be optimized significantly. + *

+ * Values for start and stop are specified, so that in the future, sorted + * rendering can be implemented, which will require sequences of lines, + * triangles, or points to be rendered in the neighborhood of one another. + * That is, if we're gonna depth sort, we can't just draw all the triangles + * and then draw all the lines, cuz that defeats the purpose. + */ + protected void rawLines(int start, int stop) { + raw.colorMode(RGB, 1); + raw.noFill(); + raw.beginShape(LINES); + + for (int i = start; i < stop; i++) { + float a[] = vertices[lines[i][VERTEX1]]; + float b[] = vertices[lines[i][VERTEX2]]; + raw.strokeWeight(vertices[lines[i][VERTEX2]][SW]); + + if (raw.is3D()) { + if ((a[VW] != 0) && (b[VW] != 0)) { + raw.stroke(a[SR], a[SG], a[SB], a[SA]); + raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]); + raw.stroke(b[SR], b[SG], b[SB], b[SA]); + raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW]); + } + } else if (raw.is2D()) { + raw.stroke(a[SR], a[SG], a[SB], a[SA]); + raw.vertex(a[TX], a[TY]); + raw.stroke(b[SR], b[SG], b[SB], b[SA]); + raw.vertex(b[TX], b[TY]); + } + } + raw.endShape(); + } + + + + ///////////////////////////////////////////////////////////////////////////// + + // TRIANGLES + + + protected void addTriangle(int a, int b, int c) { + addTriangleWithClip(a, b, c); + } + + + protected final void addTriangleWithClip(int a, int b, int c) { + boolean aClipped = false; + boolean bClipped = false; + int clippedCount = 0; + + cameraNear = -8; + if (vertices[a][VZ] > cameraNear) { + aClipped = true; + clippedCount++; + } + if (vertices[b][VZ] > cameraNear) { + bClipped = true; + clippedCount++; + } + if (vertices[c][VZ] > cameraNear) { + //cClipped = true; + clippedCount++; + } + if (clippedCount == 0) { + addTriangleWithoutClip(a, b, c); + + } else if (clippedCount == 3) { + // In this case there is only one visible point. |/| + // So we'll have to make two new points on the clip line <| | + // and add that triangle instead. |\| + + } else if (clippedCount == 2) { + //System.out.println("Clipped two"); + + int ca, cb, cc, cd, ce; + if (!aClipped) { + ca = a; + cb = b; + cc = c; + } + else if (!bClipped) { + ca = b; + cb = a; + cc = c; + } + else { //if (!cClipped) { + ca = c; + cb = b; + cc = a; + } + + cd = interpolateClipVertex(ca, cb); + ce = interpolateClipVertex(ca, cc); + addTriangleWithoutClip(ca, cd, ce); + + } else { // (clippedCount == 1) { + // . | + // In this case there are two visible points. |\| + // So we'll have to make two new points on the clip line | |> + // and then add two new triangles. |/| + // . | + //System.out.println("Clipped one"); + int ca, cb, cc, cd, ce; + if (aClipped) { + //System.out.println("aClipped"); + ca = c; + cb = b; + cc = a; + } + else if (bClipped) { + //System.out.println("bClipped"); + ca = a; + cb = c; + cc = b; + } + else { //if (cClipped) { + //System.out.println("cClipped"); + ca = a; + cb = b; + cc = c; + } + + cd = interpolateClipVertex(ca, cc); + ce = interpolateClipVertex(cb, cc); + addTriangleWithoutClip(ca, cd, cb); + //System.out.println("ca: " + ca + ", " + vertices[ca][VX] + ", " + vertices[ca][VY] + ", " + vertices[ca][VZ]); + //System.out.println("cd: " + cd + ", " + vertices[cd][VX] + ", " + vertices[cd][VY] + ", " + vertices[cd][VZ]); + //System.out.println("cb: " + cb + ", " + vertices[cb][VX] + ", " + vertices[cb][VY] + ", " + vertices[cb][VZ]); + addTriangleWithoutClip(cb, cd, ce); + } + } + + + protected final int interpolateClipVertex(int a, int b) { + float[] va; + float[] vb; + // Set up va, vb such that va[VZ] >= vb[VZ] + if (vertices[a][VZ] < vertices[b][VZ]) { + va = vertices[b]; + vb = vertices[a]; + } + else { + va = vertices[a]; + vb = vertices[b]; + } + float az = va[VZ]; + float bz = vb[VZ]; + + float dz = az - bz; + // If they have the same z, just use pt. a. + if (dz == 0) { + return a; + } + //float pa = (az - cameraNear) / dz; + //float pb = (cameraNear - bz) / dz; + float pa = (cameraNear - bz) / dz; + float pb = 1 - pa; + + vertex(pa * va[X] + pb * vb[X], + pa * va[Y] + pb * vb[Y], + pa * va[Z] + pb * vb[Z]); + int irv = vertexCount - 1; + shapeLastPlusClipped++; + + float[] rv = vertices[irv]; + + rv[TX] = pa * va[TX] + pb * vb[TX]; + rv[TY] = pa * va[TY] + pb * vb[TY]; + rv[TZ] = pa * va[TZ] + pb * vb[TZ]; + + rv[VX] = pa * va[VX] + pb * vb[VX]; + rv[VY] = pa * va[VY] + pb * vb[VY]; + rv[VZ] = pa * va[VZ] + pb * vb[VZ]; + rv[VW] = pa * va[VW] + pb * vb[VW]; + + rv[R] = pa * va[R] + pb * vb[R]; + rv[G] = pa * va[G] + pb * vb[G]; + rv[B] = pa * va[B] + pb * vb[B]; + rv[A] = pa * va[A] + pb * vb[A]; + + rv[U] = pa * va[U] + pb * vb[U]; + rv[V] = pa * va[V] + pb * vb[V]; + + rv[SR] = pa * va[SR] + pb * vb[SR]; + rv[SG] = pa * va[SG] + pb * vb[SG]; + rv[SB] = pa * va[SB] + pb * vb[SB]; + rv[SA] = pa * va[SA] + pb * vb[SA]; + + rv[NX] = pa * va[NX] + pb * vb[NX]; + rv[NY] = pa * va[NY] + pb * vb[NY]; + rv[NZ] = pa * va[NZ] + pb * vb[NZ]; + +// rv[SW] = pa * va[SW] + pb * vb[SW]; + + rv[AR] = pa * va[AR] + pb * vb[AR]; + rv[AG] = pa * va[AG] + pb * vb[AG]; + rv[AB] = pa * va[AB] + pb * vb[AB]; + + rv[SPR] = pa * va[SPR] + pb * vb[SPR]; + rv[SPG] = pa * va[SPG] + pb * vb[SPG]; + rv[SPB] = pa * va[SPB] + pb * vb[SPB]; + //rv[SPA] = pa * va[SPA] + pb * vb[SPA]; + + rv[ER] = pa * va[ER] + pb * vb[ER]; + rv[EG] = pa * va[EG] + pb * vb[EG]; + rv[EB] = pa * va[EB] + pb * vb[EB]; + + rv[SHINE] = pa * va[SHINE] + pb * vb[SHINE]; + + rv[BEEN_LIT] = 0; + + return irv; + } + + + protected final void addTriangleWithoutClip(int a, int b, int c) { + if (triangleCount == triangles.length) { + int temp[][] = new int[triangleCount<<1][TRIANGLE_FIELD_COUNT]; + System.arraycopy(triangles, 0, temp, 0, triangleCount); + triangles = temp; + //message(CHATTER, "allocating more triangles " + triangles.length); + float ftemp[][][] = new float[triangleCount<<1][3][TRI_COLOR_COUNT]; + System.arraycopy(triangleColors, 0, ftemp, 0, triangleCount); + triangleColors = ftemp; + } + triangles[triangleCount][VERTEX1] = a; + triangles[triangleCount][VERTEX2] = b; + triangles[triangleCount][VERTEX3] = c; + + if (textureImage == null) { + triangles[triangleCount][TEXTURE_INDEX] = -1; + } else { + triangles[triangleCount][TEXTURE_INDEX] = textureIndex; + } + +// triangles[triangleCount][INDEX] = shape_index; + triangleCount++; + } + + + /** + * Triangulate the current polygon. + *

+ * Simple ear clipping polygon triangulation adapted from code by + * John W. Ratcliff (jratcliff at verant.com). Presumably + * this + * bit of code from the web. + */ + protected void addPolygonTriangles() { + if (vertexOrder.length != vertices.length) { + int[] temp = new int[vertices.length]; + // vertex_start may not be zero, might need to keep old stuff around + // also, copy vertexOrder.length, not vertexCount because vertexCount + // may be larger than vertexOrder.length (since this is a post-processing + // step that happens after the vertex arrays are built). + PApplet.arrayCopy(vertexOrder, temp, vertexOrder.length); + vertexOrder = temp; + } + + // this clipping algorithm only works in 2D, so in cases where a + // polygon is drawn perpendicular to the z-axis, the area will be zero, + // and triangulation will fail. as such, when the area calculates to + // zero, figure out whether x or y is empty, and calculate based on the + // two dimensions that actually contain information. + // http://dev.processing.org/bugs/show_bug.cgi?id=111 + int d1 = X; + int d2 = Y; + // this brings up the nastier point that there may be cases where + // a polygon is irregular in space and will throw off the + // clockwise/counterclockwise calculation. for instance, if clockwise + // relative to x and z, but counter relative to y and z or something + // like that.. will wait to see if this is in fact a problem before + // hurting my head on the math. + + /* + // trying to track down bug #774 + for (int i = vertex_start; i < vertex_end; i++) { + if (i > vertex_start) { + if (vertices[i-1][MX] == vertices[i][MX] && + vertices[i-1][MY] == vertices[i][MY]) { + System.out.print("**** " ); + } + } + System.out.println(i + " " + vertices[i][MX] + " " + vertices[i][MY]); + } + System.out.println(); + */ + + // first we check if the polygon goes clockwise or counterclockwise + float area = 0; + for (int p = shapeLast - 1, q = shapeFirst; q < shapeLast; p = q++) { + area += (vertices[q][d1] * vertices[p][d2] - + vertices[p][d1] * vertices[q][d2]); + } + // rather than checking for the perpendicular case first, only do it + // when the area calculates to zero. checking for perpendicular would be + // a needless waste of time for the 99% case. + if (area == 0) { + // figure out which dimension is the perpendicular axis + boolean foundValidX = false; + boolean foundValidY = false; + + for (int i = shapeFirst; i < shapeLast; i++) { + for (int j = i; j < shapeLast; j++){ + if ( vertices[i][X] != vertices[j][X] ) foundValidX = true; + if ( vertices[i][Y] != vertices[j][Y] ) foundValidY = true; + } + } + + if (foundValidX) { + //d1 = MX; // already the case + d2 = Z; + } else if (foundValidY) { + // ermm.. which is the proper order for cw/ccw here? + d1 = Y; + d2 = Z; + } else { + // screw it, this polygon is just f-ed up + return; + } + + // re-calculate the area, with what should be good values + for (int p = shapeLast - 1, q = shapeFirst; q < shapeLast; p = q++) { + area += (vertices[q][d1] * vertices[p][d2] - + vertices[p][d1] * vertices[q][d2]); + } + } + + // don't allow polygons to come back and meet themselves, + // otherwise it will anger the triangulator + // http://dev.processing.org/bugs/show_bug.cgi?id=97 + float vfirst[] = vertices[shapeFirst]; + float vlast[] = vertices[shapeLast-1]; + if ((abs(vfirst[X] - vlast[X]) < EPSILON) && + (abs(vfirst[Y] - vlast[Y]) < EPSILON) && + (abs(vfirst[Z] - vlast[Z]) < EPSILON)) { + shapeLast--; + } + + // then sort the vertices so they are always in a counterclockwise order + int j = 0; + if (area > 0) { + for (int i = shapeFirst; i < shapeLast; i++) { + j = i - shapeFirst; + vertexOrder[j] = i; + } + } else { + for (int i = shapeFirst; i < shapeLast; i++) { + j = i - shapeFirst; + vertexOrder[j] = (shapeLast - 1) - j; + } + } + + // remove vc-2 Vertices, creating 1 triangle every time + int vc = shapeLast - shapeFirst; + int count = 2*vc; // complex polygon detection + + for (int m = 0, v = vc - 1; vc > 2; ) { + boolean snip = true; + + // if we start over again, is a complex polygon + if (0 >= (count--)) { + break; // triangulation failed + } + + // get 3 consecutive vertices + int u = v ; if (vc <= u) u = 0; // previous + v = u + 1; if (vc <= v) v = 0; // current + int w = v + 1; if (vc <= w) w = 0; // next + + // Upgrade values to doubles, and multiply by 10 so that we can have + // some better accuracy as we tessellate. This seems to have negligible + // speed differences on Windows and Intel Macs, but causes a 50% speed + // drop for PPC Macs with the bug's example code that draws ~200 points + // in a concave polygon. Apple has abandoned PPC so we may as well too. + // http://dev.processing.org/bugs/show_bug.cgi?id=774 + + // triangle A B C + double Ax = -10 * vertices[vertexOrder[u]][d1]; + double Ay = 10 * vertices[vertexOrder[u]][d2]; + double Bx = -10 * vertices[vertexOrder[v]][d1]; + double By = 10 * vertices[vertexOrder[v]][d2]; + double Cx = -10 * vertices[vertexOrder[w]][d1]; + double Cy = 10 * vertices[vertexOrder[w]][d2]; + + // first we check if continues going ccw + if (EPSILON > (((Bx-Ax) * (Cy-Ay)) - ((By-Ay) * (Cx-Ax)))) { + continue; + } + + for (int p = 0; p < vc; p++) { + if ((p == u) || (p == v) || (p == w)) { + continue; + } + + double Px = -10 * vertices[vertexOrder[p]][d1]; + double Py = 10 * vertices[vertexOrder[p]][d2]; + + double ax = Cx - Bx; double ay = Cy - By; + double bx = Ax - Cx; double by = Ay - Cy; + double cx = Bx - Ax; double cy = By - Ay; + double apx = Px - Ax; double apy = Py - Ay; + double bpx = Px - Bx; double bpy = Py - By; + double cpx = Px - Cx; double cpy = Py - Cy; + + double aCROSSbp = ax * bpy - ay * bpx; + double cCROSSap = cx * apy - cy * apx; + double bCROSScp = bx * cpy - by * cpx; + + if ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0)) { + snip = false; + } + } + + if (snip) { + addTriangle(vertexOrder[u], vertexOrder[v], vertexOrder[w]); + + m++; + + // remove v from remaining polygon + for (int s = v, t = v + 1; t < vc; s++, t++) { + vertexOrder[s] = vertexOrder[t]; + } + vc--; + + // reset error detection counter + count = 2 * vc; + } + } + } + + + private void toWorldNormal(float nx, float ny, float nz, float[] out) { + out[0] = + modelviewInv.m00*nx + modelviewInv.m10*ny + + modelviewInv.m20*nz + modelviewInv.m30; + out[1] = + modelviewInv.m01*nx + modelviewInv.m11*ny + + modelviewInv.m21*nz + modelviewInv.m31; + out[2] = + modelviewInv.m02*nx + modelviewInv.m12*ny + + modelviewInv.m22*nz + modelviewInv.m32; + out[3] = + modelviewInv.m03*nx + modelviewInv.m13*ny + + modelviewInv.m23*nz + modelviewInv.m33; + + if (out[3] != 0 && out[3] != 1) { + // divide by perspective coordinate + out[0] /= out[3]; out[1] /= out[3]; out[2] /= out[3]; + } + out[3] = 1; + + float nlen = mag(out[0], out[1], out[2]); // normalize + if (nlen != 0 && nlen != 1) { + out[0] /= nlen; out[1] /= nlen; out[2] /= nlen; + } + } + + + //private PVector calcLightingNorm = new PVector(); + //private PVector calcLightingWorldNorm = new PVector(); + float[] worldNormal = new float[4]; + + + private void calcLightingContribution(int vIndex, + float[] contribution) { + calcLightingContribution(vIndex, contribution, false); + } + + + private void calcLightingContribution(int vIndex, + float[] contribution, + boolean normalIsWorld) { + float[] v = vertices[vIndex]; + + float sr = v[SPR]; + float sg = v[SPG]; + float sb = v[SPB]; + + float wx = v[VX]; + float wy = v[VY]; + float wz = v[VZ]; + float shine = v[SHINE]; + + float nx = v[NX]; + float ny = v[NY]; + float nz = v[NZ]; + + if (!normalIsWorld) { +// System.out.println("um, hello?"); +// calcLightingNorm.set(nx, ny, nz); +// //modelviewInv.mult(calcLightingNorm, calcLightingWorldNorm); +// +//// PMatrix3D mvi = modelViewInv; +//// float ox = mvi.m00*nx + mvi.m10*ny + mvi*m20+nz + +// modelviewInv.cmult(calcLightingNorm, calcLightingWorldNorm); +// +// calcLightingWorldNorm.normalize(); +// nx = calcLightingWorldNorm.x; +// ny = calcLightingWorldNorm.y; +// nz = calcLightingWorldNorm.z; + + toWorldNormal(v[NX], v[NY], v[NZ], worldNormal); + nx = worldNormal[X]; + ny = worldNormal[Y]; + nz = worldNormal[Z]; + +// float wnx = modelviewInv.multX(nx, ny, nz); +// float wny = modelviewInv.multY(nx, ny, nz); +// float wnz = modelviewInv.multZ(nx, ny, nz); +// float wnw = modelviewInv.multW(nx, ny, nz); + +// if (wnw != 0 && wnw != 1) { +// wnx /= wnw; +// wny /= wnw; +// wnz /= wnw; +// } +// float nlen = mag(wnx, wny, wnw); +// if (nlen != 0 && nlen != 1) { +// nx = wnx / nlen; +// ny = wny / nlen; +// nz = wnz / nlen; +// } else { +// nx = wnx; +// ny = wny; +// nz = wnz; +// } +// */ + } else { + nx = v[NX]; + ny = v[NY]; + nz = v[NZ]; + } + + // Since the camera space == world space, + // we can test for visibility by the dot product of + // the normal with the direction from pt. to eye. + float dir = dot(nx, ny, nz, -wx, -wy, -wz); + // If normal is away from camera, choose its opposite. + // If we add backface culling, this will be backfacing + // (but since this is per vertex, it's more complicated) + if (dir < 0) { + nx = -nx; + ny = -ny; + nz = -nz; + } + + // These two terms will sum the contributions from the various lights + contribution[LIGHT_AMBIENT_R] = 0; + contribution[LIGHT_AMBIENT_G] = 0; + contribution[LIGHT_AMBIENT_B] = 0; + + contribution[LIGHT_DIFFUSE_R] = 0; + contribution[LIGHT_DIFFUSE_G] = 0; + contribution[LIGHT_DIFFUSE_B] = 0; + + contribution[LIGHT_SPECULAR_R] = 0; + contribution[LIGHT_SPECULAR_G] = 0; + contribution[LIGHT_SPECULAR_B] = 0; + + // for (int i = 0; i < MAX_LIGHTS; i++) { + // if (!light[i]) continue; + for (int i = 0; i < lightCount; i++) { + + float denom = lightFalloffConstant[i]; + float spotTerm = 1; + + if (lightType[i] == AMBIENT) { + if (lightFalloffQuadratic[i] != 0 || lightFalloffLinear[i] != 0) { + // Falloff depends on distance + float distSq = mag(lightPosition[i].x - wx, + lightPosition[i].y - wy, + lightPosition[i].z - wz); + denom += + lightFalloffQuadratic[i] * distSq + + lightFalloffLinear[i] * sqrt(distSq); + } + if (denom == 0) denom = 1; + + contribution[LIGHT_AMBIENT_R] += lightDiffuse[i][0] / denom; + contribution[LIGHT_AMBIENT_G] += lightDiffuse[i][1] / denom; + contribution[LIGHT_AMBIENT_B] += lightDiffuse[i][2] / denom; + + } else { + // If not ambient, we must deal with direction + + // li is the vector from the vertex to the light + float lix, liy, liz; + float lightDir_dot_li = 0; + float n_dot_li = 0; + + if (lightType[i] == DIRECTIONAL) { + lix = -lightNormal[i].x; + liy = -lightNormal[i].y; + liz = -lightNormal[i].z; + denom = 1; + n_dot_li = (nx * lix + ny * liy + nz * liz); + // If light is lighting the face away from the camera, ditch + if (n_dot_li <= 0) { + continue; + } + } else { // Point or spot light (must deal also with light location) + lix = lightPosition[i].x - wx; + liy = lightPosition[i].y - wy; + liz = lightPosition[i].z - wz; + // normalize + float distSq = mag(lix, liy, liz); + if (distSq != 0) { + lix /= distSq; + liy /= distSq; + liz /= distSq; + } + n_dot_li = (nx * lix + ny * liy + nz * liz); + // If light is lighting the face away from the camera, ditch + if (n_dot_li <= 0) { + continue; + } + + if (lightType[i] == SPOT) { // Must deal with spot cone + lightDir_dot_li = + -(lightNormal[i].x * lix + + lightNormal[i].y * liy + + lightNormal[i].z * liz); + // Outside of spot cone + if (lightDir_dot_li <= lightSpotAngleCos[i]) { + continue; + } + spotTerm = (float) Math.pow(lightDir_dot_li, lightSpotConcentration[i]); + } + + if (lightFalloffQuadratic[i] != 0 || lightFalloffLinear[i] != 0) { + // Falloff depends on distance + denom += + lightFalloffQuadratic[i] * distSq + + lightFalloffLinear[i] * (float) sqrt(distSq); + } + } + // Directional, point, or spot light: + + // We know n_dot_li > 0 from above "continues" + + if (denom == 0) + denom = 1; + float mul = n_dot_li * spotTerm / denom; + contribution[LIGHT_DIFFUSE_R] += lightDiffuse[i][0] * mul; + contribution[LIGHT_DIFFUSE_G] += lightDiffuse[i][1] * mul; + contribution[LIGHT_DIFFUSE_B] += lightDiffuse[i][2] * mul; + + // SPECULAR + + // If the material and light have a specular component. + if ((sr > 0 || sg > 0 || sb > 0) && + (lightSpecular[i][0] > 0 || + lightSpecular[i][1] > 0 || + lightSpecular[i][2] > 0)) { + + float vmag = mag(wx, wy, wz); + if (vmag != 0) { + wx /= vmag; + wy /= vmag; + wz /= vmag; + } + float sx = lix - wx; + float sy = liy - wy; + float sz = liz - wz; + vmag = mag(sx, sy, sz); + if (vmag != 0) { + sx /= vmag; + sy /= vmag; + sz /= vmag; + } + float s_dot_n = (sx * nx + sy * ny + sz * nz); + + if (s_dot_n > 0) { + s_dot_n = (float) Math.pow(s_dot_n, shine); + mul = s_dot_n * spotTerm / denom; + contribution[LIGHT_SPECULAR_R] += lightSpecular[i][0] * mul; + contribution[LIGHT_SPECULAR_G] += lightSpecular[i][1] * mul; + contribution[LIGHT_SPECULAR_B] += lightSpecular[i][2] * mul; + } + + } + } + } + return; + } + + + // Multiply the lighting contribution into the vertex's colors. + // Only do this when there is ONE lighting per vertex + // (MANUAL_VERTEX_NORMAL or SHAPE_NORMAL mode). + private void applyLightingContribution(int vIndex, float[] contribution) { + float[] v = vertices[vIndex]; + + v[R] = clamp(v[ER] + v[AR] * contribution[LIGHT_AMBIENT_R] + v[DR] * contribution[LIGHT_DIFFUSE_R]); + v[G] = clamp(v[EG] + v[AG] * contribution[LIGHT_AMBIENT_G] + v[DG] * contribution[LIGHT_DIFFUSE_G]); + v[B] = clamp(v[EB] + v[AB] * contribution[LIGHT_AMBIENT_B] + v[DB] * contribution[LIGHT_DIFFUSE_B]); + v[A] = clamp(v[DA]); + + v[SPR] = clamp(v[SPR] * contribution[LIGHT_SPECULAR_R]); + v[SPG] = clamp(v[SPG] * contribution[LIGHT_SPECULAR_G]); + v[SPB] = clamp(v[SPB] * contribution[LIGHT_SPECULAR_B]); + //v[SPA] = min(1, v[SPA]); + + v[BEEN_LIT] = 1; + } + + + private void lightVertex(int vIndex, float[] contribution) { + calcLightingContribution(vIndex, contribution); + applyLightingContribution(vIndex, contribution); + } + + + private void lightUnlitVertex(int vIndex, float[] contribution) { + if (vertices[vIndex][BEEN_LIT] == 0) { + lightVertex(vIndex, contribution); + } + } + + + private void copyPrelitVertexColor(int triIndex, int index, int colorIndex) { + float[] triColor = triangleColors[triIndex][colorIndex]; + float[] v = vertices[index]; + + triColor[TRI_DIFFUSE_R] = v[R]; + triColor[TRI_DIFFUSE_G] = v[G]; + triColor[TRI_DIFFUSE_B] = v[B]; + triColor[TRI_DIFFUSE_A] = v[A]; + triColor[TRI_SPECULAR_R] = v[SPR]; + triColor[TRI_SPECULAR_G] = v[SPG]; + triColor[TRI_SPECULAR_B] = v[SPB]; + //triColor[TRI_SPECULAR_A] = v[SPA]; + } + + + private void copyVertexColor(int triIndex, int index, int colorIndex, + float[] contrib) { + float[] triColor = triangleColors[triIndex][colorIndex]; + float[] v = vertices[index]; + + triColor[TRI_DIFFUSE_R] = + clamp(v[ER] + v[AR] * contrib[LIGHT_AMBIENT_R] + v[DR] * contrib[LIGHT_DIFFUSE_R]); + triColor[TRI_DIFFUSE_G] = + clamp(v[EG] + v[AG] * contrib[LIGHT_AMBIENT_G] + v[DG] * contrib[LIGHT_DIFFUSE_G]); + triColor[TRI_DIFFUSE_B] = + clamp(v[EB] + v[AB] * contrib[LIGHT_AMBIENT_B] + v[DB] * contrib[LIGHT_DIFFUSE_B]); + triColor[TRI_DIFFUSE_A] = clamp(v[DA]); + + triColor[TRI_SPECULAR_R] = clamp(v[SPR] * contrib[LIGHT_SPECULAR_R]); + triColor[TRI_SPECULAR_G] = clamp(v[SPG] * contrib[LIGHT_SPECULAR_G]); + triColor[TRI_SPECULAR_B] = clamp(v[SPB] * contrib[LIGHT_SPECULAR_B]); + } + + + private void lightTriangle(int triIndex, float[] lightContribution) { + int vIndex = triangles[triIndex][VERTEX1]; + copyVertexColor(triIndex, vIndex, 0, lightContribution); + vIndex = triangles[triIndex][VERTEX2]; + copyVertexColor(triIndex, vIndex, 1, lightContribution); + vIndex = triangles[triIndex][VERTEX3]; + copyVertexColor(triIndex, vIndex, 2, lightContribution); + } + + + private void lightTriangle(int triIndex) { + int vIndex; + + // Handle lighting on, but no lights (in this case, just use emissive) + // This wont be used currently because lightCount == 0 is don't use + // lighting at all... So. OK. If that ever changes, use the below: + /* + if (lightCount == 0) { + vIndex = triangles[triIndex][VERTEX1]; + copy_emissive_vertex_color_to_triangle(triIndex, vIndex, 0); + vIndex = triangles[triIndex][VERTEX2]; + copy_emissive_vertex_color_to_triangle(triIndex, vIndex, 1); + vIndex = triangles[triIndex][VERTEX3]; + copy_emissive_vertex_color_to_triangle(triIndex, vIndex, 2); + return; + } + */ + + // In MANUAL_VERTEX_NORMAL mode, we have a specific normal + // for each vertex. In that case, we light any verts that + // haven't already been lit and copy their colors straight + // into the triangle. + if (normalMode == NORMAL_MODE_VERTEX) { + vIndex = triangles[triIndex][VERTEX1]; + lightUnlitVertex(vIndex, tempLightingContribution); + copyPrelitVertexColor(triIndex, vIndex, 0); + + vIndex = triangles[triIndex][VERTEX2]; + lightUnlitVertex(vIndex, tempLightingContribution); + copyPrelitVertexColor(triIndex, vIndex, 1); + + vIndex = triangles[triIndex][VERTEX3]; + lightUnlitVertex(vIndex, tempLightingContribution); + copyPrelitVertexColor(triIndex, vIndex, 2); + + } + + // If the lighting doesn't depend on the vertex position, do the + // following: We've already dealt with NORMAL_MODE_SHAPE mode before + // we got into this function, so here we only have to deal with + // NORMAL_MODE_AUTO. So we calculate the normal for this triangle, + // and use that for the lighting. + else if (!lightingDependsOnVertexPosition) { + vIndex = triangles[triIndex][VERTEX1]; + int vIndex2 = triangles[triIndex][VERTEX2]; + int vIndex3 = triangles[triIndex][VERTEX3]; + + /* + dv1[0] = vertices[vIndex2][VX] - vertices[vIndex][VX]; + dv1[1] = vertices[vIndex2][VY] - vertices[vIndex][VY]; + dv1[2] = vertices[vIndex2][VZ] - vertices[vIndex][VZ]; + + dv2[0] = vertices[vIndex3][VX] - vertices[vIndex][VX]; + dv2[1] = vertices[vIndex3][VY] - vertices[vIndex][VY]; + dv2[2] = vertices[vIndex3][VZ] - vertices[vIndex][VZ]; + + cross(dv1, dv2, norm); + */ + + cross(vertices[vIndex2][VX] - vertices[vIndex][VX], + vertices[vIndex2][VY] - vertices[vIndex][VY], + vertices[vIndex2][VZ] - vertices[vIndex][VZ], + vertices[vIndex3][VX] - vertices[vIndex][VX], + vertices[vIndex3][VY] - vertices[vIndex][VY], + vertices[vIndex3][VZ] - vertices[vIndex][VZ], lightTriangleNorm); + + lightTriangleNorm.normalize(); + vertices[vIndex][NX] = lightTriangleNorm.x; + vertices[vIndex][NY] = lightTriangleNorm.y; + vertices[vIndex][NZ] = lightTriangleNorm.z; + + // The true at the end says the normal is already in world coordinates + calcLightingContribution(vIndex, tempLightingContribution, true); + copyVertexColor(triIndex, vIndex, 0, tempLightingContribution); + copyVertexColor(triIndex, vIndex2, 1, tempLightingContribution); + copyVertexColor(triIndex, vIndex3, 2, tempLightingContribution); + } + + // If lighting is position-dependent + else { + if (normalMode == NORMAL_MODE_SHAPE) { + vIndex = triangles[triIndex][VERTEX1]; + vertices[vIndex][NX] = vertices[shapeFirst][NX]; + vertices[vIndex][NY] = vertices[shapeFirst][NY]; + vertices[vIndex][NZ] = vertices[shapeFirst][NZ]; + calcLightingContribution(vIndex, tempLightingContribution); + copyVertexColor(triIndex, vIndex, 0, tempLightingContribution); + + vIndex = triangles[triIndex][VERTEX2]; + vertices[vIndex][NX] = vertices[shapeFirst][NX]; + vertices[vIndex][NY] = vertices[shapeFirst][NY]; + vertices[vIndex][NZ] = vertices[shapeFirst][NZ]; + calcLightingContribution(vIndex, tempLightingContribution); + copyVertexColor(triIndex, vIndex, 1, tempLightingContribution); + + vIndex = triangles[triIndex][VERTEX3]; + vertices[vIndex][NX] = vertices[shapeFirst][NX]; + vertices[vIndex][NY] = vertices[shapeFirst][NY]; + vertices[vIndex][NZ] = vertices[shapeFirst][NZ]; + calcLightingContribution(vIndex, tempLightingContribution); + copyVertexColor(triIndex, vIndex, 2, tempLightingContribution); + } + + // lighting mode is AUTO_NORMAL + else { + vIndex = triangles[triIndex][VERTEX1]; + int vIndex2 = triangles[triIndex][VERTEX2]; + int vIndex3 = triangles[triIndex][VERTEX3]; + + /* + dv1[0] = vertices[vIndex2][VX] - vertices[vIndex][VX]; + dv1[1] = vertices[vIndex2][VY] - vertices[vIndex][VY]; + dv1[2] = vertices[vIndex2][VZ] - vertices[vIndex][VZ]; + + dv2[0] = vertices[vIndex3][VX] - vertices[vIndex][VX]; + dv2[1] = vertices[vIndex3][VY] - vertices[vIndex][VY]; + dv2[2] = vertices[vIndex3][VZ] - vertices[vIndex][VZ]; + + cross(dv1, dv2, norm); + */ + + cross(vertices[vIndex2][VX] - vertices[vIndex][VX], + vertices[vIndex2][VY] - vertices[vIndex][VY], + vertices[vIndex2][VZ] - vertices[vIndex][VZ], + vertices[vIndex3][VX] - vertices[vIndex][VX], + vertices[vIndex3][VY] - vertices[vIndex][VY], + vertices[vIndex3][VZ] - vertices[vIndex][VZ], lightTriangleNorm); +// float nmag = mag(norm[X], norm[Y], norm[Z]); +// if (nmag != 0 && nmag != 1) { +// norm[X] /= nmag; norm[Y] /= nmag; norm[Z] /= nmag; +// } + lightTriangleNorm.normalize(); + vertices[vIndex][NX] = lightTriangleNorm.x; + vertices[vIndex][NY] = lightTriangleNorm.y; + vertices[vIndex][NZ] = lightTriangleNorm.z; + // The true at the end says the normal is already in world coordinates + calcLightingContribution(vIndex, tempLightingContribution, true); + copyVertexColor(triIndex, vIndex, 0, tempLightingContribution); + + vertices[vIndex2][NX] = lightTriangleNorm.x; + vertices[vIndex2][NY] = lightTriangleNorm.y; + vertices[vIndex2][NZ] = lightTriangleNorm.z; + // The true at the end says the normal is already in world coordinates + calcLightingContribution(vIndex2, tempLightingContribution, true); + copyVertexColor(triIndex, vIndex2, 1, tempLightingContribution); + + vertices[vIndex3][NX] = lightTriangleNorm.x; + vertices[vIndex3][NY] = lightTriangleNorm.y; + vertices[vIndex3][NZ] = lightTriangleNorm.z; + // The true at the end says the normal is already in world coordinates + calcLightingContribution(vIndex3, tempLightingContribution, true); + copyVertexColor(triIndex, vIndex3, 2, tempLightingContribution); + } + } + } + + + protected void renderTriangles(int start, int stop) { + for (int i = start; i < stop; i++) { + float a[] = vertices[triangles[i][VERTEX1]]; + float b[] = vertices[triangles[i][VERTEX2]]; + float c[] = vertices[triangles[i][VERTEX3]]; + int tex = triangles[i][TEXTURE_INDEX]; + + /* + // removing for 0149 with the return of P2D + // ewjordan: hack to 'fix' accuracy issues when drawing in 2d + // see also render_lines() where similar hack is employed + float shift = 0.15f;//was 0.49f + boolean shifted = false; + if (drawing2D() && (a[Z] == 0)) { + shifted = true; + a[TX] += shift; + a[TY] += shift; + a[VX] += shift*a[VW]; + a[VY] += shift*a[VW]; + b[TX] += shift; + b[TY] += shift; + b[VX] += shift*b[VW]; + b[VY] += shift*b[VW]; + c[TX] += shift; + c[TY] += shift; + c[VX] += shift*c[VW]; + c[VY] += shift*c[VW]; + } + */ + + triangle.reset(); + + // This is only true when not textured. + // We really should pass specular straight through to triangle rendering. + float ar = clamp(triangleColors[i][0][TRI_DIFFUSE_R] + triangleColors[i][0][TRI_SPECULAR_R]); + float ag = clamp(triangleColors[i][0][TRI_DIFFUSE_G] + triangleColors[i][0][TRI_SPECULAR_G]); + float ab = clamp(triangleColors[i][0][TRI_DIFFUSE_B] + triangleColors[i][0][TRI_SPECULAR_B]); + float br = clamp(triangleColors[i][1][TRI_DIFFUSE_R] + triangleColors[i][1][TRI_SPECULAR_R]); + float bg = clamp(triangleColors[i][1][TRI_DIFFUSE_G] + triangleColors[i][1][TRI_SPECULAR_G]); + float bb = clamp(triangleColors[i][1][TRI_DIFFUSE_B] + triangleColors[i][1][TRI_SPECULAR_B]); + float cr = clamp(triangleColors[i][2][TRI_DIFFUSE_R] + triangleColors[i][2][TRI_SPECULAR_R]); + float cg = clamp(triangleColors[i][2][TRI_DIFFUSE_G] + triangleColors[i][2][TRI_SPECULAR_G]); + float cb = clamp(triangleColors[i][2][TRI_DIFFUSE_B] + triangleColors[i][2][TRI_SPECULAR_B]); + + // ACCURATE TEXTURE CODE + boolean failedToPrecalc = false; + if (s_enableAccurateTextures && frustumMode){ + boolean textured = true; + smoothTriangle.reset(3); + smoothTriangle.smooth = true; + smoothTriangle.interpARGB = true; + smoothTriangle.setIntensities(ar, ag, ab, a[A], + br, bg, bb, b[A], + cr, cg, cb, c[A]); + if (tex > -1 && textures[tex] != null) { + smoothTriangle.setCamVertices(a[VX], a[VY], a[VZ], + b[VX], b[VY], b[VZ], + c[VX], c[VY], c[VZ]); + smoothTriangle.interpUV = true; + smoothTriangle.texture(textures[tex]); + float umult = textures[tex].width; // apparently no check for textureMode is needed here + float vmult = textures[tex].height; + smoothTriangle.vertices[0][U] = a[U]*umult; + smoothTriangle.vertices[0][V] = a[V]*vmult; + smoothTriangle.vertices[1][U] = b[U]*umult; + smoothTriangle.vertices[1][V] = b[V]*vmult; + smoothTriangle.vertices[2][U] = c[U]*umult; + smoothTriangle.vertices[2][V] = c[V]*vmult; + } else { + smoothTriangle.interpUV = false; + textured = false; + } + + smoothTriangle.setVertices(a[TX], a[TY], a[TZ], + b[TX], b[TY], b[TZ], + c[TX], c[TY], c[TZ]); + + + if (!textured || smoothTriangle.precomputeAccurateTexturing()){ + smoothTriangle.render(); + } else { + // Something went wrong with the precomputation, + // so we need to fall back on normal PTriangle + // rendering. + failedToPrecalc = true; + } + } + + // Normal triangle rendering + // Note: this is not an end-if from the smoothed texturing mode + // because it's possible that the precalculation will fail and we + // need to fall back on normal rendering. + if (!s_enableAccurateTextures || failedToPrecalc || (frustumMode == false)){ + if (tex > -1 && textures[tex] != null) { + triangle.setTexture(textures[tex]); + triangle.setUV(a[U], a[V], b[U], b[V], c[U], c[V]); + } + + triangle.setIntensities(ar, ag, ab, a[A], + br, bg, bb, b[A], + cr, cg, cb, c[A]); + + triangle.setVertices(a[TX], a[TY], a[TZ], + b[TX], b[TY], b[TZ], + c[TX], c[TY], c[TZ]); + + triangle.render(); + } + + /* + // removing for 0149 with the return of P2D + if (drawing2D() && shifted){ + a[TX] -= shift; + a[TY] -= shift; + a[VX] -= shift*a[VW]; + a[VY] -= shift*a[VW]; + b[TX] -= shift; + b[TY] -= shift; + b[VX] -= shift*b[VW]; + b[VY] -= shift*b[VW]; + c[TX] -= shift; + c[TY] -= shift; + c[VX] -= shift*c[VW]; + c[VY] -= shift*c[VW]; + } + */ + } + } + + + protected void rawTriangles(int start, int stop) { + raw.colorMode(RGB, 1); + raw.noStroke(); + raw.beginShape(TRIANGLES); + + for (int i = start; i < stop; i++) { + float a[] = vertices[triangles[i][VERTEX1]]; + float b[] = vertices[triangles[i][VERTEX2]]; + float c[] = vertices[triangles[i][VERTEX3]]; + + float ar = clamp(triangleColors[i][0][TRI_DIFFUSE_R] + triangleColors[i][0][TRI_SPECULAR_R]); + float ag = clamp(triangleColors[i][0][TRI_DIFFUSE_G] + triangleColors[i][0][TRI_SPECULAR_G]); + float ab = clamp(triangleColors[i][0][TRI_DIFFUSE_B] + triangleColors[i][0][TRI_SPECULAR_B]); + float br = clamp(triangleColors[i][1][TRI_DIFFUSE_R] + triangleColors[i][1][TRI_SPECULAR_R]); + float bg = clamp(triangleColors[i][1][TRI_DIFFUSE_G] + triangleColors[i][1][TRI_SPECULAR_G]); + float bb = clamp(triangleColors[i][1][TRI_DIFFUSE_B] + triangleColors[i][1][TRI_SPECULAR_B]); + float cr = clamp(triangleColors[i][2][TRI_DIFFUSE_R] + triangleColors[i][2][TRI_SPECULAR_R]); + float cg = clamp(triangleColors[i][2][TRI_DIFFUSE_G] + triangleColors[i][2][TRI_SPECULAR_G]); + float cb = clamp(triangleColors[i][2][TRI_DIFFUSE_B] + triangleColors[i][2][TRI_SPECULAR_B]); + + int tex = triangles[i][TEXTURE_INDEX]; + PImage texImage = (tex > -1) ? textures[tex] : null; + if (texImage != null) { + if (raw.is3D()) { + if ((a[VW] != 0) && (b[VW] != 0) && (c[VW] != 0)) { + raw.fill(ar, ag, ab, a[A]); + raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW], a[U], a[V]); + raw.fill(br, bg, bb, b[A]); + raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW], b[U], b[V]); + raw.fill(cr, cg, cb, c[A]); + raw.vertex(c[VX] / c[VW], c[VY] / c[VW], c[VZ] / c[VW], c[U], c[V]); + } + } else if (raw.is2D()) { + raw.fill(ar, ag, ab, a[A]); + raw.vertex(a[TX], a[TY], a[U], a[V]); + raw.fill(br, bg, bb, b[A]); + raw.vertex(b[TX], b[TY], b[U], b[V]); + raw.fill(cr, cg, cb, c[A]); + raw.vertex(c[TX], c[TY], c[U], c[V]); + } + } else { // no texture + if (raw.is3D()) { + if ((a[VW] != 0) && (b[VW] != 0) && (c[VW] != 0)) { + raw.fill(ar, ag, ab, a[A]); + raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]); + raw.fill(br, bg, bb, b[A]); + raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW]); + raw.fill(cr, cg, cb, c[A]); + raw.vertex(c[VX] / c[VW], c[VY] / c[VW], c[VZ] / c[VW]); + } + } else if (raw.is2D()) { + raw.fill(ar, ag, ab, a[A]); + raw.vertex(a[TX], a[TY]); + raw.fill(br, bg, bb, b[A]); + raw.vertex(b[TX], b[TY]); + raw.fill(cr, cg, cb, c[A]); + raw.vertex(c[TX], c[TY]); + } + } + } + + raw.endShape(); + } + + + ////////////////////////////////////////////////////////////// + + + //public void bezierVertex(float x2, float y2, + // float x3, float y3, + // float x4, float y4) + + + //public void bezierVertex(float x2, float y2, float z2, + // float x3, float y3, float z3, + // float x4, float y4, float z4) + + + + ////////////////////////////////////////////////////////////// + + + //public void curveVertex(float x, float y) + + + //public void curveVertex(float x, float y, float z) + + + + //////////////////////////////////////////////////////////// + + + /** + * Emit any sorted geometry that's been collected on this frame. + */ + public void flush() { + if (hints[ENABLE_DEPTH_SORT]) { + sort(); + } + render(); + + /* + if (triangleCount > 0) { + if (hints[ENABLE_DEPTH_SORT]) { + sortTriangles(); + } + renderTriangles(); + } + if (lineCount > 0) { + if (hints[ENABLE_DEPTH_SORT]) { + sortLines(); + } + renderLines(); + } + // Clear this out in case flush() is called again. + // For instance, with hint(ENABLE_DEPTH_SORT), it will be called + // once on endRaw(), and once again at endDraw(). + triangleCount = 0; + lineCount = 0; + */ + } + + + protected void render() { + if (pointCount > 0) { + renderPoints(0, pointCount); + if (raw != null) { + rawPoints(0, pointCount); + } + pointCount = 0; + } + if (lineCount > 0) { + renderLines(0, lineCount); + if (raw != null) { + rawLines(0, lineCount); + } + lineCount = 0; + pathCount = 0; + } + if (triangleCount > 0) { + renderTriangles(0, triangleCount); + if (raw != null) { + rawTriangles(0, triangleCount); + } + triangleCount = 0; + } + } + + + /** + * Handle depth sorting of geometry. Currently this only handles triangles, + * however in the future it will be expanded for points and lines, which + * will also need to be interspersed with one another while rendering. + */ + protected void sort() { + if (triangleCount > 0) { + sortTrianglesInternal(0, triangleCount-1); + } + } + + + private void sortTrianglesInternal(int i, int j) { + int pivotIndex = (i+j)/2; + sortTrianglesSwap(pivotIndex, j); + int k = sortTrianglesPartition(i-1, j); + sortTrianglesSwap(k, j); + if ((k-i) > 1) sortTrianglesInternal(i, k-1); + if ((j-k) > 1) sortTrianglesInternal(k+1, j); + } + + + private int sortTrianglesPartition(int left, int right) { + int pivot = right; + do { + while (sortTrianglesCompare(++left, pivot) < 0) { } + while ((right != 0) && + (sortTrianglesCompare(--right, pivot) > 0)) { } + sortTrianglesSwap(left, right); + } while (left < right); + sortTrianglesSwap(left, right); + return left; + } + + + private void sortTrianglesSwap(int a, int b) { + int tempi[] = triangles[a]; + triangles[a] = triangles[b]; + triangles[b] = tempi; + float tempf[][] = triangleColors[a]; + triangleColors[a] = triangleColors[b]; + triangleColors[b] = tempf; + } + + + private float sortTrianglesCompare(int a, int b) { + /* + if (Float.isNaN(vertices[triangles[a][VERTEX1]][TZ]) || + Float.isNaN(vertices[triangles[a][VERTEX2]][TZ]) || + Float.isNaN(vertices[triangles[a][VERTEX3]][TZ]) || + Float.isNaN(vertices[triangles[b][VERTEX1]][TZ]) || + Float.isNaN(vertices[triangles[b][VERTEX2]][TZ]) || + Float.isNaN(vertices[triangles[b][VERTEX3]][TZ])) { + System.err.println("NaN values in triangle"); + } + */ + return ((vertices[triangles[b][VERTEX1]][TZ] + + vertices[triangles[b][VERTEX2]][TZ] + + vertices[triangles[b][VERTEX3]][TZ]) - + (vertices[triangles[a][VERTEX1]][TZ] + + vertices[triangles[a][VERTEX2]][TZ] + + vertices[triangles[a][VERTEX3]][TZ])); + } + + + + ////////////////////////////////////////////////////////////// + + // POINT, LINE, TRIANGLE, QUAD + + // Because vertex(x, y) is mapped to vertex(x, y, 0), none of these commands + // need to be overridden from their default implementation in PGraphics. + + + //public void point(float x, float y) + + + //public void point(float x, float y, float z) + + + //public void line(float x1, float y1, float x2, float y2) + + + //public void line(float x1, float y1, float z1, + // float x2, float y2, float z2) + + + //public void triangle(float x1, float y1, float x2, float y2, + // float x3, float y3) + + + //public void quad(float x1, float y1, float x2, float y2, + // float x3, float y3, float x4, float y4) + + + + ////////////////////////////////////////////////////////////// + + // RECT + + + //public void rectMode(int mode) + + + //public void rect(float a, float b, float c, float d) + + + //protected void rectImpl(float x1, float y1, float x2, float y2) + + + + ////////////////////////////////////////////////////////////// + + // ELLIPSE + + + //public void ellipseMode(int mode) + + + //public void ellipse(float a, float b, float c, float d) + + + protected void ellipseImpl(float x, float y, float w, float h) { + float radiusH = w / 2; + float radiusV = h / 2; + + float centerX = x + radiusH; + float centerY = y + radiusV; + +// float sx1 = screenX(x, y); +// float sy1 = screenY(x, y); +// float sx2 = screenX(x+w, y+h); +// float sy2 = screenY(x+w, y+h); + + // returning to pre-1.0 version of algorithm because of problems + int rough = (int)(4+Math.sqrt(w+h)*3); + int accuracy = PApplet.constrain(rough, 6, 100); + + if (fill) { + // returning to pre-1.0 version of algorithm because of problems +// int rough = (int)(4+Math.sqrt(w+h)*3); +// int rough = (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) / 20); +// int accuracy = PApplet.constrain(rough, 6, 100); + + float inc = (float)SINCOS_LENGTH / accuracy; + float val = 0; + + boolean strokeSaved = stroke; + stroke = false; + boolean smoothSaved = smooth; + if (smooth && stroke) { + smooth = false; + } + + beginShape(TRIANGLE_FAN); + normal(0, 0, 1); + vertex(centerX, centerY); + for (int i = 0; i < accuracy; i++) { + vertex(centerX + cosLUT[(int) val] * radiusH, + centerY + sinLUT[(int) val] * radiusV); + val = (val + inc) % SINCOS_LENGTH; + } + // back to the beginning + vertex(centerX + cosLUT[0] * radiusH, + centerY + sinLUT[0] * radiusV); + endShape(); + + stroke = strokeSaved; + smooth = smoothSaved; + } + + if (stroke) { +// int rough = (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) / 8); +// int accuracy = PApplet.constrain(rough, 6, 100); + + float inc = (float)SINCOS_LENGTH / accuracy; + float val = 0; + + boolean savedFill = fill; + fill = false; + + val = 0; + beginShape(); + for (int i = 0; i < accuracy; i++) { + vertex(centerX + cosLUT[(int) val] * radiusH, + centerY + sinLUT[(int) val] * radiusV); + val = (val + inc) % SINCOS_LENGTH; + } + endShape(CLOSE); + + fill = savedFill; + } + } + + + //public void arc(float a, float b, float c, float d, + // float start, float stop) + + + protected void arcImpl(float x, float y, float w, float h, + float start, float stop) { + float hr = w / 2f; + float vr = h / 2f; + + float centerX = x + hr; + float centerY = y + vr; + + if (fill) { + // shut off stroke for a minute + boolean savedStroke = stroke; + stroke = false; + + int startLUT = (int) (0.5f + (start / TWO_PI) * SINCOS_LENGTH); + int stopLUT = (int) (0.5f + (stop / TWO_PI) * SINCOS_LENGTH); + + beginShape(TRIANGLE_FAN); + vertex(centerX, centerY); + int increment = 1; // what's a good algorithm? stopLUT - startLUT; + for (int i = startLUT; i < stopLUT; i += increment) { + int ii = i % SINCOS_LENGTH; + // modulo won't make the value positive + if (ii < 0) ii += SINCOS_LENGTH; + vertex(centerX + cosLUT[ii] * hr, + centerY + sinLUT[ii] * vr); + } + // draw last point explicitly for accuracy + vertex(centerX + cosLUT[stopLUT % SINCOS_LENGTH] * hr, + centerY + sinLUT[stopLUT % SINCOS_LENGTH] * vr); + endShape(); + + stroke = savedStroke; + } + + if (stroke) { + // Almost identical to above, but this uses a LINE_STRIP + // and doesn't include the first (center) vertex. + + boolean savedFill = fill; + fill = false; + + int startLUT = (int) (0.5f + (start / TWO_PI) * SINCOS_LENGTH); + int stopLUT = (int) (0.5f + (stop / TWO_PI) * SINCOS_LENGTH); + + beginShape(); //LINE_STRIP); + int increment = 1; // what's a good algorithm? stopLUT - startLUT; + for (int i = startLUT; i < stopLUT; i += increment) { + int ii = i % SINCOS_LENGTH; + if (ii < 0) ii += SINCOS_LENGTH; + vertex(centerX + cosLUT[ii] * hr, + centerY + sinLUT[ii] * vr); + } + // draw last point explicitly for accuracy + vertex(centerX + cosLUT[stopLUT % SINCOS_LENGTH] * hr, + centerY + sinLUT[stopLUT % SINCOS_LENGTH] * vr); + endShape(); + + fill = savedFill; + } + } + + + + ////////////////////////////////////////////////////////////// + + // BOX + + + //public void box(float size) + + + public void box(float w, float h, float d) { + if (triangle != null) { // triangle is null in gl + triangle.setCulling(true); + } + + super.box(w, h, d); + + if (triangle != null) { // triangle is null in gl + triangle.setCulling(false); + } + } + + + + ////////////////////////////////////////////////////////////// + + // SPHERE + + + //public void sphereDetail(int res) + + + //public void sphereDetail(int ures, int vres) + + + public void sphere(float r) { + if (triangle != null) { // triangle is null in gl + triangle.setCulling(true); + } + + super.sphere(r); + + if (triangle != null) { // triangle is null in gl + triangle.setCulling(false); + } + } + + + + ////////////////////////////////////////////////////////////// + + // BEZIER + + + //public float bezierPoint(float a, float b, float c, float d, float t) + + + //public float bezierTangent(float a, float b, float c, float d, float t) + + + //public void bezierDetail(int detail) + + + //public void bezier(float x1, float y1, + // float x2, float y2, + // float x3, float y3, + // float x4, float y4) + + + //public void bezier(float x1, float y1, float z1, + // float x2, float y2, float z2, + // float x3, float y3, float z3, + // float x4, float y4, float z4) + + + + ////////////////////////////////////////////////////////////// + + // CATMULL-ROM CURVES + + + //public float curvePoint(float a, float b, float c, float d, float t) + + + //public float curveTangent(float a, float b, float c, float d, float t) + + + //public void curveDetail(int detail) + + + //public void curveTightness(float tightness) + + + //public void curve(float x1, float y1, + // float x2, float y2, + // float x3, float y3, + // float x4, float y4) + + + //public void curve(float x1, float y1, float z1, + // float x2, float y2, float z2, + // float x3, float y3, float z3, + // float x4, float y4, float z4) + + + + ////////////////////////////////////////////////////////////// + + // SMOOTH + + + public void smooth() { + //showMethodWarning("smooth"); + s_enableAccurateTextures = true; + smooth = true; + } + + + public void noSmooth() { + s_enableAccurateTextures = false; + smooth = false; + } + + + + ////////////////////////////////////////////////////////////// + + // IMAGES + + + //public void imageMode(int mode) + + + //public void image(PImage image, float x, float y) + + + //public void image(PImage image, float x, float y, float c, float d) + + + //public void image(PImage image, + // float a, float b, float c, float d, + // int u1, int v1, int u2, int v2) + + + //protected void imageImpl(PImage image, + // float x1, float y1, float x2, float y2, + // int u1, int v1, int u2, int v2) + + + + ////////////////////////////////////////////////////////////// + + // SHAPE + + + //public void shapeMode(int mode) + + + //public void shape(PShape shape) + + + //public void shape(PShape shape, float x, float y) + + + //public void shape(PShape shape, float x, float y, float c, float d) + + + + ////////////////////////////////////////////////////////////// + + // TEXT SETTINGS + + // Only textModeCheck overridden from PGraphics, no textAlign, textAscent, + // textDescent, textFont, textLeading, textMode, textSize, textWidth + + + protected boolean textModeCheck(int mode) { + return (textMode == MODEL) || (textMode == SCREEN); + } + + + + ////////////////////////////////////////////////////////////// + + // TEXT + + // None of the variations of text() are overridden from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // TEXT IMPL + + // Not even the text drawing implementation stuff is overridden. + + + + ////////////////////////////////////////////////////////////// + + // MATRIX STACK + + + public void pushMatrix() { + if (matrixStackDepth == MATRIX_STACK_DEPTH) { + throw new RuntimeException(ERROR_PUSHMATRIX_OVERFLOW); + } + modelview.get(matrixStack[matrixStackDepth]); + modelviewInv.get(matrixInvStack[matrixStackDepth]); + matrixStackDepth++; + } + + + public void popMatrix() { + if (matrixStackDepth == 0) { + throw new RuntimeException(ERROR_PUSHMATRIX_UNDERFLOW); + } + matrixStackDepth--; + modelview.set(matrixStack[matrixStackDepth]); + modelviewInv.set(matrixInvStack[matrixStackDepth]); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX TRANSFORMATIONS + + + public void translate(float tx, float ty) { + translate(tx, ty, 0); + } + + + public void translate(float tx, float ty, float tz) { + forwardTransform.translate(tx, ty, tz); + reverseTransform.invTranslate(tx, ty, tz); + } + + + /** + * Two dimensional rotation. Same as rotateZ (this is identical + * to a 3D rotation along the z-axis) but included for clarity -- + * it'd be weird for people drawing 2D graphics to be using rotateZ. + * And they might kick our a-- for the confusion. + */ + public void rotate(float angle) { + rotateZ(angle); + } + + + public void rotateX(float angle) { + forwardTransform.rotateX(angle); + reverseTransform.invRotateX(angle); + } + + + public void rotateY(float angle) { + forwardTransform.rotateY(angle); + reverseTransform.invRotateY(angle); + } + + + public void rotateZ(float angle) { + forwardTransform.rotateZ(angle); + reverseTransform.invRotateZ(angle); + } + + + /** + * Rotate around an arbitrary vector, similar to glRotate(), + * except that it takes radians (instead of degrees). + */ + public void rotate(float angle, float v0, float v1, float v2) { + forwardTransform.rotate(angle, v0, v1, v2); + reverseTransform.invRotate(angle, v0, v1, v2); + } + + + /** + * Same as scale(s, s, s). + */ + public void scale(float s) { + scale(s, s, s); + } + + + /** + * Same as scale(sx, sy, 1). + */ + public void scale(float sx, float sy) { + scale(sx, sy, 1); + } + + + /** + * Scale in three dimensions. + */ + public void scale(float x, float y, float z) { + forwardTransform.scale(x, y, z); + reverseTransform.invScale(x, y, z); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX MORE! + + + public void resetMatrix() { + forwardTransform.reset(); + reverseTransform.reset(); + } + + + public void applyMatrix(PMatrix2D source) { + applyMatrix(source.m00, source.m01, source.m02, + source.m10, source.m11, source.m12); + } + + + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) { + applyMatrix(n00, n01, n02, 0, + n10, n11, n12, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void applyMatrix(PMatrix3D source) { + applyMatrix(source.m00, source.m01, source.m02, source.m03, + source.m10, source.m11, source.m12, source.m13, + source.m20, source.m21, source.m22, source.m23, + source.m30, source.m31, source.m32, source.m33); + } + + + /** + * Apply a 4x4 transformation matrix. Same as glMultMatrix(). + * This call will be slow because it will try to calculate the + * inverse of the transform. So avoid it whenever possible. + */ + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + + forwardTransform.apply(n00, n01, n02, n03, + n10, n11, n12, n13, + n20, n21, n22, n23, + n30, n31, n32, n33); + + reverseTransform.invApply(n00, n01, n02, n03, + n10, n11, n12, n13, + n20, n21, n22, n23, + n30, n31, n32, n33); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX GET/SET/PRINT + + + public PMatrix getMatrix() { + return modelview.get(); + } + + + //public PMatrix2D getMatrix(PMatrix2D target) + + + public PMatrix3D getMatrix(PMatrix3D target) { + if (target == null) { + target = new PMatrix3D(); + } + target.set(modelview); + return target; + } + + + //public void setMatrix(PMatrix source) + + + public void setMatrix(PMatrix2D source) { + // not efficient, but at least handles the inverse stuff. + resetMatrix(); + applyMatrix(source); + } + + + /** + * Set the current transformation to the contents of the specified source. + */ + public void setMatrix(PMatrix3D source) { + // not efficient, but at least handles the inverse stuff. + resetMatrix(); + applyMatrix(source); + } + + + /** + * Print the current model (or "transformation") matrix. + */ + public void printMatrix() { + modelview.print(); + } + + + /* + * This function checks if the modelview matrix is set up to likely be + * drawing in 2D. It merely checks if the non-translational piece of the + * matrix is unity. If this is to be used, it should be coupled with a + * check that the raw vertex coordinates lie in the z=0 plane. + * Mainly useful for applying sub-pixel shifts to avoid 2d artifacts + * in the screen plane. + * Added by ewjordan 6/13/07 + * + * TODO need to invert the logic here so that we can simply return + * the value, rather than calculating true/false and returning it. + */ + /* + private boolean drawing2D() { + if (modelview.m00 != 1.0f || + modelview.m11 != 1.0f || + modelview.m22 != 1.0f || // check scale + modelview.m01 != 0.0f || + modelview.m02 != 0.0f || // check rotational pieces + modelview.m10 != 0.0f || + modelview.m12 != 0.0f || + modelview.m20 != 0.0f || + modelview.m21 != 0.0f || + !((camera.m23-modelview.m23) <= EPSILON && + (camera.m23-modelview.m23) >= -EPSILON)) { // check for z-translation + // Something about the modelview matrix indicates 3d drawing + // (or rotated 2d, in which case 2d subpixel fixes probably aren't needed) + return false; + } else { + //The matrix is mapping z=0 vertices to the screen plane, + // which means it's likely that 2D drawing is happening. + return true; + } + } + */ + + + + ////////////////////////////////////////////////////////////// + + // CAMERA + + + /** + * Set matrix mode to the camera matrix (instead of the current + * transformation matrix). This means applyMatrix, resetMatrix, etc. + * will affect the camera. + *

+ * Note that the camera matrix is *not* the perspective matrix, + * it is in front of the modelview matrix (hence the name "model" + * and "view" for that matrix). + *

+ * beginCamera() specifies that all coordinate transforms until endCamera() + * should be pre-applied in inverse to the camera transform matrix. + * Note that this is only challenging when a user specifies an arbitrary + * matrix with applyMatrix(). Then that matrix will need to be inverted, + * which may not be possible. But take heart, if a user is applying a + * non-invertible matrix to the camera transform, then he is clearly + * up to no good, and we can wash our hands of those bad intentions. + *

+ * begin/endCamera clauses do not automatically reset the camera transform + * matrix. That's because we set up a nice default camera transform int + * setup(), and we expect it to hold through draw(). So we don't reset + * the camera transform matrix at the top of draw(). That means that an + * innocuous-looking clause like + *

+   * beginCamera();
+   * translate(0, 0, 10);
+   * endCamera();
+   * 
+ * at the top of draw(), will result in a runaway camera that shoots + * infinitely out of the screen over time. In order to prevent this, + * it is necessary to call some function that does a hard reset of the + * camera transform matrix inside of begin/endCamera. Two options are + *
+   * camera(); // sets up the nice default camera transform
+   * resetMatrix(); // sets up the identity camera transform
+   * 
+ * So to rotate a camera a constant amount, you might try + *
+   * beginCamera();
+   * camera();
+   * rotateY(PI/8);
+   * endCamera();
+   * 
+ */ + public void beginCamera() { + if (manipulatingCamera) { + throw new RuntimeException("beginCamera() cannot be called again " + + "before endCamera()"); + } else { + manipulatingCamera = true; + forwardTransform = cameraInv; + reverseTransform = camera; + } + } + + + /** + * Record the current settings into the camera matrix, and set + * the matrix mode back to the current transformation matrix. + *

+ * Note that this will destroy any settings to scale(), translate(), + * or whatever, because the final camera matrix will be copied + * (not multiplied) into the modelview. + */ + public void endCamera() { + if (!manipulatingCamera) { + throw new RuntimeException("Cannot call endCamera() " + + "without first calling beginCamera()"); + } + // reset the modelview to use this new camera matrix + modelview.set(camera); + modelviewInv.set(cameraInv); + + // set matrix mode back to modelview + forwardTransform = modelview; + reverseTransform = modelviewInv; + + // all done + manipulatingCamera = false; + } + + + /** + * Set camera to the default settings. + *

+ * Processing camera behavior: + *

+ * Camera behavior can be split into two separate components, camera + * transformation, and projection. The transformation corresponds to the + * physical location, orientation, and scale of the camera. In a physical + * camera metaphor, this is what can manipulated by handling the camera + * body (with the exception of scale, which doesn't really have a physcial + * analog). The projection corresponds to what can be changed by + * manipulating the lens. + *

+ * We maintain separate matrices to represent the camera transform and + * projection. An important distinction between the two is that the camera + * transform should be invertible, where the projection matrix should not, + * since it serves to map three dimensions to two. It is possible to bake + * the two matrices into a single one just by multiplying them together, + * but it isn't a good idea, since lighting, z-ordering, and z-buffering + * all demand a true camera z coordinate after modelview and camera + * transforms have been applied but before projection. If the camera + * transform and projection are combined there is no way to recover a + * good camera-space z-coordinate from a model coordinate. + *

+ * Fortunately, there are no functions that manipulate both camera + * transformation and projection. + *

+ * camera() sets the camera position, orientation, and center of the scene. + * It replaces the camera transform with a new one. This is different from + * gluLookAt(), but I think the only reason that GLU's lookat doesn't fully + * replace the camera matrix with the new one, but instead multiplies it, + * is that GL doesn't enforce the separation of camera transform and + * projection, so it wouldn't be safe (you'd probably stomp your projection). + *

+ * The transformation functions are the same ones used to manipulate the + * modelview matrix (scale, translate, rotate, etc.). But they are bracketed + * with beginCamera(), endCamera() to indicate that they should apply + * (in inverse), to the camera transformation matrix. + *

+ * This differs considerably from camera transformation in OpenGL. + * OpenGL only lets you say, apply everything from here out to the + * projection or modelview matrix. This makes it very hard to treat camera + * manipulation as if it were a physical camera. Imagine that you want to + * move your camera 100 units forward. In OpenGL, you need to apply the + * inverse of that transformation or else you'll move your scene 100 units + * forward--whether or not you've specified modelview or projection matrix. + * Remember they're just multiplied by model coods one after another. + * So in order to treat a camera like a physical camera, it is necessary + * to pre-apply inverse transforms to a matrix that will be applied to model + * coordinates. OpenGL provides nothing of this sort, but Processing does! + * This is the camera transform matrix. + */ + public void camera() { + camera(cameraX, cameraY, cameraZ, + cameraX, cameraY, 0, + 0, 1, 0); + } + + + /** + * More flexible method for dealing with camera(). + *

+ * The actual call is like gluLookat. Here's the real skinny on + * what does what: + *

+   * camera(); or
+   * camera(ex, ey, ez, cx, cy, cz, ux, uy, uz);
+   * 
+ * do not need to be called from with beginCamera();/endCamera(); + * That's because they always apply to the camera transformation, + * and they always totally replace it. That means that any coordinate + * transforms done before camera(); in draw() will be wiped out. + * It also means that camera() always operates in untransformed world + * coordinates. Therefore it is always redundant to call resetMatrix(); + * before camera(); This isn't technically true of gluLookat, but it's + * pretty much how it's used. + *

+ * Now, beginCamera(); and endCamera(); are useful if you want to move + * the camera around using transforms like translate(), etc. They will + * wipe out any coordinate system transforms that occur before them in + * draw(), but they will not automatically wipe out the camera transform. + * This means that they should be at the top of draw(). It also means + * that the following: + *

+   * beginCamera();
+   * rotateY(PI/8);
+   * endCamera();
+   * 
+ * will result in a camera that spins without stopping. If you want to + * just rotate a small constant amount, try this: + *
+   * beginCamera();
+   * camera(); // sets up the default view
+   * rotateY(PI/8);
+   * endCamera();
+   * 
+ * That will rotate a little off of the default view. Note that this + * is entirely equivalent to + *
+   * camera(); // sets up the default view
+   * beginCamera();
+   * rotateY(PI/8);
+   * endCamera();
+   * 
+ * because camera() doesn't care whether or not it's inside a + * begin/end clause. Basically it's safe to use camera() or + * camera(ex, ey, ez, cx, cy, cz, ux, uy, uz) as naked calls because + * they do all the matrix resetting automatically. + */ + public void camera(float eyeX, float eyeY, float eyeZ, + float centerX, float centerY, float centerZ, + float upX, float upY, float upZ) { + float z0 = eyeX - centerX; + float z1 = eyeY - centerY; + float z2 = eyeZ - centerZ; + float mag = sqrt(z0*z0 + z1*z1 + z2*z2); + + if (mag != 0) { + z0 /= mag; + z1 /= mag; + z2 /= mag; + } + + float y0 = upX; + float y1 = upY; + float y2 = upZ; + + float x0 = y1*z2 - y2*z1; + float x1 = -y0*z2 + y2*z0; + float x2 = y0*z1 - y1*z0; + + y0 = z1*x2 - z2*x1; + y1 = -z0*x2 + z2*x0; + y2 = z0*x1 - z1*x0; + + mag = sqrt(x0*x0 + x1*x1 + x2*x2); + if (mag != 0) { + x0 /= mag; + x1 /= mag; + x2 /= mag; + } + + mag = sqrt(y0*y0 + y1*y1 + y2*y2); + if (mag != 0) { + y0 /= mag; + y1 /= mag; + y2 /= mag; + } + + // just does an apply to the main matrix, + // since that'll be copied out on endCamera + camera.set(x0, x1, x2, 0, + y0, y1, y2, 0, + z0, z1, z2, 0, + 0, 0, 0, 1); + camera.translate(-eyeX, -eyeY, -eyeZ); + + cameraInv.reset(); + cameraInv.invApply(x0, x1, x2, 0, + y0, y1, y2, 0, + z0, z1, z2, 0, + 0, 0, 0, 1); + cameraInv.translate(eyeX, eyeY, eyeZ); + + modelview.set(camera); + modelviewInv.set(cameraInv); + } + + + /** + * Print the current camera matrix. + */ + public void printCamera() { + camera.print(); + } + + + ////////////////////////////////////////////////////////////// + + // PROJECTION + + + /** + * Calls ortho() with the proper parameters for Processing's + * standard orthographic projection. + */ + public void ortho() { + ortho(0, width, 0, height, -10, 10); + } + + + /** + * Similar to gluOrtho(), but wipes out the current projection matrix. + *

+ * Implementation partially based on Mesa's matrix.c. + */ + public void ortho(float left, float right, + float bottom, float top, + float near, float far) { + float x = 2.0f / (right - left); + float y = 2.0f / (top - bottom); + float z = -2.0f / (far - near); + + float tx = -(right + left) / (right - left); + float ty = -(top + bottom) / (top - bottom); + float tz = -(far + near) / (far - near); + + projection.set(x, 0, 0, tx, + 0, y, 0, ty, + 0, 0, z, tz, + 0, 0, 0, 1); + + frustumMode = false; + } + + + /** + * Calls perspective() with Processing's standard coordinate projection. + *

+ * Projection functions: + *

    + *
  • frustrum() + *
  • ortho() + *
  • perspective() + *
+ * Each of these three functions completely replaces the projection + * matrix with a new one. They can be called inside setup(), and their + * effects will be felt inside draw(). At the top of draw(), the projection + * matrix is not reset. Therefore the last projection function to be + * called always dominates. On resize, the default projection is always + * established, which has perspective. + *

+ * This behavior is pretty much familiar from OpenGL, except where + * functions replace matrices, rather than multiplying against the + * previous. + *

+ */ + public void perspective() { + perspective(cameraFOV, cameraAspect, cameraNear, cameraFar); + } + + + /** + * Similar to gluPerspective(). Implementation based on Mesa's glu.c + */ + public void perspective(float fov, float aspect, float zNear, float zFar) { + //float ymax = zNear * tan(fovy * PI / 360.0f); + float ymax = zNear * (float) Math.tan(fov / 2); + float ymin = -ymax; + + float xmin = ymin * aspect; + float xmax = ymax * aspect; + + frustum(xmin, xmax, ymin, ymax, zNear, zFar); + } + + + /** + * Same as glFrustum(), except that it wipes out (rather than + * multiplies against) the current perspective matrix. + *

+ * Implementation based on the explanation in the OpenGL blue book. + */ + public void frustum(float left, float right, float bottom, + float top, float znear, float zfar) { + + leftScreen = left; + rightScreen = right; + bottomScreen = bottom; + topScreen = top; + nearPlane = znear; + frustumMode = true; + + //System.out.println(projection); + projection.set((2*znear)/(right-left), 0, (right+left)/(right-left), 0, + 0, (2*znear)/(top-bottom), (top+bottom)/(top-bottom), 0, + 0, 0, -(zfar+znear)/(zfar-znear),-(2*zfar*znear)/(zfar-znear), + 0, 0, -1, 0); + } + + + /** + * Print the current projection matrix. + */ + public void printProjection() { + projection.print(); + } + + + + ////////////////////////////////////////////////////////////// + + // SCREEN AND MODEL COORDS + + + public float screenX(float x, float y) { + return screenX(x, y, 0); + } + + + public float screenY(float x, float y) { + return screenY(x, y, 0); + } + + + public float screenX(float x, float y, float z) { + float ax = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + float ay = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + float az = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + float aw = + modelview.m30*x + modelview.m31*y + modelview.m32*z + modelview.m33; + + float ox = + projection.m00*ax + projection.m01*ay + + projection.m02*az + projection.m03*aw; + float ow = + projection.m30*ax + projection.m31*ay + + projection.m32*az + projection.m33*aw; + + if (ow != 0) ox /= ow; + return width * (1 + ox) / 2.0f; + } + + + public float screenY(float x, float y, float z) { + float ax = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + float ay = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + float az = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + float aw = + modelview.m30*x + modelview.m31*y + modelview.m32*z + modelview.m33; + + float oy = + projection.m10*ax + projection.m11*ay + + projection.m12*az + projection.m13*aw; + float ow = + projection.m30*ax + projection.m31*ay + + projection.m32*az + projection.m33*aw; + + if (ow != 0) oy /= ow; + return height * (1 + oy) / 2.0f; + } + + + public float screenZ(float x, float y, float z) { + float ax = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + float ay = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + float az = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + float aw = + modelview.m30*x + modelview.m31*y + modelview.m32*z + modelview.m33; + + float oz = + projection.m20*ax + projection.m21*ay + + projection.m22*az + projection.m23*aw; + float ow = + projection.m30*ax + projection.m31*ay + + projection.m32*az + projection.m33*aw; + + if (ow != 0) oz /= ow; + return (oz + 1) / 2.0f; + } + + + public float modelX(float x, float y, float z) { + float ax = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + float ay = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + float az = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + float aw = + modelview.m30*x + modelview.m31*y + modelview.m32*z + modelview.m33; + + float ox = + cameraInv.m00*ax + cameraInv.m01*ay + + cameraInv.m02*az + cameraInv.m03*aw; + float ow = + cameraInv.m30*ax + cameraInv.m31*ay + + cameraInv.m32*az + cameraInv.m33*aw; + + return (ow != 0) ? ox / ow : ox; + } + + + public float modelY(float x, float y, float z) { + float ax = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + float ay = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + float az = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + float aw = + modelview.m30*x + modelview.m31*y + modelview.m32*z + modelview.m33; + + float oy = + cameraInv.m10*ax + cameraInv.m11*ay + + cameraInv.m12*az + cameraInv.m13*aw; + float ow = + cameraInv.m30*ax + cameraInv.m31*ay + + cameraInv.m32*az + cameraInv.m33*aw; + + return (ow != 0) ? oy / ow : oy; + } + + + public float modelZ(float x, float y, float z) { + float ax = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + float ay = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + float az = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + float aw = + modelview.m30*x + modelview.m31*y + modelview.m32*z + modelview.m33; + + float oz = + cameraInv.m20*ax + cameraInv.m21*ay + + cameraInv.m22*az + cameraInv.m23*aw; + float ow = + cameraInv.m30*ax + cameraInv.m31*ay + + cameraInv.m32*az + cameraInv.m33*aw; + + return (ow != 0) ? oz / ow : oz; + } + + + + ////////////////////////////////////////////////////////////// + + // STYLE + + // pushStyle(), popStyle(), style() and getStyle() inherited. + + + + ////////////////////////////////////////////////////////////// + + // STROKE CAP/JOIN/WEIGHT + + +// public void strokeWeight(float weight) { +// if (weight != DEFAULT_STROKE_WEIGHT) { +// showMethodWarning("strokeWeight"); +// } +// } + + + public void strokeJoin(int join) { + if (join != DEFAULT_STROKE_JOIN) { + showMethodWarning("strokeJoin"); + } + } + + + public void strokeCap(int cap) { + if (cap != DEFAULT_STROKE_CAP) { + showMethodWarning("strokeCap"); + } + } + + + + ////////////////////////////////////////////////////////////// + + // STROKE COLOR + + // All methods inherited from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // TINT COLOR + + // All methods inherited from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // FILL COLOR + + + protected void fillFromCalc() { + super.fillFromCalc(); + ambientFromCalc(); + } + + + + ////////////////////////////////////////////////////////////// + + // MATERIAL PROPERTIES + + // ambient, specular, shininess, and emissive all inherited. + + + + ////////////////////////////////////////////////////////////// + + // LIGHTS + + + PVector lightPositionVec = new PVector(); + PVector lightDirectionVec = new PVector(); + + /** + * Sets up an ambient and directional light. + *

+   * The Lighting Skinny:
+   *
+   * The way lighting works is complicated enough that it's worth
+   * producing a document to describe it. Lighting calculations proceed
+   * pretty much exactly as described in the OpenGL red book.
+   *
+   * Light-affecting material properties:
+   *
+   *   AMBIENT COLOR
+   *   - multiplies by light's ambient component
+   *   - for believability this should match diffuse color
+   *
+   *   DIFFUSE COLOR
+   *   - multiplies by light's diffuse component
+   *
+   *   SPECULAR COLOR
+   *   - multiplies by light's specular component
+   *   - usually less colored than diffuse/ambient
+   *
+   *   SHININESS
+   *   - the concentration of specular effect
+   *   - this should be set pretty high (20-50) to see really
+   *     noticeable specularity
+   *
+   *   EMISSIVE COLOR
+   *   - constant additive color effect
+   *
+   * Light types:
+   *
+   *   AMBIENT
+   *   - one color
+   *   - no specular color
+   *   - no direction
+   *   - may have falloff (constant, linear, and quadratic)
+   *   - may have position (which matters in non-constant falloff case)
+   *   - multiplies by a material's ambient reflection
+   *
+   *   DIRECTIONAL
+   *   - has diffuse color
+   *   - has specular color
+   *   - has direction
+   *   - no position
+   *   - no falloff
+   *   - multiplies by a material's diffuse and specular reflections
+   *
+   *   POINT
+   *   - has diffuse color
+   *   - has specular color
+   *   - has position
+   *   - no direction
+   *   - may have falloff (constant, linear, and quadratic)
+   *   - multiplies by a material's diffuse and specular reflections
+   *
+   *   SPOT
+   *   - has diffuse color
+   *   - has specular color
+   *   - has position
+   *   - has direction
+   *   - has cone angle (set to half the total cone angle)
+   *   - has concentration value
+   *   - may have falloff (constant, linear, and quadratic)
+   *   - multiplies by a material's diffuse and specular reflections
+   *
+   * Normal modes:
+   *
+   * All of the primitives (rect, box, sphere, etc.) have their normals
+   * set nicely. During beginShape/endShape normals can be set by the user.
+   *
+   *   AUTO-NORMAL
+   *   - if no normal is set during the shape, we are in auto-normal mode
+   *   - auto-normal calculates one normal per triangle (face-normal mode)
+   *
+   *   SHAPE-NORMAL
+   *   - if one normal is set during the shape, it will be used for
+   *     all vertices
+   *
+   *   VERTEX-NORMAL
+   *   - if multiple normals are set, each normal applies to
+   *     subsequent vertices
+   *   - (except for the first one, which applies to previous
+   *     and subsequent vertices)
+   *
+   * Efficiency consequences:
+   *
+   *   There is a major efficiency consequence of position-dependent
+   *   lighting calculations per vertex. (See below for determining
+   *   whether lighting is vertex position-dependent.) If there is no
+   *   position dependency then the only factors that affect the lighting
+   *   contribution per vertex are its colors and its normal.
+   *   There is a major efficiency win if
+   *
+   *   1) lighting is not position dependent
+   *   2) we are in AUTO-NORMAL or SHAPE-NORMAL mode
+   *
+   *   because then we can calculate one lighting contribution per shape
+   *   (SHAPE-NORMAL) or per triangle (AUTO-NORMAL) and simply multiply it
+   *   into the vertex colors. The converse is our worst-case performance when
+   *
+   *   1) lighting is position dependent
+   *   2) we are in AUTO-NORMAL mode
+   *
+   *   because then we must calculate lighting per-face * per-vertex.
+   *   Each vertex has a different lighting contribution per face in
+   *   which it appears. Yuck.
+   *
+   * Determining vertex position dependency:
+   *
+   *   If any of the following factors are TRUE then lighting is
+   *   vertex position dependent:
+   *
+   *   1) Any lights uses non-constant falloff
+   *   2) There are any point or spot lights
+   *   3) There is a light with specular color AND there is a
+   *      material with specular color
+   *
+   * So worth noting is that default lighting (a no-falloff ambient
+   * and a directional without specularity) is not position-dependent.
+   * We should capitalize.
+   *
+   * Simon Greenwold, April 2005
+   * 
+ */ + public void lights() { + // need to make sure colorMode is RGB 255 here + int colorModeSaved = colorMode; + colorMode = RGB; + + lightFalloff(1, 0, 0); + lightSpecular(0, 0, 0); + + ambientLight(colorModeX * 0.5f, + colorModeY * 0.5f, + colorModeZ * 0.5f); + directionalLight(colorModeX * 0.5f, + colorModeY * 0.5f, + colorModeZ * 0.5f, + 0, 0, -1); + + colorMode = colorModeSaved; + + lightingDependsOnVertexPosition = false; + } + + + /** + * Turn off all lights. + */ + public void noLights() { + // write any queued geometry, because lighting will be goofed after + flush(); + // set the light count back to zero + lightCount = 0; + } + + + /** + * Add an ambient light based on the current color mode. + */ + public void ambientLight(float r, float g, float b) { + ambientLight(r, g, b, 0, 0, 0); + } + + + /** + * Add an ambient light based on the current color mode. + * This version includes an (x, y, z) position for situations + * where the falloff distance is used. + */ + public void ambientLight(float r, float g, float b, + float x, float y, float z) { + if (lightCount == MAX_LIGHTS) { + throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); + } + colorCalc(r, g, b); + lightDiffuse[lightCount][0] = calcR; + lightDiffuse[lightCount][1] = calcG; + lightDiffuse[lightCount][2] = calcB; + + lightType[lightCount] = AMBIENT; + lightFalloffConstant[lightCount] = currentLightFalloffConstant; + lightFalloffLinear[lightCount] = currentLightFalloffLinear; + lightFalloffQuadratic[lightCount] = currentLightFalloffQuadratic; + lightPosition(lightCount, x, y, z); + lightCount++; + //return lightCount-1; + } + + + public void directionalLight(float r, float g, float b, + float nx, float ny, float nz) { + if (lightCount == MAX_LIGHTS) { + throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); + } + colorCalc(r, g, b); + lightDiffuse[lightCount][0] = calcR; + lightDiffuse[lightCount][1] = calcG; + lightDiffuse[lightCount][2] = calcB; + + lightType[lightCount] = DIRECTIONAL; + lightFalloffConstant[lightCount] = currentLightFalloffConstant; + lightFalloffLinear[lightCount] = currentLightFalloffLinear; + lightFalloffQuadratic[lightCount] = currentLightFalloffQuadratic; + lightSpecular[lightCount][0] = currentLightSpecular[0]; + lightSpecular[lightCount][1] = currentLightSpecular[1]; + lightSpecular[lightCount][2] = currentLightSpecular[2]; + lightDirection(lightCount, nx, ny, nz); + lightCount++; + } + + + public void pointLight(float r, float g, float b, + float x, float y, float z) { + if (lightCount == MAX_LIGHTS) { + throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); + } + colorCalc(r, g, b); + lightDiffuse[lightCount][0] = calcR; + lightDiffuse[lightCount][1] = calcG; + lightDiffuse[lightCount][2] = calcB; + + lightType[lightCount] = POINT; + lightFalloffConstant[lightCount] = currentLightFalloffConstant; + lightFalloffLinear[lightCount] = currentLightFalloffLinear; + lightFalloffQuadratic[lightCount] = currentLightFalloffQuadratic; + lightSpecular[lightCount][0] = currentLightSpecular[0]; + lightSpecular[lightCount][1] = currentLightSpecular[1]; + lightSpecular[lightCount][2] = currentLightSpecular[2]; + lightPosition(lightCount, x, y, z); + lightCount++; + + lightingDependsOnVertexPosition = true; + } + + + public void spotLight(float r, float g, float b, + float x, float y, float z, + float nx, float ny, float nz, + float angle, float concentration) { + if (lightCount == MAX_LIGHTS) { + throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); + } + colorCalc(r, g, b); + lightDiffuse[lightCount][0] = calcR; + lightDiffuse[lightCount][1] = calcG; + lightDiffuse[lightCount][2] = calcB; + + lightType[lightCount] = SPOT; + lightFalloffConstant[lightCount] = currentLightFalloffConstant; + lightFalloffLinear[lightCount] = currentLightFalloffLinear; + lightFalloffQuadratic[lightCount] = currentLightFalloffQuadratic; + lightSpecular[lightCount][0] = currentLightSpecular[0]; + lightSpecular[lightCount][1] = currentLightSpecular[1]; + lightSpecular[lightCount][2] = currentLightSpecular[2]; + lightPosition(lightCount, x, y, z); + lightDirection(lightCount, nx, ny, nz); + lightSpotAngle[lightCount] = angle; + lightSpotAngleCos[lightCount] = Math.max(0, (float) Math.cos(angle)); + lightSpotConcentration[lightCount] = concentration; + lightCount++; + + lightingDependsOnVertexPosition = true; + } + + + /** + * Set the light falloff rates for the last light that was created. + * Default is lightFalloff(1, 0, 0). + */ + public void lightFalloff(float constant, float linear, float quadratic) { + currentLightFalloffConstant = constant; + currentLightFalloffLinear = linear; + currentLightFalloffQuadratic = quadratic; + + lightingDependsOnVertexPosition = true; + } + + + /** + * Set the specular color of the last light created. + */ + public void lightSpecular(float x, float y, float z) { + colorCalc(x, y, z); + currentLightSpecular[0] = calcR; + currentLightSpecular[1] = calcG; + currentLightSpecular[2] = calcB; + + lightingDependsOnVertexPosition = true; + } + + + /** + * internal function to set the light position + * based on the current modelview matrix. + */ + protected void lightPosition(int num, float x, float y, float z) { + lightPositionVec.set(x, y, z); + modelview.mult(lightPositionVec, lightPosition[num]); + /* + lightPosition[num][0] = + modelview.m00*x + modelview.m01*y + modelview.m02*z + modelview.m03; + lightPosition[num][1] = + modelview.m10*x + modelview.m11*y + modelview.m12*z + modelview.m13; + lightPosition[num][2] = + modelview.m20*x + modelview.m21*y + modelview.m22*z + modelview.m23; + */ + } + + + /** + * internal function to set the light direction + * based on the current modelview matrix. + */ + protected void lightDirection(int num, float x, float y, float z) { + lightNormal[num].set(modelviewInv.m00*x + modelviewInv.m10*y + modelviewInv.m20*z + modelviewInv.m30, + modelviewInv.m01*x + modelviewInv.m11*y + modelviewInv.m21*z + modelviewInv.m31, + modelviewInv.m02*x + modelviewInv.m12*y + modelviewInv.m22*z + modelviewInv.m32); + lightNormal[num].normalize(); + + /* + lightDirectionVec.set(x, y, z); + System.out.println("dir vec " + lightDirectionVec); + //modelviewInv.mult(lightDirectionVec, lightNormal[num]); + modelviewInv.cmult(lightDirectionVec, lightNormal[num]); + System.out.println("cmult vec " + lightNormal[num]); + lightNormal[num].normalize(); + System.out.println("setting light direction " + lightNormal[num]); + */ + + /* + // Multiply by inverse transpose. + lightNormal[num][0] = + modelviewInv.m00*x + modelviewInv.m10*y + + modelviewInv.m20*z + modelviewInv.m30; + lightNormal[num][1] = + modelviewInv.m01*x + modelviewInv.m11*y + + modelviewInv.m21*z + modelviewInv.m31; + lightNormal[num][2] = + modelviewInv.m02*x + modelviewInv.m12*y + + modelviewInv.m22*z + modelviewInv.m32; + + float n = mag(lightNormal[num][0], lightNormal[num][1], lightNormal[num][2]); + if (n == 0 || n == 1) return; + + lightNormal[num][0] /= n; + lightNormal[num][1] /= n; + lightNormal[num][2] /= n; + */ + } + + + + ////////////////////////////////////////////////////////////// + + // BACKGROUND + + // Base background() variations inherited from PGraphics. + + + protected void backgroundImpl(PImage image) { + System.arraycopy(image.pixels, 0, pixels, 0, pixels.length); + Arrays.fill(zbuffer, Float.MAX_VALUE); + } + + + /** + * Clear pixel buffer. With P3D and OPENGL, this also clears the zbuffer. + */ + protected void backgroundImpl() { + Arrays.fill(pixels, backgroundColor); + Arrays.fill(zbuffer, Float.MAX_VALUE); + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR MODE + + // all colorMode() variations inherited from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // COLOR CALCULATIONS + + // protected colorCalc and colorCalcARGB inherited. + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE STUFFING + + // final color() variations inherited. + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE EXTRACTION + + // final methods alpha, red, green, blue, + // hue, saturation, and brightness all inherited. + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE INTERPOLATION + + // both lerpColor variants inherited. + + + + ////////////////////////////////////////////////////////////// + + // BEGIN/END RAW + + // beginRaw, endRaw() both inherited. + + + + ////////////////////////////////////////////////////////////// + + // WARNINGS and EXCEPTIONS + + // showWarning and showException inherited. + + + + ////////////////////////////////////////////////////////////// + + // RENDERER SUPPORT QUERIES + + + //public boolean displayable() + + + public boolean is2D() { + return false; + } + + + public boolean is3D() { + return true; + } + + + + ////////////////////////////////////////////////////////////// + + // PIMAGE METHODS + + // All these methods are inherited, because this render has a + // pixels[] array that can be accessed directly. + + // getImage + // setCache, getCache, removeCache + // isModified, setModified + // loadPixels, updatePixels + // resize + // get, getImpl, set, setImpl + // mask + // filter + // copy + // blendColor, blend + + + + ////////////////////////////////////////////////////////////// + + // MATH (internal use only) + + + private final float sqrt(float a) { + return (float) Math.sqrt(a); + } + + + private final float mag(float a, float b, float c) { + return (float) Math.sqrt(a*a + b*b + c*c); + } + + + private final float clamp(float a) { + return (a < 1) ? a : 1; + } + + + private final float abs(float a) { + return (a < 0) ? -a : a; + } + + + private float dot(float ax, float ay, float az, + float bx, float by, float bz) { + return ax*bx + ay*by + az*bz; + } + + + /* + private final void cross(float a0, float a1, float a2, + float b0, float b1, float b2, + float[] out) { + out[0] = a1*b2 - a2*b1; + out[1] = a2*b0 - a0*b2; + out[2] = a0*b1 - a1*b0; + } + */ + + + private final void cross(float a0, float a1, float a2, + float b0, float b1, float b2, + PVector out) { + out.x = a1*b2 - a2*b1; + out.y = a2*b0 - a0*b2; + out.z = a0*b1 - a1*b0; + } + + + /* + private final void cross(float[] a, float[] b, float[] out) { + out[0] = a[1]*b[2] - a[2]*b[1]; + out[1] = a[2]*b[0] - a[0]*b[2]; + out[2] = a[0]*b[1] - a[1]*b[0]; + } + */ +} + diff --git a/core/src/processing/core/PGraphicsJava2D.java b/core/src/processing/core/PGraphicsJava2D.java new file mode 100644 index 000000000..efce3fc92 --- /dev/null +++ b/core/src/processing/core/PGraphicsJava2D.java @@ -0,0 +1,1836 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-08 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.*; +import java.awt.geom.*; +import java.awt.image.*; + + +/** + * Subclass for PGraphics that implements the graphics API using Java2D. + * + *

Pixel operations too slow? As of release 0085 (the first beta), + * the default renderer uses Java2D. It's more accurate than the renderer + * used in alpha releases of Processing (it handles stroke caps and joins, + * and has better polygon tessellation), but it's super slow for handling + * pixels. At least until we get a chance to get the old 2D renderer + * (now called P2D) working in a similar fashion, you can use + * size(w, h, P3D) instead of size(w, h) which will + * be faster for general pixel flipping madness.

+ * + *

To get access to the Java 2D "Graphics2D" object for the default + * renderer, use: + *

Graphics2D g2 = ((PGraphicsJava2D)g).g2;
+ * This will let you do Java 2D stuff directly, but is not supported in + * any way shape or form. Which just means "have fun, but don't complain + * if it breaks."

+ */ +public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ { + + public Graphics2D g2; + GeneralPath gpath; + + /// break the shape at the next vertex (next vertex() call is a moveto()) + boolean breakShape; + + /// coordinates for internal curve calculation + float[] curveCoordX; + float[] curveCoordY; + float[] curveDrawX; + float[] curveDrawY; + + int transformCount; + AffineTransform transformStack[] = + new AffineTransform[MATRIX_STACK_DEPTH]; + double[] transform = new double[6]; + + Line2D.Float line = new Line2D.Float(); + Ellipse2D.Float ellipse = new Ellipse2D.Float(); + Rectangle2D.Float rect = new Rectangle2D.Float(); + Arc2D.Float arc = new Arc2D.Float(); + + protected Color tintColorObject; + + protected Color fillColorObject; + public boolean fillGradient; + public Paint fillGradientObject; + + protected Color strokeColorObject; + public boolean strokeGradient; + public Paint strokeGradientObject; + + + + ////////////////////////////////////////////////////////////// + + // INTERNAL + + + public PGraphicsJava2D() { } + + + //public void setParent(PApplet parent) + + + //public void setPrimary(boolean primary) + + + //public void setPath(String path) + + + /** + * Called in response to a resize event, handles setting the + * new width and height internally, as well as re-allocating + * the pixel buffer for the new size. + * + * Note that this will nuke any cameraMode() settings. + */ + public void setSize(int iwidth, int iheight) { // ignore + width = iwidth; + height = iheight; + width1 = width - 1; + height1 = height - 1; + + allocate(); + reapplySettings(); + } + + + // broken out because of subclassing for opengl + protected void allocate() { +// System.out.println("PGraphicsJava2D allocate() " + width + " " + height); +// System.out.println("allocate " + Thread.currentThread().getName()); + image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + g2 = (Graphics2D) image.getGraphics(); + // can't un-set this because this may be only a resize + // http://dev.processing.org/bugs/show_bug.cgi?id=463 + //defaultsInited = false; + //checkSettings(); + //reapplySettings = true; + } + + + //public void dispose() + + + + ////////////////////////////////////////////////////////////// + + // FRAME + + + public boolean canDraw() { + return true; + } + + + public void beginDraw() { + checkSettings(); + + resetMatrix(); // reset model matrix + + // reset vertices + vertexCount = 0; + } + + + public void endDraw() { + // hm, mark pixels as changed, because this will instantly do a full + // copy of all the pixels to the surface.. so that's kind of a mess. + //updatePixels(); + + // TODO this is probably overkill for most tasks... + if (!primarySurface) { + loadPixels(); + } + modified = true; + } + + + + ////////////////////////////////////////////////////////////// + + // SETTINGS + + + //protected void checkSettings() + + + //protected void defaultSettings() + + + //protected void reapplySettings() + + + + ////////////////////////////////////////////////////////////// + + // HINT + + + //public void hint(int which) + + + + ////////////////////////////////////////////////////////////// + + // SHAPES + + + //public void beginShape(int kind) + + + public void beginShape(int kind) { + //super.beginShape(kind); + shape = kind; + vertexCount = 0; + curveVertexCount = 0; + + // set gpath to null, because when mixing curves and straight + // lines, vertexCount will be set back to zero, so vertexCount == 1 + // is no longer a good indicator of whether the shape is new. + // this way, just check to see if gpath is null, and if it isn't + // then just use it to continue the shape. + gpath = null; + } + + + //public boolean edge(boolean e) + + + //public void normal(float nx, float ny, float nz) { + + + //public void textureMode(int mode) + + + public void texture(PImage image) { + showMethodWarning("texture"); + } + + + public void vertex(float x, float y) { + curveVertexCount = 0; + //float vertex[]; + + if (vertexCount == vertices.length) { + float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT]; + System.arraycopy(vertices, 0, temp, 0, vertexCount); + vertices = temp; + //message(CHATTER, "allocating more vertices " + vertices.length); + } + // not everyone needs this, but just easier to store rather + // than adding another moving part to the code... + vertices[vertexCount][X] = x; + vertices[vertexCount][Y] = y; + vertexCount++; + + switch (shape) { + + case POINTS: + point(x, y); + break; + + case LINES: + if ((vertexCount % 2) == 0) { + line(vertices[vertexCount-2][X], + vertices[vertexCount-2][Y], x, y); + } + break; + + case TRIANGLES: + if ((vertexCount % 3) == 0) { + triangle(vertices[vertexCount - 3][X], + vertices[vertexCount - 3][Y], + vertices[vertexCount - 2][X], + vertices[vertexCount - 2][Y], + x, y); + } + break; + + case TRIANGLE_STRIP: + if (vertexCount >= 3) { + triangle(vertices[vertexCount - 2][X], + vertices[vertexCount - 2][Y], + vertices[vertexCount - 1][X], + vertices[vertexCount - 1][Y], + vertices[vertexCount - 3][X], + vertices[vertexCount - 3][Y]); + } + break; + + case TRIANGLE_FAN: + if (vertexCount == 3) { + triangle(vertices[0][X], vertices[0][Y], + vertices[1][X], vertices[1][Y], + x, y); + } else if (vertexCount > 3) { + gpath = new GeneralPath(); + // when vertexCount > 3, draw an un-closed triangle + // for indices 0 (center), previous, current + gpath.moveTo(vertices[0][X], + vertices[0][Y]); + gpath.lineTo(vertices[vertexCount - 2][X], + vertices[vertexCount - 2][Y]); + gpath.lineTo(x, y); + drawShape(gpath); + } + break; + + case QUADS: + if ((vertexCount % 4) == 0) { + quad(vertices[vertexCount - 4][X], + vertices[vertexCount - 4][Y], + vertices[vertexCount - 3][X], + vertices[vertexCount - 3][Y], + vertices[vertexCount - 2][X], + vertices[vertexCount - 2][Y], + x, y); + } + break; + + case QUAD_STRIP: + // 0---2---4 + // | | | + // 1---3---5 + if ((vertexCount >= 4) && ((vertexCount % 2) == 0)) { + quad(vertices[vertexCount - 4][X], + vertices[vertexCount - 4][Y], + vertices[vertexCount - 2][X], + vertices[vertexCount - 2][Y], + x, y, + vertices[vertexCount - 3][X], + vertices[vertexCount - 3][Y]); + } + break; + + case POLYGON: + if (gpath == null) { + gpath = new GeneralPath(); + gpath.moveTo(x, y); + } else if (breakShape) { + gpath.moveTo(x, y); + breakShape = false; + } else { + gpath.lineTo(x, y); + } + break; + } + } + + + public void vertex(float x, float y, float z) { + showDepthWarningXYZ("vertex"); + } + + + public void vertex(float x, float y, float u, float v) { + showVariationWarning("vertex(x, y, u, v)"); + } + + + public void vertex(float x, float y, float z, float u, float v) { + showDepthWarningXYZ("vertex"); + } + + + public void breakShape() { + breakShape = true; + } + + + public void endShape(int mode) { + if (gpath != null) { // make sure something has been drawn + if (shape == POLYGON) { + if (mode == CLOSE) { + gpath.closePath(); + } + drawShape(gpath); + } + } + shape = 0; + } + + + + ////////////////////////////////////////////////////////////// + + // BEZIER VERTICES + + + public void bezierVertex(float x1, float y1, + float x2, float y2, + float x3, float y3) { + bezierVertexCheck(); + gpath.curveTo(x1, y1, x2, y2, x3, y3); + } + + + public void bezierVertex(float x2, float y2, float z2, + float x3, float y3, float z3, + float x4, float y4, float z4) { + showDepthWarningXYZ("bezierVertex"); + } + + + + ////////////////////////////////////////////////////////////// + + // CURVE VERTICES + + + protected void curveVertexCheck() { + super.curveVertexCheck(); + + if (curveCoordX == null) { + curveCoordX = new float[4]; + curveCoordY = new float[4]; + curveDrawX = new float[4]; + curveDrawY = new float[4]; + } + } + + + protected void curveVertexSegment(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + curveCoordX[0] = x1; + curveCoordY[0] = y1; + + curveCoordX[1] = x2; + curveCoordY[1] = y2; + + curveCoordX[2] = x3; + curveCoordY[2] = y3; + + curveCoordX[3] = x4; + curveCoordY[3] = y4; + + curveToBezierMatrix.mult(curveCoordX, curveDrawX); + curveToBezierMatrix.mult(curveCoordY, curveDrawY); + + // since the paths are continuous, + // only the first point needs the actual moveto + if (gpath == null) { + gpath = new GeneralPath(); + gpath.moveTo(curveDrawX[0], curveDrawY[0]); + } + + gpath.curveTo(curveDrawX[1], curveDrawY[1], + curveDrawX[2], curveDrawY[2], + curveDrawX[3], curveDrawY[3]); + } + + + public void curveVertex(float x, float y, float z) { + showDepthWarningXYZ("curveVertex"); + } + + + + ////////////////////////////////////////////////////////////// + + // RENDERER + + + //public void flush() + + + + ////////////////////////////////////////////////////////////// + + // POINT, LINE, TRIANGLE, QUAD + + + public void point(float x, float y) { + if (stroke) { + if (strokeWeight > 1) { + line(x, y, x + EPSILON, y + EPSILON); + } else { + set((int) screenX(x, y), (int) screenY(x, y), strokeColor); + } + } + } + + + public void line(float x1, float y1, float x2, float y2) { + line.setLine(x1, y1, x2, y2); + strokeShape(line); + } + + + public void triangle(float x1, float y1, float x2, float y2, + float x3, float y3) { + gpath = new GeneralPath(); + gpath.moveTo(x1, y1); + gpath.lineTo(x2, y2); + gpath.lineTo(x3, y3); + gpath.closePath(); + drawShape(gpath); + } + + + public void quad(float x1, float y1, float x2, float y2, + float x3, float y3, float x4, float y4) { + GeneralPath gp = new GeneralPath(); + gp.moveTo(x1, y1); + gp.lineTo(x2, y2); + gp.lineTo(x3, y3); + gp.lineTo(x4, y4); + gp.closePath(); + drawShape(gp); + } + + + + ////////////////////////////////////////////////////////////// + + // RECT + + + //public void rectMode(int mode) + + + //public void rect(float a, float b, float c, float d) + + + protected void rectImpl(float x1, float y1, float x2, float y2) { + rect.setFrame(x1, y1, x2-x1, y2-y1); + drawShape(rect); + } + + + + ////////////////////////////////////////////////////////////// + + // ELLIPSE + + + //public void ellipseMode(int mode) + + + //public void ellipse(float a, float b, float c, float d) + + + protected void ellipseImpl(float x, float y, float w, float h) { + ellipse.setFrame(x, y, w, h); + drawShape(ellipse); + } + + + + ////////////////////////////////////////////////////////////// + + // ARC + + + //public void arc(float a, float b, float c, float d, + // float start, float stop) + + + protected void arcImpl(float x, float y, float w, float h, + float start, float stop) { + // 0 to 90 in java would be 0 to -90 for p5 renderer + // but that won't work, so -90 to 0? + + start = -start * RAD_TO_DEG; + stop = -stop * RAD_TO_DEG; + + // ok to do this because already checked for NaN +// while (start < 0) { +// start += 360; +// stop += 360; +// } +// if (start > stop) { +// float temp = start; +// start = stop; +// stop = temp; +// } + float sweep = stop - start; + + // stroke as Arc2D.OPEN, fill as Arc2D.PIE + if (fill) { + //System.out.println("filla"); + arc.setArc(x, y, w, h, start, sweep, Arc2D.PIE); + fillShape(arc); + } + if (stroke) { + //System.out.println("strokey"); + arc.setArc(x, y, w, h, start, sweep, Arc2D.OPEN); + strokeShape(arc); + } + } + + + + ////////////////////////////////////////////////////////////// + + // JAVA2D SHAPE/PATH HANDLING + + + protected void fillShape(Shape s) { + if (fillGradient) { + g2.setPaint(fillGradientObject); + g2.fill(s); + } else if (fill) { + g2.setColor(fillColorObject); + g2.fill(s); + } + } + + + protected void strokeShape(Shape s) { + if (strokeGradient) { + g2.setPaint(strokeGradientObject); + g2.draw(s); + } else if (stroke) { + g2.setColor(strokeColorObject); + g2.draw(s); + } + } + + + protected void drawShape(Shape s) { + if (fillGradient) { + g2.setPaint(fillGradientObject); + g2.fill(s); + } else if (fill) { + g2.setColor(fillColorObject); + g2.fill(s); + } + if (strokeGradient) { + g2.setPaint(strokeGradientObject); + g2.draw(s); + } else if (stroke) { + g2.setColor(strokeColorObject); + g2.draw(s); + } + } + + + + ////////////////////////////////////////////////////////////// + + // BOX + + + //public void box(float size) + + + public void box(float w, float h, float d) { + showMethodWarning("box"); + } + + + + ////////////////////////////////////////////////////////////// + + // SPHERE + + + //public void sphereDetail(int res) + + + //public void sphereDetail(int ures, int vres) + + + public void sphere(float r) { + showMethodWarning("sphere"); + } + + + + ////////////////////////////////////////////////////////////// + + // BEZIER + + + //public float bezierPoint(float a, float b, float c, float d, float t) + + + //public float bezierTangent(float a, float b, float c, float d, float t) + + + //protected void bezierInitCheck() + + + //protected void bezierInit() + + + /** Ignored (not needed) in Java 2D. */ + public void bezierDetail(int detail) { + } + + + //public void bezier(float x1, float y1, + // float x2, float y2, + // float x3, float y3, + // float x4, float y4) + + + //public void bezier(float x1, float y1, float z1, + // float x2, float y2, float z2, + // float x3, float y3, float z3, + // float x4, float y4, float z4) + + + + ////////////////////////////////////////////////////////////// + + // CURVE + + + //public float curvePoint(float a, float b, float c, float d, float t) + + + //public float curveTangent(float a, float b, float c, float d, float t) + + + /** Ignored (not needed) in Java 2D. */ + public void curveDetail(int detail) { + } + + //public void curveTightness(float tightness) + + + //protected void curveInitCheck() + + + //protected void curveInit() + + + //public void curve(float x1, float y1, + // float x2, float y2, + // float x3, float y3, + // float x4, float y4) + + + //public void curve(float x1, float y1, float z1, + // float x2, float y2, float z2, + // float x3, float y3, float z3, + // float x4, float y4, float z4) + + + + ////////////////////////////////////////////////////////////// + + // SMOOTH + + + public void smooth() { + smooth = true; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BICUBIC); + } + + + public void noSmooth() { + smooth = false; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); + } + + + + ////////////////////////////////////////////////////////////// + + // IMAGE + + + //public void imageMode(int mode) + + + //public void image(PImage image, float x, float y) + + + //public void image(PImage image, float x, float y, float c, float d) + + + //public void image(PImage image, + // float a, float b, float c, float d, + // int u1, int v1, int u2, int v2) + + + /** + * Handle renderer-specific image drawing. + */ + protected void imageImpl(PImage who, + float x1, float y1, float x2, float y2, + int u1, int v1, int u2, int v2) { + // Image not ready yet, or an error + if (who.width <= 0 || who.height <= 0) return; + + if (who.getCache(this) == null) { + //System.out.println("making new image cache"); + who.setCache(this, new ImageCache(who)); + who.updatePixels(); // mark the whole thing for update + who.modified = true; + } + + ImageCache cash = (ImageCache) who.getCache(this); + // if image previously was tinted, or the color changed + // or the image was tinted, and tint is now disabled + if ((tint && !cash.tinted) || + (tint && (cash.tintedColor != tintColor)) || + (!tint && cash.tinted)) { + // for tint change, mark all pixels as needing update + who.updatePixels(); + } + + if (who.modified) { + cash.update(tint, tintColor); + who.modified = false; + } + + g2.drawImage(((ImageCache) who.getCache(this)).image, + (int) x1, (int) y1, (int) x2, (int) y2, + u1, v1, u2, v2, null); + } + + + class ImageCache { + PImage source; + boolean tinted; + int tintedColor; + int tintedPixels[]; // one row of tinted pixels + BufferedImage image; + + public ImageCache(PImage source) { + this.source = source; + // even if RGB, set the image type to ARGB, because the + // image may have an alpha value for its tint(). +// int type = BufferedImage.TYPE_INT_ARGB; + //System.out.println("making new buffered image"); +// image = new BufferedImage(source.width, source.height, type); + } + + /** + * Update the pixels of the cache image. Already determined that the tint + * has changed, or the pixels have changed, so should just go through + * with the update without further checks. + */ + public void update(boolean tint, int tintColor) { + int bufferType = BufferedImage.TYPE_INT_ARGB; + boolean opaque = (tintColor & 0xFF000000) == 0xFF000000; + if (source.format == RGB) { + if (!tint || (tint && opaque)) { + bufferType = BufferedImage.TYPE_INT_RGB; + } + } + boolean wrongType = (image != null) && (image.getType() != bufferType); + if ((image == null) || wrongType) { + image = new BufferedImage(source.width, source.height, bufferType); + } + + WritableRaster wr = image.getRaster(); + if (tint) { + if (tintedPixels == null || tintedPixels.length != source.width) { + tintedPixels = new int[source.width]; + } + int a2 = (tintColor >> 24) & 0xff; + int r2 = (tintColor >> 16) & 0xff; + int g2 = (tintColor >> 8) & 0xff; + int b2 = (tintColor) & 0xff; + + if (bufferType == BufferedImage.TYPE_INT_RGB) { + //int alpha = tintColor & 0xFF000000; + int index = 0; + for (int y = 0; y < source.height; y++) { + for (int x = 0; x < source.width; x++) { + int argb1 = source.pixels[index++]; + int r1 = (argb1 >> 16) & 0xff; + int g1 = (argb1 >> 8) & 0xff; + int b1 = (argb1) & 0xff; + + tintedPixels[x] = //0xFF000000 | + (((r2 * r1) & 0xff00) << 8) | + ((g2 * g1) & 0xff00) | + (((b2 * b1) & 0xff00) >> 8); + } + wr.setDataElements(0, y, source.width, 1, tintedPixels); + } + // could this be any slower? +// float[] scales = { tintR, tintG, tintB }; +// float[] offsets = new float[3]; +// RescaleOp op = new RescaleOp(scales, offsets, null); +// op.filter(image, image); + + } else if (bufferType == BufferedImage.TYPE_INT_ARGB) { + int index = 0; + for (int y = 0; y < source.height; y++) { + if (source.format == RGB) { + int alpha = tintColor & 0xFF000000; + for (int x = 0; x < source.width; x++) { + int argb1 = source.pixels[index++]; + int r1 = (argb1 >> 16) & 0xff; + int g1 = (argb1 >> 8) & 0xff; + int b1 = (argb1) & 0xff; + tintedPixels[x] = alpha | + (((r2 * r1) & 0xff00) << 8) | + ((g2 * g1) & 0xff00) | + (((b2 * b1) & 0xff00) >> 8); + } + } else if (source.format == ARGB) { + for (int x = 0; x < source.width; x++) { + int argb1 = source.pixels[index++]; + int a1 = (argb1 >> 24) & 0xff; + int r1 = (argb1 >> 16) & 0xff; + int g1 = (argb1 >> 8) & 0xff; + int b1 = (argb1) & 0xff; + tintedPixels[x] = + (((a2 * a1) & 0xff00) << 16) | + (((r2 * r1) & 0xff00) << 8) | + ((g2 * g1) & 0xff00) | + (((b2 * b1) & 0xff00) >> 8); + } + } else if (source.format == ALPHA) { + int lower = tintColor & 0xFFFFFF; + for (int x = 0; x < source.width; x++) { + int a1 = source.pixels[index++]; + tintedPixels[x] = + (((a2 * a1) & 0xff00) << 16) | lower; + } + } + wr.setDataElements(0, y, source.width, 1, tintedPixels); + } + // Not sure why ARGB images take the scales in this order... +// float[] scales = { tintR, tintG, tintB, tintA }; +// float[] offsets = new float[4]; +// RescaleOp op = new RescaleOp(scales, offsets, null); +// op.filter(image, image); + } + } else { + wr.setDataElements(0, 0, source.width, source.height, source.pixels); + } + this.tinted = tint; + this.tintedColor = tintColor; + } + } + + + + ////////////////////////////////////////////////////////////// + + // SHAPE + + + //public void shapeMode(int mode) + + + //public void shape(PShape shape) + + + //public void shape(PShape shape, float x, float y) + + + //public void shape(PShape shape, float x, float y, float c, float d) + + + + ////////////////////////////////////////////////////////////// + + // TEXT ATTRIBTUES + + + //public void textAlign(int align) + + + //public void textAlign(int alignX, int alignY) + + + public float textAscent() { + Font font = textFont.getFont(); + if (font == null) { + return super.textAscent(); + } + FontMetrics metrics = parent.getFontMetrics(font); + return metrics.getAscent(); + } + + + public float textDescent() { + Font font = textFont.getFont(); + if (font == null) { + return super.textDescent(); + } + FontMetrics metrics = parent.getFontMetrics(font); + return metrics.getDescent(); + } + + + //public void textFont(PFont which) + + + //public void textFont(PFont which, float size) + + + //public void textLeading(float leading) + + + //public void textMode(int mode) + + + protected boolean textModeCheck(int mode) { + return (mode == MODEL) || (mode == SCREEN); + } + + + /** + * Same as parent, but override for native version of the font. + *

+ * Also gets called by textFont, so the metrics + * will get recorded properly. + */ + public void textSize(float size) { + // if a native version available, derive this font +// if (textFontNative != null) { +// textFontNative = textFontNative.deriveFont(size); +// g2.setFont(textFontNative); +// textFontNativeMetrics = g2.getFontMetrics(textFontNative); +// } + Font font = textFont.getFont(); + if (font != null) { + Font dfont = font.deriveFont(size); + g2.setFont(dfont); + textFont.setFont(dfont); + } + + // take care of setting the textSize and textLeading vars + // this has to happen second, because it calls textAscent() + // (which requires the native font metrics to be set) + super.textSize(size); + } + + + //public float textWidth(char c) + + + //public float textWidth(String str) + + + protected float textWidthImpl(char buffer[], int start, int stop) { + Font font = textFont.getFont(); + if (font == null) { + return super.textWidthImpl(buffer, start, stop); + } + // maybe should use one of the newer/fancier functions for this? + int length = stop - start; + FontMetrics metrics = g2.getFontMetrics(font); + return metrics.charsWidth(buffer, start, length); + } + + + + ////////////////////////////////////////////////////////////// + + // TEXT + + // None of the variations of text() are overridden from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // TEXT IMPL + + + //protected void textLineAlignImpl(char buffer[], int start, int stop, + // float x, float y) + + + protected void textLineImpl(char buffer[], int start, int stop, + float x, float y) { + Font font = textFont.getFont(); + if (font == null) { + super.textLineImpl(buffer, start, stop, x, y); + return; + } + + /* + // save the current setting for text smoothing. note that this is + // different from the smooth() function, because the font smoothing + // is controlled when the font is created, not now as it's drawn. + // fixed a bug in 0116 that handled this incorrectly. + Object textAntialias = + g2.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); + + // override the current text smoothing setting based on the font + // (don't change the global smoothing settings) + g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + textFont.smooth ? + RenderingHints.VALUE_ANTIALIAS_ON : + RenderingHints.VALUE_ANTIALIAS_OFF); + */ + + Object antialias = + g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING); + if (antialias == null) { + // if smooth() and noSmooth() not called, this will be null (0120) + antialias = RenderingHints.VALUE_ANTIALIAS_DEFAULT; + } + + // override the current smoothing setting based on the font + // also changes global setting for antialiasing, but this is because it's + // not possible to enable/disable them independently in some situations. + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + textFont.smooth ? + RenderingHints.VALUE_ANTIALIAS_ON : + RenderingHints.VALUE_ANTIALIAS_OFF); + + //System.out.println("setting frac metrics"); + //g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, + // RenderingHints.VALUE_FRACTIONALMETRICS_ON); + + g2.setColor(fillColorObject); + int length = stop - start; + g2.drawChars(buffer, start, length, (int) (x + 0.5f), (int) (y + 0.5f)); + // better to use drawString() with floats? (nope, draws the same) + //g2.drawString(new String(buffer, start, length), x, y); + + // this didn't seem to help the scaling issue + // and creates garbage because of the new temporary object + //java.awt.font.GlyphVector gv = textFontNative.createGlyphVector(g2.getFontRenderContext(), new String(buffer, start, stop)); + //g2.drawGlyphVector(gv, x, y); + +// System.out.println("text() " + new String(buffer, start, stop)); + + // return to previous smoothing state if it was changed + //g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, textAntialias); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antialias); + + textX = x + textWidthImpl(buffer, start, stop); + textY = y; + textZ = 0; // this will get set by the caller if non-zero + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX STACK + + + public void pushMatrix() { + if (transformCount == transformStack.length) { + throw new RuntimeException("pushMatrix() cannot use push more than " + + transformStack.length + " times"); + } + transformStack[transformCount] = g2.getTransform(); + transformCount++; + } + + + public void popMatrix() { + if (transformCount == 0) { + throw new RuntimeException("missing a popMatrix() " + + "to go with that pushMatrix()"); + } + transformCount--; + g2.setTransform(transformStack[transformCount]); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX TRANSFORMS + + + public void translate(float tx, float ty) { + g2.translate(tx, ty); + } + + + //public void translate(float tx, float ty, float tz) + + + public void rotate(float angle) { + g2.rotate(angle); + } + + + public void rotateX(float angle) { + showDepthWarning("rotateX"); + } + + + public void rotateY(float angle) { + showDepthWarning("rotateY"); + } + + + public void rotateZ(float angle) { + showDepthWarning("rotateZ"); + } + + + public void rotate(float angle, float vx, float vy, float vz) { + showVariationWarning("rotate"); + } + + + public void scale(float s) { + g2.scale(s, s); + } + + + public void scale(float sx, float sy) { + g2.scale(sx, sy); + } + + + public void scale(float sx, float sy, float sz) { + showDepthWarningXYZ("scale"); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX MORE + + + public void resetMatrix() { + g2.setTransform(new AffineTransform()); + } + + + //public void applyMatrix(PMatrix2D source) + + + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) { + //System.out.println("PGraphicsJava2D.applyMatrix()"); + //System.out.println(new AffineTransform(n00, n10, n01, n11, n02, n12)); + g2.transform(new AffineTransform(n00, n10, n01, n11, n02, n12)); + //g2.transform(new AffineTransform(n00, n01, n02, n10, n11, n12)); + } + + + //public void applyMatrix(PMatrix3D source) + + + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + showVariationWarning("applyMatrix"); + } + + + + ////////////////////////////////////////////////////////////// + + // MATRIX GET/SET + + + public PMatrix getMatrix() { + return getMatrix((PMatrix2D) null); + } + + + public PMatrix2D getMatrix(PMatrix2D target) { + if (target == null) { + target = new PMatrix2D(); + } + g2.getTransform().getMatrix(transform); + target.set((float) transform[0], (float) transform[2], (float) transform[4], + (float) transform[1], (float) transform[3], (float) transform[5]); + return target; + } + + + public PMatrix3D getMatrix(PMatrix3D target) { + showVariationWarning("getMatrix"); + return target; + } + + + //public void setMatrix(PMatrix source) + + + public void setMatrix(PMatrix2D source) { + g2.setTransform(new AffineTransform(source.m00, source.m10, + source.m01, source.m11, + source.m02, source.m12)); + } + + + public void setMatrix(PMatrix3D source) { + showVariationWarning("setMatrix"); + } + + + public void printMatrix() { + getMatrix((PMatrix2D) null).print(); + } + + + + ////////////////////////////////////////////////////////////// + + // CAMERA and PROJECTION + + // Inherit the plaintive warnings from PGraphics + + + //public void beginCamera() + //public void endCamera() + //public void camera() + //public void camera(float eyeX, float eyeY, float eyeZ, + // float centerX, float centerY, float centerZ, + // float upX, float upY, float upZ) + //public void printCamera() + + //public void ortho() + //public void ortho(float left, float right, + // float bottom, float top, + // float near, float far) + //public void perspective() + //public void perspective(float fov, float aspect, float near, float far) + //public void frustum(float left, float right, + // float bottom, float top, + // float near, float far) + //public void printProjection() + + + + ////////////////////////////////////////////////////////////// + + // SCREEN and MODEL transforms + + + public float screenX(float x, float y) { + g2.getTransform().getMatrix(transform); + return (float)transform[0]*x + (float)transform[2]*y + (float)transform[4]; + } + + + public float screenY(float x, float y) { + g2.getTransform().getMatrix(transform); + return (float)transform[1]*x + (float)transform[3]*y + (float)transform[5]; + } + + + public float screenX(float x, float y, float z) { + showDepthWarningXYZ("screenX"); + return 0; + } + + + public float screenY(float x, float y, float z) { + showDepthWarningXYZ("screenY"); + return 0; + } + + + public float screenZ(float x, float y, float z) { + showDepthWarningXYZ("screenZ"); + return 0; + } + + + //public float modelX(float x, float y, float z) + + + //public float modelY(float x, float y, float z) + + + //public float modelZ(float x, float y, float z) + + + + ////////////////////////////////////////////////////////////// + + // STYLE + + // pushStyle(), popStyle(), style() and getStyle() inherited. + + + + ////////////////////////////////////////////////////////////// + + // STROKE CAP/JOIN/WEIGHT + + + public void strokeCap(int cap) { + super.strokeCap(cap); + strokeImpl(); + } + + + public void strokeJoin(int join) { + super.strokeJoin(join); + strokeImpl(); + } + + + public void strokeWeight(float weight) { + super.strokeWeight(weight); + strokeImpl(); + } + + + protected void strokeImpl() { + int cap = BasicStroke.CAP_BUTT; + if (strokeCap == ROUND) { + cap = BasicStroke.CAP_ROUND; + } else if (strokeCap == PROJECT) { + cap = BasicStroke.CAP_SQUARE; + } + + int join = BasicStroke.JOIN_BEVEL; + if (strokeJoin == MITER) { + join = BasicStroke.JOIN_MITER; + } else if (strokeJoin == ROUND) { + join = BasicStroke.JOIN_ROUND; + } + + g2.setStroke(new BasicStroke(strokeWeight, cap, join)); + } + + + + ////////////////////////////////////////////////////////////// + + // STROKE + + // noStroke() and stroke() inherited from PGraphics. + + + protected void strokeFromCalc() { + super.strokeFromCalc(); + strokeColorObject = new Color(strokeColor, true); + strokeGradient = false; + } + + + + ////////////////////////////////////////////////////////////// + + // TINT + + // noTint() and tint() inherited from PGraphics. + + + protected void tintFromCalc() { + super.tintFromCalc(); + // TODO actually implement tinted images + tintColorObject = new Color(tintColor, true); + } + + + + ////////////////////////////////////////////////////////////// + + // FILL + + // noFill() and fill() inherited from PGraphics. + + + protected void fillFromCalc() { + super.fillFromCalc(); + fillColorObject = new Color(fillColor, true); + fillGradient = false; + } + + + + ////////////////////////////////////////////////////////////// + + // MATERIAL PROPERTIES + + + //public void ambient(int rgb) + //public void ambient(float gray) + //public void ambient(float x, float y, float z) + //protected void ambientFromCalc() + //public void specular(int rgb) + //public void specular(float gray) + //public void specular(float x, float y, float z) + //protected void specularFromCalc() + //public void shininess(float shine) + //public void emissive(int rgb) + //public void emissive(float gray) + //public void emissive(float x, float y, float z ) + //protected void emissiveFromCalc() + + + + ////////////////////////////////////////////////////////////// + + // LIGHTS + + + //public void lights() + //public void noLights() + //public void ambientLight(float red, float green, float blue) + //public void ambientLight(float red, float green, float blue, + // float x, float y, float z) + //public void directionalLight(float red, float green, float blue, + // float nx, float ny, float nz) + //public void pointLight(float red, float green, float blue, + // float x, float y, float z) + //public void spotLight(float red, float green, float blue, + // float x, float y, float z, + // float nx, float ny, float nz, + // float angle, float concentration) + //public void lightFalloff(float constant, float linear, float quadratic) + //public void lightSpecular(float x, float y, float z) + //protected void lightPosition(int num, float x, float y, float z) + //protected void lightDirection(int num, float x, float y, float z) + + + + ////////////////////////////////////////////////////////////// + + // BACKGROUND + + // background() methods inherited from PGraphics, along with the + // PImage version of backgroundImpl(), since it just calls set(). + + + //public void backgroundImpl(PImage image) + + + int[] clearPixels; + + public void backgroundImpl() { + if (backgroundAlpha) { + // Create a small array that can be used to set the pixels several times. + // Using a single-pixel line of length 'width' is a tradeoff between + // speed (setting each pixel individually is too slow) and memory + // (an array for width*height would waste lots of memory if it stayed + // resident, and would terrify the gc if it were re-created on each trip + // to background(). + WritableRaster raster = ((BufferedImage) image).getRaster(); + if ((clearPixels == null) || (clearPixels.length < width)) { + clearPixels = new int[width]; + } + java.util.Arrays.fill(clearPixels, backgroundColor); + for (int i = 0; i < height; i++) { + raster.setDataElements(0, i, width, 1, clearPixels); + } + } else { + //new Exception().printStackTrace(System.out); + // in case people do transformations before background(), + // need to handle this with a push/reset/pop + pushMatrix(); + resetMatrix(); + g2.setColor(new Color(backgroundColor)); //, backgroundAlpha)); + g2.fillRect(0, 0, width, height); + popMatrix(); + } + } + + + + ////////////////////////////////////////////////////////////// + + // COLOR MODE + + // All colorMode() variations are inherited from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // COLOR CALC + + // colorCalc() and colorCalcARGB() inherited from PGraphics. + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE STUFFING + + // final color() variations inherited. + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE EXTRACTION + + // final methods alpha, red, green, blue, + // hue, saturation, and brightness all inherited. + + + + ////////////////////////////////////////////////////////////// + + // COLOR DATATYPE INTERPOLATION + + // both lerpColor variants inherited. + + + + ////////////////////////////////////////////////////////////// + + // BEGIN/END RAW + + + public void beginRaw(PGraphics recorderRaw) { + showMethodWarning("beginRaw"); + } + + + public void endRaw() { + showMethodWarning("endRaw"); + } + + + + ////////////////////////////////////////////////////////////// + + // WARNINGS and EXCEPTIONS + + // showWarning and showException inherited. + + + + ////////////////////////////////////////////////////////////// + + // RENDERER SUPPORT QUERIES + + + //public boolean displayable() // true + + + //public boolean is2D() // true + + + //public boolean is3D() // false + + + + ////////////////////////////////////////////////////////////// + + // PIMAGE METHODS + + + // getImage, setCache, getCache, removeCache, isModified, setModified + + + public void loadPixels() { + if ((pixels == null) || (pixels.length != width * height)) { + pixels = new int[width * height]; + } + //((BufferedImage) image).getRGB(0, 0, width, height, pixels, 0, width); + WritableRaster raster = ((BufferedImage) image).getRaster(); + raster.getDataElements(0, 0, width, height, pixels); + } + + + /** + * Update the pixels[] buffer to the PGraphics image. + *

+ * Unlike in PImage, where updatePixels() only requests that the + * update happens, in PGraphicsJava2D, this will happen immediately. + */ + public void updatePixels() { + //updatePixels(0, 0, width, height); + WritableRaster raster = ((BufferedImage) image).getRaster(); + raster.setDataElements(0, 0, width, height, pixels); + } + + + /** + * Update the pixels[] buffer to the PGraphics image. + *

+ * Unlike in PImage, where updatePixels() only requests that the + * update happens, in PGraphicsJava2D, this will happen immediately. + */ + public void updatePixels(int x, int y, int c, int d) { + //if ((x == 0) && (y == 0) && (c == width) && (d == height)) { + if ((x != 0) || (y != 0) || (c != width) || (d != height)) { + // Show a warning message, but continue anyway. + showVariationWarning("updatePixels(x, y, w, h)"); + } + updatePixels(); + } + + + public void resize(int wide, int high) { + showMethodWarning("resize"); + } + + + + ////////////////////////////////////////////////////////////// + + // GET/SET + + + static int getset[] = new int[1]; + + + public int get(int x, int y) { + if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return 0; + //return ((BufferedImage) image).getRGB(x, y); + WritableRaster raster = ((BufferedImage) image).getRaster(); + raster.getDataElements(x, y, getset); + return getset[0]; + } + + + //public PImage get(int x, int y, int w, int h) + + + public PImage getImpl(int x, int y, int w, int h) { + PImage output = new PImage(w, h); + output.parent = parent; + + // oops, the last parameter is the scan size of the *target* buffer + //((BufferedImage) image).getRGB(x, y, w, h, output.pixels, 0, w); + WritableRaster raster = ((BufferedImage) image).getRaster(); + raster.getDataElements(x, y, w, h, output.pixels); + + return output; + } + + + public PImage get() { + return get(0, 0, width, height); + } + + + public void set(int x, int y, int argb) { + if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return; +// ((BufferedImage) image).setRGB(x, y, argb); + getset[0] = argb; + WritableRaster raster = ((BufferedImage) image).getRaster(); + raster.setDataElements(x, y, getset); + } + + + protected void setImpl(int dx, int dy, int sx, int sy, int sw, int sh, + PImage src) { + WritableRaster raster = ((BufferedImage) image).getRaster(); + if ((sx == 0) && (sy == 0) && (sw == src.width) && (sh == src.height)) { + raster.setDataElements(dx, dy, src.width, src.height, src.pixels); + } else { + // TODO Optimize, incredibly inefficient to reallocate this much memory + PImage temp = src.get(sx, sy, sw, sh); + raster.setDataElements(dx, dy, temp.width, temp.height, temp.pixels); + } + } + + + + ////////////////////////////////////////////////////////////// + + // MASK + + + public void mask(int alpha[]) { + showMethodWarning("mask"); + } + + + public void mask(PImage alpha) { + showMethodWarning("mask"); + } + + + + ////////////////////////////////////////////////////////////// + + // FILTER + + // Because the PImage versions call loadPixels() and + // updatePixels(), no need to override anything here. + + + //public void filter(int kind) + + + //public void filter(int kind, float param) + + + + ////////////////////////////////////////////////////////////// + + // COPY + + + public void copy(int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh) { + if ((sw != dw) || (sh != dh)) { + // use slow version if changing size + copy(this, sx, sy, sw, sh, dx, dy, dw, dh); + + } else { + dx = dx - sx; // java2d's "dx" is the delta, not dest + dy = dy - sy; + g2.copyArea(sx, sy, sw, sh, dx, dy); + } + } + + +// public void copy(PImage src, +// int sx1, int sy1, int sx2, int sy2, +// int dx1, int dy1, int dx2, int dy2) { +// loadPixels(); +// super.copy(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); +// updatePixels(); +// } + + + + ////////////////////////////////////////////////////////////// + + // BLEND + + +// static public int blendColor(int c1, int c2, int mode) + + +// public void blend(int sx, int sy, int sw, int sh, +// int dx, int dy, int dw, int dh, int mode) + + +// public void blend(PImage src, +// int sx, int sy, int sw, int sh, +// int dx, int dy, int dw, int dh, int mode) + + + + ////////////////////////////////////////////////////////////// + + // SAVE + + +// public void save(String filename) { +// loadPixels(); +// super.save(filename); +// } +} \ No newline at end of file diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java new file mode 100644 index 000000000..ab6788be9 --- /dev/null +++ b/core/src/processing/core/PImage.java @@ -0,0 +1,2709 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.awt.image.*; +import java.io.*; +import java.util.HashMap; + +import javax.imageio.ImageIO; + + +/** + * Storage class for pixel data. This is the base class for most image and + * pixel information, such as PGraphics and the video library classes. + *

+ * Code for copying, resizing, scaling, and blending contributed + * by toxi. + *

+ */ +public class PImage implements PConstants, Cloneable { + + /** + * Format for this image, one of RGB, ARGB or ALPHA. + * note that RGB images still require 0xff in the high byte + * because of how they'll be manipulated by other functions + */ + public int format; + + public int[] pixels; + public int width, height; + + /** + * Path to parent object that will be used with save(). + * This prevents users from needing savePath() to use PImage.save(). + */ + public PApplet parent; + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** for subclasses that need to store info about the image */ + protected HashMap cacheMap; + + + /** modified portion of the image */ + protected boolean modified; + protected int mx1, my1, mx2, my2; + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + // private fields + private int fracU, ifU, fracV, ifV, u1, u2, v1, v2, sX, sY, iw, iw1, ih1; + private int ul, ll, ur, lr, cUL, cLL, cUR, cLR; + private int srcXOffset, srcYOffset; + private int r, g, b, a; + private int[] srcBuffer; + + // fixed point precision is limited to 15 bits!! + static final int PRECISIONB = 15; + static final int PRECISIONF = 1 << PRECISIONB; + static final int PREC_MAXVAL = PRECISIONF-1; + static final int PREC_ALPHA_SHIFT = 24-PRECISIONB; + static final int PREC_RED_SHIFT = 16-PRECISIONB; + + // internal kernel stuff for the gaussian blur filter + private int blurRadius; + private int blurKernelSize; + private int[] blurKernel; + private int[][] blurMult; + + + ////////////////////////////////////////////////////////////// + + + /** + * Create an empty image object, set its format to RGB. + * The pixel array is not allocated. + */ + public PImage() { + format = ARGB; // default to ARGB images for release 0116 +// cache = null; + } + + + /** + * Create a new RGB (alpha ignored) image of a specific size. + * All pixels are set to zero, meaning black, but since the + * alpha is zero, it will be transparent. + */ + public PImage(int width, int height) { + init(width, height, RGB); + + // toxi: is it maybe better to init the image with max alpha enabled? + //for(int i=0; i(); + cacheMap.put(parent, storage); + } + + + /** + * Get cache storage data for the specified renderer. Because each renderer + * will cache data in different formats, it's necessary to store cache data + * keyed by the renderer object. Otherwise, attempting to draw the same + * image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors. + * @param parent The PGraphics object (or any object, really) associated + * @return data stored for the specified parent + */ + public Object getCache(Object parent) { + if (cacheMap == null) return null; + return cacheMap.get(parent); + } + + + /** + * Remove information associated with this renderer from the cache, if any. + * @param parent The PGraphics object whose cache data should be removed + */ + public void removeCache(Object parent) { + if (cacheMap != null) { + cacheMap.remove(parent); + } + } + + + + ////////////////////////////////////////////////////////////// + + // MARKING IMAGE AS MODIFIED / FOR USE w/ GET/SET + + + public boolean isModified() { // ignore + return modified; + } + + + public void setModified() { // ignore + modified = true; + } + + + public void setModified(boolean m) { // ignore + modified = m; + } + + + /** + * Call this when you want to mess with the pixels[] array. + *

+ * For subclasses where the pixels[] buffer isn't set by default, + * this should copy all data into the pixels[] array + */ + public void loadPixels() { // ignore + } + + + /** + * Call this when finished messing with the pixels[] array. + *

+ * Mark all pixels as needing update. + */ + public void updatePixels() { // ignore + updatePixelsImpl(0, 0, width, height); + } + + + /** + * Mark the pixels in this region as needing an update. + *

+ * This is not currently used by any of the renderers, however the api + * is structured this way in the hope of being able to use this to + * speed things up in the future. + */ + public void updatePixels(int x, int y, int w, int h) { // ignore +// if (imageMode == CORNER) { // x2, y2 are w/h +// x2 += x1; +// y2 += y1; +// +// } else if (imageMode == CENTER) { +// x1 -= x2 / 2; +// y1 -= y2 / 2; +// x2 += x1; +// y2 += y1; +// } + updatePixelsImpl(x, y, w, h); + } + + + protected void updatePixelsImpl(int x, int y, int w, int h) { + int x2 = x + w; + int y2 = y + h; + + if (!modified) { + mx1 = x; + mx2 = x2; + my1 = y; + my2 = y2; + modified = true; + + } else { + if (x < mx1) mx1 = x; + if (x > mx2) mx2 = x; + if (y < my1) my1 = y; + if (y > my2) my2 = y; + + if (x2 < mx1) mx1 = x2; + if (x2 > mx2) mx2 = x2; + if (y2 < my1) my1 = y2; + if (y2 > my2) my2 = y2; + } + } + + + + ////////////////////////////////////////////////////////////// + + // COPYING IMAGE DATA + + + /** + * Duplicate an image, returns new PImage object. + * The pixels[] array for the new object will be unique + * and recopied from the source image. This is implemented as an + * override of Object.clone(). We recommend using get() instead, + * because it prevents you from needing to catch the + * CloneNotSupportedException, and from doing a cast from the result. + */ + public Object clone() throws CloneNotSupportedException { // ignore + PImage c = (PImage) super.clone(); + + // super.clone() will only copy the reference to the pixels + // array, so this will do a proper duplication of it instead. + c.pixels = new int[width * height]; + System.arraycopy(pixels, 0, c.pixels, 0, pixels.length); + + // return the goods + return c; + } + + + /** + * Resize this image to a new width and height. + * Use 0 for wide or high to make that dimension scale proportionally. + */ + public void resize(int wide, int high) { // ignore + // Make sure that the pixels[] array is valid + loadPixels(); + + if (wide <= 0 && high <= 0) { + width = 0; // Gimme a break, don't waste my time + height = 0; + pixels = new int[0]; + + } else { + if (wide == 0) { // Use height to determine relative size + float diff = (float) high / (float) height; + wide = (int) (width * diff); + } else if (high == 0) { // Use the width to determine relative size + float diff = (float) wide / (float) width; + high = (int) (height * diff); + } + PImage temp = new PImage(wide, high, this.format); + temp.copy(this, 0, 0, width, height, 0, 0, wide, high); + this.width = wide; + this.height = high; + this.pixels = temp.pixels; + } + // Mark the pixels array as altered + updatePixels(); + } + + + + ////////////////////////////////////////////////////////////// + + // GET/SET PIXELS + + + /** + * Returns an ARGB "color" type (a packed 32 bit int with the color. + * If the coordinate is outside the image, zero is returned + * (black, but completely transparent). + *

+ * If the image is in RGB format (i.e. on a PVideo object), + * the value will get its high bits set, just to avoid cases where + * they haven't been set already. + *

+ * If the image is in ALPHA format, this returns a white with its + * alpha value set. + *

+ * This function is included primarily for beginners. It is quite + * slow because it has to check to see if the x, y that was provided + * is inside the bounds, and then has to check to see what image + * type it is. If you want things to be more efficient, access the + * pixels[] array directly. + */ + public int get(int x, int y) { + if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return 0; + + switch (format) { + case RGB: + return pixels[y*width + x] | 0xff000000; + + case ARGB: + return pixels[y*width + x]; + + case ALPHA: + return (pixels[y*width + x] << 24) | 0xffffff; + } + return 0; + } + + + /** + * Grab a subsection of a PImage, and copy it into a fresh PImage. + * As of release 0149, no longer honors imageMode() for the coordinates. + */ + public PImage get(int x, int y, int w, int h) { + /* + if (imageMode == CORNERS) { // if CORNER, do nothing + //x2 += x1; y2 += y1; + // w/h are x2/y2 in this case, bring em down to size + w = (w - x); + h = (h - y); + } else if (imageMode == CENTER) { + x -= w/2; + y -= h/2; + } + */ + + if (x < 0) { + w += x; // clip off the left edge + x = 0; + } + if (y < 0) { + h += y; // clip off some of the height + y = 0; + } + + if (x + w > width) w = width - x; + if (y + h > height) h = height - y; + + return getImpl(x, y, w, h); + } + + + /** + * Internal function to actually handle getting a block of pixels that + * has already been properly cropped to a valid region. That is, x/y/w/h + * are guaranteed to be inside the image space, so the implementation can + * use the fastest possible pixel copying method. + */ + protected PImage getImpl(int x, int y, int w, int h) { + PImage newbie = new PImage(w, h, format); + newbie.parent = parent; + + int index = y*width + x; + int index2 = 0; + for (int row = y; row < y+h; row++) { + System.arraycopy(pixels, index, newbie.pixels, index2, w); + index += width; + index2 += w; + } + return newbie; + } + + + /** + * Returns a copy of this PImage. Equivalent to get(0, 0, width, height). + */ + public PImage get() { + try { + return (PImage) clone(); + } catch (CloneNotSupportedException e) { + return null; + } + } + + + /** + * Set a single pixel to the specified color. + */ + public void set(int x, int y, int c) { + if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return; + pixels[y*width + x] = c; + updatePixelsImpl(x, y, x+1, y+1); // slow? + } + + + /** + * Efficient method of drawing an image's pixels directly to this surface. + * No variations are employed, meaning that any scale, tint, or imageMode + * settings will be ignored. + */ + public void set(int x, int y, PImage src) { + int sx = 0; + int sy = 0; + int sw = src.width; + int sh = src.height; + +// if (imageMode == CENTER) { +// x -= src.width/2; +// y -= src.height/2; +// } + if (x < 0) { // off left edge + sx -= x; + sw += x; + x = 0; + } + if (y < 0) { // off top edge + sy -= y; + sh += y; + y = 0; + } + if (x + sw > width) { // off right edge + sw = width - x; + } + if (y + sh > height) { // off bottom edge + sh = height - y; + } + + // this could be nonexistant + if ((sw <= 0) || (sh <= 0)) return; + + setImpl(x, y, sx, sy, sw, sh, src); + } + + + /** + * Internal function to actually handle setting a block of pixels that + * has already been properly cropped from the image to a valid region. + */ + protected void setImpl(int dx, int dy, int sx, int sy, int sw, int sh, + PImage src) { + int srcOffset = sy * src.width + sx; + int dstOffset = dy * width + dx; + + for (int y = sy; y < sy + sh; y++) { + System.arraycopy(src.pixels, srcOffset, pixels, dstOffset, sw); + srcOffset += src.width; + dstOffset += width; + } + updatePixelsImpl(sx, sy, sx+sw, sy+sh); + } + + + + ////////////////////////////////////////////////////////////// + + // ALPHA CHANNEL + + + /** + * Set alpha channel for an image. Black colors in the source + * image will make the destination image completely transparent, + * and white will make things fully opaque. Gray values will + * be in-between steps. + *

+ * Strictly speaking the "blue" value from the source image is + * used as the alpha color. For a fully grayscale image, this + * is correct, but for a color image it's not 100% accurate. + * For a more accurate conversion, first use filter(GRAY) + * which will make the image into a "correct" grayscake by + * performing a proper luminance-based conversion. + */ + public void mask(int alpha[]) { + loadPixels(); + // don't execute if mask image is different size + if (alpha.length != pixels.length) { + throw new RuntimeException("The PImage used with mask() must be " + + "the same size as the applet."); + } + for (int i = 0; i < pixels.length; i++) { + pixels[i] = ((alpha[i] & 0xff) << 24) | (pixels[i] & 0xffffff); + } + format = ARGB; + updatePixels(); + } + + + /** + * Set alpha channel for an image using another image as the source. + */ + public void mask(PImage alpha) { + mask(alpha.pixels); + } + + + + ////////////////////////////////////////////////////////////// + + // IMAGE FILTERS + + + /** + * Method to apply a variety of basic filters to this image. + *

+ *

    + *
  • filter(BLUR) provides a basic blur. + *
  • filter(GRAY) converts the image to grayscale based on luminance. + *
  • filter(INVERT) will invert the color components in the image. + *
  • filter(OPAQUE) set all the high bits in the image to opaque + *
  • filter(THRESHOLD) converts the image to black and white. + *
  • filter(DILATE) grow white/light areas + *
  • filter(ERODE) shrink white/light areas + *
+ * Luminance conversion code contributed by + * toxi + *

+ * Gaussian blur code contributed by + * Mario Klingemann + */ + public void filter(int kind) { + loadPixels(); + + switch (kind) { + case BLUR: + // TODO write basic low-pass filter blur here + // what does photoshop do on the edges with this guy? + // better yet.. why bother? just use gaussian with radius 1 + filter(BLUR, 1); + break; + + case GRAY: + if (format == ALPHA) { + // for an alpha image, convert it to an opaque grayscale + for (int i = 0; i < pixels.length; i++) { + int col = 255 - pixels[i]; + pixels[i] = 0xff000000 | (col << 16) | (col << 8) | col; + } + format = RGB; + + } else { + // Converts RGB image data into grayscale using + // weighted RGB components, and keeps alpha channel intact. + // [toxi 040115] + for (int i = 0; i < pixels.length; i++) { + int col = pixels[i]; + // luminance = 0.3*red + 0.59*green + 0.11*blue + // 0.30 * 256 = 77 + // 0.59 * 256 = 151 + // 0.11 * 256 = 28 + int lum = (77*(col>>16&0xff) + 151*(col>>8&0xff) + 28*(col&0xff))>>8; + pixels[i] = (col & ALPHA_MASK) | lum<<16 | lum<<8 | lum; + } + } + break; + + case INVERT: + for (int i = 0; i < pixels.length; i++) { + //pixels[i] = 0xff000000 | + pixels[i] ^= 0xffffff; + } + break; + + case POSTERIZE: + throw new RuntimeException("Use filter(POSTERIZE, int levels) " + + "instead of filter(POSTERIZE)"); + + case RGB: + for (int i = 0; i < pixels.length; i++) { + pixels[i] |= 0xff000000; + } + format = RGB; + break; + + case THRESHOLD: + filter(THRESHOLD, 0.5f); + break; + + // [toxi20050728] added new filters + case ERODE: + dilate(true); + break; + + case DILATE: + dilate(false); + break; + } + updatePixels(); // mark as modified + } + + + /** + * Method to apply a variety of basic filters to this image. + * These filters all take a parameter. + *

+ *

    + *
  • filter(BLUR, int radius) performs a gaussian blur of the + * specified radius. + *
  • filter(POSTERIZE, int levels) will posterize the image to + * between 2 and 255 levels. + *
  • filter(THRESHOLD, float center) allows you to set the + * center point for the threshold. It takes a value from 0 to 1.0. + *
+ * Gaussian blur code contributed by + * Mario Klingemann + * and later updated by toxi for better speed. + */ + public void filter(int kind, float param) { + loadPixels(); + + switch (kind) { + case BLUR: + if (format == ALPHA) + blurAlpha(param); + else if (format == ARGB) + blurARGB(param); + else + blurRGB(param); + break; + + case GRAY: + throw new RuntimeException("Use filter(GRAY) instead of " + + "filter(GRAY, param)"); + + case INVERT: + throw new RuntimeException("Use filter(INVERT) instead of " + + "filter(INVERT, param)"); + + case OPAQUE: + throw new RuntimeException("Use filter(OPAQUE) instead of " + + "filter(OPAQUE, param)"); + + case POSTERIZE: + int levels = (int)param; + if ((levels < 2) || (levels > 255)) { + throw new RuntimeException("Levels must be between 2 and 255 for " + + "filter(POSTERIZE, levels)"); + } + int levels1 = levels - 1; + for (int i = 0; i < pixels.length; i++) { + int rlevel = (pixels[i] >> 16) & 0xff; + int glevel = (pixels[i] >> 8) & 0xff; + int blevel = pixels[i] & 0xff; + rlevel = (((rlevel * levels) >> 8) * 255) / levels1; + glevel = (((glevel * levels) >> 8) * 255) / levels1; + blevel = (((blevel * levels) >> 8) * 255) / levels1; + pixels[i] = ((0xff000000 & pixels[i]) | + (rlevel << 16) | + (glevel << 8) | + blevel); + } + break; + + case THRESHOLD: // greater than or equal to the threshold + int thresh = (int) (param * 255); + for (int i = 0; i < pixels.length; i++) { + int max = Math.max((pixels[i] & RED_MASK) >> 16, + Math.max((pixels[i] & GREEN_MASK) >> 8, + (pixels[i] & BLUE_MASK))); + pixels[i] = (pixels[i] & ALPHA_MASK) | + ((max < thresh) ? 0x000000 : 0xffffff); + } + break; + + // [toxi20050728] added new filters + case ERODE: + throw new RuntimeException("Use filter(ERODE) instead of " + + "filter(ERODE, param)"); + case DILATE: + throw new RuntimeException("Use filter(DILATE) instead of " + + "filter(DILATE, param)"); + } + updatePixels(); // mark as modified + } + + + /** + * Optimized code for building the blur kernel. + * further optimized blur code (approx. 15% for radius=20) + * bigger speed gains for larger radii (~30%) + * added support for various image types (ALPHA, RGB, ARGB) + * [toxi 050728] + */ + protected void buildBlurKernel(float r) { + int radius = (int) (r * 3.5f); + radius = (radius < 1) ? 1 : ((radius < 248) ? radius : 248); + if (blurRadius != radius) { + blurRadius = radius; + blurKernelSize = 1 + blurRadius<<1; + blurKernel = new int[blurKernelSize]; + blurMult = new int[blurKernelSize][256]; + + int bk,bki; + int[] bm,bmi; + + for (int i = 1, radiusi = radius - 1; i < radius; i++) { + blurKernel[radius+i] = blurKernel[radiusi] = bki = radiusi * radiusi; + bm=blurMult[radius+i]; + bmi=blurMult[radiusi--]; + for (int j = 0; j < 256; j++) + bm[j] = bmi[j] = bki*j; + } + bk = blurKernel[radius] = radius * radius; + bm = blurMult[radius]; + for (int j = 0; j < 256; j++) + bm[j] = bk*j; + } + } + + + protected void blurAlpha(float r) { + int sum, cb; + int read, ri, ym, ymi, bk0; + int b2[] = new int[pixels.length]; + int yi = 0; + + buildBlurKernel(r); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + //cb = cg = cr = sum = 0; + cb = sum = 0; + read = x - blurRadius; + if (read<0) { + bk0=-read; + read=0; + } else { + if (read >= width) + break; + bk0=0; + } + for (int i = bk0; i < blurKernelSize; i++) { + if (read >= width) + break; + int c = pixels[read + yi]; + int[] bm=blurMult[i]; + cb += bm[c & BLUE_MASK]; + sum += blurKernel[i]; + read++; + } + ri = yi + x; + b2[ri] = cb / sum; + } + yi += width; + } + + yi = 0; + ym=-blurRadius; + ymi=ym*width; + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + //cb = cg = cr = sum = 0; + cb = sum = 0; + if (ym<0) { + bk0 = ri = -ym; + read = x; + } else { + if (ym >= height) + break; + bk0 = 0; + ri = ym; + read = x + ymi; + } + for (int i = bk0; i < blurKernelSize; i++) { + if (ri >= height) + break; + int[] bm=blurMult[i]; + cb += bm[b2[read]]; + sum += blurKernel[i]; + ri++; + read += width; + } + pixels[x+yi] = (cb/sum); + } + yi += width; + ymi += width; + ym++; + } + } + + + protected void blurRGB(float r) { + int sum, cr, cg, cb; //, k; + int /*pixel,*/ read, ri, /*roff,*/ ym, ymi, /*riw,*/ bk0; + int r2[] = new int[pixels.length]; + int g2[] = new int[pixels.length]; + int b2[] = new int[pixels.length]; + int yi = 0; + + buildBlurKernel(r); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + cb = cg = cr = sum = 0; + read = x - blurRadius; + if (read<0) { + bk0=-read; + read=0; + } else { + if (read >= width) + break; + bk0=0; + } + for (int i = bk0; i < blurKernelSize; i++) { + if (read >= width) + break; + int c = pixels[read + yi]; + int[] bm=blurMult[i]; + cr += bm[(c & RED_MASK) >> 16]; + cg += bm[(c & GREEN_MASK) >> 8]; + cb += bm[c & BLUE_MASK]; + sum += blurKernel[i]; + read++; + } + ri = yi + x; + r2[ri] = cr / sum; + g2[ri] = cg / sum; + b2[ri] = cb / sum; + } + yi += width; + } + + yi = 0; + ym=-blurRadius; + ymi=ym*width; + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + cb = cg = cr = sum = 0; + if (ym<0) { + bk0 = ri = -ym; + read = x; + } else { + if (ym >= height) + break; + bk0 = 0; + ri = ym; + read = x + ymi; + } + for (int i = bk0; i < blurKernelSize; i++) { + if (ri >= height) + break; + int[] bm=blurMult[i]; + cr += bm[r2[read]]; + cg += bm[g2[read]]; + cb += bm[b2[read]]; + sum += blurKernel[i]; + ri++; + read += width; + } + pixels[x+yi] = 0xff000000 | (cr/sum)<<16 | (cg/sum)<<8 | (cb/sum); + } + yi += width; + ymi += width; + ym++; + } + } + + + protected void blurARGB(float r) { + int sum, cr, cg, cb, ca; + int /*pixel,*/ read, ri, /*roff,*/ ym, ymi, /*riw,*/ bk0; + int wh = pixels.length; + int r2[] = new int[wh]; + int g2[] = new int[wh]; + int b2[] = new int[wh]; + int a2[] = new int[wh]; + int yi = 0; + + buildBlurKernel(r); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + cb = cg = cr = ca = sum = 0; + read = x - blurRadius; + if (read<0) { + bk0=-read; + read=0; + } else { + if (read >= width) + break; + bk0=0; + } + for (int i = bk0; i < blurKernelSize; i++) { + if (read >= width) + break; + int c = pixels[read + yi]; + int[] bm=blurMult[i]; + ca += bm[(c & ALPHA_MASK) >>> 24]; + cr += bm[(c & RED_MASK) >> 16]; + cg += bm[(c & GREEN_MASK) >> 8]; + cb += bm[c & BLUE_MASK]; + sum += blurKernel[i]; + read++; + } + ri = yi + x; + a2[ri] = ca / sum; + r2[ri] = cr / sum; + g2[ri] = cg / sum; + b2[ri] = cb / sum; + } + yi += width; + } + + yi = 0; + ym=-blurRadius; + ymi=ym*width; + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + cb = cg = cr = ca = sum = 0; + if (ym<0) { + bk0 = ri = -ym; + read = x; + } else { + if (ym >= height) + break; + bk0 = 0; + ri = ym; + read = x + ymi; + } + for (int i = bk0; i < blurKernelSize; i++) { + if (ri >= height) + break; + int[] bm=blurMult[i]; + ca += bm[a2[read]]; + cr += bm[r2[read]]; + cg += bm[g2[read]]; + cb += bm[b2[read]]; + sum += blurKernel[i]; + ri++; + read += width; + } + pixels[x+yi] = (ca/sum)<<24 | (cr/sum)<<16 | (cg/sum)<<8 | (cb/sum); + } + yi += width; + ymi += width; + ym++; + } + } + + + /** + * Generic dilate/erode filter using luminance values + * as decision factor. [toxi 050728] + */ + protected void dilate(boolean isInverted) { + int currIdx=0; + int maxIdx=pixels.length; + int[] out=new int[maxIdx]; + + if (!isInverted) { + // erosion (grow light areas) + while (currIdx=maxRowIdx) + idxRight=currIdx; + if (idxUp<0) + idxUp=0; + if (idxDown>=maxIdx) + idxDown=currIdx; + + int colUp=pixels[idxUp]; + int colLeft=pixels[idxLeft]; + int colDown=pixels[idxDown]; + int colRight=pixels[idxRight]; + + // compute luminance + int currLum = + 77*(colOrig>>16&0xff) + 151*(colOrig>>8&0xff) + 28*(colOrig&0xff); + int lumLeft = + 77*(colLeft>>16&0xff) + 151*(colLeft>>8&0xff) + 28*(colLeft&0xff); + int lumRight = + 77*(colRight>>16&0xff) + 151*(colRight>>8&0xff) + 28*(colRight&0xff); + int lumUp = + 77*(colUp>>16&0xff) + 151*(colUp>>8&0xff) + 28*(colUp&0xff); + int lumDown = + 77*(colDown>>16&0xff) + 151*(colDown>>8&0xff) + 28*(colDown&0xff); + + if (lumLeft>currLum) { + colOut=colLeft; + currLum=lumLeft; + } + if (lumRight>currLum) { + colOut=colRight; + currLum=lumRight; + } + if (lumUp>currLum) { + colOut=colUp; + currLum=lumUp; + } + if (lumDown>currLum) { + colOut=colDown; + currLum=lumDown; + } + out[currIdx++]=colOut; + } + } + } else { + // dilate (grow dark areas) + while (currIdx=maxRowIdx) + idxRight=currIdx; + if (idxUp<0) + idxUp=0; + if (idxDown>=maxIdx) + idxDown=currIdx; + + int colUp=pixels[idxUp]; + int colLeft=pixels[idxLeft]; + int colDown=pixels[idxDown]; + int colRight=pixels[idxRight]; + + // compute luminance + int currLum = + 77*(colOrig>>16&0xff) + 151*(colOrig>>8&0xff) + 28*(colOrig&0xff); + int lumLeft = + 77*(colLeft>>16&0xff) + 151*(colLeft>>8&0xff) + 28*(colLeft&0xff); + int lumRight = + 77*(colRight>>16&0xff) + 151*(colRight>>8&0xff) + 28*(colRight&0xff); + int lumUp = + 77*(colUp>>16&0xff) + 151*(colUp>>8&0xff) + 28*(colUp&0xff); + int lumDown = + 77*(colDown>>16&0xff) + 151*(colDown>>8&0xff) + 28*(colDown&0xff); + + if (lumLeft + *
  • REPLACE - destination colour equals colour of source pixel: C = A. + * Sometimes called "Normal" or "Copy" in other software. + * + *
  • BLEND - linear interpolation of colours: + * C = A*factor + B + * + *
  • ADD - additive blending with white clip: + * C = min(A*factor + B, 255). + * Clipped to 0..255, Photoshop calls this "Linear Burn", + * and Director calls it "Add Pin". + * + *
  • SUBTRACT - substractive blend with black clip: + * C = max(B - A*factor, 0). + * Clipped to 0..255, Photoshop calls this "Linear Dodge", + * and Director calls it "Subtract Pin". + * + *
  • DARKEST - only the darkest colour succeeds: + * C = min(A*factor, B). + * Illustrator calls this "Darken". + * + *
  • LIGHTEST - only the lightest colour succeeds: + * C = max(A*factor, B). + * Illustrator calls this "Lighten". + * + *
  • DIFFERENCE - subtract colors from underlying image. + * + *
  • EXCLUSION - similar to DIFFERENCE, but less extreme. + * + *
  • MULTIPLY - Multiply the colors, result will always be darker. + * + *
  • SCREEN - Opposite multiply, uses inverse values of the colors. + * + *
  • OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, + * and screens light values. + * + *
  • HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower. + * + *
  • SOFT_LIGHT - Mix of DARKEST and LIGHTEST. + * Works like OVERLAY, but not as harsh. + * + *
  • DODGE - Lightens light tones and increases contrast, ignores darks. + * Called "Color Dodge" in Illustrator and Photoshop. + * + *
  • BURN - Darker areas are applied, increasing contrast, ignores lights. + * Called "Color Burn" in Illustrator and Photoshop. + * + *

    A useful reference for blending modes and their algorithms can be + * found in the SVG + * specification.

    + *

    It is important to note that Processing uses "fast" code, not + * necessarily "correct" code. No biggie, most software does. A nitpicker + * can find numerous "off by 1 division" problems in the blend code where + * >>8 or >>7 is used when strictly speaking + * /255.0 or /127.0 should have been used.

    + *

    For instance, exclusion (not intended for real-time use) reads + * r1 + r2 - ((2 * r1 * r2) / 255) because 255 == 1.0 + * not 256 == 1.0. In other words, (255*255)>>8 is not + * the same as (255*255)/255. But for real-time use the shifts + * are preferrable, and the difference is insignificant for applications + * built with Processing.

    + */ + static public int blendColor(int c1, int c2, int mode) { + switch (mode) { + case REPLACE: return c2; + case BLEND: return blend_blend(c1, c2); + + case ADD: return blend_add_pin(c1, c2); + case SUBTRACT: return blend_sub_pin(c1, c2); + + case LIGHTEST: return blend_lightest(c1, c2); + case DARKEST: return blend_darkest(c1, c2); + + case DIFFERENCE: return blend_difference(c1, c2); + case EXCLUSION: return blend_exclusion(c1, c2); + + case MULTIPLY: return blend_multiply(c1, c2); + case SCREEN: return blend_screen(c1, c2); + + case HARD_LIGHT: return blend_hard_light(c1, c2); + case SOFT_LIGHT: return blend_soft_light(c1, c2); + case OVERLAY: return blend_overlay(c1, c2); + + case DODGE: return blend_dodge(c1, c2); + case BURN: return blend_burn(c1, c2); + } + return 0; + } + + + /** + * Blends one area of this image to another area. + * @see processing.core.PImage#blendColor(int,int,int) + */ + public void blend(int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh, int mode) { + blend(this, sx, sy, sw, sh, dx, dy, dw, dh, mode); + } + + + /** + * Copies area of one image into another PImage object. + * @see processing.core.PImage#blendColor(int,int,int) + */ + public void blend(PImage src, + int sx, int sy, int sw, int sh, + int dx, int dy, int dw, int dh, int mode) { + /* + if (imageMode == CORNER) { // if CORNERS, do nothing + sx2 += sx1; + sy2 += sy1; + dx2 += dx1; + dy2 += dy1; + + } else if (imageMode == CENTER) { + sx1 -= sx2 / 2f; + sy1 -= sy2 / 2f; + sx2 += sx1; + sy2 += sy1; + dx1 -= dx2 / 2f; + dy1 -= dy2 / 2f; + dx2 += dx1; + dy2 += dy1; + } + */ + int sx2 = sx + sw; + int sy2 = sy + sh; + int dx2 = dx + dw; + int dy2 = dy + dh; + + loadPixels(); + if (src == this) { + if (intersect(sx, sy, sx2, sy2, dx, dy, dx2, dy2)) { + blit_resize(get(sx, sy, sx2 - sx, sy2 - sy), + 0, 0, sx2 - sx - 1, sy2 - sy - 1, + pixels, width, height, dx, dy, dx2, dy2, mode); + } else { + // same as below, except skip the loadPixels() because it'd be redundant + blit_resize(src, sx, sy, sx2, sy2, + pixels, width, height, dx, dy, dx2, dy2, mode); + } + } else { + src.loadPixels(); + blit_resize(src, sx, sy, sx2, sy2, + pixels, width, height, dx, dy, dx2, dy2, mode); + //src.updatePixels(); + } + updatePixels(); + } + + + /** + * Check to see if two rectangles intersect one another + */ + private boolean intersect(int sx1, int sy1, int sx2, int sy2, + int dx1, int dy1, int dx2, int dy2) { + int sw = sx2 - sx1 + 1; + int sh = sy2 - sy1 + 1; + int dw = dx2 - dx1 + 1; + int dh = dy2 - dy1 + 1; + + if (dx1 < sx1) { + dw += dx1 - sx1; + if (dw > sw) { + dw = sw; + } + } else { + int w = sw + sx1 - dx1; + if (dw > w) { + dw = w; + } + } + if (dy1 < sy1) { + dh += dy1 - sy1; + if (dh > sh) { + dh = sh; + } + } else { + int h = sh + sy1 - dy1; + if (dh > h) { + dh = h; + } + } + return !(dw <= 0 || dh <= 0); + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Internal blitter/resizer/copier from toxi. + * Uses bilinear filtering if smooth() has been enabled + * 'mode' determines the blending mode used in the process. + */ + private void blit_resize(PImage img, + int srcX1, int srcY1, int srcX2, int srcY2, + int[] destPixels, int screenW, int screenH, + int destX1, int destY1, int destX2, int destY2, + int mode) { + if (srcX1 < 0) srcX1 = 0; + if (srcY1 < 0) srcY1 = 0; + if (srcX2 >= img.width) srcX2 = img.width - 1; + if (srcY2 >= img.height) srcY2 = img.height - 1; + + int srcW = srcX2 - srcX1; + int srcH = srcY2 - srcY1; + int destW = destX2 - destX1; + int destH = destY2 - destY1; + + boolean smooth = true; // may as well go with the smoothing these days + + if (!smooth) { + srcW++; srcH++; + } + + if (destW <= 0 || destH <= 0 || + srcW <= 0 || srcH <= 0 || + destX1 >= screenW || destY1 >= screenH || + srcX1 >= img.width || srcY1 >= img.height) { + return; + } + + int dx = (int) (srcW / (float) destW * PRECISIONF); + int dy = (int) (srcH / (float) destH * PRECISIONF); + + srcXOffset = (int) (destX1 < 0 ? -destX1 * dx : srcX1 * PRECISIONF); + srcYOffset = (int) (destY1 < 0 ? -destY1 * dy : srcY1 * PRECISIONF); + + if (destX1 < 0) { + destW += destX1; + destX1 = 0; + } + if (destY1 < 0) { + destH += destY1; + destY1 = 0; + } + + destW = low(destW, screenW - destX1); + destH = low(destH, screenH - destY1); + + int destOffset = destY1 * screenW + destX1; + srcBuffer = img.pixels; + + if (smooth) { + // use bilinear filtering + iw = img.width; + iw1 = img.width - 1; + ih1 = img.height - 1; + + switch (mode) { + + case BLEND: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + // davbol - renamed old blend_multiply to blend_blend + destPixels[destOffset + x] = + blend_blend(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case ADD: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_add_pin(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case SUBTRACT: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_sub_pin(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case LIGHTEST: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_lightest(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case DARKEST: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_darkest(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case REPLACE: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = filter_bilinear(); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case DIFFERENCE: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_difference(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case EXCLUSION: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_exclusion(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case MULTIPLY: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_multiply(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case SCREEN: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_screen(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case OVERLAY: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_overlay(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case HARD_LIGHT: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_hard_light(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case SOFT_LIGHT: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_soft_light(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + // davbol - proposed 2007-01-09 + case DODGE: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_dodge(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case BURN: + for (int y = 0; y < destH; y++) { + filter_new_scanline(); + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_burn(destPixels[destOffset + x], filter_bilinear()); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + } + + } else { + // nearest neighbour scaling (++fast!) + switch (mode) { + + case BLEND: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + // davbol - renamed old blend_multiply to blend_blend + destPixels[destOffset + x] = + blend_blend(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case ADD: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_add_pin(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case SUBTRACT: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_sub_pin(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case LIGHTEST: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_lightest(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case DARKEST: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_darkest(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case REPLACE: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = srcBuffer[sY + (sX >> PRECISIONB)]; + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case DIFFERENCE: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_difference(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case EXCLUSION: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_exclusion(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case MULTIPLY: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_multiply(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case SCREEN: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_screen(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case OVERLAY: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_overlay(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case HARD_LIGHT: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_hard_light(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case SOFT_LIGHT: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_soft_light(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + // davbol - proposed 2007-01-09 + case DODGE: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_dodge(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + case BURN: + for (int y = 0; y < destH; y++) { + sX = srcXOffset; + sY = (srcYOffset >> PRECISIONB) * img.width; + for (int x = 0; x < destW; x++) { + destPixels[destOffset + x] = + blend_burn(destPixels[destOffset + x], + srcBuffer[sY + (sX >> PRECISIONB)]); + sX += dx; + } + destOffset += screenW; + srcYOffset += dy; + } + break; + + } + } + } + + + private void filter_new_scanline() { + sX = srcXOffset; + fracV = srcYOffset & PREC_MAXVAL; + ifV = PREC_MAXVAL - fracV; + v1 = (srcYOffset >> PRECISIONB) * iw; + v2 = low((srcYOffset >> PRECISIONB) + 1, ih1) * iw; + } + + + private int filter_bilinear() { + fracU = sX & PREC_MAXVAL; + ifU = PREC_MAXVAL - fracU; + ul = (ifU * ifV) >> PRECISIONB; + ll = (ifU * fracV) >> PRECISIONB; + ur = (fracU * ifV) >> PRECISIONB; + lr = (fracU * fracV) >> PRECISIONB; + u1 = (sX >> PRECISIONB); + u2 = low(u1 + 1, iw1); + + // get color values of the 4 neighbouring texels + cUL = srcBuffer[v1 + u1]; + cUR = srcBuffer[v1 + u2]; + cLL = srcBuffer[v2 + u1]; + cLR = srcBuffer[v2 + u2]; + + r = ((ul*((cUL&RED_MASK)>>16) + ll*((cLL&RED_MASK)>>16) + + ur*((cUR&RED_MASK)>>16) + lr*((cLR&RED_MASK)>>16)) + << PREC_RED_SHIFT) & RED_MASK; + + g = ((ul*(cUL&GREEN_MASK) + ll*(cLL&GREEN_MASK) + + ur*(cUR&GREEN_MASK) + lr*(cLR&GREEN_MASK)) + >>> PRECISIONB) & GREEN_MASK; + + b = (ul*(cUL&BLUE_MASK) + ll*(cLL&BLUE_MASK) + + ur*(cUR&BLUE_MASK) + lr*(cLR&BLUE_MASK)) + >>> PRECISIONB; + + a = ((ul*((cUL&ALPHA_MASK)>>>24) + ll*((cLL&ALPHA_MASK)>>>24) + + ur*((cUR&ALPHA_MASK)>>>24) + lr*((cLR&ALPHA_MASK)>>>24)) + << PREC_ALPHA_SHIFT) & ALPHA_MASK; + + return a | r | g | b; + } + + + + ////////////////////////////////////////////////////////////// + + // internal blending methods + + + private static int low(int a, int b) { + return (a < b) ? a : b; + } + + + private static int high(int a, int b) { + return (a > b) ? a : b; + } + + // davbol - added peg helper, equiv to constrain(n,0,255) + private static int peg(int n) { + return (n < 0) ? 0 : ((n > 255) ? 255 : n); + } + + private static int mix(int a, int b, int f) { + return a + (((b - a) * f) >> 8); + } + + + + ///////////////////////////////////////////////////////////// + + // BLEND MODE IMPLEMENTIONS + + + private static int blend_blend(int a, int b) { + int f = (b & ALPHA_MASK) >>> 24; + + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + mix(a & RED_MASK, b & RED_MASK, f) & RED_MASK | + mix(a & GREEN_MASK, b & GREEN_MASK, f) & GREEN_MASK | + mix(a & BLUE_MASK, b & BLUE_MASK, f)); + } + + + /** + * additive blend with clipping + */ + private static int blend_add_pin(int a, int b) { + int f = (b & ALPHA_MASK) >>> 24; + + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + low(((a & RED_MASK) + + ((b & RED_MASK) >> 8) * f), RED_MASK) & RED_MASK | + low(((a & GREEN_MASK) + + ((b & GREEN_MASK) >> 8) * f), GREEN_MASK) & GREEN_MASK | + low((a & BLUE_MASK) + + (((b & BLUE_MASK) * f) >> 8), BLUE_MASK)); + } + + + /** + * subtractive blend with clipping + */ + private static int blend_sub_pin(int a, int b) { + int f = (b & ALPHA_MASK) >>> 24; + + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + high(((a & RED_MASK) - ((b & RED_MASK) >> 8) * f), + GREEN_MASK) & RED_MASK | + high(((a & GREEN_MASK) - ((b & GREEN_MASK) >> 8) * f), + BLUE_MASK) & GREEN_MASK | + high((a & BLUE_MASK) - (((b & BLUE_MASK) * f) >> 8), 0)); + } + + + /** + * only returns the blended lightest colour + */ + private static int blend_lightest(int a, int b) { + int f = (b & ALPHA_MASK) >>> 24; + + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + high(a & RED_MASK, ((b & RED_MASK) >> 8) * f) & RED_MASK | + high(a & GREEN_MASK, ((b & GREEN_MASK) >> 8) * f) & GREEN_MASK | + high(a & BLUE_MASK, ((b & BLUE_MASK) * f) >> 8)); + } + + + /** + * only returns the blended darkest colour + */ + private static int blend_darkest(int a, int b) { + int f = (b & ALPHA_MASK) >>> 24; + + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + mix(a & RED_MASK, + low(a & RED_MASK, + ((b & RED_MASK) >> 8) * f), f) & RED_MASK | + mix(a & GREEN_MASK, + low(a & GREEN_MASK, + ((b & GREEN_MASK) >> 8) * f), f) & GREEN_MASK | + mix(a & BLUE_MASK, + low(a & BLUE_MASK, + ((b & BLUE_MASK) * f) >> 8), f)); + } + + + /** + * returns the absolute value of the difference of the input colors + * C = |A - B| + */ + private static int blend_difference(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = (ar > br) ? (ar-br) : (br-ar); + int cg = (ag > bg) ? (ag-bg) : (bg-ag); + int cb = (ab > bb) ? (ab-bb) : (bb-ab); + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * Cousin of difference, algorithm used here is based on a Lingo version + * found here: http://www.mediamacros.com/item/item-1006687616/ + * (Not yet verified to be correct). + */ + private static int blend_exclusion(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = ar + br - ((ar * br) >> 7); + int cg = ag + bg - ((ag * bg) >> 7); + int cb = ab + bb - ((ab * bb) >> 7); + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * returns the product of the input colors + * C = A * B + */ + private static int blend_multiply(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = (ar * br) >> 8; + int cg = (ag * bg) >> 8; + int cb = (ab * bb) >> 8; + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * returns the inverse of the product of the inverses of the input colors + * (the inverse of multiply). C = 1 - (1-A) * (1-B) + */ + private static int blend_screen(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = 255 - (((255 - ar) * (255 - br)) >> 8); + int cg = 255 - (((255 - ag) * (255 - bg)) >> 8); + int cb = 255 - (((255 - ab) * (255 - bb)) >> 8); + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * returns either multiply or screen for darker or lighter values of A + * (the inverse of hard light) + * C = + * A < 0.5 : 2 * A * B + * A >=0.5 : 1 - (2 * (255-A) * (255-B)) + */ + private static int blend_overlay(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = (ar < 128) ? ((ar*br)>>7) : (255-(((255-ar)*(255-br))>>7)); + int cg = (ag < 128) ? ((ag*bg)>>7) : (255-(((255-ag)*(255-bg))>>7)); + int cb = (ab < 128) ? ((ab*bb)>>7) : (255-(((255-ab)*(255-bb))>>7)); + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * returns either multiply or screen for darker or lighter values of B + * (the inverse of overlay) + * C = + * B < 0.5 : 2 * A * B + * B >=0.5 : 1 - (2 * (255-A) * (255-B)) + */ + private static int blend_hard_light(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = (br < 128) ? ((ar*br)>>7) : (255-(((255-ar)*(255-br))>>7)); + int cg = (bg < 128) ? ((ag*bg)>>7) : (255-(((255-ag)*(255-bg))>>7)); + int cb = (bb < 128) ? ((ab*bb)>>7) : (255-(((255-ab)*(255-bb))>>7)); + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * returns the inverse multiply plus screen, which simplifies to + * C = 2AB + A^2 - 2A^2B + */ + private static int blend_soft_light(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = ((ar*br)>>7) + ((ar*ar)>>8) - ((ar*ar*br)>>15); + int cg = ((ag*bg)>>7) + ((ag*ag)>>8) - ((ag*ag*bg)>>15); + int cb = ((ab*bb)>>7) + ((ab*ab)>>8) - ((ab*ab*bb)>>15); + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * Returns the first (underlay) color divided by the inverse of + * the second (overlay) color. C = A / (255-B) + */ + private static int blend_dodge(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = (br==255) ? 255 : peg((ar << 8) / (255 - br)); // division requires pre-peg()-ing + int cg = (bg==255) ? 255 : peg((ag << 8) / (255 - bg)); // " + int cb = (bb==255) ? 255 : peg((ab << 8) / (255 - bb)); // " + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + /** + * returns the inverse of the inverse of the first (underlay) color + * divided by the second (overlay) color. C = 255 - (255-A) / B + */ + private static int blend_burn(int a, int b) { + // setup (this portion will always be the same) + int f = (b & ALPHA_MASK) >>> 24; + int ar = (a & RED_MASK) >> 16; + int ag = (a & GREEN_MASK) >> 8; + int ab = (a & BLUE_MASK); + int br = (b & RED_MASK) >> 16; + int bg = (b & GREEN_MASK) >> 8; + int bb = (b & BLUE_MASK); + // formula: + int cr = (br==0) ? 0 : 255 - peg(((255 - ar) << 8) / br); // division requires pre-peg()-ing + int cg = (bg==0) ? 0 : 255 - peg(((255 - ag) << 8) / bg); // " + int cb = (bb==0) ? 0 : 255 - peg(((255 - ab) << 8) / bb); // " + // alpha blend (this portion will always be the same) + return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | + (peg(ar + (((cr - ar) * f) >> 8)) << 16) | + (peg(ag + (((cg - ag) * f) >> 8)) << 8) | + (peg(ab + (((cb - ab) * f) >> 8)) ) ); + } + + + ////////////////////////////////////////////////////////////// + + // FILE I/O + + + static byte TIFF_HEADER[] = { + 77, 77, 0, 42, 0, 0, 0, 8, 0, 9, 0, -2, 0, 4, 0, 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 0, 1, + 0, 0, 0, 0, 1, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 122, 1, 6, 0, 3, 0, + 0, 0, 1, 0, 2, 0, 0, 1, 17, 0, 4, 0, 0, 0, 1, 0, 0, 3, 0, 1, 21, + 0, 3, 0, 0, 0, 1, 0, 3, 0, 0, 1, 22, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, + 1, 23, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 0, 8 + }; + + + static final String TIFF_ERROR = + "Error: Processing can only read its own TIFF files."; + + static protected PImage loadTIFF(byte tiff[]) { + if ((tiff[42] != tiff[102]) || // width/height in both places + (tiff[43] != tiff[103])) { + System.err.println(TIFF_ERROR); + return null; + } + + int width = + ((tiff[30] & 0xff) << 8) | (tiff[31] & 0xff); + int height = + ((tiff[42] & 0xff) << 8) | (tiff[43] & 0xff); + + int count = + ((tiff[114] & 0xff) << 24) | + ((tiff[115] & 0xff) << 16) | + ((tiff[116] & 0xff) << 8) | + (tiff[117] & 0xff); + if (count != width * height * 3) { + System.err.println(TIFF_ERROR + " (" + width + ", " + height +")"); + return null; + } + + // check the rest of the header + for (int i = 0; i < TIFF_HEADER.length; i++) { + if ((i == 30) || (i == 31) || (i == 42) || (i == 43) || + (i == 102) || (i == 103) || + (i == 114) || (i == 115) || (i == 116) || (i == 117)) continue; + + if (tiff[i] != TIFF_HEADER[i]) { + System.err.println(TIFF_ERROR + " (" + i + ")"); + return null; + } + } + + PImage outgoing = new PImage(width, height, RGB); + int index = 768; + count /= 3; + for (int i = 0; i < count; i++) { + outgoing.pixels[i] = + 0xFF000000 | + (tiff[index++] & 0xff) << 16 | + (tiff[index++] & 0xff) << 8 | + (tiff[index++] & 0xff); + } + return outgoing; + } + + + protected boolean saveTIFF(OutputStream output) { + // shutting off the warning, people can figure this out themselves + /* + if (format != RGB) { + System.err.println("Warning: only RGB information is saved with " + + ".tif files. Use .tga or .png for ARGB images and others."); + } + */ + try { + byte tiff[] = new byte[768]; + System.arraycopy(TIFF_HEADER, 0, tiff, 0, TIFF_HEADER.length); + + tiff[30] = (byte) ((width >> 8) & 0xff); + tiff[31] = (byte) ((width) & 0xff); + tiff[42] = tiff[102] = (byte) ((height >> 8) & 0xff); + tiff[43] = tiff[103] = (byte) ((height) & 0xff); + + int count = width*height*3; + tiff[114] = (byte) ((count >> 24) & 0xff); + tiff[115] = (byte) ((count >> 16) & 0xff); + tiff[116] = (byte) ((count >> 8) & 0xff); + tiff[117] = (byte) ((count) & 0xff); + + // spew the header to the disk + output.write(tiff); + + for (int i = 0; i < pixels.length; i++) { + output.write((pixels[i] >> 16) & 0xff); + output.write((pixels[i] >> 8) & 0xff); + output.write(pixels[i] & 0xff); + } + output.flush(); + return true; + + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + + + /** + * Creates a Targa32 formatted byte sequence of specified + * pixel buffer using RLE compression. + *

    + * Also figured out how to avoid parsing the image upside-down + * (there's a header flag to set the image origin to top-left) + *

    + * Starting with revision 0092, the format setting is taken into account: + *
      + *
    • ALPHA images written as 8bit grayscale (uses lowest byte) + *
    • RGB → 24 bits + *
    • ARGB → 32 bits + *
    + * All versions are RLE compressed. + *

    + * Contributed by toxi 8-10 May 2005, based on this RLE + * specification + */ + protected boolean saveTGA(OutputStream output) { + byte header[] = new byte[18]; + + if (format == ALPHA) { // save ALPHA images as 8bit grayscale + header[2] = 0x0B; + header[16] = 0x08; + header[17] = 0x28; + + } else if (format == RGB) { + header[2] = 0x0A; + header[16] = 24; + header[17] = 0x20; + + } else if (format == ARGB) { + header[2] = 0x0A; + header[16] = 32; + header[17] = 0x28; + + } else { + throw new RuntimeException("Image format not recognized inside save()"); + } + // set image dimensions lo-hi byte order + header[12] = (byte) (width & 0xff); + header[13] = (byte) (width >> 8); + header[14] = (byte) (height & 0xff); + header[15] = (byte) (height >> 8); + + try { + output.write(header); + + int maxLen = height * width; + int index = 0; + int col; //, prevCol; + int[] currChunk = new int[128]; + + // 8bit image exporter is in separate loop + // to avoid excessive conditionals... + if (format == ALPHA) { + while (index < maxLen) { + boolean isRLE = false; + int rle = 1; + currChunk[0] = col = pixels[index] & 0xff; + while (index + rle < maxLen) { + if (col != (pixels[index + rle]&0xff) || rle == 128) { + isRLE = (rle > 1); + break; + } + rle++; + } + if (isRLE) { + output.write(0x80 | (rle - 1)); + output.write(col); + + } else { + rle = 1; + while (index + rle < maxLen) { + int cscan = pixels[index + rle] & 0xff; + if ((col != cscan && rle < 128) || rle < 3) { + currChunk[rle] = col = cscan; + } else { + if (col == cscan) rle -= 2; + break; + } + rle++; + } + output.write(rle - 1); + for (int i = 0; i < rle; i++) output.write(currChunk[i]); + } + index += rle; + } + } else { // export 24/32 bit TARGA + while (index < maxLen) { + boolean isRLE = false; + currChunk[0] = col = pixels[index]; + int rle = 1; + // try to find repeating bytes (min. len = 2 pixels) + // maximum chunk size is 128 pixels + while (index + rle < maxLen) { + if (col != pixels[index + rle] || rle == 128) { + isRLE = (rle > 1); // set flag for RLE chunk + break; + } + rle++; + } + if (isRLE) { + output.write(128 | (rle - 1)); + output.write(col & 0xff); + output.write(col >> 8 & 0xff); + output.write(col >> 16 & 0xff); + if (format == ARGB) output.write(col >>> 24 & 0xff); + + } else { // not RLE + rle = 1; + while (index + rle < maxLen) { + if ((col != pixels[index + rle] && rle < 128) || rle < 3) { + currChunk[rle] = col = pixels[index + rle]; + } else { + // check if the exit condition was the start of + // a repeating colour + if (col == pixels[index + rle]) rle -= 2; + break; + } + rle++; + } + // write uncompressed chunk + output.write(rle - 1); + if (format == ARGB) { + for (int i = 0; i < rle; i++) { + col = currChunk[i]; + output.write(col & 0xff); + output.write(col >> 8 & 0xff); + output.write(col >> 16 & 0xff); + output.write(col >>> 24 & 0xff); + } + } else { + for (int i = 0; i < rle; i++) { + col = currChunk[i]; + output.write(col & 0xff); + output.write(col >> 8 & 0xff); + output.write(col >> 16 & 0xff); + } + } + } + index += rle; + } + } + output.flush(); + return true; + + } catch (IOException e) { + e.printStackTrace(); + return false; + } + } + + + /** + * Use ImageIO functions from Java 1.4 and later to handle image save. + * Various formats are supported, typically jpeg, png, bmp, and wbmp. + * To get a list of the supported formats for writing, use:
    + * println(javax.imageio.ImageIO.getReaderFormatNames()) + */ + protected void saveImageIO(String path) throws IOException { + try { + BufferedImage bimage = + new BufferedImage(width, height, (format == ARGB) ? + BufferedImage.TYPE_INT_ARGB : + BufferedImage.TYPE_INT_RGB); + /* + Class bufferedImageClass = + Class.forName("java.awt.image.BufferedImage"); + Constructor bufferedImageConstructor = + bufferedImageClass.getConstructor(new Class[] { + Integer.TYPE, + Integer.TYPE, + Integer.TYPE }); + Field typeIntRgbField = bufferedImageClass.getField("TYPE_INT_RGB"); + int typeIntRgb = typeIntRgbField.getInt(typeIntRgbField); + Field typeIntArgbField = bufferedImageClass.getField("TYPE_INT_ARGB"); + int typeIntArgb = typeIntArgbField.getInt(typeIntArgbField); + Object bimage = + bufferedImageConstructor.newInstance(new Object[] { + new Integer(width), + new Integer(height), + new Integer((format == ARGB) ? typeIntArgb : typeIntRgb) + }); + */ + + bimage.setRGB(0, 0, width, height, pixels, 0, width); + /* + Method setRgbMethod = + bufferedImageClass.getMethod("setRGB", new Class[] { + Integer.TYPE, Integer.TYPE, + Integer.TYPE, Integer.TYPE, + pixels.getClass(), + Integer.TYPE, Integer.TYPE + }); + setRgbMethod.invoke(bimage, new Object[] { + new Integer(0), new Integer(0), + new Integer(width), new Integer(height), + pixels, new Integer(0), new Integer(width) + }); + */ + + File file = new File(path); + String extension = path.substring(path.lastIndexOf('.') + 1); + + ImageIO.write(bimage, extension, file); + /* + Class renderedImageClass = + Class.forName("java.awt.image.RenderedImage"); + Class ioClass = Class.forName("javax.imageio.ImageIO"); + Method writeMethod = + ioClass.getMethod("write", new Class[] { + renderedImageClass, String.class, File.class + }); + writeMethod.invoke(null, new Object[] { bimage, extension, file }); + */ + + } catch (Exception e) { + e.printStackTrace(); + throw new IOException("image save failed."); + } + } + + + protected String[] saveImageFormats; + + /** + * Save this image to disk. + *

    + * As of revision 0100, this function requires an absolute path, + * in order to avoid confusion. To save inside the sketch folder, + * use the function savePath() from PApplet, or use saveFrame() instead. + * As of revision 0116, savePath() is not needed if this object has been + * created (as recommended) via createImage() or createGraphics() or + * one of its neighbors. + *

    + * As of revision 0115, when using Java 1.4 and later, you can write + * to several formats besides tga and tiff. If Java 1.4 is installed + * and the extension used is supported (usually png, jpg, jpeg, bmp, + * and tiff), then those methods will be used to write the image. + * To get a list of the supported formats for writing, use:
    + * println(javax.imageio.ImageIO.getReaderFormatNames()) + *

    + * To use the original built-in image writers, use .tga or .tif as the + * extension, or don't include an extension. When no extension is used, + * the extension .tif will be added to the file name. + *

    + * The ImageIO API claims to support wbmp files, however they probably + * require a black and white image. Basic testing produced a zero-length + * file with no error. + */ + public void save(String path) { // ignore + boolean success = false; + + File file = new File(path); + if (!file.isAbsolute()) { + if (parent != null) { + //file = new File(parent.savePath(filename)); + path = parent.savePath(path); + } else { + String msg = "PImage.save() requires an absolute path. " + + "Use createImage(), or pass savePath() to save()."; + PGraphics.showException(msg); + } + } + + // Make sure the pixel data is ready to go + loadPixels(); + + try { + OutputStream os = null; + + if (saveImageFormats == null) { + saveImageFormats = javax.imageio.ImageIO.getWriterFormatNames(); + } + if (saveImageFormats != null) { + for (int i = 0; i < saveImageFormats.length; i++) { + if (path.endsWith("." + saveImageFormats[i])) { + saveImageIO(path); + return; + } + } + } + + if (path.toLowerCase().endsWith(".tga")) { + os = new BufferedOutputStream(new FileOutputStream(path), 32768); + success = saveTGA(os); //, pixels, width, height, format); + + } else { + if (!path.toLowerCase().endsWith(".tif") && + !path.toLowerCase().endsWith(".tiff")) { + // if no .tif extension, add it.. + path += ".tif"; + } + os = new BufferedOutputStream(new FileOutputStream(path), 32768); + success = saveTIFF(os); //, pixels, width, height); + } + os.flush(); + os.close(); + + } catch (IOException e) { + //System.err.println("Error while saving image."); + e.printStackTrace(); + success = false; + } + if (!success) { + throw new RuntimeException("Error while saving image."); + } + } +} + diff --git a/core/src/processing/core/PLine.java b/core/src/processing/core/PLine.java new file mode 100644 index 000000000..a18afda9c --- /dev/null +++ b/core/src/processing/core/PLine.java @@ -0,0 +1,1278 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-07 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +/** + * Code for rendering lines with P2D and P3D. + * @author rocha + * @author fry + */ +public class PLine implements PConstants +{ + private int[] m_pixels; + private float[] m_zbuffer; + //private int[] m_stencil; + + private int m_index; + + static final int R_COLOR = 0x1; + static final int R_ALPHA = 0x2; + static final int R_SPATIAL = 0x8; + static final int R_THICK = 0x4; + static final int R_SMOOTH = 0x10; + + private int SCREEN_WIDTH; + private int SCREEN_HEIGHT; + private int SCREEN_WIDTH1; + private int SCREEN_HEIGHT1; + + public boolean INTERPOLATE_RGB; + public boolean INTERPOLATE_ALPHA; + public boolean INTERPOLATE_Z; + public boolean INTERPOLATE_THICK; + + // antialias + private boolean SMOOTH; + + // blender + //private boolean BLENDER; + + // stroke color + private int m_stroke; + + // draw flags + public int m_drawFlags; + + // vertex coordinates + private float[] x_array; + private float[] y_array; + private float[] z_array; + + // vertex intensity + private float[] r_array; + private float[] g_array; + private float[] b_array; + private float[] a_array; + + // vertex offsets + private int o0; + private int o1; + + // start values + private float m_r0; + private float m_g0; + private float m_b0; + private float m_a0; + private float m_z0; + + // deltas + private float dz; + + // rgba deltas + private float dr; + private float dg; + private float db; + private float da; + + private PGraphics parent; + + + public PLine(PGraphics g) { + INTERPOLATE_Z = false; + + x_array = new float[2]; + y_array = new float[2]; + z_array = new float[2]; + r_array = new float[2]; + g_array = new float[2]; + b_array = new float[2]; + a_array = new float[2]; + + this.parent = g; + } + + + public void reset() { + // reset these in case PGraphics was resized + SCREEN_WIDTH = parent.width; + SCREEN_HEIGHT = parent.height; + SCREEN_WIDTH1 = SCREEN_WIDTH-1; + SCREEN_HEIGHT1 = SCREEN_HEIGHT-1; + + m_pixels = parent.pixels; + //m_stencil = parent.stencil; + if (parent instanceof PGraphics3D) { + m_zbuffer = ((PGraphics3D) parent).zbuffer; + } + + // other things to reset + + INTERPOLATE_RGB = false; + INTERPOLATE_ALPHA = false; + //INTERPOLATE_Z = false; + m_drawFlags = 0; + m_index = 0; + //BLENDER = false; + } + + + public void setVertices(float x0, float y0, float z0, + float x1, float y1, float z1) { + // [rocha] fixed z drawing, so whenever a line turns on + // z interpolation, all the lines are z interpolated + if (z0 != z1 || z0 != 0.0f || z1 != 0.0f || INTERPOLATE_Z) { + INTERPOLATE_Z = true; + m_drawFlags |= R_SPATIAL; + } else { + INTERPOLATE_Z = false; + m_drawFlags &= ~R_SPATIAL; + } + + z_array[0] = z0; + z_array[1] = z1; + + x_array[0] = x0; + x_array[1] = x1; + + y_array[0] = y0; + y_array[1] = y1; + } + + + public void setIntensities(float r0, float g0, float b0, float a0, + float r1, float g1, float b1, float a1) { + a_array[0] = (a0 * 253f + 1.0f) * 65536f; + a_array[1] = (a1 * 253f + 1.0f) * 65536f; + + // check if we need alpha or not? + if ((a0 != 1.0f) || (a1 != 1.0f)) { + INTERPOLATE_ALPHA = true; + m_drawFlags |= R_ALPHA; + } else { + INTERPOLATE_ALPHA = false; + m_drawFlags &= ~R_ALPHA; + } + + // extra scaling added to prevent color "overflood" due to rounding errors + r_array[0] = (r0 * 253f + 1.0f) * 65536f; + r_array[1] = (r1 * 253f + 1.0f) * 65536f; + + g_array[0] = (g0 * 253f + 1.0f) * 65536f; + g_array[1] = (g1 * 253f + 1.0f) * 65536f; + + b_array[0] = (b0 * 253f + 1.0f) * 65536f; + b_array[1] = (b1 * 253f + 1.0f) * 65536f; + + // check if we need to interpolate the intensity values + if (r0 != r1) { + INTERPOLATE_RGB = true; + m_drawFlags |= R_COLOR; + + } else if (g0 != g1) { + INTERPOLATE_RGB = true; + m_drawFlags |= R_COLOR; + + } else if (b0 != b1) { + INTERPOLATE_RGB = true; + m_drawFlags |= R_COLOR; + + } else { + // when plain we use the stroke color of the first vertex + m_stroke = 0xFF000000 | + ((int)(255*r0) << 16) | ((int)(255*g0) << 8) | (int)(255*b0); + INTERPOLATE_RGB = false; + m_drawFlags &= ~R_COLOR; + } + } + + + public void setIndex(int index) { + m_index = index; + //BLENDER = false; + if (m_index != -1) { + //BLENDER = true; + } else { + m_index = 0; + } + } + + + public void draw() { + int xi; + int yi; + int length; + boolean visible = true; + + if (parent.smooth) { + SMOOTH = true; + m_drawFlags |= R_SMOOTH; + + } else { + SMOOTH = false; + m_drawFlags &= ~R_SMOOTH; + } + + /* + // line hack + if (parent.hints[DISABLE_FLYING_POO]) { + float nwidth2 = -SCREEN_WIDTH; + float nheight2 = -SCREEN_HEIGHT; + float width2 = SCREEN_WIDTH * 2; + float height2 = SCREEN_HEIGHT * 2; + if ((x_array[1] < nwidth2) || + (x_array[1] > width2) || + (x_array[0] < nwidth2) || + (x_array[0] > width2) || + (y_array[1] < nheight2) || + (y_array[1] > height2) || + (y_array[0] < nheight2) || + (y_array[0] > height2)) { + return; // this is a bad line + } + } + */ + + /////////////////////////////////////// + // line clipping + visible = lineClipping(); + if (!visible) { + return; + } + + /////////////////////////////////////// + // calculate line values + int shortLen; + int longLen; + boolean yLonger; + int dt; + + yLonger = false; + + // HACK for drawing lines left-to-right for rev 0069 + // some kind of bug exists with the line-stepping algorithm + // that causes strange patterns in the anti-aliasing. + // [040228 fry] + // + // swap rgba as well as the coords.. oops + // [040712 fry] + // + if (x_array[1] < x_array[0]) { + float t; + + t = x_array[1]; x_array[1] = x_array[0]; x_array[0] = t; + t = y_array[1]; y_array[1] = y_array[0]; y_array[0] = t; + t = z_array[1]; z_array[1] = z_array[0]; z_array[0] = t; + + t = r_array[1]; r_array[1] = r_array[0]; r_array[0] = t; + t = g_array[1]; g_array[1] = g_array[0]; g_array[0] = t; + t = b_array[1]; b_array[1] = b_array[0]; b_array[0] = t; + t = a_array[1]; a_array[1] = a_array[0]; a_array[0] = t; + } + + // important - don't change the casts + // is needed this way for line drawing algorithm + longLen = (int)x_array[1] - (int)x_array[0]; + shortLen = (int)y_array[1] - (int)y_array[0]; + + if (Math.abs(shortLen) > Math.abs(longLen)) { + int swap = shortLen; + shortLen = longLen; + longLen = swap; + yLonger = true; + } + + // now we sort points so longLen is always positive + // and we always start drawing from x[0], y[0] + if (longLen < 0) { + // swap order + o0 = 1; + o1 = 0; + + xi = (int) x_array[1]; + yi = (int) y_array[1]; + + length = -longLen; + + } else { + o0 = 0; + o1 = 1; + + xi = (int) x_array[0]; + yi = (int) y_array[0]; + + length = longLen; + } + + // calculate dt + if (length == 0) { + dt = 0; + } else { + dt = (shortLen << 16) / longLen; + } + + m_r0 = r_array[o0]; + m_g0 = g_array[o0]; + m_b0 = b_array[o0]; + + if (INTERPOLATE_RGB) { + dr = (r_array[o1] - r_array[o0]) / length; + dg = (g_array[o1] - g_array[o0]) / length; + db = (b_array[o1] - b_array[o0]) / length; + } else { + dr = 0; + dg = 0; + db = 0; + } + + m_a0 = a_array[o0]; + + if (INTERPOLATE_ALPHA) { + da = (a_array[o1] - a_array[o0]) / length; + } else { + da = 0; + } + + m_z0 = z_array[o0]; + //z0 += -0.001f; // [rocha] ugly fix for z buffer precision + + if (INTERPOLATE_Z) { + dz = (z_array[o1] - z_array[o0]) / length; + } else { + dz = 0; + } + + // draw thin points + if (length == 0) { + if (INTERPOLATE_ALPHA) { + drawPoint_alpha(xi, yi); + } else { + drawPoint(xi, yi); + } + return; + } + + /* + // draw antialias polygon lines for non stroked polygons + if (BLENDER && SMOOTH) { + // fix for endpoints not being drawn + // [rocha] + drawPoint_alpha((int)x_array[0], (int)x_array[0]); + drawPoint_alpha((int)x_array[1], (int)x_array[1]); + + drawline_blender(x_array[0], y_array[0], x_array[1], y_array[1]); + return; + } + */ + + // draw normal strokes + if (SMOOTH) { +// if ((m_drawFlags & R_SPATIAL) != 0) { +// drawLine_smooth_spatial(xi, yi, dt, length, yLonger); +// } else { + drawLine_smooth(xi, yi, dt, length, yLonger); +// } + + } else { + if (m_drawFlags == 0) { + drawLine_plain(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == R_ALPHA) { + drawLine_plain_alpha(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == R_COLOR) { + drawLine_color(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == (R_COLOR + R_ALPHA)) { + drawLine_color_alpha(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == R_SPATIAL) { + drawLine_plain_spatial(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == (R_SPATIAL + R_ALPHA)) { + drawLine_plain_alpha_spatial(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == (R_SPATIAL + R_COLOR)) { + drawLine_color_spatial(xi, yi, dt, length, yLonger); + + } else if (m_drawFlags == (R_SPATIAL + R_COLOR + R_ALPHA)) { + drawLine_color_alpha_spatial(xi, yi, dt, length, yLonger); + } + } + } + + + public boolean lineClipping() { + // new cohen-sutherland clipping code, as old one was buggy [toxi] + // get the "dips" for the points to clip + int code1 = lineClipCode(x_array[0], y_array[0]); + int code2 = lineClipCode(x_array[1], y_array[1]); + int dip = code1 | code2; + + if ((code1 & code2)!=0) { + + return false; + + } else if (dip != 0) { + + // now calculate the clipped points + float a0 = 0, a1 = 1, a = 0; + + for (int i = 0; i < 4; i++) { + if (((dip>>i)%2)==1){ + a = lineSlope(x_array[0], y_array[0], x_array[1], y_array[1], i+1); + if (((code1 >> i) % 2) == 1) { + a0 = (a>a0)?a:a0; // max(a,a0) + } else { + a1 = (a a1) { + return false; + } else { + float xt = x_array[0]; + float yt = y_array[0]; + + x_array[0] = xt + a0 * (x_array[1] - xt); + y_array[0] = yt + a0 * (y_array[1] - yt); + x_array[1] = xt + a1 * (x_array[1] - xt); + y_array[1] = yt + a1 * (y_array[1] - yt); + + // interpolate remaining parameters + if (INTERPOLATE_RGB) { + float t = r_array[0]; + r_array[0] = t + a0 * (r_array[1] - t); + r_array[1] = t + a1 * (r_array[1] - t); + t = g_array[0]; + g_array[0] = t + a0 * (g_array[1] - t); + g_array[1] = t + a1 * (g_array[1] - t); + t = b_array[0]; + b_array[0] = t + a0 * (b_array[1] - t); + b_array[1] = t + a1 * (b_array[1] - t); + } + + if (INTERPOLATE_ALPHA) { + float t = a_array[0]; + a_array[0] = t + a0 * (a_array[1] - t); + a_array[1] = t + a1 * (a_array[1] - t); + } + } + } + return true; + } + + + private int lineClipCode(float xi, float yi) { + int xmin = 0; + int ymin = 0; + int xmax = SCREEN_WIDTH1; + int ymax = SCREEN_HEIGHT1; + + //return ((yi < ymin ? 8 : 0) | (yi > ymax ? 4 : 0) | + // (xi < xmin ? 2 : 0) | (xi > xmax ? 1 : 0)); + //(int) added by ewjordan 6/13/07 because otherwise we sometimes clip last pixel when it should actually be displayed. + //Currently the min values are okay because values less than 0 should not be rendered; however, bear in mind that + //(int) casts towards zero, so without this clipping, values between -1+eps and +1-eps would all be rendered as 0. + return ((yi < ymin ? 8 : 0) | ((int)yi > ymax ? 4 : 0) | + (xi < xmin ? 2 : 0) | ((int)xi > xmax ? 1 : 0)); + } + + + private float lineSlope(float x1, float y1, float x2, float y2, int border) { + int xmin = 0; + int ymin = 0; + int xmax = SCREEN_WIDTH1; + int ymax = SCREEN_HEIGHT1; + + switch (border) { + case 4: return (ymin-y1)/(y2-y1); + case 3: return (ymax-y1)/(y2-y1); + case 2: return (xmin-x1)/(x2-x1); + case 1: return (xmax-x1)/(x2-x1); + } + return -1f; + } + + + private void drawPoint(int x0, int y0) { + float iz = m_z0; + int offset = y0 * SCREEN_WIDTH + x0; + + if (m_zbuffer == null) { + m_pixels[offset] = m_stroke; + + } else { + if (iz <= m_zbuffer[offset]) { + m_pixels[offset] = m_stroke; + m_zbuffer[offset] = iz; + } + } + } + + + private void drawPoint_alpha(int x0, int y0) { + int ia = (int) a_array[0]; + int pr = m_stroke & 0xFF0000; + int pg = m_stroke & 0xFF00; + int pb = m_stroke & 0xFF; + float iz = m_z0; + int offset = y0 * SCREEN_WIDTH + x0; + + if ((m_zbuffer == null) || iz <= m_zbuffer[offset]) { + int alpha = ia >> 16; + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = iz; + } + } + + + private void drawLine_plain(int x0, int y0, int dt, + int length, boolean vertical) { + // new "extremely fast" line code + // adapted from http://www.edepot.com/linee.html + // first version modified by [toxi] + // simplified by [rocha] + // length must be >= 0 + + //assert length>=0:length; + + int offset = 0; + + if (vertical) { + // vertical + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + m_pixels[offset] = m_stroke; + if (m_zbuffer != null) m_zbuffer[offset] = m_z0; + j+=dt; + } + + } else { + // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + m_pixels[offset] = m_stroke; + if (m_zbuffer != null) m_zbuffer[offset] = m_z0; + j+=dt; + } + } + } + + + private void drawLine_plain_alpha(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + + int pr = m_stroke & 0xFF0000; + int pg = m_stroke & 0xFF00; + int pb = m_stroke & 0xFF; + + int ia = (int) (m_a0); + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + + int alpha = ia >> 16; + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + //m_zbuffer[offset] = m_z0; // don't set zbuffer w/ alpha lines + + ia += da; + j += dt; + } + + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + + int alpha = ia >> 16; + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + //m_zbuffer[offset] = m_z0; // no zbuffer w/ alpha lines + + ia += da; + j += dt; + } + } + } + + + private void drawLine_color(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + + int ir = (int) m_r0; + int ig = (int) m_g0; + int ib = (int) m_b0; + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + m_pixels[offset] = 0xFF000000 | + ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16)); + if (m_zbuffer != null) m_zbuffer[offset] = m_z0; + ir += dr; + ig += dg; + ib += db; + j +=dt; + } + + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + m_pixels[offset] = 0xFF000000 | + ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16)); + if (m_zbuffer != null) m_zbuffer[offset] = m_z0; + ir += dr; + ig += dg; + ib += db; + j += dt; + } + } + } + + + private void drawLine_color_alpha(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + + int ir = (int) m_r0; + int ig = (int) m_g0; + int ib = (int) m_b0; + int ia = (int) m_a0; + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + + int alpha = ia >> 16; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = m_z0; + + ir+= dr; + ig+= dg; + ib+= db; + ia+= da; + j+=dt; + } + + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + + int alpha = ia >> 16; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = m_z0; + + ir+= dr; + ig+= dg; + ib+= db; + ia+= da; + j+=dt; + } + } + } + + + private void drawLine_plain_spatial(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + float iz = m_z0; + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + if (offset < m_pixels.length) { + if (iz <= m_zbuffer[offset]) { + m_pixels[offset] = m_stroke; + m_zbuffer[offset] = iz; + } + } + iz+=dz; + j+=dt; + } + + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + if (offset < m_pixels.length) { + if (iz <= m_zbuffer[offset]) { + m_pixels[offset] = m_stroke; + m_zbuffer[offset] = iz; + } + } + iz+=dz; + j+=dt; + } + } + } + + + private void drawLine_plain_alpha_spatial(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + float iz = m_z0; + + int pr = m_stroke & 0xFF0000; + int pg = m_stroke & 0xFF00; + int pb = m_stroke & 0xFF; + + int ia = (int) m_a0; + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + if (offset < m_pixels.length) { + if (iz <= m_zbuffer[offset]) { + int alpha = ia >> 16; + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + m_zbuffer[offset] = iz; + } + } + iz +=dz; + ia += da; + j += dt; + } + + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + + if (offset < m_pixels.length) { + if (iz <= m_zbuffer[offset]) { + int alpha = ia >> 16; + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + m_zbuffer[offset] = iz; + } + } + iz += dz; + ia += da; + j += dt; + } + } + } + + + private void drawLine_color_spatial(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + float iz = m_z0; + + int ir = (int) m_r0; + int ig = (int) m_g0; + int ib = (int) m_b0; + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + + if (iz <= m_zbuffer[offset]) { + m_pixels[offset] = 0xFF000000 | + ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16)); + m_zbuffer[offset] = iz; + } + iz +=dz; + ir += dr; + ig += dg; + ib += db; + j += dt; + } + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + if (iz <= m_zbuffer[offset]) { + m_pixels[offset] = 0xFF000000 | + ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16)); + m_zbuffer[offset] = iz; + } + iz += dz; + ir += dr; + ig += dg; + ib += db; + j += dt; + } + return; + } + } + + + private void drawLine_color_alpha_spatial(int x0, int y0, int dt, + int length, boolean vertical) { + int offset = 0; + float iz = m_z0; + + int ir = (int) m_r0; + int ig = (int) m_g0; + int ib = (int) m_b0; + int ia = (int) m_a0; + + if (vertical) { + length += y0; + for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) { + offset = y0 * SCREEN_WIDTH + (j>>16); + + if (iz <= m_zbuffer[offset]) { + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + + int alpha = ia >> 16; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + m_zbuffer[offset] = iz; + } + iz+=dz; + ir+= dr; + ig+= dg; + ib+= db; + ia+= da; + j+=dt; + } + + } else { // horizontal + length += x0; + for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) { + offset = (j>>16) * SCREEN_WIDTH + x0; + + if (iz <= m_zbuffer[offset]) { + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + int alpha = ia >> 16; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + m_zbuffer[offset] = iz; + } + iz += dz; + ir += dr; + ig += dg; + ib += db; + ia += da; + j += dt; + } + } + } + + + private void drawLine_smooth(int x0, int y0, int dt, + int length, boolean vertical) { + int xi, yi; // these must be >=32 bits + int offset = 0; + int temp; + int end; + + float iz = m_z0; + + int ir = (int) m_r0; + int ig = (int) m_g0; + int ib = (int) m_b0; + int ia = (int) m_a0; + + if (vertical) { + xi = x0 << 16; + yi = y0 << 16; + + end = length + y0; + + while ((yi >> 16) < end) { + + offset = (yi>>16) * SCREEN_WIDTH + (xi>>16); + + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + if ((m_zbuffer == null) || (iz <= m_zbuffer[offset])) { + int alpha = (((~xi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = iz; + } + + // this if() makes things slow. there should be a better way to check + // if the second pixel is within the image array [rocha] + temp = ((xi>>16)+1); + if (temp >= SCREEN_WIDTH) { + xi += dt; + yi += (1 << 16); + continue; + } + + offset = (yi>>16) * SCREEN_WIDTH + temp; + + if ((m_zbuffer == null) || (iz <= m_zbuffer[offset])) { + int alpha = (((xi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = iz; + } + + xi += dt; + yi += (1 << 16); + + iz+=dz; + ir+= dr; + ig+= dg; + ib+= db; + ia+= da; + } + + } else { // horizontal + xi = x0 << 16; + yi = y0 << 16; + end = length + x0; + + while ((xi >> 16) < end) { + offset = (yi>>16) * SCREEN_WIDTH + (xi>>16); + + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + if ((m_zbuffer == null) || (iz <= m_zbuffer[offset])) { + int alpha = (((~yi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = iz; + } + + // see above [rocha] + temp = ((yi>>16)+1); + if (temp >= SCREEN_HEIGHT) { + xi += (1 << 16); + yi += dt; + continue; + } + + offset = temp * SCREEN_WIDTH + (xi>>16); + + if ((m_zbuffer == null) || (iz <= m_zbuffer[offset])) { + int alpha = (((yi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0&=0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + if (m_zbuffer != null) m_zbuffer[offset] = iz; + } + + xi += (1 << 16); + yi += dt; + + iz += dz; + ir += dr; + ig += dg; + ib += db; + ia += da; + } + } + } + + + /* + void drawLine_smooth(int x0, int y0, int dt, + int length, boolean vertical) { + int xi, yi; // these must be >=32 bits + int offset = 0; + int temp; + int end; + + int ir = (int) m_r0; + int ig = (int) m_g0; + int ib = (int) m_b0; + int ia = (int) m_a0; + + if (vertical) { + xi = x0 << 16; + yi = y0 << 16; + + end = length + y0; + + while ((yi >> 16) < end) { + offset = (yi>>16) * SCREEN_WIDTH + (xi>>16); + + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + int alpha = (((~xi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + + // this if() makes things slow. there should be a better way to check + // if the second pixel is within the image array [rocha] + temp = ((xi>>16)+1); + if (temp >= SCREEN_WIDTH) { + xi += dt; + yi += (1 << 16); + continue; + } + + offset = (yi>>16) * SCREEN_WIDTH + temp; + + alpha = (((xi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + r0 = m_pixels[offset]; + g0 = r0 & 0xFF00; + b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + + xi += dt; + yi += (1 << 16); + + ir += dr; + ig += dg; + ib += db; + ia += da; + } + + } else { // horizontal + xi = x0 << 16; + yi = y0 << 16; + end = length + x0; + + while ((xi >> 16) < end) { + offset = (yi>>16) * SCREEN_WIDTH + (xi>>16); + + int pr = ir & 0xFF0000; + int pg = (ig >> 8) & 0xFF00; + int pb = (ib >> 16); + + int alpha = (((~yi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + int r0 = m_pixels[offset]; + int g0 = r0 & 0xFF00; + int b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + + // see above [rocha] + temp = ((yi>>16)+1); + if (temp >= SCREEN_HEIGHT) { + xi += (1 << 16); + yi += dt; + continue; + } + + offset = temp * SCREEN_WIDTH + (xi>>16); + + alpha = (((yi >> 8) & 0xFF) * (ia >> 16)) >> 8; + + r0 = m_pixels[offset]; + g0 = r0 & 0xFF00; + b0 = r0 & 0xFF; + r0 &= 0xFF0000; + + r0 = r0 + (((pr - r0) * alpha) >> 8); + g0 = g0 + (((pg - g0) * alpha) >> 8); + b0 = b0 + (((pb - b0) * alpha) >> 8); + + m_pixels[offset] = 0xFF000000 | + (r0 & 0xFF0000) | (g0 & 0xFF00) | (b0 & 0xFF); + + xi += (1 << 16); + yi += dt; + + ir+= dr; + ig+= dg; + ib+= db; + ia+= da; + } + } + } + */ +} diff --git a/core/src/processing/core/PMatrix.java b/core/src/processing/core/PMatrix.java new file mode 100644 index 000000000..aac9c0625 --- /dev/null +++ b/core/src/processing/core/PMatrix.java @@ -0,0 +1,150 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-08 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +public interface PMatrix { + + public void reset(); + + /** + * Returns a copy of this PMatrix. + */ + public PMatrix get(); + + /** + * Copies the matrix contents into a float array. + * If target is null (or not the correct size), a new array will be created. + */ + public float[] get(float[] target); + + + public void set(PMatrix src); + + public void set(float[] source); + + public void set(float m00, float m01, float m02, + float m10, float m11, float m12); + + public void set(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33); + + + public void translate(float tx, float ty); + + public void translate(float tx, float ty, float tz); + + public void rotate(float angle); + + public void rotateX(float angle); + + public void rotateY(float angle); + + public void rotateZ(float angle); + + public void rotate(float angle, float v0, float v1, float v2); + + public void scale(float s); + + public void scale(float sx, float sy); + + public void scale(float x, float y, float z); + + public void skewX(float angle); + + public void skewY(float angle); + + /** + * Multiply this matrix by another. + */ + public void apply(PMatrix source); + + public void apply(PMatrix2D source); + + public void apply(PMatrix3D source); + + public void apply(float n00, float n01, float n02, + float n10, float n11, float n12); + + public void apply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33); + + /** + * Apply another matrix to the left of this one. + */ + public void preApply(PMatrix2D left); + + public void preApply(PMatrix3D left); + + public void preApply(float n00, float n01, float n02, + float n10, float n11, float n12); + + public void preApply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33); + + + /** + * Multiply a PVector by this matrix. + */ + public PVector mult(PVector source, PVector target); + + + /** + * Multiply a multi-element vector against this matrix. + */ + public float[] mult(float[] source, float[] target); + + +// public float multX(float x, float y); +// public float multY(float x, float y); + +// public float multX(float x, float y, float z); +// public float multY(float x, float y, float z); +// public float multZ(float x, float y, float z); + + + /** + * Transpose this matrix. + */ + public void transpose(); + + + /** + * Invert this matrix. + * @return true if successful + */ + public boolean invert(); + + + /** + * @return the determinant of the matrix + */ + public float determinant(); +} \ No newline at end of file diff --git a/core/src/processing/core/PMatrix2D.java b/core/src/processing/core/PMatrix2D.java new file mode 100644 index 000000000..fad4d0fa8 --- /dev/null +++ b/core/src/processing/core/PMatrix2D.java @@ -0,0 +1,450 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-08 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +/** + * 3x2 affine matrix implementation. + */ +public class PMatrix2D implements PMatrix { + + public float m00, m01, m02; + public float m10, m11, m12; + + + public PMatrix2D() { + reset(); + } + + + public PMatrix2D(float m00, float m01, float m02, + float m10, float m11, float m12) { + set(m00, m01, m02, + m10, m11, m12); + } + + + public PMatrix2D(PMatrix matrix) { + set(matrix); + } + + + public void reset() { + set(1, 0, 0, + 0, 1, 0); + } + + + /** + * Returns a copy of this PMatrix. + */ + public PMatrix2D get() { + PMatrix2D outgoing = new PMatrix2D(); + outgoing.set(this); + return outgoing; + } + + + /** + * Copies the matrix contents into a 6 entry float array. + * If target is null (or not the correct size), a new array will be created. + */ + public float[] get(float[] target) { + if ((target == null) || (target.length != 6)) { + target = new float[6]; + } + target[0] = m00; + target[1] = m01; + target[2] = m02; + + target[3] = m10; + target[4] = m11; + target[5] = m12; + + return target; + } + + + public void set(PMatrix matrix) { + if (matrix instanceof PMatrix2D) { + PMatrix2D src = (PMatrix2D) matrix; + set(src.m00, src.m01, src.m02, + src.m10, src.m11, src.m12); + } else { + throw new IllegalArgumentException("PMatrix2D.set() only accepts PMatrix2D objects."); + } + } + + + public void set(PMatrix3D src) { + } + + + public void set(float[] source) { + m00 = source[0]; + m01 = source[1]; + m02 = source[2]; + + m10 = source[3]; + m11 = source[4]; + m12 = source[5]; + } + + + public void set(float m00, float m01, float m02, + float m10, float m11, float m12) { + this.m00 = m00; this.m01 = m01; this.m02 = m02; + this.m10 = m10; this.m11 = m11; this.m12 = m12; + } + + + public void set(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) { + + } + + + public void translate(float tx, float ty) { + m02 = tx*m00 + ty*m01 + m02; + m12 = tx*m10 + ty*m11 + m12; + } + + + public void translate(float x, float y, float z) { + throw new IllegalArgumentException("Cannot use translate(x, y, z) on a PMatrix2D."); + } + + + // Implementation roughly based on AffineTransform. + public void rotate(float angle) { + float s = sin(angle); + float c = cos(angle); + + float temp1 = m00; + float temp2 = m01; + m00 = c * temp1 + s * temp2; + m01 = -s * temp1 + c * temp2; + temp1 = m10; + temp2 = m11; + m10 = c * temp1 + s * temp2; + m11 = -s * temp1 + c * temp2; + } + + + public void rotateX(float angle) { + throw new IllegalArgumentException("Cannot use rotateX() on a PMatrix2D."); + } + + + public void rotateY(float angle) { + throw new IllegalArgumentException("Cannot use rotateY() on a PMatrix2D."); + } + + + public void rotateZ(float angle) { + rotate(angle); + } + + + public void rotate(float angle, float v0, float v1, float v2) { + throw new IllegalArgumentException("Cannot use this version of rotate() on a PMatrix2D."); + } + + + public void scale(float s) { + scale(s, s); + } + + + public void scale(float sx, float sy) { + m00 *= sx; m01 *= sy; + m10 *= sx; m11 *= sy; + } + + + public void scale(float x, float y, float z) { + throw new IllegalArgumentException("Cannot use this version of scale() on a PMatrix2D."); + } + + + public void skewX(float angle) { + apply(1, 0, 1, angle, 0, 0); + } + + + public void skewY(float angle) { + apply(1, 0, 1, 0, angle, 0); + } + + + public void apply(PMatrix source) { + if (source instanceof PMatrix2D) { + apply((PMatrix2D) source); + } else if (source instanceof PMatrix3D) { + apply((PMatrix3D) source); + } + } + + + public void apply(PMatrix2D source) { + apply(source.m00, source.m01, source.m02, + source.m10, source.m11, source.m12); + } + + + public void apply(PMatrix3D source) { + throw new IllegalArgumentException("Cannot use apply(PMatrix3D) on a PMatrix2D."); + } + + + public void apply(float n00, float n01, float n02, + float n10, float n11, float n12) { + float t0 = m00; + float t1 = m01; + m00 = n00 * t0 + n10 * t1; + m01 = n01 * t0 + n11 * t1; + m02 += n02 * t0 + n12 * t1; + + t0 = m10; + t1 = m11; + m10 = n00 * t0 + n10 * t1; + m11 = n01 * t0 + n11 * t1; + m12 += n02 * t0 + n12 * t1; + } + + + public void apply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + throw new IllegalArgumentException("Cannot use this version of apply() on a PMatrix2D."); + } + + + /** + * Apply another matrix to the left of this one. + */ + public void preApply(PMatrix2D left) { + preApply(left.m00, left.m01, left.m02, + left.m10, left.m11, left.m12); + } + + + public void preApply(PMatrix3D left) { + throw new IllegalArgumentException("Cannot use preApply(PMatrix3D) on a PMatrix2D."); + } + + + public void preApply(float n00, float n01, float n02, + float n10, float n11, float n12) { + float t0 = m02; + float t1 = m12; + n02 += t0 * n00 + t1 * n01; + n12 += t0 * n10 + t1 * n11; + + m02 = n02; + m12 = n12; + + t0 = m00; + t1 = m10; + m00 = t0 * n00 + t1 * n01; + m10 = t0 * n10 + t1 * n11; + + t0 = m01; + t1 = m11; + m01 = t0 * n00 + t1 * n01; + m11 = t0 * n10 + t1 * n11; + } + + + public void preApply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + throw new IllegalArgumentException("Cannot use this version of preApply() on a PMatrix2D."); + } + + + ////////////////////////////////////////////////////////////// + + + /** + * Multiply the x and y coordinates of a PVector against this matrix. + */ + public PVector mult(PVector source, PVector target) { + if (target == null) { + target = new PVector(); + } + target.x = m00*source.x + m01*source.y + m02; + target.y = m10*source.x + m11*source.y + m12; + return target; + } + + + /** + * Multiply a two element vector against this matrix. + * If out is null or not length four, a new float array will be returned. + * The values for vec and out can be the same (though that's less efficient). + */ + public float[] mult(float vec[], float out[]) { + if (out == null || out.length != 2) { + out = new float[2]; + } + + if (vec == out) { + float tx = m00*vec[0] + m01*vec[1] + m02; + float ty = m10*vec[0] + m11*vec[1] + m12; + + out[0] = tx; + out[1] = ty; + + } else { + out[0] = m00*vec[0] + m01*vec[1] + m02; + out[1] = m10*vec[0] + m11*vec[1] + m12; + } + + return out; + } + + + public float multX(float x, float y) { + return m00*x + m01*y + m02; + } + + + public float multY(float x, float y) { + return m10*x + m11*y + m12; + } + + + /** + * Transpose this matrix. + */ + public void transpose() { + } + + + /** + * Invert this matrix. Implementation stolen from OpenJDK. + * @return true if successful + */ + public boolean invert() { + float determinant = determinant(); + if (Math.abs(determinant) <= Float.MIN_VALUE) { + return false; + } + + float t00 = m00; + float t01 = m01; + float t02 = m02; + float t10 = m10; + float t11 = m11; + float t12 = m12; + + m00 = t11 / determinant; + m10 = -t10 / determinant; + m01 = -t01 / determinant; + m11 = t00 / determinant; + m02 = (t01 * t12 - t11 * t02) / determinant; + m12 = (t10 * t02 - t00 * t12) / determinant; + + return true; + } + + + /** + * @return the determinant of the matrix + */ + public float determinant() { + return m00 * m11 - m01 * m10; + } + + + ////////////////////////////////////////////////////////////// + + + public void print() { + int big = (int) abs(max(PApplet.max(abs(m00), abs(m01), abs(m02)), + PApplet.max(abs(m10), abs(m11), abs(m12)))); + + int digits = 1; + if (Float.isNaN(big) || Float.isInfinite(big)) { // avoid infinite loop + digits = 5; + } else { + while ((big /= 10) != 0) digits++; // cheap log() + } + + System.out.println(PApplet.nfs(m00, digits, 4) + " " + + PApplet.nfs(m01, digits, 4) + " " + + PApplet.nfs(m02, digits, 4)); + + System.out.println(PApplet.nfs(m10, digits, 4) + " " + + PApplet.nfs(m11, digits, 4) + " " + + PApplet.nfs(m12, digits, 4)); + + System.out.println(); + } + + + ////////////////////////////////////////////////////////////// + + // TODO these need to be added as regular API, but the naming and + // implementation needs to be improved first. (e.g. actually keeping track + // of whether the matrix is in fact identity internally.) + + + protected boolean isIdentity() { + return ((m00 == 1) && (m01 == 0) && (m02 == 0) && + (m10 == 0) && (m11 == 1) && (m12 == 0)); + } + + + // TODO make this more efficient, or move into PMatrix2D + protected boolean isWarped() { + return ((m00 != 1) || (m01 != 0) && + (m10 != 0) || (m11 != 1)); + } + + + ////////////////////////////////////////////////////////////// + + + private final float max(float a, float b) { + return (a > b) ? a : b; + } + + private final float abs(float a) { + return (a < 0) ? -a : a; + } + + private final float sin(float angle) { + return (float)Math.sin(angle); + } + + private final float cos(float angle) { + return (float)Math.cos(angle); + } +} diff --git a/core/src/processing/core/PMatrix3D.java b/core/src/processing/core/PMatrix3D.java new file mode 100644 index 000000000..25d9fd11d --- /dev/null +++ b/core/src/processing/core/PMatrix3D.java @@ -0,0 +1,782 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2005-08 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +/** + * 4x4 matrix implementation. + */ +public final class PMatrix3D implements PMatrix /*, PConstants*/ { + + public float m00, m01, m02, m03; + public float m10, m11, m12, m13; + public float m20, m21, m22, m23; + public float m30, m31, m32, m33; + + + // locally allocated version to avoid creating new memory + protected PMatrix3D inverseCopy; + + + public PMatrix3D() { + reset(); + } + + + public PMatrix3D(float m00, float m01, float m02, + float m10, float m11, float m12) { + set(m00, m01, m02, 0, + m10, m11, m12, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public PMatrix3D(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) { + set(m00, m01, m02, m03, + m10, m11, m12, m13, + m20, m21, m22, m23, + m30, m31, m32, m33); + } + + + public PMatrix3D(PMatrix matrix) { + set(matrix); + } + + + public void reset() { + set(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + /** + * Returns a copy of this PMatrix. + */ + public PMatrix3D get() { + PMatrix3D outgoing = new PMatrix3D(); + outgoing.set(this); + return outgoing; + } + + + /** + * Copies the matrix contents into a 16 entry float array. + * If target is null (or not the correct size), a new array will be created. + */ + public float[] get(float[] target) { + if ((target == null) || (target.length != 16)) { + target = new float[16]; + } + target[0] = m00; + target[1] = m01; + target[2] = m02; + target[3] = m03; + + target[4] = m10; + target[5] = m11; + target[6] = m12; + target[7] = m13; + + target[8] = m20; + target[9] = m21; + target[10] = m22; + target[11] = m23; + + target[12] = m30; + target[13] = m31; + target[14] = m32; + target[15] = m33; + + return target; + } + + + public void set(PMatrix matrix) { + if (matrix instanceof PMatrix3D) { + PMatrix3D src = (PMatrix3D) matrix; + set(src.m00, src.m01, src.m02, src.m03, + src.m10, src.m11, src.m12, src.m13, + src.m20, src.m21, src.m22, src.m23, + src.m30, src.m31, src.m32, src.m33); + } else { + PMatrix2D src = (PMatrix2D) matrix; + set(src.m00, src.m01, 0, src.m02, + src.m10, src.m11, 0, src.m12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + } + + + public void set(float[] source) { + if (source.length == 6) { + set(source[0], source[1], source[2], + source[3], source[4], source[5]); + + } else if (source.length == 16) { + m00 = source[0]; + m01 = source[1]; + m02 = source[2]; + m03 = source[3]; + + m10 = source[4]; + m11 = source[5]; + m12 = source[6]; + m13 = source[7]; + + m20 = source[8]; + m21 = source[9]; + m22 = source[10]; + m23 = source[11]; + + m30 = source[12]; + m31 = source[13]; + m32 = source[14]; + m33 = source[15]; + } + } + + + public void set(float m00, float m01, float m02, + float m10, float m11, float m12) { + set(m00, m01, 0, m02, + m10, m11, 0, m12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void set(float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) { + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; + this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13; + this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23; + this.m30 = m30; this.m31 = m31; this.m32 = m32; this.m33 = m33; + } + + + public void translate(float tx, float ty) { + translate(tx, ty, 0); + } + +// public void invTranslate(float tx, float ty) { +// invTranslate(tx, ty, 0); +// } + + + public void translate(float tx, float ty, float tz) { + m03 += tx*m00 + ty*m01 + tz*m02; + m13 += tx*m10 + ty*m11 + tz*m12; + m23 += tx*m20 + ty*m21 + tz*m22; + m33 += tx*m30 + ty*m31 + tz*m32; + } + + + public void rotate(float angle) { + rotateZ(angle); + } + + + public void rotateX(float angle) { + float c = cos(angle); + float s = sin(angle); + apply(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); + } + + + public void rotateY(float angle) { + float c = cos(angle); + float s = sin(angle); + apply(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1); + } + + + public void rotateZ(float angle) { + float c = cos(angle); + float s = sin(angle); + apply(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + } + + + public void rotate(float angle, float v0, float v1, float v2) { + // TODO should make sure this vector is normalized + + float c = cos(angle); + float s = sin(angle); + float t = 1.0f - c; + + apply((t*v0*v0) + c, (t*v0*v1) - (s*v2), (t*v0*v2) + (s*v1), 0, + (t*v0*v1) + (s*v2), (t*v1*v1) + c, (t*v1*v2) - (s*v0), 0, + (t*v0*v2) - (s*v1), (t*v1*v2) + (s*v0), (t*v2*v2) + c, 0, + 0, 0, 0, 1); + } + + + public void scale(float s) { + //apply(s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1); + scale(s, s, s); + } + + + public void scale(float sx, float sy) { + //apply(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + scale(sx, sy, 1); + } + + + public void scale(float x, float y, float z) { + //apply(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1); + m00 *= x; m01 *= y; m02 *= z; + m10 *= x; m11 *= y; m12 *= z; + m20 *= x; m21 *= y; m22 *= z; + m30 *= x; m31 *= y; m32 *= z; + } + + + public void skewX(float angle) { + float t = (float) Math.tan(angle); + apply(1, t, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void skewY(float angle) { + float t = (float) Math.tan(angle); + apply(1, 0, 0, 0, + t, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void apply(PMatrix source) { + if (source instanceof PMatrix2D) { + apply((PMatrix2D) source); + } else if (source instanceof PMatrix3D) { + apply((PMatrix3D) source); + } + } + + + public void apply(PMatrix2D source) { + apply(source.m00, source.m01, 0, source.m02, + source.m10, source.m11, 0, source.m12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void apply(PMatrix3D source) { + apply(source.m00, source.m01, source.m02, source.m03, + source.m10, source.m11, source.m12, source.m13, + source.m20, source.m21, source.m22, source.m23, + source.m30, source.m31, source.m32, source.m33); + } + + + public void apply(float n00, float n01, float n02, + float n10, float n11, float n12) { + apply(n00, n01, 0, n02, + n10, n11, 0, n12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void apply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + + float r00 = m00*n00 + m01*n10 + m02*n20 + m03*n30; + float r01 = m00*n01 + m01*n11 + m02*n21 + m03*n31; + float r02 = m00*n02 + m01*n12 + m02*n22 + m03*n32; + float r03 = m00*n03 + m01*n13 + m02*n23 + m03*n33; + + float r10 = m10*n00 + m11*n10 + m12*n20 + m13*n30; + float r11 = m10*n01 + m11*n11 + m12*n21 + m13*n31; + float r12 = m10*n02 + m11*n12 + m12*n22 + m13*n32; + float r13 = m10*n03 + m11*n13 + m12*n23 + m13*n33; + + float r20 = m20*n00 + m21*n10 + m22*n20 + m23*n30; + float r21 = m20*n01 + m21*n11 + m22*n21 + m23*n31; + float r22 = m20*n02 + m21*n12 + m22*n22 + m23*n32; + float r23 = m20*n03 + m21*n13 + m22*n23 + m23*n33; + + float r30 = m30*n00 + m31*n10 + m32*n20 + m33*n30; + float r31 = m30*n01 + m31*n11 + m32*n21 + m33*n31; + float r32 = m30*n02 + m31*n12 + m32*n22 + m33*n32; + float r33 = m30*n03 + m31*n13 + m32*n23 + m33*n33; + + m00 = r00; m01 = r01; m02 = r02; m03 = r03; + m10 = r10; m11 = r11; m12 = r12; m13 = r13; + m20 = r20; m21 = r21; m22 = r22; m23 = r23; + m30 = r30; m31 = r31; m32 = r32; m33 = r33; + } + + + public void preApply(PMatrix2D left) { + preApply(left.m00, left.m01, 0, left.m02, + left.m10, left.m11, 0, left.m12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + /** + * Apply another matrix to the left of this one. + */ + public void preApply(PMatrix3D left) { + preApply(left.m00, left.m01, left.m02, left.m03, + left.m10, left.m11, left.m12, left.m13, + left.m20, left.m21, left.m22, left.m23, + left.m30, left.m31, left.m32, left.m33); + } + + + public void preApply(float n00, float n01, float n02, + float n10, float n11, float n12) { + preApply(n00, n01, 0, n02, + n10, n11, 0, n12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void preApply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + + float r00 = n00*m00 + n01*m10 + n02*m20 + n03*m30; + float r01 = n00*m01 + n01*m11 + n02*m21 + n03*m31; + float r02 = n00*m02 + n01*m12 + n02*m22 + n03*m32; + float r03 = n00*m03 + n01*m13 + n02*m23 + n03*m33; + + float r10 = n10*m00 + n11*m10 + n12*m20 + n13*m30; + float r11 = n10*m01 + n11*m11 + n12*m21 + n13*m31; + float r12 = n10*m02 + n11*m12 + n12*m22 + n13*m32; + float r13 = n10*m03 + n11*m13 + n12*m23 + n13*m33; + + float r20 = n20*m00 + n21*m10 + n22*m20 + n23*m30; + float r21 = n20*m01 + n21*m11 + n22*m21 + n23*m31; + float r22 = n20*m02 + n21*m12 + n22*m22 + n23*m32; + float r23 = n20*m03 + n21*m13 + n22*m23 + n23*m33; + + float r30 = n30*m00 + n31*m10 + n32*m20 + n33*m30; + float r31 = n30*m01 + n31*m11 + n32*m21 + n33*m31; + float r32 = n30*m02 + n31*m12 + n32*m22 + n33*m32; + float r33 = n30*m03 + n31*m13 + n32*m23 + n33*m33; + + m00 = r00; m01 = r01; m02 = r02; m03 = r03; + m10 = r10; m11 = r11; m12 = r12; m13 = r13; + m20 = r20; m21 = r21; m22 = r22; m23 = r23; + m30 = r30; m31 = r31; m32 = r32; m33 = r33; + } + + + ////////////////////////////////////////////////////////////// + + + public PVector mult(PVector source, PVector target) { + if (target == null) { + target = new PVector(); + } + target.x = m00*source.x + m01*source.y + m02*source.z + m03; + target.y = m10*source.x + m11*source.y + m12*source.z + m13; + target.z = m20*source.x + m21*source.y + m22*source.z + m23; +// float tw = m30*source.x + m31*source.y + m32*source.z + m33; +// if (tw != 0 && tw != 1) { +// target.div(tw); +// } + return target; + } + + + /* + public PVector cmult(PVector source, PVector target) { + if (target == null) { + target = new PVector(); + } + target.x = m00*source.x + m10*source.y + m20*source.z + m30; + target.y = m01*source.x + m11*source.y + m21*source.z + m31; + target.z = m02*source.x + m12*source.y + m22*source.z + m32; + float tw = m03*source.x + m13*source.y + m23*source.z + m33; + if (tw != 0 && tw != 1) { + target.div(tw); + } + return target; + } + */ + + + /** + * Multiply a three or four element vector against this matrix. If out is + * null or not length 3 or 4, a new float array (length 3) will be returned. + */ + public float[] mult(float[] source, float[] target) { + if (target == null || target.length < 3) { + target = new float[3]; + } + if (source == target) { + throw new RuntimeException("The source and target vectors used in " + + "PMatrix3D.mult() cannot be identical."); + } + if (target.length == 3) { + target[0] = m00*source[0] + m01*source[1] + m02*source[2] + m03; + target[1] = m10*source[0] + m11*source[1] + m12*source[2] + m13; + target[2] = m20*source[0] + m21*source[1] + m22*source[2] + m23; + //float w = m30*source[0] + m31*source[1] + m32*source[2] + m33; + //if (w != 0 && w != 1) { + // target[0] /= w; target[1] /= w; target[2] /= w; + //} + } else if (target.length > 3) { + target[0] = m00*source[0] + m01*source[1] + m02*source[2] + m03*source[3]; + target[1] = m10*source[0] + m11*source[1] + m12*source[2] + m13*source[3]; + target[2] = m20*source[0] + m21*source[1] + m22*source[2] + m23*source[3]; + target[3] = m30*source[0] + m31*source[1] + m32*source[2] + m33*source[3]; + } + return target; + } + + + public float multX(float x, float y) { + return m00*x + m01*y + m03; + } + + + public float multY(float x, float y) { + return m10*x + m11*y + m13; + } + + + public float multX(float x, float y, float z) { + return m00*x + m01*y + m02*z + m03; + } + + + public float multY(float x, float y, float z) { + return m10*x + m11*y + m12*z + m13; + } + + + public float multZ(float x, float y, float z) { + return m20*x + m21*y + m22*z + m23; + } + + + public float multW(float x, float y, float z) { + return m30*x + m31*y + m32*z + m33; + } + + + public float multX(float x, float y, float z, float w) { + return m00*x + m01*y + m02*z + m03*w; + } + + + public float multY(float x, float y, float z, float w) { + return m10*x + m11*y + m12*z + m13*w; + } + + + public float multZ(float x, float y, float z, float w) { + return m20*x + m21*y + m22*z + m23*w; + } + + + public float multW(float x, float y, float z, float w) { + return m30*x + m31*y + m32*z + m33*w; + } + + + /** + * Transpose this matrix. + */ + public void transpose() { + float temp; + temp = m01; m01 = m10; m10 = temp; + temp = m02; m02 = m20; m20 = temp; + temp = m03; m03 = m30; m30 = temp; + temp = m12; m12 = m21; m21 = temp; + temp = m13; m13 = m31; m31 = temp; + temp = m23; m23 = m32; m32 = temp; + } + + + /** + * Invert this matrix. + * @return true if successful + */ + public boolean invert() { + float determinant = determinant(); + if (determinant == 0) { + return false; + } + + // first row + float t00 = determinant3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33); + float t01 = -determinant3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33); + float t02 = determinant3x3(m10, m11, m13, m20, m21, m23, m30, m31, m33); + float t03 = -determinant3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32); + + // second row + float t10 = -determinant3x3(m01, m02, m03, m21, m22, m23, m31, m32, m33); + float t11 = determinant3x3(m00, m02, m03, m20, m22, m23, m30, m32, m33); + float t12 = -determinant3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33); + float t13 = determinant3x3(m00, m01, m02, m20, m21, m22, m30, m31, m32); + + // third row + float t20 = determinant3x3(m01, m02, m03, m11, m12, m13, m31, m32, m33); + float t21 = -determinant3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33); + float t22 = determinant3x3(m00, m01, m03, m10, m11, m13, m30, m31, m33); + float t23 = -determinant3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32); + + // fourth row + float t30 = -determinant3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23); + float t31 = determinant3x3(m00, m02, m03, m10, m12, m13, m20, m22, m23); + float t32 = -determinant3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23); + float t33 = determinant3x3(m00, m01, m02, m10, m11, m12, m20, m21, m22); + + // transpose and divide by the determinant + m00 = t00 / determinant; + m01 = t10 / determinant; + m02 = t20 / determinant; + m03 = t30 / determinant; + + m10 = t01 / determinant; + m11 = t11 / determinant; + m12 = t21 / determinant; + m13 = t31 / determinant; + + m20 = t02 / determinant; + m21 = t12 / determinant; + m22 = t22 / determinant; + m23 = t32 / determinant; + + m30 = t03 / determinant; + m31 = t13 / determinant; + m32 = t23 / determinant; + m33 = t33 / determinant; + + return true; + } + + + /** + * Calculate the determinant of a 3x3 matrix. + * @return result + */ + private float determinant3x3(float t00, float t01, float t02, + float t10, float t11, float t12, + float t20, float t21, float t22) { + return (t00 * (t11 * t22 - t12 * t21) + + t01 * (t12 * t20 - t10 * t22) + + t02 * (t10 * t21 - t11 * t20)); + } + + + /** + * @return the determinant of the matrix + */ + public float determinant() { + float f = + m00 + * ((m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32) + - m13 * m22 * m31 + - m11 * m23 * m32 + - m12 * m21 * m33); + f -= m01 + * ((m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32) + - m13 * m22 * m30 + - m10 * m23 * m32 + - m12 * m20 * m33); + f += m02 + * ((m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31) + - m13 * m21 * m30 + - m10 * m23 * m31 + - m11 * m20 * m33); + f -= m03 + * ((m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31) + - m12 * m21 * m30 + - m10 * m22 * m31 + - m11 * m20 * m32); + return f; + } + + + ////////////////////////////////////////////////////////////// + + // REVERSE VERSIONS OF MATRIX OPERATIONS + + // These functions should not be used, as they will be removed in the future. + + + protected void invTranslate(float tx, float ty, float tz) { + preApply(1, 0, 0, -tx, + 0, 1, 0, -ty, + 0, 0, 1, -tz, + 0, 0, 0, 1); + } + + + protected void invRotateX(float angle) { + float c = cos(-angle); + float s = sin(-angle); + preApply(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); + } + + + protected void invRotateY(float angle) { + float c = cos(-angle); + float s = sin(-angle); + preApply(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1); + } + + + protected void invRotateZ(float angle) { + float c = cos(-angle); + float s = sin(-angle); + preApply(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + } + + + protected void invRotate(float angle, float v0, float v1, float v2) { + //TODO should make sure this vector is normalized + + float c = cos(-angle); + float s = sin(-angle); + float t = 1.0f - c; + + preApply((t*v0*v0) + c, (t*v0*v1) - (s*v2), (t*v0*v2) + (s*v1), 0, + (t*v0*v1) + (s*v2), (t*v1*v1) + c, (t*v1*v2) - (s*v0), 0, + (t*v0*v2) - (s*v1), (t*v1*v2) + (s*v0), (t*v2*v2) + c, 0, + 0, 0, 0, 1); + } + + + protected void invScale(float x, float y, float z) { + preApply(1/x, 0, 0, 0, 0, 1/y, 0, 0, 0, 0, 1/z, 0, 0, 0, 0, 1); + } + + + protected boolean invApply(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + if (inverseCopy == null) { + inverseCopy = new PMatrix3D(); + } + inverseCopy.set(n00, n01, n02, n03, + n10, n11, n12, n13, + n20, n21, n22, n23, + n30, n31, n32, n33); + if (!inverseCopy.invert()) { + return false; + } + preApply(inverseCopy); + return true; + } + + + ////////////////////////////////////////////////////////////// + + + public void print() { + /* + System.out.println(m00 + " " + m01 + " " + m02 + " " + m03 + "\n" + + m10 + " " + m11 + " " + m12 + " " + m13 + "\n" + + m20 + " " + m21 + " " + m22 + " " + m23 + "\n" + + m30 + " " + m31 + " " + m32 + " " + m33 + "\n"); + */ + int big = (int) Math.abs(max(max(max(max(abs(m00), abs(m01)), + max(abs(m02), abs(m03))), + max(max(abs(m10), abs(m11)), + max(abs(m12), abs(m13)))), + max(max(max(abs(m20), abs(m21)), + max(abs(m22), abs(m23))), + max(max(abs(m30), abs(m31)), + max(abs(m32), abs(m33)))))); + + int digits = 1; + if (Float.isNaN(big) || Float.isInfinite(big)) { // avoid infinite loop + digits = 5; + } else { + while ((big /= 10) != 0) digits++; // cheap log() + } + + System.out.println(PApplet.nfs(m00, digits, 4) + " " + + PApplet.nfs(m01, digits, 4) + " " + + PApplet.nfs(m02, digits, 4) + " " + + PApplet.nfs(m03, digits, 4)); + + System.out.println(PApplet.nfs(m10, digits, 4) + " " + + PApplet.nfs(m11, digits, 4) + " " + + PApplet.nfs(m12, digits, 4) + " " + + PApplet.nfs(m13, digits, 4)); + + System.out.println(PApplet.nfs(m20, digits, 4) + " " + + PApplet.nfs(m21, digits, 4) + " " + + PApplet.nfs(m22, digits, 4) + " " + + PApplet.nfs(m23, digits, 4)); + + System.out.println(PApplet.nfs(m30, digits, 4) + " " + + PApplet.nfs(m31, digits, 4) + " " + + PApplet.nfs(m32, digits, 4) + " " + + PApplet.nfs(m33, digits, 4)); + + System.out.println(); + } + + + ////////////////////////////////////////////////////////////// + + + private final float max(float a, float b) { + return (a > b) ? a : b; + } + + private final float abs(float a) { + return (a < 0) ? -a : a; + } + + private final float sin(float angle) { + return (float) Math.sin(angle); + } + + private final float cos(float angle) { + return (float) Math.cos(angle); + } +} diff --git a/core/src/processing/core/PPolygon.java b/core/src/processing/core/PPolygon.java new file mode 100644 index 000000000..2a20b7c78 --- /dev/null +++ b/core/src/processing/core/PPolygon.java @@ -0,0 +1,701 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +/** + * Z-buffer polygon rendering object used by PGraphics2D. + */ +public class PPolygon implements PConstants { + + static final int DEFAULT_SIZE = 64; // this is needed for spheres + float vertices[][] = new float[DEFAULT_SIZE][VERTEX_FIELD_COUNT]; + int vertexCount; + + float r[] = new float[DEFAULT_SIZE]; // storage used by incrementalize + float dr[] = new float[DEFAULT_SIZE]; + float l[] = new float[DEFAULT_SIZE]; // more storage for incrementalize + float dl[] = new float[DEFAULT_SIZE]; + float sp[] = new float[DEFAULT_SIZE]; // temporary storage for scanline + float sdp[] = new float[DEFAULT_SIZE]; + + protected boolean interpX; + protected boolean interpUV; // is this necessary? could just check timage != null + protected boolean interpARGB; + + private int rgba; + private int r2, g2, b2, a2, a2orig; + + PGraphics parent; + int[] pixels; + // the parent's width/height, + // or if smooth is enabled, parent's w/h scaled + // up by the smooth dimension + int width, height; + int width1, height1; + + PImage timage; + int[] tpixels; + int theight, twidth; + int theight1, twidth1; + int tformat; + + // for anti-aliasing + static final int SUBXRES = 8; + static final int SUBXRES1 = 7; + static final int SUBYRES = 8; + static final int SUBYRES1 = 7; + static final int MAX_COVERAGE = SUBXRES * SUBYRES; + + boolean smooth; + int firstModY; + int lastModY; + int lastY; + int aaleft[] = new int[SUBYRES]; + int aaright[] = new int[SUBYRES]; + int aaleftmin, aarightmin; + int aaleftmax, aarightmax; + int aaleftfull, aarightfull; + + final private int MODYRES(int y) { + return (y & SUBYRES1); + } + + + public PPolygon(PGraphics iparent) { + parent = iparent; + reset(0); + } + + + protected void reset(int count) { + vertexCount = count; + interpX = true; +// interpZ = true; + interpUV = false; + interpARGB = true; + timage = null; + } + + + protected float[] nextVertex() { + if (vertexCount == vertices.length) { + float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT]; + System.arraycopy(vertices, 0, temp, 0, vertexCount); + vertices = temp; + + r = new float[vertices.length]; + dr = new float[vertices.length]; + l = new float[vertices.length]; + dl = new float[vertices.length]; + sp = new float[vertices.length]; + sdp = new float[vertices.length]; + } + return vertices[vertexCount++]; // returns v[0], sets vc to 1 + } + + + /** + * Return true if this vertex is redundant. If so, will also + * decrement the vertex count. + */ + /* + public boolean redundantVertex(float x, float y, float z) { + // because vertexCount will be 2 when setting vertex[1] + if (vertexCount < 2) return false; + + // vertexCount-1 is the current vertex that would be used + // vertexCount-2 would be the previous feller + if ((Math.abs(vertices[vertexCount-2][MX] - x) < EPSILON) && + (Math.abs(vertices[vertexCount-2][MY] - y) < EPSILON) && + (Math.abs(vertices[vertexCount-2][MZ] - z) < EPSILON)) { + vertexCount--; + return true; + } + return false; + } + */ + + + protected void texture(PImage image) { + this.timage = image; + + if (image != null) { + this.tpixels = image.pixels; + this.twidth = image.width; + this.theight = image.height; + this.tformat = image.format; + + twidth1 = twidth - 1; + theight1 = theight - 1; + interpUV = true; + + } else { + interpUV = false; + } + } + + + protected void renderPolygon(float[][] v, int count) { + vertices = v; + vertexCount = count; + + if (r.length < vertexCount) { + r = new float[vertexCount]; // storage used by incrementalize + dr = new float[vertexCount]; + l = new float[vertexCount]; // more storage for incrementalize + dl = new float[vertexCount]; + sp = new float[vertexCount]; // temporary storage for scanline + sdp = new float[vertexCount]; + } + + render(); + checkExpand(); + } + + + protected void renderTriangle(float[] v1, float[] v2, float[] v3) { + // Calling code will have already done reset(3). + // Can't do it here otherwise would nuke any texture settings. + + vertices[0] = v1; + vertices[1] = v2; + vertices[2] = v3; + + render(); + checkExpand(); + } + + + protected void checkExpand() { + if (smooth) { + for (int i = 0; i < vertexCount; i++) { + vertices[i][TX] /= SUBXRES; + vertices[i][TY] /= SUBYRES; + } + } + } + + + protected void render() { + if (vertexCount < 3) return; + + // these may have changed due to a resize() + // so they should be refreshed here + pixels = parent.pixels; + //zbuffer = parent.zbuffer; + +// noDepthTest = parent.hints[DISABLE_DEPTH_TEST]; + smooth = parent.smooth; + + // by default, text turns on smooth for the textures + // themselves. but this should be shut off if the hint + // for DISABLE_TEXT_SMOOTH is set. +// texture_smooth = true; + + width = smooth ? parent.width*SUBXRES : parent.width; + height = smooth ? parent.height*SUBYRES : parent.height; + + width1 = width - 1; + height1 = height - 1; + + if (!interpARGB) { + r2 = (int) (vertices[0][R] * 255); + g2 = (int) (vertices[0][G] * 255); + b2 = (int) (vertices[0][B] * 255); + a2 = (int) (vertices[0][A] * 255); + a2orig = a2; // save an extra copy + rgba = 0xff000000 | (r2 << 16) | (g2 << 8) | b2; + } + + for (int i = 0; i < vertexCount; i++) { + r[i] = 0; dr[i] = 0; l[i] = 0; dl[i] = 0; + } + + /* + // hack to not make polygons fly into the screen + if (parent.hints[DISABLE_FLYING_POO]) { + float nwidth2 = -width * 2; + float nheight2 = -height * 2; + float width2 = width * 2; + float height2 = height * 2; + for (int i = 0; i < vertexCount; i++) { + if ((vertices[i][TX] < nwidth2) || + (vertices[i][TX] > width2) || + (vertices[i][TY] < nheight2) || + (vertices[i][TY] > height2)) { + return; // this is a bad poly + } + } + } + */ + +// for (int i = 0; i < 4; i++) { +// System.out.println(vertices[i][R] + " " + vertices[i][G] + " " + vertices[i][B]); +// } +// System.out.println(); + + if (smooth) { + for (int i = 0; i < vertexCount; i++) { + vertices[i][TX] *= SUBXRES; + vertices[i][TY] *= SUBYRES; + } + firstModY = -1; + } + + // find top vertex (y is zero at top, higher downwards) + int topi = 0; + float ymin = vertices[0][TY]; + float ymax = vertices[0][TY]; // fry 031001 + for (int i = 1; i < vertexCount; i++) { + if (vertices[i][TY] < ymin) { + ymin = vertices[i][TY]; + topi = i; + } + if (vertices[i][TY] > ymax) { + ymax = vertices[i][TY]; + } + } + + // the last row is an exceptional case, because there won't + // necessarily be 8 rows of subpixel lines that will force + // the final line to render. so instead, the algo keeps track + // of the lastY (in subpixel resolution) that will be rendered + // and that will force a scanline to happen the same as + // every eighth in the other situations + //lastY = -1; // fry 031001 + lastY = (int) (ymax - 0.5f); // global to class bc used by other fxns + + int lefti = topi; // li, index of left vertex + int righti = topi; // ri, index of right vertex + int y = (int) (ymin + 0.5f); // current scan line + int lefty = y - 1; // lower end of left edge + int righty = y - 1; // lower end of right edge + + interpX = true; + + int remaining = vertexCount; + + // scan in y, activating new edges on left & right + // as scan line passes over new vertices + while (remaining > 0) { + // advance left edge? + while ((lefty <= y) && (remaining > 0)) { + remaining--; + // step ccw down left side + int i = (lefti != 0) ? (lefti-1) : (vertexCount-1); + incrementalizeY(vertices[lefti], vertices[i], l, dl, y); + lefty = (int) (vertices[i][TY] + 0.5f); + lefti = i; + } + + // advance right edge? + while ((righty <= y) && (remaining > 0)) { + remaining--; + // step cw down right edge + int i = (righti != vertexCount-1) ? (righti + 1) : 0; + incrementalizeY(vertices[righti], vertices[i], r, dr, y); + righty = (int) (vertices[i][TY] + 0.5f); + righti = i; + } + + // do scanlines till end of l or r edge + while (y < lefty && y < righty) { + // this doesn't work because it's not always set here + //if (remaining == 0) { + //lastY = (lefty < righty) ? lefty-1 : righty-1; + //System.out.println("lastY is " + lastY); + //} + + if ((y >= 0) && (y < height)) { + //try { // hopefully this bug is fixed + if (l[TX] <= r[TX]) scanline(y, l, r); + else scanline(y, r, l); + //} catch (ArrayIndexOutOfBoundsException e) { + //e.printStackTrace(); + //} + } + y++; + // this increment probably needs to be different + // UV and RGB shouldn't be incremented until line is emitted + increment(l, dl); + increment(r, dr); + } + } + //if (smooth) { + //System.out.println("y/lasty/lastmody = " + y + " " + lastY + " " + lastModY); + //} + } + + + private void scanline(int y, float l[], float r[]) { + //System.out.println("scanline " + y); + for (int i = 0; i < vertexCount; i++) { // should be moved later + sp[i] = 0; sdp[i] = 0; + } + + // this rounding doesn't seem to be relevant with smooth + int lx = (int) (l[TX] + 0.49999f); // ceil(l[TX]-.5); + if (lx < 0) lx = 0; + int rx = (int) (r[TX] - 0.5f); + if (rx > width1) rx = width1; + + if (lx > rx) return; + + if (smooth) { + int mody = MODYRES(y); + + aaleft[mody] = lx; + aaright[mody] = rx; + + if (firstModY == -1) { + firstModY = mody; + aaleftmin = lx; aaleftmax = lx; + aarightmin = rx; aarightmax = rx; + + } else { + if (aaleftmin > aaleft[mody]) aaleftmin = aaleft[mody]; + if (aaleftmax < aaleft[mody]) aaleftmax = aaleft[mody]; + if (aarightmin > aaright[mody]) aarightmin = aaright[mody]; + if (aarightmax < aaright[mody]) aarightmax = aaright[mody]; + } + + lastModY = mody; // moved up here (before the return) 031001 + // not the eighth (or lastY) line, so not scanning this time + if ((mody != SUBYRES1) && (y != lastY)) return; + //lastModY = mody; // eeK! this was missing + //return; + + //if (y == lastY) { + //System.out.println("y is lasty"); + //} + //lastModY = mody; + aaleftfull = aaleftmax/SUBXRES + 1; + aarightfull = aarightmin/SUBXRES - 1; + } + + // this is the setup, based on lx + incrementalizeX(l, r, sp, sdp, lx); + + // scan in x, generating pixels + // using parent.width to get actual pixel index + // rather than scaled by smooth factor + int offset = smooth ? parent.width * (y / SUBYRES) : parent.width*y; + + int truelx = 0, truerx = 0; + if (smooth) { + truelx = lx / SUBXRES; + truerx = (rx + SUBXRES1) / SUBXRES; + + lx = aaleftmin / SUBXRES; + rx = (aarightmax + SUBXRES1) / SUBXRES; + if (lx < 0) lx = 0; + if (rx > parent.width1) rx = parent.width1; + } + + interpX = false; + int tr, tg, tb, ta; + +// System.out.println("P2D interp uv " + interpUV + " " + +// vertices[2][U] + " " + vertices[2][V]); + for (int x = lx; x <= rx; x++) { + // map texture based on U, V coords in sp[U] and sp[V] + if (interpUV) { + int tu = (int) (sp[U] * twidth); + int tv = (int) (sp[V] * theight); + + if (tu > twidth1) tu = twidth1; + if (tv > theight1) tv = theight1; + if (tu < 0) tu = 0; + if (tv < 0) tv = 0; + + int txy = tv*twidth + tu; + + int tuf1 = (int) (255f * (sp[U]*twidth - (float)tu)); + int tvf1 = (int) (255f * (sp[V]*theight - (float)tv)); + + // the closer sp[U or V] is to the decimal being zero + // the more coverage it should get of the original pixel + int tuf = 255 - tuf1; + int tvf = 255 - tvf1; + + // this code sucks! filled with bugs and slow as hell! + int pixel00 = tpixels[txy]; + int pixel01 = (tv < theight1) ? + tpixels[txy + twidth] : tpixels[txy]; + int pixel10 = (tu < twidth1) ? + tpixels[txy + 1] : tpixels[txy]; + int pixel11 = ((tv < theight1) && (tu < twidth1)) ? + tpixels[txy + twidth + 1] : tpixels[txy]; + + int p00, p01, p10, p11; + int px0, px1; //, pxy; + + + // calculate alpha component (ta) + + if (tformat == ALPHA) { + px0 = (pixel00*tuf + pixel10*tuf1) >> 8; + px1 = (pixel01*tuf + pixel11*tuf1) >> 8; + ta = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[A]*255)) : a2orig)) >> 8; + + } else if (tformat == ARGB) { + p00 = (pixel00 >> 24) & 0xff; + p01 = (pixel01 >> 24) & 0xff; + p10 = (pixel10 >> 24) & 0xff; + p11 = (pixel11 >> 24) & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + ta = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[A]*255)) : a2orig)) >> 8; + + } else { // RGB image, no alpha + ta = interpARGB ? ((int) (sp[A]*255)) : a2orig; + } + + // calculate r,g,b components (tr, tg, tb) + + if ((tformat == RGB) || (tformat == ARGB)) { + p00 = (pixel00 >> 16) & 0xff; // red + p01 = (pixel01 >> 16) & 0xff; + p10 = (pixel10 >> 16) & 0xff; + p11 = (pixel11 >> 16) & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + tr = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[R]*255)) : r2)) >> 8; + + p00 = (pixel00 >> 8) & 0xff; // green + p01 = (pixel01 >> 8) & 0xff; + p10 = (pixel10 >> 8) & 0xff; + p11 = (pixel11 >> 8) & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + tg = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[G]*255)) : g2)) >> 8; + + p00 = pixel00 & 0xff; // blue + p01 = pixel01 & 0xff; + p10 = pixel10 & 0xff; + p11 = pixel11 & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + tb = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[B]*255)) : b2)) >> 8; + + } else { // alpha image, only use current fill color + if (interpARGB) { + tr = (int) (sp[R] * 255); + tg = (int) (sp[G] * 255); + tb = (int) (sp[B] * 255); + + } else { + tr = r2; + tg = g2; + tb = b2; + } + } + + int weight = smooth ? coverage(x) : 255; + if (weight != 255) ta = ta*weight >> 8; + + if ((ta == 254) || (ta == 255)) { // if (ta & 0xf8) would be good + // no need to blend + pixels[offset+x] = 0xff000000 | (tr << 16) | (tg << 8) | tb; + + } else { + // blend with pixel on screen + int a1 = 255-ta; + int r1 = (pixels[offset+x] >> 16) & 0xff; + int g1 = (pixels[offset+x] >> 8) & 0xff; + int b1 = (pixels[offset+x]) & 0xff; + + pixels[offset+x] = 0xff000000 | + (((tr*ta + r1*a1) >> 8) << 16) | + ((tg*ta + g1*a1) & 0xff00) | + ((tb*ta + b1*a1) >> 8); + } + + } else { // no image applied + int weight = smooth ? coverage(x) : 255; + + if (interpARGB) { + r2 = (int) (sp[R] * 255); + g2 = (int) (sp[G] * 255); + b2 = (int) (sp[B] * 255); + if (sp[A] != 1) weight = (weight * ((int) (sp[A] * 255))) >> 8; + if (weight == 255) { + rgba = 0xff000000 | (r2 << 16) | (g2 << 8) | b2; + } + } else { + if (a2orig != 255) weight = (weight * a2orig) >> 8; + } + + if (weight == 255) { + // no blend, no aa, just the rgba + pixels[offset+x] = rgba; + //zbuffer[offset+x] = sp[Z]; + + } else { + int r1 = (pixels[offset+x] >> 16) & 0xff; + int g1 = (pixels[offset+x] >> 8) & 0xff; + int b1 = (pixels[offset+x]) & 0xff; + a2 = weight; + + int a1 = 255 - a2; + pixels[offset+x] = (0xff000000 | + ((r1*a1 + r2*a2) >> 8) << 16 | + // use & instead of >> and << below + ((g1*a1 + g2*a2) >> 8) << 8 | + ((b1*a1 + b2*a2) >> 8)); + } + } + + // if smooth enabled, don't increment values + // for the pixel in the stretch out version + // of the scanline used to get smooth edges. + if (!smooth || ((x >= truelx) && (x <= truerx))) { + increment(sp, sdp); + } + } + firstModY = -1; + interpX = true; + } + + + // x is in screen, not huge 8x coordinates + private int coverage(int x) { + if ((x >= aaleftfull) && (x <= aarightfull) && + // important since not all SUBYRES lines may have been covered + (firstModY == 0) && (lastModY == SUBYRES1)) { + return 255; + } + + int pixelLeft = x*SUBXRES; // huh? + int pixelRight = pixelLeft + 8; + + int amt = 0; + for (int i = firstModY; i <= lastModY; i++) { + if ((aaleft[i] > pixelRight) || (aaright[i] < pixelLeft)) { + continue; + } + // does this need a +1 ? + amt += ((aaright[i] < pixelRight ? aaright[i] : pixelRight) - + (aaleft[i] > pixelLeft ? aaleft[i] : pixelLeft)); + } + amt <<= 2; + return (amt == 256) ? 255 : amt; + } + + + private void incrementalizeY(float p1[], float p2[], + float p[], float dp[], int y) { + float delta = p2[TY] - p1[TY]; + if (delta == 0) delta = 1; + float fraction = y + 0.5f - p1[TY]; + + if (interpX) { + dp[TX] = (p2[TX] - p1[TX]) / delta; + p[TX] = p1[TX] + dp[TX] * fraction; + } + + if (interpARGB) { + dp[R] = (p2[R] - p1[R]) / delta; + dp[G] = (p2[G] - p1[G]) / delta; + dp[B] = (p2[B] - p1[B]) / delta; + dp[A] = (p2[A] - p1[A]) / delta; + p[R] = p1[R] + dp[R] * fraction; + p[G] = p1[G] + dp[G] * fraction; + p[B] = p1[B] + dp[B] * fraction; + p[A] = p1[A] + dp[A] * fraction; + } + + if (interpUV) { + dp[U] = (p2[U] - p1[U]) / delta; + dp[V] = (p2[V] - p1[V]) / delta; + + p[U] = p1[U] + dp[U] * fraction; + p[V] = p1[V] + dp[V] * fraction; + } + } + + + private void incrementalizeX(float p1[], float p2[], + float p[], float dp[], int x) { + float delta = p2[TX] - p1[TX]; + if (delta == 0) delta = 1; + float fraction = x + 0.5f - p1[TX]; + if (smooth) { + delta /= SUBXRES; + fraction /= SUBXRES; + } + + if (interpX) { + dp[TX] = (p2[TX] - p1[TX]) / delta; + p[TX] = p1[TX] + dp[TX] * fraction; + } + + if (interpARGB) { + dp[R] = (p2[R] - p1[R]) / delta; + dp[G] = (p2[G] - p1[G]) / delta; + dp[B] = (p2[B] - p1[B]) / delta; + dp[A] = (p2[A] - p1[A]) / delta; + p[R] = p1[R] + dp[R] * fraction; + p[G] = p1[G] + dp[G] * fraction; + p[B] = p1[B] + dp[B] * fraction; + p[A] = p1[A] + dp[A] * fraction; + } + + if (interpUV) { + dp[U] = (p2[U] - p1[U]) / delta; + dp[V] = (p2[V] - p1[V]) / delta; + + p[U] = p1[U] + dp[U] * fraction; + p[V] = p1[V] + dp[V] * fraction; + } + } + + + private void increment(float p[], float dp[]) { + if (interpX) p[TX] += dp[TX]; + + if (interpARGB) { + p[R] += dp[R]; + p[G] += dp[G]; + p[B] += dp[B]; + p[A] += dp[A]; + } + + if (interpUV) { + p[U] += dp[U]; + p[V] += dp[V]; + } + } +} diff --git a/core/src/processing/core/PShape.java b/core/src/processing/core/PShape.java new file mode 100644 index 000000000..cf2274480 --- /dev/null +++ b/core/src/processing/core/PShape.java @@ -0,0 +1,842 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2006-08 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +import java.util.HashMap; + + +/** + * In-progress class to handle shape data, currently to be considered of + * alpha or beta quality. Major structural work may be performed on this class + * after the release of Processing 1.0. Such changes may include: + * + *

      + *
    • addition of proper accessors to read shape vertex and coloring data + * (this is the second most important part of having a PShape class after all). + *
    • a means of creating PShape objects ala beginShape() and endShape(). + *
    • load(), update(), and cache methods ala PImage, so that shapes can + * have renderer-specific optimizations, such as vertex arrays in OpenGL. + *
    • splitting this class into multiple classes to handle different + * varieties of shape data (primitives vs collections of vertices vs paths) + *
    • change of package declaration, for instance moving the code into + * package processing.shape (if the code grows too much). + *
    + * + *

    For the time being, this class and its shape() and loadShape() friends in + * PApplet exist as placeholders for more exciting things to come. If you'd + * like to work with this class, make a subclass (see how PShapeSVG works) + * and you can play with its internal methods all you like.

    + * + *

    Library developers are encouraged to create PShape objects when loading + * shape data, so that they can eventually hook into the bounty that will be + * the PShape interface, and the ease of loadShape() and shape().

    + */ +public class PShape implements PConstants { + + protected String name; + protected HashMap nameTable; + + /** Generic, only draws its child objects. */ + static public final int GROUP = 0; + /** A line, ellipse, arc, image, etc. */ + static public final int PRIMITIVE = 1; + /** A series of vertex, curveVertex, and bezierVertex calls. */ + static public final int PATH = 2; + /** Collections of vertices created with beginShape(). */ + static public final int GEOMETRY = 3; + /** The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY. */ + protected int family; + + /** ELLIPSE, LINE, QUAD; TRIANGLE_FAN, QUAD_STRIP; etc. */ + protected int kind; + + protected PMatrix matrix; + + /** Texture or image data associated with this shape. */ + protected PImage image; + + // boundary box of this shape + //protected float x; + //protected float y; + //protected float width; + //protected float height; + public float width; + public float height; + + // set to false if the object is hidden in the layers palette + protected boolean visible = true; + + protected boolean stroke; + protected int strokeColor; + protected float strokeWeight; // default is 1 + protected int strokeCap; + protected int strokeJoin; + + protected boolean fill; + protected int fillColor; + + /** Temporary toggle for whether styles should be honored. */ + protected boolean style = true; + + /** For primitive shapes in particular, parms like x/y/w/h or x1/y1/x2/y2. */ + protected float[] params; + + protected int vertexCount; + /** + * When drawing POLYGON shapes, the second param is an array of length + * VERTEX_FIELD_COUNT. When drawing PATH shapes, the second param has only + * two variables. + */ + protected float[][] vertices; + + static public final int VERTEX = 0; + static public final int BEZIER_VERTEX = 1; + static public final int CURVE_VERTEX = 2; + static public final int BREAK = 3; + /** Array of VERTEX, BEZIER_VERTEX, and CURVE_VERTEXT calls. */ + protected int vertexCodeCount; + protected int[] vertexCodes; + /** True if this is a closed path. */ + protected boolean close; + + // should this be called vertices (consistent with PGraphics internals) + // or does that hurt flexibility? + + protected PShape parent; + protected int childCount; + protected PShape[] children; + + // POINTS, LINES, xLINE_STRIP, xLINE_LOOP + // TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN + // QUADS, QUAD_STRIP + // xPOLYGON +// static final int PATH = 1; // POLYGON, LINE_LOOP, LINE_STRIP +// static final int GROUP = 2; + + // how to handle rectmode/ellipsemode? + // are they bitshifted into the constant? + // CORNER, CORNERS, CENTER, (CENTER_RADIUS?) +// static final int RECT = 3; // could just be QUAD, but would be x1/y1/x2/y2 +// static final int ELLIPSE = 4; +// +// static final int VERTEX = 7; +// static final int CURVE = 5; +// static final int BEZIER = 6; + + + // fill and stroke functions will need a pointer to the parent + // PGraphics object.. may need some kind of createShape() fxn + // or maybe the values are stored until draw() is called? + + // attaching images is very tricky.. it's a different type of data + + // material parameters will be thrown out, + // except those currently supported (kinds of lights) + + // pivot point for transformations +// public float px; +// public float py; + + + public PShape() { + this.family = GROUP; + } + + + public PShape(int family) { + this.family = family; + } + + + public void setName(String name) { + this.name = name; + } + + + public String getName() { + return name; + } + + + public boolean isVisible() { + return visible; + } + + + public void setVisible(boolean visible) { + this.visible = visible; + } + + + /** + * Overrides this shape's style information and uses PGraphics styles and + * colors. Identical to ignoreStyles(true). Also disables styles for all + * child shapes. + */ + public void disableStyle() { + style = false; + + for (int i = 0; i < childCount; i++) { + children[i].disableStyle(); + } + } + + + /** + * Re-enables style information (fill and stroke) set in the shape. + */ + public void enableStyle() { + style = true; + + for (int i = 0; i < childCount; i++) { + children[i].enableStyle(); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +// protected void checkBounds() { +// if (width == 0 || height == 0) { +// // calculate bounds here (also take kids into account) +// width = 1; +// height = 1; +// } +// } + + + /** + * Get the width of the drawing area (not necessarily the shape boundary). + */ + public float getWidth() { + //checkBounds(); + return width; + } + + + /** + * Get the height of the drawing area (not necessarily the shape boundary). + */ + public float getHeight() { + //checkBounds(); + return height; + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /* + boolean strokeSaved; + int strokeColorSaved; + float strokeWeightSaved; + int strokeCapSaved; + int strokeJoinSaved; + + boolean fillSaved; + int fillColorSaved; + + int rectModeSaved; + int ellipseModeSaved; + int shapeModeSaved; + */ + + + protected void pre(PGraphics g) { + if (matrix != null) { + g.pushMatrix(); + g.applyMatrix(matrix); + } + + /* + strokeSaved = g.stroke; + strokeColorSaved = g.strokeColor; + strokeWeightSaved = g.strokeWeight; + strokeCapSaved = g.strokeCap; + strokeJoinSaved = g.strokeJoin; + + fillSaved = g.fill; + fillColorSaved = g.fillColor; + + rectModeSaved = g.rectMode; + ellipseModeSaved = g.ellipseMode; + shapeModeSaved = g.shapeMode; + */ + if (style) { + g.pushStyle(); + styles(g); + } + } + + + protected void styles(PGraphics g) { + // should not be necessary because using only the int version of color + //parent.colorMode(PConstants.RGB, 255); + + if (stroke) { + g.stroke(strokeColor); + g.strokeWeight(strokeWeight); + g.strokeCap(strokeCap); + g.strokeJoin(strokeJoin); + } else { + g.noStroke(); + } + + if (fill) { + //System.out.println("filling " + PApplet.hex(fillColor)); + g.fill(fillColor); + } else { + g.noFill(); + } + } + + + public void post(PGraphics g) { +// for (int i = 0; i < childCount; i++) { +// children[i].draw(g); +// } + + /* + // TODO this is not sufficient, since not saving fillR et al. + g.stroke = strokeSaved; + g.strokeColor = strokeColorSaved; + g.strokeWeight = strokeWeightSaved; + g.strokeCap = strokeCapSaved; + g.strokeJoin = strokeJoinSaved; + + g.fill = fillSaved; + g.fillColor = fillColorSaved; + + g.ellipseMode = ellipseModeSaved; + */ + + if (matrix != null) { + g.popMatrix(); + } + + if (style) { + g.popStyle(); + } + } + + + /** + * Called by the following (the shape() command adds the g) + * PShape s = loadShapes("blah.svg"); + * shape(s); + */ + public void draw(PGraphics g) { + if (visible) { + pre(g); + drawImpl(g); + post(g); + } + } + + + /** + * Draws the SVG document. + */ + public void drawImpl(PGraphics g) { + //System.out.println("drawing " + family); + if (family == GROUP) { + drawGroup(g); + } else if (family == PRIMITIVE) { + drawPrimitive(g); + } else if (family == GEOMETRY) { + drawGeometry(g); + } else if (family == PATH) { + drawPath(g); + } + } + + + protected void drawGroup(PGraphics g) { + for (int i = 0; i < childCount; i++) { + children[i].draw(g); + } + } + + + protected void drawPrimitive(PGraphics g) { + if (kind == POINT) { + g.point(params[0], params[1]); + + } else if (kind == LINE) { + if (params.length == 4) { // 2D + g.line(params[0], params[1], + params[2], params[3]); + } else { // 3D + g.line(params[0], params[1], params[2], + params[3], params[4], params[5]); + } + + } else if (kind == TRIANGLE) { + g.triangle(params[0], params[1], + params[2], params[3], + params[4], params[5]); + + } else if (kind == QUAD) { + g.quad(params[0], params[1], + params[2], params[3], + params[4], params[5], + params[6], params[7]); + + } else if (kind == RECT) { + if (image != null) { + g.imageMode(CORNER); + g.image(image, params[0], params[1], params[2], params[3]); + } else { + g.rectMode(CORNER); + g.rect(params[0], params[1], params[2], params[3]); + } + + } else if (kind == ELLIPSE) { + g.ellipseMode(CORNER); + g.ellipse(params[0], params[1], params[2], params[3]); + + } else if (kind == ARC) { + g.ellipseMode(CORNER); + g.arc(params[0], params[1], params[2], params[3], params[4], params[5]); + + } else if (kind == BOX) { + if (params.length == 1) { + g.box(params[0]); + } else { + g.box(params[0], params[1], params[2]); + } + + } else if (kind == SPHERE) { + g.sphere(params[0]); + } + } + + + protected void drawGeometry(PGraphics g) { + g.beginShape(kind); + if (style) { + for (int i = 0; i < vertexCount; i++) { + g.vertex(vertices[i]); + } + } else { + for (int i = 0; i < vertexCount; i++) { + float[] vert = vertices[i]; + if (vert[PGraphics.Z] == 0) { + g.vertex(vert[X], vert[Y]); + } else { + g.vertex(vert[X], vert[Y], vert[Z]); + } + } + } + g.endShape(); + } + + + /* + protected void drawPath(PGraphics g) { + g.beginShape(); + for (int j = 0; j < childCount; j++) { + if (j > 0) g.breakShape(); + int count = children[j].vertexCount; + float[][] vert = children[j].vertices; + int[] code = children[j].vertexCodes; + + for (int i = 0; i < count; i++) { + if (style) { + if (children[j].fill) { + g.fill(vert[i][R], vert[i][G], vert[i][B]); + } else { + g.noFill(); + } + if (children[j].stroke) { + g.stroke(vert[i][R], vert[i][G], vert[i][B]); + } else { + g.noStroke(); + } + } + g.edge(vert[i][EDGE] == 1); + + if (code[i] == VERTEX) { + g.vertex(vert[i]); + + } else if (code[i] == BEZIER_VERTEX) { + float z0 = vert[i+0][Z]; + float z1 = vert[i+1][Z]; + float z2 = vert[i+2][Z]; + if (z0 == 0 && z1 == 0 && z2 == 0) { + g.bezierVertex(vert[i+0][X], vert[i+0][Y], z0, + vert[i+1][X], vert[i+1][Y], z1, + vert[i+2][X], vert[i+2][Y], z2); + } else { + g.bezierVertex(vert[i+0][X], vert[i+0][Y], + vert[i+1][X], vert[i+1][Y], + vert[i+2][X], vert[i+2][Y]); + } + } else if (code[i] == CURVE_VERTEX) { + float z = vert[i][Z]; + if (z == 0) { + g.curveVertex(vert[i][X], vert[i][Y]); + } else { + g.curveVertex(vert[i][X], vert[i][Y], z); + } + } + } + } + g.endShape(); + } + */ + + + protected void drawPath(PGraphics g) { + // Paths might be empty (go figure) + // http://dev.processing.org/bugs/show_bug.cgi?id=982 + if (vertices == null) return; + + g.beginShape(); + + if (vertexCodeCount == 0) { // each point is a simple vertex + if (vertices[0].length == 2) { // drawing 2D vertices + for (int i = 0; i < vertexCount; i++) { + g.vertex(vertices[i][X], vertices[i][Y]); + } + } else { // drawing 3D vertices + for (int i = 0; i < vertexCount; i++) { + g.vertex(vertices[i][X], vertices[i][Y], vertices[i][Z]); + } + } + + } else { // coded set of vertices + int index = 0; + + if (vertices[0].length == 2) { // drawing a 2D path + for (int j = 0; j < vertexCodeCount; j++) { + switch (vertexCodes[j]) { + + case VERTEX: + g.vertex(vertices[index][X], vertices[index][Y]); + index++; + break; + + case BEZIER_VERTEX: + g.bezierVertex(vertices[index+0][X], vertices[index+0][Y], + vertices[index+1][X], vertices[index+1][Y], + vertices[index+2][X], vertices[index+2][Y]); + index += 3; + break; + + case CURVE_VERTEX: + g.curveVertex(vertices[index][X], vertices[index][Y]); + index++; + + case BREAK: + g.breakShape(); + } + } + } else { // drawing a 3D path + for (int j = 0; j < vertexCodeCount; j++) { + switch (vertexCodes[j]) { + + case VERTEX: + g.vertex(vertices[index][X], vertices[index][Y], vertices[index][Z]); + index++; + break; + + case BEZIER_VERTEX: + g.bezierVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z], + vertices[index+1][X], vertices[index+1][Y], vertices[index+1][Z], + vertices[index+2][X], vertices[index+2][Y], vertices[index+2][Z]); + index += 3; + break; + + case CURVE_VERTEX: + g.curveVertex(vertices[index][X], vertices[index][Y], vertices[index][Z]); + index++; + + case BREAK: + g.breakShape(); + } + } + } + } + g.endShape(close ? CLOSE : OPEN); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + public int getChildCount() { + return childCount; + } + + + public PShape getChild(int index) { + return children[index]; + } + + + public PShape getChild(String target) { + if (name != null && name.equals(target)) { + return this; + } + if (nameTable != null) { + PShape found = nameTable.get(target); + if (found != null) return found; + } + for (int i = 0; i < childCount; i++) { + PShape found = children[i].getChild(target); + if (found != null) return found; + } + return null; + } + + + /** + * Same as getChild(name), except that it first walks all the way up the + * hierarchy to the farthest parent, so that children can be found anywhere. + */ + public PShape findChild(String target) { + if (parent == null) { + return getChild(target); + + } else { + return parent.findChild(target); + } + } + + + // can't be just 'add' because that suggests additive geometry + public void addChild(PShape who) { + if (children == null) { + children = new PShape[1]; + } + if (childCount == children.length) { + children = (PShape[]) PApplet.expand(children); + } + children[childCount++] = who; + who.parent = this; + + if (who.getName() != null) { + addName(who.getName(), who); + } + } + + + /** + * Add a shape to the name lookup table. + */ + protected void addName(String nom, PShape shape) { + if (parent != null) { + parent.addName(nom, shape); + } else { + if (nameTable == null) { + nameTable = new HashMap(); + } + nameTable.put(nom, shape); + } + } + + +// public PShape createGroup() { +// PShape group = new PShape(); +// group.kind = GROUP; +// addChild(group); +// return group; +// } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + // translate, rotate, scale, apply (no push/pop) + // these each call matrix.translate, etc + // if matrix is null when one is called, + // it is created and set to identity + + + public void translate(float tx, float ty) { + checkMatrix(2); + matrix.translate(tx, ty); + } + + + public void translate(float tx, float ty, float tz) { + checkMatrix(3); + matrix.translate(tx, ty, 0); + } + + + public void rotateX(float angle) { + rotate(angle, 1, 0, 0); + } + + + public void rotateY(float angle) { + rotate(angle, 0, 1, 0); + } + + + public void rotateZ(float angle) { + rotate(angle, 0, 0, 1); + } + + + public void rotate(float angle) { + checkMatrix(2); // at least 2... + matrix.rotate(angle); + } + + + public void rotate(float angle, float v0, float v1, float v2) { + checkMatrix(3); + matrix.rotate(angle, v0, v1, v2); + } + + + // + + + public void scale(float s) { + checkMatrix(2); // at least 2... + matrix.scale(s); + } + + + public void scale(float sx, float sy) { + checkMatrix(2); + matrix.scale(sx, sy); + } + + + public void scale(float x, float y, float z) { + checkMatrix(3); + matrix.scale(x, y, z); + } + + + // + + + public void resetMatrix() { + checkMatrix(2); + matrix.reset(); + } + + + public void applyMatrix(PMatrix source) { + if (source instanceof PMatrix2D) { + applyMatrix((PMatrix2D) source); + } else if (source instanceof PMatrix3D) { + applyMatrix((PMatrix3D) source); + } + } + + + public void applyMatrix(PMatrix2D source) { + applyMatrix(source.m00, source.m01, 0, source.m02, + source.m10, source.m11, 0, source.m12, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void applyMatrix(float n00, float n01, float n02, + float n10, float n11, float n12) { + checkMatrix(2); + matrix.apply(n00, n01, n02, 0, + n10, n11, n12, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + } + + + public void apply(PMatrix3D source) { + applyMatrix(source.m00, source.m01, source.m02, source.m03, + source.m10, source.m11, source.m12, source.m13, + source.m20, source.m21, source.m22, source.m23, + source.m30, source.m31, source.m32, source.m33); + } + + + public void applyMatrix(float n00, float n01, float n02, float n03, + float n10, float n11, float n12, float n13, + float n20, float n21, float n22, float n23, + float n30, float n31, float n32, float n33) { + checkMatrix(3); + matrix.apply(n00, n01, n02, n03, + n10, n11, n12, n13, + n20, n21, n22, n23, + n30, n31, n32, n33); + } + + + // + + + /** + * Make sure that the shape's matrix is 1) not null, and 2) has a matrix + * that can handle at least the specified number of dimensions. + */ + protected void checkMatrix(int dimensions) { + if (matrix == null) { + if (dimensions == 2) { + matrix = new PMatrix2D(); + } else { + matrix = new PMatrix3D(); + } + } else if (dimensions == 3 && (matrix instanceof PMatrix2D)) { + // time for an upgrayedd for a double dose of my pimpin' + matrix = new PMatrix3D(matrix); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Center the shape based on its bounding box. Can't assume + * that the bounding box is 0, 0, width, height. Common case will be + * opening a letter size document in Illustrator, and drawing something + * in the middle, then reading it in as an svg file. + * This will also need to flip the y axis (scale(1, -1)) in cases + * like Adobe Illustrator where the coordinates start at the bottom. + */ +// public void center() { +// } + + + /** + * Set the pivot point for all transformations. + */ +// public void pivot(float x, float y) { +// px = x; +// py = y; +// } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +} \ No newline at end of file diff --git a/core/src/processing/core/PShapeSVG.java b/core/src/processing/core/PShapeSVG.java new file mode 100644 index 000000000..db1bd9e88 --- /dev/null +++ b/core/src/processing/core/PShapeSVG.java @@ -0,0 +1,1469 @@ +package processing.core; + +import java.awt.Paint; +import java.awt.PaintContext; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.awt.image.ColorModel; +import java.awt.image.Raster; +import java.awt.image.WritableRaster; +import java.util.HashMap; + +import processing.xml.XMLElement; + + +/** + * SVG stands for Scalable Vector Graphics, a portable graphics format. It is + * a vector format so it allows for infinite resolution and relatively small + * file sizes. Most modern media software can view SVG files, including Adobe + * products, Firefox, etc. Illustrator and Inkscape can edit SVG files. + *

    + * We have no intention of turning this into a full-featured SVG library. + * The goal of this project is a basic shape importer that is small enough + * to be included with applets, meaning that its download size should be + * in the neighborhood of 25-30k. Starting with release 0149, this library + * has been incorporated into the core via the loadShape() command, because + * vector shape data is just as important as the image data from loadImage(). + *

    + * For more sophisticated import/export, consider the + * Batik + * library from the Apache Software Foundation. Future improvements to this + * library may focus on this properly supporting a specific subset of SVG, + * for instance the simpler SVG profiles known as + * SVG Tiny or Basic, + * although we still would not support the interactivity options. + * + *


    + * + * A minimal example program using SVG: + * (assuming a working moo.svg is in your data folder) + * + *

    + * PShape moo;
    + *
    + * void setup() {
    + *   size(400, 400);
    + *   moo = loadShape("moo.svg");
    + * }
    + * void draw() {
    + *   background(255);
    + *   shape(moo, mouseX, mouseY);
    + * }
    + * 
    + * + * This code is based on the Candy library written by Michael Chang, which was + * later revised and expanded for use as a Processing core library by Ben Fry. + * Thanks to Ricard Marxer Pinon for help with better Inkscape support in 0154. + * + *


    + * + * Late October 2008 revisions from ricardmp, incorporated by fry (0154) + *

      + *
    • Better style attribute handling, enabling better Inkscape support. + *
    + * + * October 2008 revisions by fry (Processing 0149, pre-1.0) + *
      + *
    • Candy is no longer a separate library, and is instead part of core. + *
    • Loading now works through loadShape() + *
    • Shapes are now drawn using the new PGraphics shape() method. + *
    + * + * August 2008 revisions by fry (Processing 0149) + *
      + *
    • Major changes to rework around PShape. + *
    • Now implementing more of the "transform" attribute. + *
    + * + * February 2008 revisions by fry (Processing 0136) + *
      + *
    • Added support for quadratic curves in paths (Q, q, T, and t operators) + *
    • Support for reading SVG font data (though not rendering it yet) + *
    + * + * Revisions for "Candy 2" November 2006 by fry + *
      + *
    • Switch to the new processing.xml library + *
    • Several bug fixes for parsing of shape data + *
    • Support for linear and radial gradients + *
    • Support for additional types of shapes + *
    • Added compound shapes (shapes with interior points) + *
    • Added methods to get shapes from an internal table + *
    + * + * Revision 10/31/06 by flux + *
      + *
    • Now properly supports Processing 0118 + *
    • Fixed a bunch of things for Casey's students and general buggity. + *
    • Will now properly draw #FFFFFFFF colors (were being represented as -1) + *
    • SVGs without tags are now properly caught and loaded + *
    • Added a method customStyle() for overriding SVG colors/styles + *
    • Added a method SVGStyle() to go back to using SVG colors/styles + *
    + * + * Some SVG objects and features may not yet be supported. + * Here is a partial list of non-included features + *
      + *
    • Rounded rectangles + *
    • Drop shadow objects + *
    • Typography + *
    • Layers added for Candy 2 + *
    • Patterns + *
    • Embedded images + *
    + * + * For those interested, the SVG specification can be found + * here. + */ +public class PShapeSVG extends PShape { + XMLElement element; + + float opacity; + float strokeOpacity; + float fillOpacity; + + + Gradient strokeGradient; + Paint strokeGradientPaint; + String strokeName; // id of another object, gradients only? + + Gradient fillGradient; + Paint fillGradientPaint; + String fillName; // id of another object + + + /** + * Initializes a new SVG Object with the given filename. + */ + public PShapeSVG(PApplet parent, String filename) { + // this will grab the root document, starting + // the xml version and initial comments are ignored + this(new XMLElement(parent, filename)); + } + + + /** + * Initializes a new SVG Object from the given XMLElement. + */ + public PShapeSVG(XMLElement svg) { + this(null, svg); + + if (!svg.getName().equals("svg")) { + throw new RuntimeException("root is not , it's <" + svg.getName() + ">"); + } + + // not proper parsing of the viewBox, but will cover us for cases where + // the width and height of the object is not specified + String viewBoxStr = svg.getStringAttribute("viewBox"); + if (viewBoxStr != null) { + int[] viewBox = PApplet.parseInt(PApplet.splitTokens(viewBoxStr)); + width = viewBox[2]; + height = viewBox[3]; + } + + // TODO if viewbox is not same as width/height, then use it to scale + // the original objects. for now, viewbox only used when width/height + // are empty values (which by the spec means w/h of "100%" + String unitWidth = svg.getStringAttribute("width"); + String unitHeight = svg.getStringAttribute("height"); + if (unitWidth != null) { + width = parseUnitSize(unitWidth); + height = parseUnitSize(unitHeight); + } else { + if ((width == 0) || (height == 0)) { + //throw new RuntimeException("width/height not specified"); + PGraphics.showWarning("The width and/or height is not " + + "readable in the tag of this file."); + // For the spec, the default is 100% and 100%. For purposes + // here, insert a dummy value because this is prolly just a + // font or something for which the w/h doesn't matter. + width = 1; + height = 1; + } + } + + //root = new Group(null, svg); + parseChildren(svg); // ? + } + + + public PShapeSVG(PShapeSVG parent, XMLElement properties) { + //super(GROUP); + + if (parent == null) { + // set values to their defaults according to the SVG spec + stroke = false; + strokeColor = 0xff000000; + strokeWeight = 1; + strokeCap = PConstants.SQUARE; // equivalent to BUTT in svg spec + strokeJoin = PConstants.MITER; + strokeGradient = null; + strokeGradientPaint = null; + strokeName = null; + + fill = true; + fillColor = 0xff000000; + fillGradient = null; + fillGradientPaint = null; + fillName = null; + + //hasTransform = false; + //transformation = null; //new float[] { 1, 0, 0, 1, 0, 0 }; + + strokeOpacity = 1; + fillOpacity = 1; + opacity = 1; + + } else { + stroke = parent.stroke; + strokeColor = parent.strokeColor; + strokeWeight = parent.strokeWeight; + strokeCap = parent.strokeCap; + strokeJoin = parent.strokeJoin; + strokeGradient = parent.strokeGradient; + strokeGradientPaint = parent.strokeGradientPaint; + strokeName = parent.strokeName; + + fill = parent.fill; + fillColor = parent.fillColor; + fillGradient = parent.fillGradient; + fillGradientPaint = parent.fillGradientPaint; + fillName = parent.fillName; + + //hasTransform = parent.hasTransform; + //transformation = parent.transformation; + + opacity = parent.opacity; + } + + element = properties; + name = properties.getStringAttribute("id"); + + String displayStr = properties.getStringAttribute("display", "inline"); + visible = !displayStr.equals("none"); + + String transformStr = properties.getStringAttribute("transform"); + if (transformStr != null) { + matrix = parseMatrix(transformStr); + } + + parseColors(properties); + parseChildren(properties); + } + + + protected void parseChildren(XMLElement graphics) { + XMLElement[] elements = graphics.getChildren(); + children = new PShape[elements.length]; + childCount = 0; + + for (XMLElement elem : elements) { + PShape kid = parseChild(elem); + if (kid != null) { + addChild(kid); + } + } + } + + + /** + * Parse a child XML element. + * Override this method to add parsing for more SVG elements. + */ + protected PShape parseChild(XMLElement elem) { + String name = elem.getName(); + PShapeSVG shape = null; + + if (name.equals("g")) { + //return new BaseObject(this, elem); + shape = new PShapeSVG(this, elem); + + } else if (name.equals("defs")) { + // generally this will contain gradient info, so may + // as well just throw it into a group element for parsing + //return new BaseObject(this, elem); + shape = new PShapeSVG(this, elem); + + } else if (name.equals("line")) { + //return new Line(this, elem); + //return new BaseObject(this, elem, LINE); + shape = new PShapeSVG(this, elem); + shape.parseLine(); + + } else if (name.equals("circle")) { + //return new BaseObject(this, elem, ELLIPSE); + shape = new PShapeSVG(this, elem); + shape.parseEllipse(true); + + } else if (name.equals("ellipse")) { + //return new BaseObject(this, elem, ELLIPSE); + shape = new PShapeSVG(this, elem); + shape.parseEllipse(false); + + } else if (name.equals("rect")) { + //return new BaseObject(this, elem, RECT); + shape = new PShapeSVG(this, elem); + shape.parseRect(); + + } else if (name.equals("polygon")) { + //return new BaseObject(this, elem, POLYGON); + shape = new PShapeSVG(this, elem); + shape.parsePoly(true); + + } else if (name.equals("polyline")) { + //return new BaseObject(this, elem, POLYGON); + shape = new PShapeSVG(this, elem); + shape.parsePoly(false); + + } else if (name.equals("path")) { + //return new BaseObject(this, elem, PATH); + shape = new PShapeSVG(this, elem); + shape.parsePath(); + + } else if (name.equals("radialGradient")) { + return new RadialGradient(this, elem); + + } else if (name.equals("linearGradient")) { + return new LinearGradient(this, elem); + + } else if (name.equals("text")) { + PGraphics.showWarning("Text in SVG files is not currently supported, " + + "convert text to outlines instead."); + + } else if (name.equals("filter")) { + PGraphics.showWarning("Filters are not supported."); + + } else if (name.equals("mask")) { + PGraphics.showWarning("Masks are not supported."); + + } else { + PGraphics.showWarning("Ignoring <" + name + "> tag."); + } + return shape; + } + + + protected void parseLine() { + kind = LINE; + family = PRIMITIVE; + params = new float[] { + element.getFloatAttribute("x1"), + element.getFloatAttribute("y1"), + element.getFloatAttribute("x2"), + element.getFloatAttribute("y2"), + }; + // x = params[0]; + // y = params[1]; + // width = params[2]; + // height = params[3]; + } + + + /** + * Handles parsing ellipse and circle tags. + * @param circle true if this is a circle and not an ellipse + */ + protected void parseEllipse(boolean circle) { + kind = ELLIPSE; + family = PRIMITIVE; + params = new float[4]; + + params[0] = element.getFloatAttribute("cx"); + params[1] = element.getFloatAttribute("cy"); + + float rx, ry; + if (circle) { + rx = ry = element.getFloatAttribute("r"); + } else { + rx = element.getFloatAttribute("rx"); + ry = element.getFloatAttribute("ry"); + } + params[0] -= rx; + params[1] -= ry; + + params[2] = rx*2; + params[3] = ry*2; + } + + + protected void parseRect() { + kind = RECT; + family = PRIMITIVE; + params = new float[] { + element.getFloatAttribute("x"), + element.getFloatAttribute("y"), + element.getFloatAttribute("width"), + element.getFloatAttribute("height"), + }; + } + + + /** + * Parse a polyline or polygon from an SVG file. + * @param close true if shape is closed (polygon), false if not (polyline) + */ + protected void parsePoly(boolean close) { + family = PATH; + this.close = close; + + String pointsAttr = element.getStringAttribute("points"); + if (pointsAttr != null) { + String[] pointsBuffer = PApplet.splitTokens(pointsAttr); + vertexCount = pointsBuffer.length; + vertices = new float[vertexCount][2]; + for (int i = 0; i < vertexCount; i++) { + String pb[] = PApplet.split(pointsBuffer[i], ','); + vertices[i][X] = Float.valueOf(pb[0]).floatValue(); + vertices[i][Y] = Float.valueOf(pb[1]).floatValue(); + } + } + } + + + protected void parsePath() { + family = PATH; + kind = 0; + + String pathData = element.getStringAttribute("d"); + if (pathData == null) return; + char[] pathDataChars = pathData.toCharArray(); + + StringBuffer pathBuffer = new StringBuffer(); + boolean lastSeparate = false; + + for (int i = 0; i < pathDataChars.length; i++) { + char c = pathDataChars[i]; + boolean separate = false; + + if (c == 'M' || c == 'm' || + c == 'L' || c == 'l' || + c == 'H' || c == 'h' || + c == 'V' || c == 'v' || + c == 'C' || c == 'c' || // beziers + c == 'S' || c == 's' || + c == 'Q' || c == 'q' || // quadratic beziers + c == 'T' || c == 't' || + c == 'Z' || c == 'z' || // closepath + c == ',') { + separate = true; + if (i != 0) { + pathBuffer.append("|"); + } + } + if (c == 'Z' || c == 'z') { + separate = false; + } + if (c == '-' && !lastSeparate) { + pathBuffer.append("|"); + } + if (c != ',') { + pathBuffer.append(c); //"" + pathDataBuffer.charAt(i)); + } + if (separate && c != ',' && c != '-') { + pathBuffer.append("|"); + } + lastSeparate = separate; + } + + // use whitespace constant to get rid of extra spaces and CR or LF + String[] pathDataKeys = + PApplet.splitTokens(pathBuffer.toString(), "|" + WHITESPACE); + vertices = new float[pathDataKeys.length][2]; + vertexCodes = new int[pathDataKeys.length]; + + float cx = 0; + float cy = 0; + + int i = 0; + while (i < pathDataKeys.length) { + char c = pathDataKeys[i].charAt(0); + switch (c) { + + case 'M': // M - move to (absolute) + cx = PApplet.parseFloat(pathDataKeys[i + 1]); + cy = PApplet.parseFloat(pathDataKeys[i + 2]); + parsePathMoveto(cx, cy); + i += 3; + break; + + case 'm': // m - move to (relative) + cx = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + cy = cy + PApplet.parseFloat(pathDataKeys[i + 2]); + parsePathMoveto(cx, cy); + i += 3; + break; + + case 'L': + cx = PApplet.parseFloat(pathDataKeys[i + 1]); + cy = PApplet.parseFloat(pathDataKeys[i + 2]); + parsePathLineto(cx, cy); + i += 3; + break; + + case 'l': + cx = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + cy = cy + PApplet.parseFloat(pathDataKeys[i + 2]); + parsePathLineto(cx, cy); + i += 3; + break; + + // horizontal lineto absolute + case 'H': + cx = PApplet.parseFloat(pathDataKeys[i + 1]); + parsePathLineto(cx, cy); + i += 2; + break; + + // horizontal lineto relative + case 'h': + cx = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + parsePathLineto(cx, cy); + i += 2; + break; + + case 'V': + cy = PApplet.parseFloat(pathDataKeys[i + 1]); + parsePathLineto(cx, cy); + i += 2; + break; + + case 'v': + cy = cy + PApplet.parseFloat(pathDataKeys[i + 1]); + parsePathLineto(cx, cy); + i += 2; + break; + + // C - curve to (absolute) + case 'C': { + float ctrlX1 = PApplet.parseFloat(pathDataKeys[i + 1]); + float ctrlY1 = PApplet.parseFloat(pathDataKeys[i + 2]); + float ctrlX2 = PApplet.parseFloat(pathDataKeys[i + 3]); + float ctrlY2 = PApplet.parseFloat(pathDataKeys[i + 4]); + float endX = PApplet.parseFloat(pathDataKeys[i + 5]); + float endY = PApplet.parseFloat(pathDataKeys[i + 6]); + parsePathCurveto(ctrlX1, ctrlY1, ctrlX2, ctrlY2, endX, endY); + cx = endX; + cy = endY; + i += 7; + } + break; + + // c - curve to (relative) + case 'c': { + float ctrlX1 = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + float ctrlY1 = cy + PApplet.parseFloat(pathDataKeys[i + 2]); + float ctrlX2 = cx + PApplet.parseFloat(pathDataKeys[i + 3]); + float ctrlY2 = cy + PApplet.parseFloat(pathDataKeys[i + 4]); + float endX = cx + PApplet.parseFloat(pathDataKeys[i + 5]); + float endY = cy + PApplet.parseFloat(pathDataKeys[i + 6]); + parsePathCurveto(ctrlX1, ctrlY1, ctrlX2, ctrlY2, endX, endY); + cx = endX; + cy = endY; + i += 7; + } + break; + + // S - curve to shorthand (absolute) + case 'S': { + float ppx = vertices[vertexCount-2][X]; + float ppy = vertices[vertexCount-2][Y]; + float px = vertices[vertexCount-1][X]; + float py = vertices[vertexCount-1][Y]; + float ctrlX1 = px + (px - ppx); + float ctrlY1 = py + (py - ppy); + float ctrlX2 = PApplet.parseFloat(pathDataKeys[i + 1]); + float ctrlY2 = PApplet.parseFloat(pathDataKeys[i + 2]); + float endX = PApplet.parseFloat(pathDataKeys[i + 3]); + float endY = PApplet.parseFloat(pathDataKeys[i + 4]); + parsePathCurveto(ctrlX1, ctrlY1, ctrlX2, ctrlY2, endX, endY); + cx = endX; + cy = endY; + i += 5; + } + break; + + // s - curve to shorthand (relative) + case 's': { + float ppx = vertices[vertexCount-2][X]; + float ppy = vertices[vertexCount-2][Y]; + float px = vertices[vertexCount-1][X]; + float py = vertices[vertexCount-1][Y]; + float ctrlX1 = px + (px - ppx); + float ctrlY1 = py + (py - ppy); + float ctrlX2 = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + float ctrlY2 = cy + PApplet.parseFloat(pathDataKeys[i + 2]); + float endX = cx + PApplet.parseFloat(pathDataKeys[i + 3]); + float endY = cy + PApplet.parseFloat(pathDataKeys[i + 4]); + parsePathCurveto(ctrlX1, ctrlY1, ctrlX2, ctrlY2, endX, endY); + cx = endX; + cy = endY; + i += 5; + } + break; + + // Q - quadratic curve to (absolute) + case 'Q': { + float ctrlX = PApplet.parseFloat(pathDataKeys[i + 1]); + float ctrlY = PApplet.parseFloat(pathDataKeys[i + 2]); + float endX = PApplet.parseFloat(pathDataKeys[i + 3]); + float endY = PApplet.parseFloat(pathDataKeys[i + 4]); + parsePathQuadto(cx, cy, ctrlX, ctrlY, endX, endY); + cx = endX; + cy = endY; + i += 5; + } + break; + + // q - quadratic curve to (relative) + case 'q': { + float ctrlX = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + float ctrlY = cy + PApplet.parseFloat(pathDataKeys[i + 2]); + float endX = cx + PApplet.parseFloat(pathDataKeys[i + 3]); + float endY = cy + PApplet.parseFloat(pathDataKeys[i + 4]); + parsePathQuadto(cx, cy, ctrlX, ctrlY, endX, endY); + cx = endX; + cy = endY; + i += 5; + } + break; + + // T - quadratic curve to shorthand (absolute) + // The control point is assumed to be the reflection of the + // control point on the previous command relative to the + // current point. (If there is no previous command or if the + // previous command was not a Q, q, T or t, assume the control + // point is coincident with the current point.) + case 'T': { + float ppx = vertices[vertexCount-2][X]; + float ppy = vertices[vertexCount-2][Y]; + float px = vertices[vertexCount-1][X]; + float py = vertices[vertexCount-1][Y]; + float ctrlX = px + (px - ppx); + float ctrlY = py + (py - ppy); + float endX = PApplet.parseFloat(pathDataKeys[i + 1]); + float endY = PApplet.parseFloat(pathDataKeys[i + 2]); + parsePathQuadto(cx, cy, ctrlX, ctrlY, endX, endY); + cx = endX; + cy = endY; + i += 3; + } + break; + + // t - quadratic curve to shorthand (relative) + case 't': { + float ppx = vertices[vertexCount-2][X]; + float ppy = vertices[vertexCount-2][Y]; + float px = vertices[vertexCount-1][X]; + float py = vertices[vertexCount-1][Y]; + float ctrlX = px + (px - ppx); + float ctrlY = py + (py - ppy); + float endX = cx + PApplet.parseFloat(pathDataKeys[i + 1]); + float endY = cy + PApplet.parseFloat(pathDataKeys[i + 2]); + parsePathQuadto(cx, cy, ctrlX, ctrlY, endX, endY); + cx = endX; + cy = endY; + i += 3; + } + break; + + case 'Z': + case 'z': + close = true; + i++; + break; + + default: + String parsed = + PApplet.join(PApplet.subset(pathDataKeys, 0, i), ","); + String unparsed = + PApplet.join(PApplet.subset(pathDataKeys, i), ","); + System.err.println("parsed: " + parsed); + System.err.println("unparsed: " + unparsed); + if (pathDataKeys[i].equals("a") || pathDataKeys[i].equals("A")) { + String msg = "Sorry, elliptical arc support for SVG files " + + "is not yet implemented (See bug #996 for details)"; + throw new RuntimeException(msg); + } + throw new RuntimeException("shape command not handled: " + pathDataKeys[i]); + } + } + } + + +// private void parsePathCheck(int num) { +// if (vertexCount + num-1 >= vertices.length) { +// //vertices = (float[][]) PApplet.expand(vertices); +// float[][] temp = new float[vertexCount << 1][2]; +// System.arraycopy(vertices, 0, temp, 0, vertexCount); +// vertices = temp; +// } +// } + + private void parsePathVertex(float x, float y) { + if (vertexCount == vertices.length) { + //vertices = (float[][]) PApplet.expand(vertices); + float[][] temp = new float[vertexCount << 1][2]; + System.arraycopy(vertices, 0, temp, 0, vertexCount); + vertices = temp; + } + vertices[vertexCount][X] = x; + vertices[vertexCount][Y] = y; + vertexCount++; + } + + + private void parsePathCode(int what) { + if (vertexCodeCount == vertexCodes.length) { + vertexCodes = PApplet.expand(vertexCodes); + } + vertexCodes[vertexCodeCount++] = what; + } + + + private void parsePathMoveto(float px, float py) { + if (vertexCount > 0) { + parsePathCode(BREAK); + } + parsePathCode(VERTEX); + parsePathVertex(px, py); + } + + + private void parsePathLineto(float px, float py) { + parsePathCode(VERTEX); + parsePathVertex(px, py); + } + + + private void parsePathCurveto(float x1, float y1, + float x2, float y2, + float x3, float y3) { + parsePathCode(BEZIER_VERTEX); + parsePathVertex(x1, y1); + parsePathVertex(x2, y2); + parsePathVertex(x3, y3); + } + + private void parsePathQuadto(float x1, float y1, + float cx, float cy, + float x2, float y2) { + parsePathCode(BEZIER_VERTEX); + // x1/y1 already covered by last moveto, lineto, or curveto + parsePathVertex(x1 + ((cx-x1)*2/3.0f), y1 + ((cy-y1)*2/3.0f)); + parsePathVertex(x2 + ((cx-x2)*2/3.0f), y2 + ((cy-y2)*2/3.0f)); + parsePathVertex(x2, y2); + } + + + /** + * Parse the specified SVG matrix into a PMatrix2D. Note that PMatrix2D + * is rotated relative to the SVG definition, so parameters are rearranged + * here. More about the transformation matrices in + * this section + * of the SVG documentation. + * @param matrixStr text of the matrix param. + * @return a good old-fashioned PMatrix2D + */ + static protected PMatrix2D parseMatrix(String matrixStr) { + String[] pieces = PApplet.match(matrixStr, "\\s*(\\w+)\\((.*)\\)"); + if (pieces == null) { + System.err.println("Could not parse transform " + matrixStr); + return null; + } + float[] m = PApplet.parseFloat(PApplet.splitTokens(pieces[2], ", ")); + if (pieces[1].equals("matrix")) { + return new PMatrix2D(m[0], m[2], m[4], m[1], m[3], m[5]); + + } else if (pieces[1].equals("translate")) { + float tx = m[0]; + float ty = (m.length == 2) ? m[1] : m[0]; + //return new float[] { 1, 0, tx, 0, 1, ty }; + return new PMatrix2D(1, 0, tx, 0, 1, ty); + + } else if (pieces[1].equals("scale")) { + float sx = m[0]; + float sy = (m.length == 2) ? m[1] : m[0]; + //return new float[] { sx, 0, 0, 0, sy, 0 }; + return new PMatrix2D(sx, 0, 0, 0, sy, 0); + + } else if (pieces[1].equals("rotate")) { + float angle = m[0]; + + if (m.length == 1) { + float c = PApplet.cos(angle); + float s = PApplet.sin(angle); + // SVG version is cos(a) sin(a) -sin(a) cos(a) 0 0 + return new PMatrix2D(c, -s, 0, s, c, 0); + + } else if (m.length == 3) { + PMatrix2D mat = new PMatrix2D(0, 1, m[1], 1, 0, m[2]); + mat.rotate(m[0]); + mat.translate(-m[1], -m[2]); + return mat; //.get(null); + } + + } else if (pieces[1].equals("skewX")) { + return new PMatrix2D(1, 0, 1, PApplet.tan(m[0]), 0, 0); + + } else if (pieces[1].equals("skewY")) { + return new PMatrix2D(1, 0, 1, 0, PApplet.tan(m[0]), 0); + } + return null; + } + + + protected void parseColors(XMLElement properties) { + if (properties.hasAttribute("opacity")) { + String opacityText = properties.getStringAttribute("opacity"); + setOpacity(opacityText); + } + + if (properties.hasAttribute("stroke")) { + String strokeText = properties.getStringAttribute("stroke"); + setStroke(strokeText); + } + + if (properties.hasAttribute("stroke-width")) { + // if NaN (i.e. if it's 'inherit') then default back to the inherit setting + String lineweight = properties.getStringAttribute("stroke-width"); + setStrokeWeight(lineweight); + } + + if (properties.hasAttribute("stroke-linejoin")) { + String linejoin = properties.getStringAttribute("stroke-linejoin"); + setStrokeJoin(linejoin); + } + + if (properties.hasAttribute("stroke-linecap")) { + String linecap = properties.getStringAttribute("stroke-linecap"); + setStrokeCap(linecap); + } + + + // fill defaults to black (though stroke defaults to "none") + // http://www.w3.org/TR/SVG/painting.html#FillProperties + if (properties.hasAttribute("fill")) { + String fillText = properties.getStringAttribute("fill"); + setFill(fillText); + + } + + if (properties.hasAttribute("style")) { + String styleText = properties.getStringAttribute("style"); + String[] styleTokens = PApplet.splitTokens(styleText, ";"); + + //PApplet.println(styleTokens); + for (int i = 0; i < styleTokens.length; i++) { + String[] tokens = PApplet.splitTokens(styleTokens[i], ":"); + //PApplet.println(tokens); + + tokens[0] = PApplet.trim(tokens[0]); + + if (tokens[0].equals("fill")) { + setFill(tokens[1]); + + } else if(tokens[0].equals("fill-opacity")) { + setFillOpacity(tokens[1]); + + } else if(tokens[0].equals("stroke")) { + setStroke(tokens[1]); + + } else if(tokens[0].equals("stroke-width")) { + setStrokeWeight(tokens[1]); + + } else if(tokens[0].equals("stroke-linecap")) { + setStrokeCap(tokens[1]); + + } else if(tokens[0].equals("stroke-linejoin")) { + setStrokeJoin(tokens[1]); + + } else if(tokens[0].equals("stroke-opacity")) { + setStrokeOpacity(tokens[1]); + + } else if(tokens[0].equals("opacity")) { + setOpacity(tokens[1]); + + } else { + // Other attributes are not yet implemented + } + } + } + } + + void setOpacity(String opacityText) { + opacity = PApplet.parseFloat(opacityText); + strokeColor = ((int) (opacity * 255)) << 24 | strokeColor & 0xFFFFFF; + fillColor = ((int) (opacity * 255)) << 24 | fillColor & 0xFFFFFF; + } + + void setStrokeWeight(String lineweight) { + strokeWeight = PApplet.parseFloat(lineweight); + } + + void setStrokeOpacity(String opacityText) { + strokeOpacity = PApplet.parseFloat(opacityText); + strokeColor = ((int) (strokeOpacity * 255)) << 24 | strokeColor & 0xFFFFFF; + } + + void setStroke(String strokeText) { + int opacityMask = strokeColor & 0xFF000000; + if (strokeText.equals("none")) { + stroke = false; + } else if (strokeText.startsWith("#")) { + stroke = true; + strokeColor = opacityMask | + (Integer.parseInt(strokeText.substring(1), 16)) & 0xFFFFFF; + } else if (strokeText.startsWith("rgb")) { + stroke = true; + strokeColor = opacityMask | parseRGB(strokeText); + } else if (strokeText.startsWith("url(#")) { + strokeName = strokeText.substring(5, strokeText.length() - 1); + Object strokeObject = findChild(strokeName); + if (strokeObject instanceof Gradient) { + strokeGradient = (Gradient) strokeObject; + strokeGradientPaint = calcGradientPaint(strokeGradient); //, opacity); + } else { + System.err.println("url " + strokeName + " refers to unexpected data"); + } + } + } + + void setStrokeJoin(String linejoin) { + if (linejoin.equals("inherit")) { + // do nothing, will inherit automatically + + } else if (linejoin.equals("miter")) { + strokeJoin = PConstants.MITER; + + } else if (linejoin.equals("round")) { + strokeJoin = PConstants.ROUND; + + } else if (linejoin.equals("bevel")) { + strokeJoin = PConstants.BEVEL; + } + } + + void setStrokeCap(String linecap) { + if (linecap.equals("inherit")) { + // do nothing, will inherit automatically + + } else if (linecap.equals("butt")) { + strokeCap = PConstants.SQUARE; + + } else if (linecap.equals("round")) { + strokeCap = PConstants.ROUND; + + } else if (linecap.equals("square")) { + strokeCap = PConstants.PROJECT; + } + } + + void setFillOpacity(String opacityText) { + fillOpacity = PApplet.parseFloat(opacityText); + fillColor = ((int) (fillOpacity * 255)) << 24 | fillColor & 0xFFFFFF; + } + + void setFill(String fillText) { + int opacityMask = fillColor & 0xFF000000; + if (fillText.equals("none")) { + fill = false; + } else if (fillText.startsWith("#")) { + fill = true; + fillColor = opacityMask | + (Integer.parseInt(fillText.substring(1), 16)) & 0xFFFFFF; + //System.out.println("hex for fill is " + PApplet.hex(fillColor)); + } else if (fillText.startsWith("rgb")) { + fill = true; + fillColor = opacityMask | parseRGB(fillText); + } else if (fillText.startsWith("url(#")) { + fillName = fillText.substring(5, fillText.length() - 1); + //PApplet.println("looking for " + fillName); + Object fillObject = findChild(fillName); + //PApplet.println("found " + fillObject); + if (fillObject instanceof Gradient) { + fill = true; + fillGradient = (Gradient) fillObject; + fillGradientPaint = calcGradientPaint(fillGradient); //, opacity); + //PApplet.println("got filla " + fillObject); + } else { + System.err.println("url " + fillName + " refers to unexpected data"); + } + } + } + + + static protected int parseRGB(String what) { + int leftParen = what.indexOf('(') + 1; + int rightParen = what.indexOf(')'); + String sub = what.substring(leftParen, rightParen); + int[] values = PApplet.parseInt(PApplet.splitTokens(sub, ", ")); + return (values[0] << 16) | (values[1] << 8) | (values[2]); + } + + + static protected HashMap parseStyleAttributes(String style) { + HashMap table = new HashMap(); + String[] pieces = style.split(";"); + for (int i = 0; i < pieces.length; i++) { + String[] parts = pieces[i].split(":"); + table.put(parts[0], parts[1]); + } + return table; + } + + + /** + * Parse a size that may have a suffix for its units. + * Ignoring cases where this could also be a percentage. + * The units spec: + *
      + *
    • "1pt" equals "1.25px" (and therefore 1.25 user units) + *
    • "1pc" equals "15px" (and therefore 15 user units) + *
    • "1mm" would be "3.543307px" (3.543307 user units) + *
    • "1cm" equals "35.43307px" (and therefore 35.43307 user units) + *
    • "1in" equals "90px" (and therefore 90 user units) + *
    + */ + static protected float parseUnitSize(String text) { + int len = text.length() - 2; + + if (text.endsWith("pt")) { + return PApplet.parseFloat(text.substring(0, len)) * 1.25f; + } else if (text.endsWith("pc")) { + return PApplet.parseFloat(text.substring(0, len)) * 15; + } else if (text.endsWith("mm")) { + return PApplet.parseFloat(text.substring(0, len)) * 3.543307f; + } else if (text.endsWith("cm")) { + return PApplet.parseFloat(text.substring(0, len)) * 35.43307f; + } else if (text.endsWith("in")) { + return PApplet.parseFloat(text.substring(0, len)) * 90; + } else if (text.endsWith("px")) { + return PApplet.parseFloat(text.substring(0, len)); + } else { + return PApplet.parseFloat(text); + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + static class Gradient extends PShapeSVG { + AffineTransform transform; + + float[] offset; + int[] color; + int count; + + public Gradient(PShapeSVG parent, XMLElement properties) { + super(parent, properties); + + XMLElement elements[] = properties.getChildren(); + offset = new float[elements.length]; + color = new int[elements.length]; + + // + for (int i = 0; i < elements.length; i++) { + XMLElement elem = elements[i]; + String name = elem.getName(); + if (name.equals("stop")) { + offset[count] = elem.getFloatAttribute("offset"); + String style = elem.getStringAttribute("style"); + HashMap styles = parseStyleAttributes(style); + + String colorStr = styles.get("stop-color"); + if (colorStr == null) colorStr = "#000000"; + String opacityStr = styles.get("stop-opacity"); + if (opacityStr == null) opacityStr = "1"; + int tupacity = (int) (PApplet.parseFloat(opacityStr) * 255); + color[count] = (tupacity << 24) | + Integer.parseInt(colorStr.substring(1), 16); + count++; + } + } + offset = PApplet.subset(offset, 0, count); + color = PApplet.subset(color, 0, count); + } + } + + + class LinearGradient extends Gradient { + float x1, y1, x2, y2; + + public LinearGradient(PShapeSVG parent, XMLElement properties) { + super(parent, properties); + + this.x1 = properties.getFloatAttribute("x1"); + this.y1 = properties.getFloatAttribute("y1"); + this.x2 = properties.getFloatAttribute("x2"); + this.y2 = properties.getFloatAttribute("y2"); + + String transformStr = + properties.getStringAttribute("gradientTransform"); + + if (transformStr != null) { + float t[] = parseMatrix(transformStr).get(null); + this.transform = new AffineTransform(t[0], t[3], t[1], t[4], t[2], t[5]); + + Point2D t1 = transform.transform(new Point2D.Float(x1, y1), null); + Point2D t2 = transform.transform(new Point2D.Float(x2, y2), null); + + this.x1 = (float) t1.getX(); + this.y1 = (float) t1.getY(); + this.x2 = (float) t2.getX(); + this.y2 = (float) t2.getY(); + } + } + } + + + class RadialGradient extends Gradient { + float cx, cy, r; + + public RadialGradient(PShapeSVG parent, XMLElement properties) { + super(parent, properties); + + this.cx = properties.getFloatAttribute("cx"); + this.cy = properties.getFloatAttribute("cy"); + this.r = properties.getFloatAttribute("r"); + + String transformStr = + properties.getStringAttribute("gradientTransform"); + + if (transformStr != null) { + float t[] = parseMatrix(transformStr).get(null); + this.transform = new AffineTransform(t[0], t[3], t[1], t[4], t[2], t[5]); + + Point2D t1 = transform.transform(new Point2D.Float(cx, cy), null); + Point2D t2 = transform.transform(new Point2D.Float(cx + r, cy), null); + + this.cx = (float) t1.getX(); + this.cy = (float) t1.getY(); + this.r = (float) (t2.getX() - t1.getX()); + } + } + } + + + + class LinearGradientPaint implements Paint { + float x1, y1, x2, y2; + float[] offset; + int[] color; + int count; + float opacity; + + public LinearGradientPaint(float x1, float y1, float x2, float y2, + float[] offset, int[] color, int count, + float opacity) { + this.x1 = x1; + this.y1 = y1; + this.x2 = x2; + this.y2 = y2; + this.offset = offset; + this.color = color; + this.count = count; + this.opacity = opacity; + } + + public PaintContext createContext(ColorModel cm, + Rectangle deviceBounds, Rectangle2D userBounds, + AffineTransform xform, RenderingHints hints) { + Point2D t1 = xform.transform(new Point2D.Float(x1, y1), null); + Point2D t2 = xform.transform(new Point2D.Float(x2, y2), null); + return new LinearGradientContext((float) t1.getX(), (float) t1.getY(), + (float) t2.getX(), (float) t2.getY()); + } + + public int getTransparency() { + return TRANSLUCENT; // why not.. rather than checking each color + } + + public class LinearGradientContext implements PaintContext { + int ACCURACY = 2; + float tx1, ty1, tx2, ty2; + + public LinearGradientContext(float tx1, float ty1, float tx2, float ty2) { + this.tx1 = tx1; + this.ty1 = ty1; + this.tx2 = tx2; + this.ty2 = ty2; + } + + public void dispose() { } + + public ColorModel getColorModel() { return ColorModel.getRGBdefault(); } + + public Raster getRaster(int x, int y, int w, int h) { + WritableRaster raster = + getColorModel().createCompatibleWritableRaster(w, h); + + int[] data = new int[w * h * 4]; + + // make normalized version of base vector + float nx = tx2 - tx1; + float ny = ty2 - ty1; + float len = (float) Math.sqrt(nx*nx + ny*ny); + if (len != 0) { + nx /= len; + ny /= len; + } + + int span = (int) PApplet.dist(tx1, ty1, tx2, ty2) * ACCURACY; + if (span <= 0) { + //System.err.println("span is too small"); + // annoying edge case where the gradient isn't legit + int index = 0; + for (int j = 0; j < h; j++) { + for (int i = 0; i < w; i++) { + data[index++] = 0; + data[index++] = 0; + data[index++] = 0; + data[index++] = 255; + } + } + + } else { + int[][] interp = new int[span][4]; + int prev = 0; + for (int i = 1; i < count; i++) { + int c0 = color[i-1]; + int c1 = color[i]; + int last = (int) (offset[i] * (span-1)); + //System.out.println("last is " + last); + for (int j = prev; j <= last; j++) { + float btwn = PApplet.norm(j, prev, last); + interp[j][0] = (int) PApplet.lerp((c0 >> 16) & 0xff, (c1 >> 16) & 0xff, btwn); + interp[j][1] = (int) PApplet.lerp((c0 >> 8) & 0xff, (c1 >> 8) & 0xff, btwn); + interp[j][2] = (int) PApplet.lerp(c0 & 0xff, c1 & 0xff, btwn); + interp[j][3] = (int) (PApplet.lerp((c0 >> 24) & 0xff, (c1 >> 24) & 0xff, btwn) * opacity); + //System.out.println(j + " " + interp[j][0] + " " + interp[j][1] + " " + interp[j][2]); + } + prev = last; + } + + int index = 0; + for (int j = 0; j < h; j++) { + for (int i = 0; i < w; i++) { + //float distance = 0; //PApplet.dist(cx, cy, x + i, y + j); + //int which = PApplet.min((int) (distance * ACCURACY), interp.length-1); + float px = (x + i) - tx1; + float py = (y + j) - ty1; + // distance up the line is the dot product of the normalized + // vector of the gradient start/stop by the point being tested + int which = (int) ((px*nx + py*ny) * ACCURACY); + if (which < 0) which = 0; + if (which > interp.length-1) which = interp.length-1; + //if (which > 138) System.out.println("grabbing " + which); + + data[index++] = interp[which][0]; + data[index++] = interp[which][1]; + data[index++] = interp[which][2]; + data[index++] = interp[which][3]; + } + } + } + raster.setPixels(0, 0, w, h, data); + + return raster; + } + } + } + + + class RadialGradientPaint implements Paint { + float cx, cy, radius; + float[] offset; + int[] color; + int count; + float opacity; + + public RadialGradientPaint(float cx, float cy, float radius, + float[] offset, int[] color, int count, + float opacity) { + this.cx = cx; + this.cy = cy; + this.radius = radius; + this.offset = offset; + this.color = color; + this.count = count; + this.opacity = opacity; + } + + public PaintContext createContext(ColorModel cm, + Rectangle deviceBounds, Rectangle2D userBounds, + AffineTransform xform, RenderingHints hints) { + return new RadialGradientContext(); + } + + public int getTransparency() { + return TRANSLUCENT; + } + + public class RadialGradientContext implements PaintContext { + int ACCURACY = 5; + + public void dispose() {} + + public ColorModel getColorModel() { return ColorModel.getRGBdefault(); } + + public Raster getRaster(int x, int y, int w, int h) { + WritableRaster raster = + getColorModel().createCompatibleWritableRaster(w, h); + + int span = (int) radius * ACCURACY; + int[][] interp = new int[span][4]; + int prev = 0; + for (int i = 1; i < count; i++) { + int c0 = color[i-1]; + int c1 = color[i]; + int last = (int) (offset[i] * (span - 1)); + for (int j = prev; j <= last; j++) { + float btwn = PApplet.norm(j, prev, last); + interp[j][0] = (int) PApplet.lerp((c0 >> 16) & 0xff, (c1 >> 16) & 0xff, btwn); + interp[j][1] = (int) PApplet.lerp((c0 >> 8) & 0xff, (c1 >> 8) & 0xff, btwn); + interp[j][2] = (int) PApplet.lerp(c0 & 0xff, c1 & 0xff, btwn); + interp[j][3] = (int) (PApplet.lerp((c0 >> 24) & 0xff, (c1 >> 24) & 0xff, btwn) * opacity); + } + prev = last; + } + + int[] data = new int[w * h * 4]; + int index = 0; + for (int j = 0; j < h; j++) { + for (int i = 0; i < w; i++) { + float distance = PApplet.dist(cx, cy, x + i, y + j); + int which = PApplet.min((int) (distance * ACCURACY), interp.length-1); + + data[index++] = interp[which][0]; + data[index++] = interp[which][1]; + data[index++] = interp[which][2]; + data[index++] = interp[which][3]; + } + } + raster.setPixels(0, 0, w, h, data); + + return raster; + } + } + } + + + protected Paint calcGradientPaint(Gradient gradient) { + if (gradient instanceof LinearGradient) { + LinearGradient grad = (LinearGradient) gradient; + return new LinearGradientPaint(grad.x1, grad.y1, grad.x2, grad.y2, + grad.offset, grad.color, grad.count, + opacity); + + } else if (gradient instanceof RadialGradient) { + RadialGradient grad = (RadialGradient) gradient; + return new RadialGradientPaint(grad.cx, grad.cy, grad.r, + grad.offset, grad.color, grad.count, + opacity); + } + return null; + } + + +// protected Paint calcGradientPaint(Gradient gradient, +// float x1, float y1, float x2, float y2) { +// if (gradient instanceof LinearGradient) { +// LinearGradient grad = (LinearGradient) gradient; +// return new LinearGradientPaint(x1, y1, x2, y2, +// grad.offset, grad.color, grad.count, +// opacity); +// } +// throw new RuntimeException("Not a linear gradient."); +// } + + +// protected Paint calcGradientPaint(Gradient gradient, +// float cx, float cy, float r) { +// if (gradient instanceof RadialGradient) { +// RadialGradient grad = (RadialGradient) gradient; +// return new RadialGradientPaint(cx, cy, r, +// grad.offset, grad.color, grad.count, +// opacity); +// } +// throw new RuntimeException("Not a radial gradient."); +// } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + protected void styles(PGraphics g) { + super.styles(g); + + if (g instanceof PGraphicsJava2D) { + PGraphicsJava2D p2d = (PGraphicsJava2D) g; + + if (strokeGradient != null) { + p2d.strokeGradient = true; + p2d.strokeGradientObject = strokeGradientPaint; + } else { + // need to shut off, in case parent object has a gradient applied + //p2d.strokeGradient = false; + } + if (fillGradient != null) { + p2d.fillGradient = true; + p2d.fillGradientObject = fillGradientPaint; + } else { + // need to shut off, in case parent object has a gradient applied + //p2d.fillGradient = false; + } + } + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + //public void drawImpl(PGraphics g) { + // do nothing + //} + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + /** + * Get a particular element based on its SVG ID. When editing SVG by hand, + * this is the id="" tag on any SVG element. When editing from Illustrator, + * these IDs can be edited by expanding the layers palette. The names used + * in the layers palette, both for the layers or the shapes and groups + * beneath them can be used here. + *
    +   * // This code grabs "Layer 3" and the shapes beneath it.
    +   * SVG layer3 = svg.getChild("Layer 3");
    +   * 
    + */ + public PShape getChild(String name) { + PShape found = super.getChild(name); + if (found == null) { + // Otherwise try with underscores instead of spaces + // (this is how Illustrator handles spaces in the layer names). + found = super.getChild(name.replace(' ', '_')); + } + // Set bounding box based on the parent bounding box + if (found != null) { +// found.x = this.x; +// found.y = this.y; + found.width = this.width; + found.height = this.height; + } + return found; + } + + + /** + * Prints out the SVG document. Useful for parsing. + */ + public void print() { + PApplet.println(element.toString()); + } +} diff --git a/core/src/processing/core/PSmoothTriangle.java b/core/src/processing/core/PSmoothTriangle.java new file mode 100644 index 000000000..ba692fefd --- /dev/null +++ b/core/src/processing/core/PSmoothTriangle.java @@ -0,0 +1,968 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +/** + * Smoothed triangle renderer for P3D. + * + * Based off of the PPolygon class in old versions of Processing. + * Name and location of this class will change in a future release. + */ +public class PSmoothTriangle implements PConstants { + + // really this is "debug" but.. + private static final boolean EWJORDAN = false; + private static final boolean FRY = false; + + // identical to the constants from PGraphics + + static final int X = 0; // transformed xyzw + static final int Y = 1; // formerly SX SY SZ + static final int Z = 2; + + static final int R = 3; // actual rgb, after lighting + static final int G = 4; // fill stored here, transform in place + static final int B = 5; + static final int A = 6; + + static final int U = 7; // texture + static final int V = 8; + + static final int DEFAULT_SIZE = 64; // this is needed for spheres + float vertices[][] = new float[DEFAULT_SIZE][PGraphics.VERTEX_FIELD_COUNT]; + int vertexCount; + + + // after some fiddling, this seems to produce the best results + static final int ZBUFFER_MIN_COVERAGE = 204; + + float r[] = new float[DEFAULT_SIZE]; // storage used by incrementalize + float dr[] = new float[DEFAULT_SIZE]; + float l[] = new float[DEFAULT_SIZE]; // more storage for incrementalize + float dl[] = new float[DEFAULT_SIZE]; + float sp[] = new float[DEFAULT_SIZE]; // temporary storage for scanline + float sdp[] = new float[DEFAULT_SIZE]; + + // color and xyz are always interpolated + boolean interpX; + boolean interpZ; + boolean interpUV; // is this necessary? could just check timage != null + boolean interpARGB; + + int rgba; + int r2, g2, b2, a2, a2orig; + + boolean noDepthTest; + + PGraphics3D parent; + int pixels[]; + float[] zbuffer; + + // the parent's width/height, + // or if smooth is enabled, parent's w/h scaled + // up by the smooth dimension + int width, height; + int width1, height1; + + PImage timage; + int tpixels[]; + int theight, twidth; + int theight1, twidth1; + int tformat; + + // temp fix to behave like SMOOTH_IMAGES + // TODO ewjordan: can probably remove this variable + boolean texture_smooth; + + // for anti-aliasing + static final int SUBXRES = 8; + static final int SUBXRES1 = 7; + static final int SUBYRES = 8; + static final int SUBYRES1 = 7; + static final int MAX_COVERAGE = SUBXRES * SUBYRES; + + boolean smooth; + int firstModY; + int lastModY; + int lastY; + int aaleft[] = new int[SUBYRES]; + int aaright[] = new int[SUBYRES]; + int aaleftmin, aarightmin; + int aaleftmax, aarightmax; + int aaleftfull, aarightfull; + + /* Variables needed for accurate texturing. */ + //private PMatrix textureMatrix = new PMatrix3D(); + private float[] camX = new float[3]; + private float[] camY = new float[3]; + private float[] camZ = new float[3]; + private float ax,ay,az; + private float bx,by,bz; + private float cx,cy,cz; + private float nearPlaneWidth, nearPlaneHeight, nearPlaneDepth; + //private float newax, newbx, newcx; + private float xmult, ymult; + + + final private int MODYRES(int y) { + return (y & SUBYRES1); + } + + + public PSmoothTriangle(PGraphics3D iparent) { + parent = iparent; + reset(0); + } + + + public void reset(int count) { + vertexCount = count; + interpX = true; + interpZ = true; + interpUV = false; + interpARGB = true; + timage = null; + } + + + public float[] nextVertex() { + if (vertexCount == vertices.length) { + //parent.message(CHATTER, "re-allocating for " + + // (vertexCount*2) + " vertices"); + float temp[][] = new float[vertexCount<<1][PGraphics.VERTEX_FIELD_COUNT]; + System.arraycopy(vertices, 0, temp, 0, vertexCount); + vertices = temp; + + r = new float[vertices.length]; + dr = new float[vertices.length]; + l = new float[vertices.length]; + dl = new float[vertices.length]; + sp = new float[vertices.length]; + sdp = new float[vertices.length]; + } + return vertices[vertexCount++]; // returns v[0], sets vc to 1 + } + + + public void texture(PImage image) { + this.timage = image; + this.tpixels = image.pixels; + this.twidth = image.width; + this.theight = image.height; + this.tformat = image.format; + + twidth1 = twidth - 1; + theight1 = theight - 1; + interpUV = true; + } + + public void render() { + if (vertexCount < 3) return; + + smooth = true;//TODO + // these may have changed due to a resize() + // so they should be refreshed here + pixels = parent.pixels; + zbuffer = parent.zbuffer; + + noDepthTest = false;//parent.hints[DISABLE_DEPTH_TEST]; + + // In 0148+, should always be true if this code is called at all + //smooth = parent.smooth; + + // by default, text turns on smooth for the textures + // themselves. but this should be shut off if the hint + // for DISABLE_TEXT_SMOOTH is set. + texture_smooth = true; + + width = smooth ? parent.width*SUBXRES : parent.width; + height = smooth ? parent.height*SUBYRES : parent.height; + + width1 = width - 1; + height1 = height - 1; + + if (!interpARGB) { + r2 = (int) (vertices[0][R] * 255); + g2 = (int) (vertices[0][G] * 255); + b2 = (int) (vertices[0][B] * 255); + a2 = (int) (vertices[0][A] * 255); + a2orig = a2; // save an extra copy + rgba = 0xff000000 | (r2 << 16) | (g2 << 8) | b2; + } + + for (int i = 0; i < vertexCount; i++) { + r[i] = 0; dr[i] = 0; l[i] = 0; dl[i] = 0; + } + + if (smooth) { + for (int i = 0; i < vertexCount; i++) { + vertices[i][X] *= SUBXRES; + vertices[i][Y] *= SUBYRES; + } + firstModY = -1; + } + + // find top vertex (y is zero at top, higher downwards) + int topi = 0; + float ymin = vertices[0][Y]; + float ymax = vertices[0][Y]; // fry 031001 + for (int i = 1; i < vertexCount; i++) { + if (vertices[i][Y] < ymin) { + ymin = vertices[i][Y]; + topi = i; + } + if (vertices[i][Y] > ymax) ymax = vertices[i][Y]; + } + + // the last row is an exceptional case, because there won't + // necessarily be 8 rows of subpixel lines that will force + // the final line to render. so instead, the algo keeps track + // of the lastY (in subpixel resolution) that will be rendered + // and that will force a scanline to happen the same as + // every eighth in the other situations + //lastY = -1; // fry 031001 + lastY = (int) (ymax - 0.5f); // global to class bc used by other fxns + + int lefti = topi; // li, index of left vertex + int righti = topi; // ri, index of right vertex + int y = (int) (ymin + 0.5f); // current scan line + int lefty = y - 1; // lower end of left edge + int righty = y - 1; // lower end of right edge + + interpX = true; + + int remaining = vertexCount; + + // scan in y, activating new edges on left & right + // as scan line passes over new vertices + while (remaining > 0) { + // advance left edge? + while ((lefty <= y) && (remaining > 0)) { + remaining--; + // step ccw down left side + int i = (lefti != 0) ? (lefti-1) : (vertexCount-1); + incrementalize_y(vertices[lefti], vertices[i], l, dl, y); + lefty = (int) (vertices[i][Y] + 0.5f); + lefti = i; + } + + // advance right edge? + while ((righty <= y) && (remaining > 0)) { + remaining--; + // step cw down right edge + int i = (righti != vertexCount-1) ? (righti + 1) : 0; + incrementalize_y(vertices[righti], vertices[i], r, dr, y); + righty = (int) (vertices[i][Y] + 0.5f); + righti = i; + } + + // do scanlines till end of l or r edge + while (y < lefty && y < righty) { + // this doesn't work because it's not always set here + //if (remaining == 0) { + //lastY = (lefty < righty) ? lefty-1 : righty-1; + //System.out.println("lastY is " + lastY); + //} + + if ((y >= 0) && (y < height)) { + //try { // hopefully this bug is fixed + if (l[X] <= r[X]) scanline(y, l, r); + else scanline(y, r, l); + //} catch (ArrayIndexOutOfBoundsException e) { + //e.printStackTrace(); + //} + } + y++; + // this increment probably needs to be different + // UV and RGB shouldn't be incremented until line is emitted + increment(l, dl); + increment(r, dr); + } + } + //if (smooth) { + //System.out.println("y/lasty/lastmody = " + y + " " + lastY + " " + lastModY); + //} + } + + + public void unexpand() { + if (smooth) { + for (int i = 0; i < vertexCount; i++) { + vertices[i][X] /= SUBXRES; + vertices[i][Y] /= SUBYRES; + } + } + } + + + private void scanline(int y, float l[], float r[]) { + //System.out.println("scanline " + y); + for (int i = 0; i < vertexCount; i++) { // should be moved later + sp[i] = 0; sdp[i] = 0; + } + + // this rounding doesn't seem to be relevant with smooth + int lx = (int) (l[X] + 0.49999f); // ceil(l[X]-.5); + if (lx < 0) lx = 0; + int rx = (int) (r[X] - 0.5f); + if (rx > width1) rx = width1; + + if (lx > rx) return; + + if (smooth) { + int mody = MODYRES(y); + + aaleft[mody] = lx; + aaright[mody] = rx; + + if (firstModY == -1) { + firstModY = mody; + aaleftmin = lx; aaleftmax = lx; + aarightmin = rx; aarightmax = rx; + + } else { + if (aaleftmin > aaleft[mody]) aaleftmin = aaleft[mody]; + if (aaleftmax < aaleft[mody]) aaleftmax = aaleft[mody]; + if (aarightmin > aaright[mody]) aarightmin = aaright[mody]; + if (aarightmax < aaright[mody]) aarightmax = aaright[mody]; + } + + lastModY = mody; // moved up here (before the return) 031001 + // not the eighth (or lastY) line, so not scanning this time + if ((mody != SUBYRES1) && (y != lastY)) return; + //lastModY = mody; // eeK! this was missing + //return; + + //if (y == lastY) { + //System.out.println("y is lasty"); + //} + //lastModY = mody; + aaleftfull = aaleftmax/SUBXRES + 1; + aarightfull = aarightmin/SUBXRES - 1; + } + + // this is the setup, based on lx + incrementalize_x(l, r, sp, sdp, lx); + //System.out.println(l[V] + " " + r[V] + " " +sp[V] + " " +sdp[V]); + + // scan in x, generating pixels + // using parent.width to get actual pixel index + // rather than scaled by smooth factor + int offset = smooth ? parent.width * (y / SUBYRES) : parent.width*y; + + int truelx = 0, truerx = 0; + if (smooth) { + truelx = lx / SUBXRES; + truerx = (rx + SUBXRES1) / SUBXRES; + + lx = aaleftmin / SUBXRES; + rx = (aarightmax + SUBXRES1) / SUBXRES; + if (lx < 0) lx = 0; + if (rx > parent.width1) rx = parent.width1; + } + +// System.out.println("P3D interp uv " + interpUV + " " + +// vertices[2][U] + " " + vertices[2][V]); + + interpX = false; + int tr, tg, tb, ta; + //System.out.println("lx: "+lx + "\nrx: "+rx); + for (int x = lx; x <= rx; x++) { + + // added == because things on same plane weren't replacing each other + // makes for strangeness in 3D [ewj: yup!], but totally necessary for 2D + //if (noDepthTest || (sp[Z] < zbuffer[offset+x])) { + if (noDepthTest || (sp[Z] <= zbuffer[offset+x])) { + //if (true) { + + // map texture based on U, V coords in sp[U] and sp[V] + if (interpUV) { + int tu = (int)sp[U]; + int tv = (int)sp[V]; + + if (tu > twidth1) tu = twidth1; + if (tv > theight1) tv = theight1; + if (tu < 0) tu = 0; + if (tv < 0) tv = 0; + + int txy = tv*twidth + tu; + //System.out.println("tu: "+tu+" ; tv: "+tv+" ; txy: "+txy); + float[] uv = new float[2]; + txy = getTextureIndex(x, y*1.0f/SUBYRES, uv); + // txy = getTextureIndex(x* 1.0f/SUBXRES, y*1.0f/SUBYRES, uv); + + tu = (int)uv[0]; tv = (int)uv[1]; + // if (tu > twidth1) tu = twidth1; + // if (tv > theight1) tv = theight1; + // if (tu < 0) tu = 0; + // if (tv < 0) tv = 0; + txy = twidth*tv + tu; + // if (EWJORDAN) System.out.println("x/y/txy:"+x + " " + y + " " +txy); + //PApplet.println(sp); + + //smooth = true; + if (smooth || texture_smooth) { + //if (FRY) System.out.println("sp u v = " + sp[U] + " " + sp[V]); + //System.out.println("sp u v = " + sp[U] + " " + sp[V]); + // tuf1/tvf1 is the amount of coverage for the adjacent + // pixel, which is the decimal percentage. + // int tuf1 = (int) (255f * (sp[U] - (float)tu)); + // int tvf1 = (int) (255f * (sp[V] - (float)tv)); + + int tuf1 = (int) (255f * (uv[0] - tu)); + int tvf1 = (int) (255f * (uv[1] - tv)); + + // the closer sp[U or V] is to the decimal being zero + // the more coverage it should get of the original pixel + int tuf = 255 - tuf1; + int tvf = 255 - tvf1; + + // this code sucks! filled with bugs and slow as hell! + int pixel00 = tpixels[txy]; + int pixel01 = (tv < theight1) ? tpixels[txy + twidth] : tpixels[txy]; + int pixel10 = (tu < twidth1) ? tpixels[txy + 1] : tpixels[txy]; + int pixel11 = ((tv < theight1) && (tu < twidth1)) ? tpixels[txy + twidth + 1] : tpixels[txy]; + //System.out.println("1: "+pixel00); + //check + int p00, p01, p10, p11; + int px0, px1; //, pxy; + + if (tformat == ALPHA) { + px0 = (pixel00*tuf + pixel10*tuf1) >> 8; + px1 = (pixel01*tuf + pixel11*tuf1) >> 8; + ta = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[A]*255)) : a2orig)) >> 8; + } else if (tformat == ARGB) { + p00 = (pixel00 >> 24) & 0xff; + p01 = (pixel01 >> 24) & 0xff; + p10 = (pixel10 >> 24) & 0xff; + p11 = (pixel11 >> 24) & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + ta = (((px0*tvf + px1*tvf1) >> 8) * + (interpARGB ? ((int) (sp[A]*255)) : a2orig)) >> 8; + } else { // RGB image, no alpha + //ACCTEX: Getting here when smooth is on + ta = interpARGB ? ((int) (sp[A]*255)) : a2orig; + //System.out.println("4: "+ta + " " +interpARGB + " " + sp[A] + " " + a2orig); + //check + } + + if ((tformat == RGB) || (tformat == ARGB)) { + p00 = (pixel00 >> 16) & 0xff; // red + p01 = (pixel01 >> 16) & 0xff; + p10 = (pixel10 >> 16) & 0xff; + p11 = (pixel11 >> 16) & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + tr = (((px0*tvf + px1*tvf1) >> 8) * (interpARGB ? ((int) (sp[R]*255)) : r2)) >> 8; + + p00 = (pixel00 >> 8) & 0xff; // green + p01 = (pixel01 >> 8) & 0xff; + p10 = (pixel10 >> 8) & 0xff; + p11 = (pixel11 >> 8) & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + tg = (((px0*tvf + px1*tvf1) >> 8) * (interpARGB ? ((int) (sp[G]*255)) : g2)) >> 8; + + + p00 = pixel00 & 0xff; // blue + p01 = pixel01 & 0xff; + p10 = pixel10 & 0xff; + p11 = pixel11 & 0xff; + + px0 = (p00*tuf + p10*tuf1) >> 8; + px1 = (p01*tuf + p11*tuf1) >> 8; + tb = (((px0*tvf + px1*tvf1) >> 8) * (interpARGB ? ((int) (sp[B]*255)) : b2)) >> 8; + //System.out.println("5: "+tr + " " + tg + " " +tb); + //check + } else { // alpha image, only use current fill color + if (interpARGB) { + tr = (int) (sp[R] * 255); + tg = (int) (sp[G] * 255); + tb = (int) (sp[B] * 255); + } else { + tr = r2; + tg = g2; + tb = b2; + } + } + + // get coverage for pixel if smooth + // checks smooth again here because of + // hints[SMOOTH_IMAGES] used up above + int weight = smooth ? coverage(x) : 255; + if (weight != 255) ta = (ta*weight) >> 8; + //System.out.println(ta); + //System.out.println("8"); + //check + } else { // no smooth, just get the pixels + int tpixel = tpixels[txy]; + // TODO i doubt splitting these guys really gets us + // all that much speed.. is it worth it? + if (tformat == ALPHA) { + ta = tpixel; + if (interpARGB) { + tr = (int) (sp[R]*255); + tg = (int) (sp[G]*255); + tb = (int) (sp[B]*255); + if (sp[A] != 1) { + ta = (((int) (sp[A]*255)) * ta) >> 8; + } + } else { + tr = r2; + tg = g2; + tb = b2; + ta = (a2orig * ta) >> 8; + } + + } else { // RGB or ARGB + ta = (tformat == RGB) ? 255 : (tpixel >> 24) & 0xff; + if (interpARGB) { + tr = (((int) (sp[R]*255)) * ((tpixel >> 16) & 0xff)) >> 8; + tg = (((int) (sp[G]*255)) * ((tpixel >> 8) & 0xff)) >> 8; + tb = (((int) (sp[B]*255)) * ((tpixel) & 0xff)) >> 8; + ta = (((int) (sp[A]*255)) * ta) >> 8; + } else { + tr = (r2 * ((tpixel >> 16) & 0xff)) >> 8; + tg = (g2 * ((tpixel >> 8) & 0xff)) >> 8; + tb = (b2 * ((tpixel) & 0xff)) >> 8; + ta = (a2orig * ta) >> 8; + } + } + } + + if ((ta == 254) || (ta == 255)) { // if (ta & 0xf8) would be good + // no need to blend + pixels[offset+x] = 0xff000000 | (tr << 16) | (tg << 8) | tb; + zbuffer[offset+x] = sp[Z]; + } else { + // blend with pixel on screen + int a1 = 255-ta; + int r1 = (pixels[offset+x] >> 16) & 0xff; + int g1 = (pixels[offset+x] >> 8) & 0xff; + int b1 = (pixels[offset+x]) & 0xff; + + + pixels[offset+x] = + 0xff000000 | + (((tr*ta + r1*a1) >> 8) << 16) | + ((tg*ta + g1*a1) & 0xff00) | + ((tb*ta + b1*a1) >> 8); + + //System.out.println("17"); + //check + if (ta > ZBUFFER_MIN_COVERAGE) zbuffer[offset+x] = sp[Z]; + } + + //System.out.println("18"); + //check + } else { // no image applied + int weight = smooth ? coverage(x) : 255; + + if (interpARGB) { + r2 = (int) (sp[R] * 255); + g2 = (int) (sp[G] * 255); + b2 = (int) (sp[B] * 255); + if (sp[A] != 1) weight = (weight * ((int) (sp[A] * 255))) >> 8; + if (weight == 255) { + rgba = 0xff000000 | (r2 << 16) | (g2 << 8) | b2; + } + } else { + if (a2orig != 255) weight = (weight * a2orig) >> 8; + } + + if (weight == 255) { + // no blend, no aa, just the rgba + pixels[offset+x] = rgba; + zbuffer[offset+x] = sp[Z]; + + } else { + int r1 = (pixels[offset+x] >> 16) & 0xff; + int g1 = (pixels[offset+x] >> 8) & 0xff; + int b1 = (pixels[offset+x]) & 0xff; + a2 = weight; + + int a1 = 255 - a2; + pixels[offset+x] = (0xff000000 | + ((r1*a1 + r2*a2) >> 8) << 16 | + // use & instead of >> and << below + ((g1*a1 + g2*a2) >> 8) << 8 | + ((b1*a1 + b2*a2) >> 8)); + + if (a2 > ZBUFFER_MIN_COVERAGE) zbuffer[offset+x] = sp[Z]; + } + } + } + // if smooth enabled, don't increment values + // for the pixel in the stretch out version + // of the scanline used to get smooth edges. + if (!smooth || ((x >= truelx) && (x <= truerx))) { + //if (!smooth) + increment(sp, sdp); + } + } + firstModY = -1; + interpX = true; + } + + + // x is in screen, not huge 8x coordinates + private int coverage(int x) { + if ((x >= aaleftfull) && (x <= aarightfull) && + // important since not all SUBYRES lines may have been covered + (firstModY == 0) && (lastModY == SUBYRES1)) { + return 255; + } + + int pixelLeft = x*SUBXRES; // huh? + int pixelRight = pixelLeft + 8; + + int amt = 0; + for (int i = firstModY; i <= lastModY; i++) { + if ((aaleft[i] > pixelRight) || (aaright[i] < pixelLeft)) { + continue; + } + // does this need a +1 ? + amt += ((aaright[i] < pixelRight ? aaright[i] : pixelRight) - + (aaleft[i] > pixelLeft ? aaleft[i] : pixelLeft)); + } + amt <<= 2; + return (amt == 256) ? 255 : amt; + } + + + private void incrementalize_y(float p1[], float p2[], + float p[], float dp[], int y) { + float delta = p2[Y] - p1[Y]; + if (delta == 0) delta = 1; + float fraction = y + 0.5f - p1[Y]; + + if (interpX) { + dp[X] = (p2[X] - p1[X]) / delta; + p[X] = p1[X] + dp[X] * fraction; + } + if (interpZ) { + dp[Z] = (p2[Z] - p1[Z]) / delta; + p[Z] = p1[Z] + dp[Z] * fraction; + } + + if (interpARGB) { + dp[R] = (p2[R] - p1[R]) / delta; + dp[G] = (p2[G] - p1[G]) / delta; + dp[B] = (p2[B] - p1[B]) / delta; + dp[A] = (p2[A] - p1[A]) / delta; + p[R] = p1[R] + dp[R] * fraction; + p[G] = p1[G] + dp[G] * fraction; + p[B] = p1[B] + dp[B] * fraction; + p[A] = p1[A] + dp[A] * fraction; + } + + if (interpUV) { + dp[U] = (p2[U] - p1[U]) / delta; + dp[V] = (p2[V] - p1[V]) / delta; + + //if (smooth) { + //p[U] = p1[U]; //+ dp[U] * fraction; + //p[V] = p1[V]; //+ dp[V] * fraction; + + //} else { + p[U] = p1[U] + dp[U] * fraction; + p[V] = p1[V] + dp[V] * fraction; + //} + if (FRY) System.out.println("inc y p[U] p[V] = " + p[U] + " " + p[V]); + } + } + + //incrementalize_x(l, r, sp, sdp, lx); + private void incrementalize_x(float p1[], float p2[], + float p[], float dp[], int x) { + float delta = p2[X] - p1[X]; + if (delta == 0) delta = 1; + float fraction = x + 0.5f - p1[X]; + if (smooth) { + delta /= SUBXRES; + fraction /= SUBXRES; + } + + if (interpX) { + dp[X] = (p2[X] - p1[X]) / delta; + p[X] = p1[X] + dp[X] * fraction; + } + if (interpZ) { + dp[Z] = (p2[Z] - p1[Z]) / delta; + p[Z] = p1[Z] + dp[Z] * fraction; + //System.out.println(p2[Z]+" " +p1[Z]+" " +dp[Z]); + } + + if (interpARGB) { + dp[R] = (p2[R] - p1[R]) / delta; + dp[G] = (p2[G] - p1[G]) / delta; + dp[B] = (p2[B] - p1[B]) / delta; + dp[A] = (p2[A] - p1[A]) / delta; + p[R] = p1[R] + dp[R] * fraction; + p[G] = p1[G] + dp[G] * fraction; + p[B] = p1[B] + dp[B] * fraction; + p[A] = p1[A] + dp[A] * fraction; + } + + if (interpUV) { + if (FRY) System.out.println("delta, frac = " + delta + ", " + fraction); + dp[U] = (p2[U] - p1[U]) / delta; + dp[V] = (p2[V] - p1[V]) / delta; + + //if (smooth) { + //p[U] = p1[U]; + // offset for the damage that will be done by the + // 8 consecutive calls to scanline + // agh.. this won't work b/c not always 8 calls before render + // maybe lastModY - firstModY + 1 instead? + if (FRY) System.out.println("before inc x p[V] = " + p[V] + " " + p1[V] + " " + p2[V]); + //p[V] = p1[V] - SUBXRES1 * fraction; + + //} else { + p[U] = p1[U] + dp[U] * fraction; + p[V] = p1[V] + dp[V] * fraction; + //} + } + } + + private void increment(float p[], float dp[]) { + if (interpX) p[X] += dp[X]; + if (interpZ) p[Z] += dp[Z]; + + if (interpARGB) { + p[R] += dp[R]; + p[G] += dp[G]; + p[B] += dp[B]; + p[A] += dp[A]; + } + + if (interpUV) { + if (FRY) System.out.println("increment() " + p[V] + " " + dp[V]); + p[U] += dp[U]; + p[V] += dp[V]; + } + } + + + /** + * Pass camera-space coordinates for the triangle. + * Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. + * Generally this will not need to be called manually, + * currently called from PGraphics3D.render_triangles() + */ + public void setCamVertices(float x0, float y0, float z0, + float x1, float y1, float z1, + float x2, float y2, float z2) { + camX[0] = x0; + camX[1] = x1; + camX[2] = x2; + + camY[0] = y0; + camY[1] = y1; + camY[2] = y2; + + camZ[0] = z0; + camZ[1] = z1; + camZ[2] = z2; + } + + public void setVertices(float x0, float y0, float z0, + float x1, float y1, float z1, + float x2, float y2, float z2) { + vertices[0][X] = x0; + vertices[1][X] = x1; + vertices[2][X] = x2; + + vertices[0][Y] = y0; + vertices[1][Y] = y1; + vertices[2][Y] = y2; + + vertices[0][Z] = z0; + vertices[1][Z] = z1; + vertices[2][Z] = z2; + } + + + + /** + * Precompute a bunch of variables needed to perform + * texture mapping. + * @return True unless texture mapping is degenerate + */ + boolean precomputeAccurateTexturing() { + int o0 = 0; + int o1 = 1; + int o2 = 2; + + PMatrix3D myMatrix = new PMatrix3D(vertices[o0][U], vertices[o0][V], 1, 0, + vertices[o1][U], vertices[o1][V], 1, 0, + vertices[o2][U], vertices[o2][V], 1, 0, + 0, 0, 0, 1); + + // A 3x3 inversion would be more efficient here, + // given that the fourth r/c are unity + boolean invertSuccess = myMatrix.invert();// = myMatrix.invert(); + + // If the matrix inversion had trouble, let the caller know. + // Note that this does not catch everything that could go wrong + // here, like if the renderer is in ortho() mode (which really + // must be caught in PGraphics3D instead of here). + if (!invertSuccess) return false; + + float m00, m01, m02, m10, m11, m12, m20, m21, m22; + m00 = myMatrix.m00*camX[o0]+myMatrix.m01*camX[o1]+myMatrix.m02*camX[o2]; + m01 = myMatrix.m10*camX[o0]+myMatrix.m11*camX[o1]+myMatrix.m12*camX[o2]; + m02 = myMatrix.m20*camX[o0]+myMatrix.m21*camX[o1]+myMatrix.m22*camX[o2]; + m10 = myMatrix.m00*camY[o0]+myMatrix.m01*camY[o1]+myMatrix.m02*camY[o2]; + m11 = myMatrix.m10*camY[o0]+myMatrix.m11*camY[o1]+myMatrix.m12*camY[o2]; + m12 = myMatrix.m20*camY[o0]+myMatrix.m21*camY[o1]+myMatrix.m22*camY[o2]; + m20 = -(myMatrix.m00*camZ[o0]+myMatrix.m01*camZ[o1]+myMatrix.m02*camZ[o2]); + m21 = -(myMatrix.m10*camZ[o0]+myMatrix.m11*camZ[o1]+myMatrix.m12*camZ[o2]); + m22 = -(myMatrix.m20*camZ[o0]+myMatrix.m21*camZ[o1]+myMatrix.m22*camZ[o2]); + + float px = m02; + float py = m12; + float pz = m22; + + float TEX_WIDTH = this.twidth; + float TEX_HEIGHT = this.theight; + + float resultT0x = m00*TEX_WIDTH+m02; + float resultT0y = m10*TEX_WIDTH+m12; + float resultT0z = m20*TEX_WIDTH+m22; + float result0Tx = m01*TEX_HEIGHT+m02; + float result0Ty = m11*TEX_HEIGHT+m12; + float result0Tz = m21*TEX_HEIGHT+m22; + float mx = resultT0x-m02; + float my = resultT0y-m12; + float mz = resultT0z-m22; + float nx = result0Tx-m02; + float ny = result0Ty-m12; + float nz = result0Tz-m22; + + //avec = p x n + ax = (py*nz-pz*ny)*TEX_WIDTH; //F_TEX_WIDTH/HEIGHT? + ay = (pz*nx-px*nz)*TEX_WIDTH; + az = (px*ny-py*nx)*TEX_WIDTH; + //bvec = m x p + bx = (my*pz-mz*py)*TEX_HEIGHT; + by = (mz*px-mx*pz)*TEX_HEIGHT; + bz = (mx*py-my*px)*TEX_HEIGHT; + //cvec = n x m + cx = ny*mz-nz*my; + cy = nz*mx-nx*mz; + cz = nx*my-ny*mx; + + //System.out.println("a/b/c: "+ax+" " + ay + " " + az + " " + bx + " " + by + " " + bz + " " + cx + " " + cy + " " + cz); + + nearPlaneWidth = (parent.rightScreen-parent.leftScreen); + nearPlaneHeight = (parent.topScreen-parent.bottomScreen); + nearPlaneDepth = parent.nearPlane; + + // one pixel width in nearPlane coordinates + xmult = nearPlaneWidth / parent.width; + ymult = nearPlaneHeight / parent.height; + // Extra scalings to map screen plane units to pixel units +// newax = ax*xmult; +// newbx = bx*xmult; +// newcx = cx*xmult; + + + // System.out.println("nearplane: "+ nearPlaneWidth + " " + nearPlaneHeight + " " + nearPlaneDepth); + // System.out.println("mults: "+ xmult + " " + ymult); + // System.out.println("news: "+ newax + " " + newbx + " " + newcx); + return true; + } + + /** + * Get the texture map location based on the current screen + * coordinates. Assumes precomputeAccurateTexturing() has + * been called already for this texture mapping. + * @param sx + * @param sy + * @return + */ + private int getTextureIndex(float sx, float sy, float[] uv) { + if (EWJORDAN) System.out.println("Getting texel at "+sx + ", "+sy); + //System.out.println("Screen: "+ sx + " " + sy); + sx = xmult*(sx-(parent.width/2.0f) +.5f);//+.5f) + sy = ymult*(sy-(parent.height/2.0f)+.5f);//+.5f) + //sx /= SUBXRES; + //sy /= SUBYRES; + float sz = nearPlaneDepth; + float a = sx * ax + sy * ay + sz * az; + float b = sx * bx + sy * by + sz * bz; + float c = sx * cx + sy * cy + sz * cz; + int u = (int)(a / c); + int v = (int)(b / c); + uv[0] = a / c; + uv[1] = b / c; + if (uv[0] < 0) { + uv[0] = u = 0; + } + if (uv[1] < 0) { + uv[1] = v = 0; + } + if (uv[0] >= twidth) { + uv[0] = twidth-1; + u = twidth-1; + } + if (uv[1] >= theight) { + uv[1] = theight-1; + v = theight-1; + } + int result = v*twidth + u; + //System.out.println("a/b/c: "+a + " " + b + " " + c); + //System.out.println("cx/y/z: "+cx + " " + cy + " " + cz); + //if (result < 0) result = 0; + //if (result >= timage.pixels.length-2) result = timage.pixels.length - 2; + if (EWJORDAN) System.out.println("Got texel "+result); + return result; + } + + + public void setIntensities(float ar, float ag, float ab, float aa, + float br, float bg, float bb, float ba, + float cr, float cg, float cb, float ca) { + vertices[0][R] = ar; + vertices[0][G] = ag; + vertices[0][B] = ab; + vertices[0][A] = aa; + vertices[1][R] = br; + vertices[1][G] = bg; + vertices[1][B] = bb; + vertices[1][A] = ba; + vertices[2][R] = cr; + vertices[2][G] = cg; + vertices[2][B] = cb; + vertices[2][A] = ca; + } +} diff --git a/core/src/processing/core/PStyle.java b/core/src/processing/core/PStyle.java new file mode 100644 index 000000000..ccea03a42 --- /dev/null +++ b/core/src/processing/core/PStyle.java @@ -0,0 +1,61 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + + +public class PStyle implements PConstants { + public int imageMode; + public int rectMode; + public int ellipseMode; + public int shapeMode; + + public int colorMode; + public float colorModeX; + public float colorModeY; + public float colorModeZ; + public float colorModeA; + + public boolean tint; + public int tintColor; + public boolean fill; + public int fillColor; + public boolean stroke; + public int strokeColor; + public float strokeWeight; + public int strokeCap; + public int strokeJoin; + + // TODO these fellas are inconsistent, and may need to go elsewhere + public float ambientR, ambientG, ambientB; + public float specularR, specularG, specularB; + public float emissiveR, emissiveG, emissiveB; + public float shininess; + + public PFont textFont; + public int textAlign; + public int textAlignY; + public int textMode; + public float textSize; + public float textLeading; +} diff --git a/core/src/processing/core/PTriangle.java b/core/src/processing/core/PTriangle.java new file mode 100644 index 000000000..97c4fed2e --- /dev/null +++ b/core/src/processing/core/PTriangle.java @@ -0,0 +1,3850 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-07 Ben Fry and Casey Reas + Copyright (c) 2001-04 Massachusetts Institute of Technology + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +/** + * Handles rendering of single (tesselated) triangles in 3D. + *

    + * Originally written by sami (www.sumea.com) + */ +public class PTriangle implements PConstants +{ + static final float PIXEL_CENTER = 0.5f; // for polygon aa + + static final int R_GOURAUD = 0x1; + static final int R_TEXTURE8 = 0x2; + static final int R_TEXTURE24 = 0x4; + static final int R_TEXTURE32 = 0x8; + static final int R_ALPHA = 0x10; + + private int[] m_pixels; + private int[] m_texture; + //private int[] m_stencil; + private float[] m_zbuffer; + + private int SCREEN_WIDTH; + private int SCREEN_HEIGHT; + //private int SCREEN_WIDTH1; + //private int SCREEN_HEIGHT1; + + private int TEX_WIDTH; + private int TEX_HEIGHT; + private float F_TEX_WIDTH; + private float F_TEX_HEIGHT; + + public boolean INTERPOLATE_UV; + public boolean INTERPOLATE_RGB; + public boolean INTERPOLATE_ALPHA; + + // the power of 2 that tells how many pixels to interpolate + // for between exactly computed texture coordinates + private static final int DEFAULT_INTERP_POWER = 3; + private static int TEX_INTERP_POWER = DEFAULT_INTERP_POWER; + + // Vertex coordinates + private float[] x_array; + private float[] y_array; + private float[] z_array; + + private float[] camX; + private float[] camY; + private float[] camZ; + + // U,V coordinates + private float[] u_array; + private float[] v_array; + + // Vertex Intensity + private float[] r_array; + private float[] g_array; + private float[] b_array; + private float[] a_array; + + // vertex offsets + private int o0; + private int o1; + private int o2; + + /* rgb & a */ + private float r0; + private float r1; + private float r2; + private float g0; + private float g1; + private float g2; + private float b0; + private float b1; + private float b2; + private float a0; + private float a1; + private float a2; + + /* accurate texture uv coordinates */ + private float u0; + private float u1; + private float u2; + private float v0; + private float v1; + private float v2; + + /* deltas */ + //private float dx0; + //private float dx1; + private float dx2; + private float dy0; + private float dy1; + private float dy2; + private float dz0; + //private float dz1; + private float dz2; + + /* texture deltas */ + private float du0; + //private float du1; + private float du2; + private float dv0; + //private float dv1; + private float dv2; + + /* rgba deltas */ + private float dr0; + //private float dr1; + private float dr2; + private float dg0; + //private float dg1; + private float dg2; + private float db0; + //private float db1; + private float db2; + private float da0; + //private float da1; + private float da2; + + /* */ + private float uleft; + private float vleft; + private float uleftadd; + private float vleftadd; + + /* polyedge positions & adds */ + private float xleft; + private float xrght; + private float xadd1; + private float xadd2; + private float zleft; + private float zleftadd; + + /* rgba positions & adds */ + private float rleft; + private float gleft; + private float bleft; + private float aleft; + private float rleftadd; + private float gleftadd; + private float bleftadd; + private float aleftadd; + + /* other somewhat useful variables :) */ + private float dta; + //private float dta2; + private float temp; + private float width; + + /* integer poly UV adds */ + private int iuadd; + private int ivadd; + private int iradd; + private int igadd; + private int ibadd; + private int iaadd; + private float izadd; + + /* fill color */ + private int m_fill; + + /* draw flags */ + public int m_drawFlags; + + /* current poly number */ +// private int m_index; + + /** */ + private PGraphics3D parent; + + private boolean noDepthTest; + //private boolean argbSurface; + + /** */ + private boolean m_culling; + + /** */ + private boolean m_singleRight; + + /** + * True if using bilinear interpolation for textures. + * Always set to true. If this is ever changed (maybe with a hint()?) + * will need to write code for texture8/24/32 et al that will handle mixing + * the m_fill color in with the texture color. + */ + private boolean m_bilinear = true; // always set to true + + + // Vectors needed in accurate texture code + // We store them as class members to avoid too much code duplication + private float ax,ay,az; + private float bx,by,bz; + private float cx,cy,cz; + private float nearPlaneWidth; + private float nearPlaneHeight; + private float nearPlaneDepth; + private float xmult; + private float ymult; + // optimization vars...not pretty, but save a couple mults per pixel + private float newax,newbx,newcx; + // are we currently drawing the first piece of the triangle, + // or have we already done so? + private boolean firstSegment; + + + public PTriangle(PGraphics3D g) { + x_array = new float[3]; + y_array = new float[3]; + z_array = new float[3]; + u_array = new float[3]; + v_array = new float[3]; + r_array = new float[3]; + g_array = new float[3]; + b_array = new float[3]; + a_array = new float[3]; + + camX = new float[3]; + camY = new float[3]; + camZ = new float[3]; + + this.parent = g; + reset(); + } + + + /** + * Resets polygon attributes + */ + public void reset() { + // reset these in case PGraphics was resized + + SCREEN_WIDTH = parent.width; + SCREEN_HEIGHT = parent.height; + //SCREEN_WIDTH1 = SCREEN_WIDTH-1; + //SCREEN_HEIGHT1 = SCREEN_HEIGHT-1; + + m_pixels = parent.pixels; +// m_stencil = parent.stencil; + m_zbuffer = parent.zbuffer; + + noDepthTest = parent.hints[DISABLE_DEPTH_TEST]; + //argbSurface = parent.format == PConstants.ARGB; + + // other things to reset + + INTERPOLATE_UV = false; + INTERPOLATE_RGB = false; + INTERPOLATE_ALPHA = false; + //m_tImage = null; + m_texture = null; + m_drawFlags = 0; + } + + + /** + * Sets backface culling on/off + */ + public void setCulling(boolean tf) { + m_culling = tf; + } + + + /** + * Sets vertex coordinates for the triangle + */ + public void setVertices(float x0, float y0, float z0, + float x1, float y1, float z1, + float x2, float y2, float z2) { + x_array[0] = x0; + x_array[1] = x1; + x_array[2] = x2; + + y_array[0] = y0; + y_array[1] = y1; + y_array[2] = y2; + + z_array[0] = z0; + z_array[1] = z1; + z_array[2] = z2; + } + + + /** + * Pass camera-space coordinates for the triangle. + * Needed to render if hint(ENABLE_ACCURATE_TEXTURES) enabled. + * Generally this will not need to be called manually, + * currently called from PGraphics3D.render_triangles() + */ + public void setCamVertices(float x0, float y0, float z0, + float x1, float y1, float z1, + float x2, float y2, float z2) { + camX[0] = x0; + camX[1] = x1; + camX[2] = x2; + + camY[0] = y0; + camY[1] = y1; + camY[2] = y2; + + camZ[0] = z0; + camZ[1] = z1; + camZ[2] = z2; + } + + + /** + * Sets the UV coordinates of the texture + */ + public void setUV(float u0, float v0, + float u1, float v1, + float u2, float v2) { + // sets & scales uv texture coordinates to center of the pixel + u_array[0] = (u0 * F_TEX_WIDTH + 0.5f) * 65536f; + u_array[1] = (u1 * F_TEX_WIDTH + 0.5f) * 65536f; + u_array[2] = (u2 * F_TEX_WIDTH + 0.5f) * 65536f; + v_array[0] = (v0 * F_TEX_HEIGHT + 0.5f) * 65536f; + v_array[1] = (v1 * F_TEX_HEIGHT + 0.5f) * 65536f; + v_array[2] = (v2 * F_TEX_HEIGHT + 0.5f) * 65536f; + } + + + /** + * Sets vertex intensities in 0xRRGGBBAA format + */ + public void setIntensities(float r0, float g0, float b0, float a0, + float r1, float g1, float b1, float a1, + float r2, float g2, float b2, float a2) { + // Check if we need alpha or not? + if ((a0 != 1.0f) || (a1 != 1.0f) || (a2 != 1.0f)) { + INTERPOLATE_ALPHA = true; + a_array[0] = (a0 * 253f + 1.0f) * 65536f; + a_array[1] = (a1 * 253f + 1.0f) * 65536f; + a_array[2] = (a2 * 253f + 1.0f) * 65536f; + m_drawFlags|=R_ALPHA; + } else { + INTERPOLATE_ALPHA = false; + m_drawFlags&=~R_ALPHA; + } + + // Check if we need to interpolate the intensity values + if ((r0 != r1) || (r1 != r2)) { + INTERPOLATE_RGB = true; + m_drawFlags |= R_GOURAUD; + } else if ((g0 != g1) || (g1 != g2)) { + INTERPOLATE_RGB = true; + m_drawFlags |= R_GOURAUD; + } else if ((b0 != b1) || (b1 != b2)) { + INTERPOLATE_RGB = true; + m_drawFlags |= R_GOURAUD; + } else { + //m_fill = parent.filli; + m_drawFlags &=~ R_GOURAUD; + } + + // push values to arrays.. some extra scaling is added + // to prevent possible color "overflood" due to rounding errors + r_array[0] = (r0 * 253f + 1.0f) * 65536f; + r_array[1] = (r1 * 253f + 1.0f) * 65536f; + r_array[2] = (r2 * 253f + 1.0f) * 65536f; + + g_array[0] = (g0 * 253f + 1.0f) * 65536f; + g_array[1] = (g1 * 253f + 1.0f) * 65536f; + g_array[2] = (g2 * 253f + 1.0f) * 65536f; + + b_array[0] = (b0 * 253f + 1.0f) * 65536f; + b_array[1] = (b1 * 253f + 1.0f) * 65536f; + b_array[2] = (b2 * 253f + 1.0f) * 65536f; + + // for plain triangles + m_fill = 0xFF000000 | + ((int)(255*r0) << 16) | ((int)(255*g0) << 8) | (int)(255*b0); + } + + + /** + * Sets texture image used for the polygon + */ + public void setTexture(PImage image) { + //m_tImage = image; + m_texture = image.pixels; + TEX_WIDTH = image.width; + TEX_HEIGHT = image.height; + F_TEX_WIDTH = TEX_WIDTH-1; + F_TEX_HEIGHT = TEX_HEIGHT-1; + INTERPOLATE_UV = true; + + if (image.format == ARGB) { + m_drawFlags |= R_TEXTURE32; + } else if (image.format == RGB) { + m_drawFlags |= R_TEXTURE24; + } else if (image.format == ALPHA) { + m_drawFlags |= R_TEXTURE8; + } + } + + + /** + * + */ + public void setUV(float[] u, float[] v) { + if (m_bilinear) { + // sets & scales uv texture coordinates to edges of pixels + u_array[0] = (u[0] * F_TEX_WIDTH) * 65500f; + u_array[1] = (u[1] * F_TEX_WIDTH) * 65500f; + u_array[2] = (u[2] * F_TEX_WIDTH) * 65500f; + v_array[0] = (v[0] * F_TEX_HEIGHT) * 65500f; + v_array[1] = (v[1] * F_TEX_HEIGHT) * 65500f; + v_array[2] = (v[2] * F_TEX_HEIGHT) * 65500f; + } else { + // sets & scales uv texture coordinates to center of the pixel + u_array[0] = (u[0] * TEX_WIDTH) * 65500f; + u_array[1] = (u[1] * TEX_WIDTH) * 65500f; + u_array[2] = (u[2] * TEX_WIDTH) * 65500f; + v_array[0] = (v[0] * TEX_HEIGHT) * 65500f; + v_array[1] = (v[1] * TEX_HEIGHT) * 65500f; + v_array[2] = (v[2] * TEX_HEIGHT) * 65500f; + } + } + + +// public void setIndex(int index) { +// m_index = index; +// } + + + /** + * Renders the polygon + */ + public void render() { + float x0, x1, x2; + float z0, z1, z2; + + float y0 = y_array[0]; + float y1 = y_array[1]; + float y2 = y_array[2]; + + //System.out.println(PApplet.hex(m_drawFlags)); + + // For accurate texture interpolation, need to mark whether + // we've already pre-calculated for the triangle + firstSegment = true; + + // do backface culling? + if (m_culling) { + x0 = x_array[0]; + if ((x_array[2]-x0)*(y1-y0) < (x_array[1]-x0)*(y2-y0)) + return; + } + + /* get vertex order from top -> down */ + if (y0 < y1) { + if (y2 < y1) { + if (y2 < y0) { // 2,0,1 + o0 = 2; + o1 = 0; + o2 = 1; + } else { // 0,2,1 + o0 = 0; + o1 = 2; + o2 = 1; + } + } else { // 0,1,2 + o0 = 0; + o1 = 1; + o2 = 2; + } + } else { + if (y2 > y1) { + if (y2 < y0) { // 1,2,0 + o0 = 1; + o1 = 2; + o2 = 0; + } else { // 1,0,2 + o0 = 1; + o1 = 0; + o2 = 2; + } + } else { // 2,1,0 + o0 = 2; + o1 = 1; + o2 = 0; + } + } + + /** + * o0 = "top" vertex offset + * o1 = "mid" vertex offset + * o2 = "bot" vertex offset + */ + + y0 = y_array[o0]; + int yi0 = (int) (y0 + PIXEL_CENTER); + if (yi0 > SCREEN_HEIGHT) { + return; + } else if (yi0 < 0) { + yi0 = 0; + } + + y2 = y_array[o2]; + int yi2 = (int) (y2 + PIXEL_CENTER); + if (yi2 < 0) { + return; + } else if (yi2 > SCREEN_HEIGHT) { + yi2 = SCREEN_HEIGHT; + } + + // Does the poly actually cross a scanline? + if (yi2 > yi0) { + x0 = x_array[o0]; + x1 = x_array[o1]; + x2 = x_array[o2]; + + // get mid Y and clip it + y1 = y_array[o1]; + int yi1 = (int) (y1 + PIXEL_CENTER); + if (yi1 < 0) + yi1 = 0; + if (yi1 > SCREEN_HEIGHT) + yi1 = SCREEN_HEIGHT; + + // calculate deltas etc. + dx2 = x2 - x0; + dy0 = y1 - y0; + dy2 = y2 - y0; + xadd2 = dx2 / dy2; // xadd for "single" edge + temp = dy0 / dy2; + width = temp * dx2 + x0 - x1; + + // calculate alpha blend interpolation + if (INTERPOLATE_ALPHA) { + a0 = a_array[o0]; + a1 = a_array[o1]; + a2 = a_array[o2]; + da0 = a1-a0; + da2 = a2-a0; + iaadd = (int) ((temp * da2 - da0) / width); // alpha add + } + + // calculate intensity interpolation + if (INTERPOLATE_RGB) { + r0 = r_array[o0]; + r1 = r_array[o1]; + r2 = r_array[o2]; + + g0 = g_array[o0]; + g1 = g_array[o1]; + g2 = g_array[o2]; + + b0 = b_array[o0]; + b1 = b_array[o1]; + b2 = b_array[o2]; + + dr0 = r1-r0; + dg0 = g1-g0; + db0 = b1-b0; + + dr2 = r2-r0; + dg2 = g2-g0; + db2 = b2-b0; + + iradd = (int) ((temp * dr2 - dr0) / width); // r add + igadd = (int) ((temp * dg2 - dg0) / width); // g add + ibadd = (int) ((temp * db2 - db0) / width); // b add + } + + // calculate UV interpolation + if (INTERPOLATE_UV) { + u0 = u_array[o0]; + u1 = u_array[o1]; + u2 = u_array[o2]; + v0 = v_array[o0]; + v1 = v_array[o1]; + v2 = v_array[o2]; + du0 = u1-u0; + dv0 = v1-v0; + du2 = u2-u0; + dv2 = v2-v0; + iuadd = (int) ((temp * du2 - du0) / width); // u add + ivadd = (int) ((temp * dv2 - dv0) / width); // v add + } + + z0 = z_array[o0]; + z1 = z_array[o1]; + z2 = z_array[o2]; + dz0 = z1-z0; + dz2 = z2-z0; + izadd = (temp * dz2 - dz0) / width; + + // draw the upper poly segment if it's visible + if (yi1 > yi0) { + dta = (yi0 + PIXEL_CENTER) - y0; + xadd1 = (x1 - x0) / dy0; + + // we can determine which side is "single" side + // by comparing left/right edge adds + if (xadd2 > xadd1) { + xleft = x0 + dta * xadd1; + xrght = x0 + dta * xadd2; + zleftadd = dz0 / dy0; + zleft = dta*zleftadd+z0; + + if (INTERPOLATE_UV) { + uleftadd = du0 / dy0; + vleftadd = dv0 / dy0; + uleft = dta*uleftadd+u0; + vleft = dta*vleftadd+v0; + } + + if (INTERPOLATE_RGB) { + rleftadd = dr0 / dy0; + gleftadd = dg0 / dy0; + bleftadd = db0 / dy0; + rleft = dta*rleftadd+r0; + gleft = dta*gleftadd+g0; + bleft = dta*bleftadd+b0; + } + + if (INTERPOLATE_ALPHA) { + aleftadd = da0 / dy0; + aleft = dta*aleftadd+a0; + + if (m_drawFlags == R_ALPHA) { + drawsegment_plain_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_ALPHA)) { + drawsegment_gouraud_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_TEXTURE8 + R_ALPHA)) { + drawsegment_texture8_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_TEXTURE24 + R_ALPHA)) { + drawsegment_texture24_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_TEXTURE32 + R_ALPHA)) { + drawsegment_texture32_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8 + R_ALPHA)) { + drawsegment_gouraud_texture8_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24 + R_ALPHA)) { + drawsegment_gouraud_texture24_alpha(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32 + R_ALPHA)) { + drawsegment_gouraud_texture32_alpha(xadd1,xadd2, yi0,yi1); + } + } else { + if (m_drawFlags == 0) { + drawsegment_plain(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == R_GOURAUD) { + drawsegment_gouraud(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == R_TEXTURE8) { + drawsegment_texture8(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == R_TEXTURE24) { + drawsegment_texture24(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == R_TEXTURE32) { + drawsegment_texture32(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8)) { + drawsegment_gouraud_texture8(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24)) { + drawsegment_gouraud_texture24(xadd1,xadd2, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32)) { + drawsegment_gouraud_texture32(xadd1,xadd2, yi0,yi1); + } + } + m_singleRight = true; + } else { + xleft = x0 + dta * xadd2; + xrght = x0 + dta * xadd1; + zleftadd = dz2 / dy2; + zleft = dta*zleftadd+z0; + // + if (INTERPOLATE_UV) { + uleftadd = du2 / dy2; + vleftadd = dv2 / dy2; + uleft = dta*uleftadd+u0; + vleft = dta*vleftadd+v0; + } + + // + if (INTERPOLATE_RGB) { + rleftadd = dr2 / dy2; + gleftadd = dg2 / dy2; + bleftadd = db2 / dy2; + rleft = dta*rleftadd+r0; + gleft = dta*gleftadd+g0; + bleft = dta*bleftadd+b0; + } + + + if (INTERPOLATE_ALPHA) { + aleftadd = da2 / dy2; + aleft = dta*aleftadd+a0; + + if (m_drawFlags == R_ALPHA) { + drawsegment_plain_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_ALPHA)) { + drawsegment_gouraud_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_TEXTURE8 + R_ALPHA)) { + drawsegment_texture8_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_TEXTURE24 + R_ALPHA)) { + drawsegment_texture24_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_TEXTURE32 + R_ALPHA)) { + drawsegment_texture32_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8 + R_ALPHA)) { + drawsegment_gouraud_texture8_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24 + R_ALPHA)) { + drawsegment_gouraud_texture24_alpha(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32 + R_ALPHA)) { + drawsegment_gouraud_texture32_alpha(xadd2, xadd1, yi0,yi1); + } + } else { + if (m_drawFlags == 0) { + drawsegment_plain(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == R_GOURAUD) { + drawsegment_gouraud(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == R_TEXTURE8) { + drawsegment_texture8(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == R_TEXTURE24) { + drawsegment_texture24(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == R_TEXTURE32) { + drawsegment_texture32(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8)) { + drawsegment_gouraud_texture8(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24)) { + drawsegment_gouraud_texture24(xadd2, xadd1, yi0,yi1); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32)) { + drawsegment_gouraud_texture32(xadd2, xadd1, yi0,yi1); + } + } + m_singleRight = false; + } + + // if bottom segment height is zero, return + if (yi2 == yi1) return; + + // calculate xadd 1 + dy1 = y2 - y1; + xadd1 = (x2 - x1) / dy1; + + } else { + // top seg height was zero, calculate & clip single edge X + dy1 = y2 - y1; + xadd1 = (x2 - x1) / dy1; + + // which edge is left? + if (xadd2 < xadd1) { + xrght = ((yi1 + PIXEL_CENTER) - y0) * xadd2 + x0; + m_singleRight = true; + } else { + dta = (yi1 + PIXEL_CENTER) - y0; + xleft = dta * xadd2 + x0; + zleftadd = dz2 / dy2; + zleft = dta * zleftadd + z0; + + if (INTERPOLATE_UV) { + uleftadd = du2 / dy2; + vleftadd = dv2 / dy2; + uleft = dta * uleftadd + u0; + vleft = dta * vleftadd + v0; + } + + if (INTERPOLATE_RGB) { + rleftadd = dr2 / dy2; + gleftadd = dg2 / dy2; + bleftadd = db2 / dy2; + rleft = dta * rleftadd + r0; + gleft = dta * gleftadd + g0; + bleft = dta * bleftadd + b0; + } + + // + if (INTERPOLATE_ALPHA) { + aleftadd = da2 / dy2; + aleft = dta * aleftadd + a0; + } + m_singleRight = false; + } + } + + // draw the lower segment + if (m_singleRight) { + dta = (yi1 + PIXEL_CENTER) - y1; + xleft = dta * xadd1 + x1; + zleftadd = (z2 - z1) / dy1; + zleft = dta * zleftadd + z1; + + if (INTERPOLATE_UV) { + uleftadd = (u2 - u1) / dy1; + vleftadd = (v2 - v1) / dy1; + uleft = dta * uleftadd + u1; + vleft = dta * vleftadd + v1; + } + + if (INTERPOLATE_RGB) { + rleftadd = (r2 - r1) / dy1; + gleftadd = (g2 - g1) / dy1; + bleftadd = (b2 - b1) / dy1; + rleft = dta * rleftadd + r1; + gleft = dta * gleftadd + g1; + bleft = dta * bleftadd + b1; + } + + if (INTERPOLATE_ALPHA) { + aleftadd = (a2 - a1) / dy1; + aleft = dta * aleftadd + a1; + + if (m_drawFlags == R_ALPHA) { + drawsegment_plain_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_ALPHA)) { + drawsegment_gouraud_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_TEXTURE8 + R_ALPHA)) { + drawsegment_texture8_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_TEXTURE24 + R_ALPHA)) { + drawsegment_texture24_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_TEXTURE32 + R_ALPHA)) { + drawsegment_texture32_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8 + R_ALPHA)) { + drawsegment_gouraud_texture8_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24 + R_ALPHA)) { + drawsegment_gouraud_texture24_alpha(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32 + R_ALPHA)) { + drawsegment_gouraud_texture32_alpha(xadd1, xadd2, yi1,yi2); + } + } else { + if (m_drawFlags == 0) { + drawsegment_plain(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == R_GOURAUD) { + drawsegment_gouraud(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == R_TEXTURE8) { + drawsegment_texture8(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == R_TEXTURE24) { + drawsegment_texture24(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == R_TEXTURE32) { + drawsegment_texture32(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8)) { + drawsegment_gouraud_texture8(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24)) { + drawsegment_gouraud_texture24(xadd1, xadd2, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32)) { + drawsegment_gouraud_texture32(xadd1, xadd2, yi1,yi2); + } + } + } else { + xrght = ((yi1 + PIXEL_CENTER)- y1) * xadd1 + x1; + + if (INTERPOLATE_ALPHA) { + if (m_drawFlags == R_ALPHA) { + drawsegment_plain_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_ALPHA)) { + drawsegment_gouraud_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_TEXTURE8 + R_ALPHA)) { + drawsegment_texture8_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_TEXTURE24 + R_ALPHA)) { + drawsegment_texture24_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_TEXTURE32 + R_ALPHA)) { + drawsegment_texture32_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8 + R_ALPHA)) { + drawsegment_gouraud_texture8_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24 + R_ALPHA)) { + drawsegment_gouraud_texture24_alpha(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32 + R_ALPHA)) { + drawsegment_gouraud_texture32_alpha(xadd2, xadd1, yi1,yi2); + } + } else { + if (m_drawFlags == 0) { + drawsegment_plain(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == R_GOURAUD) { + drawsegment_gouraud(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == R_TEXTURE8) { + drawsegment_texture8(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == R_TEXTURE24) { + drawsegment_texture24(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == R_TEXTURE32) { + drawsegment_texture32(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE8)) { + drawsegment_gouraud_texture8(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE24)) { + drawsegment_gouraud_texture24(xadd2, xadd1, yi1,yi2); + } else if (m_drawFlags == (R_GOURAUD + R_TEXTURE32)) { + drawsegment_gouraud_texture32(xadd2, xadd1, yi1,yi2); + } + } + } + } + } + + + /** + * Accurate texturing code by ewjordan@gmail.com, April 14, 2007 + * The getColorFromTexture() function should be inlined and optimized + * so that most of the heavy lifting happens outside the per-pixel loop. + * The unoptimized generic algorithm looks like this (unless noted, + * all of these variables are vectors, so the actual code will look messier): + * + * p = camera space vector where u == 0, v == 0; + * m = vector from p to location where u == TEX_WIDTH; + * n = vector from p to location where v == TEX_HEIGHT; + * + * A = p cross n; + * B = m cross p; + * C = n cross m; + * A *= texture.width; + * B *= texture.height; + * + * for (scanlines in triangle){ + * float a = S * A; + * float b = S * B; + * float c = S * C; + * for (pixels in scanline){ + * int u = a/c; + * int v = b/c; + * color = texture[v * texture.width + u]; + * a += A.x; + * b += B.x; + * c += C.x; + * } + * } + * + * We don't use this exact algorithm here, however, because of the extra + * overhead from the divides. Instead we compute the exact u and v (labelled + * iu and iv in the code) at the start of each scanline and we perform a + * linear interpolation for every linearInterpLength = 1 << TEX_INTERP_POWER + * pixels. This means that we only perform the true calculation once in a + * while, and the rest of the time the algorithm functions exactly as in the + * fast inaccurate case, at least in theory. In practice, even if we set + * linearInterpLength very high we still incur some speed penalty due to the + * preprocessing that must take place per-scanline. A similar method could + * be applied per scanline to avoid this, but it would only be worthwhile in + * the case that we never compute more than one exact calculation per + * scanline. If we want something like this, however, it would be best to + * create another mode of calculation called "constant-z" interpolation, + * which could be used for things like floors and ceilings where the + * distance from the camera plane never changes over the course of a + * scanline. We could also add the vertical analogue for drawing vertical + * walls. In any case, these are not critical as the current algorithm runs + * fairly well, perhaps ~10% slower than the default perspective-less one. + */ + + /** + * Solve for camera space coordinates of critical texture points and + * set up per-triangle variables for accurate texturing. + * Sets all class variables relevant to accurate texture computation + * Should be called once per triangle - checks firstSegment to see if + * we've already called. + */ + private boolean precomputeAccurateTexturing() { + // rescale u/v_array values when inverting matrix and performing other calcs + float myFact = 65500.0f; + float myFact2 = 65500.0f; + + //Matrix inversion to find affine transform between (u,v,(1)) -> (x,y,z) + + // OPTIMIZE: There should be a way to avoid the inversion here, which is + // quite expensive (~150 mults). Also it might crap out due to loss of + // precision depending on the scaling of the u/v_arrays. Nothing clever + // currently happens if the inversion fails, since this means the + // transformation is degenerate - we just pass false back to the caller + // and let it handle the situation. [There is no good solution to this + // case from within this function, since the way the calculation proceeds + // presumes a non-degenerate transformation matrix between camera space + // and uv space] + + // Obvious optimization: if the vertices are actually at the appropriate + // texture coordinates (e.g. (0,0), (TEX_WIDTH,0), and (0,TEX_HEIGHT)) + // then we can immediately return the right solution without the inversion. + // This is fairly common, so could speed up many cases of drawing. + // [not implemented] + + // Furthermore, we could cache the p,resultT0,result0T vectors in the + // triangle's basis, since we could then do a look-up and generate the + // resulting coordinates very simply. This would include the above + // optimization as a special case - we could pre-populate the cache with + // special cases like that and dynamically add more. The idea here is that + // most people simply paste textures onto triangles and move the triangles + // from frame to frame, so any per-triangle-per-frame code is likely + // wasted effort. [not implemented] + + // Note: o0, o1, and o2 vary depending on view angle to triangle, + // but p, n, and m should not depend on ordering differences + + if (firstSegment){ + PMatrix3D myMatrix = + new PMatrix3D(u_array[o0]/myFact, v_array[o0]/myFact2, 1, 0, + u_array[o1]/myFact, v_array[o1]/myFact2, 1, 0, + u_array[o2]/myFact, v_array[o2]/myFact2, 1, 0, + 0, 0, 0, 1); + // A 3x3 inversion would be more efficient here, + // given that the fourth r/c are unity + myMatrix.invert(); + // if the matrix inversion had trouble, let the caller know + if (myMatrix == null) return false; + + float m00, m01, m02, m10, m11, m12, m20, m21, m22; + m00 = myMatrix.m00*camX[o0]+myMatrix.m01*camX[o1]+myMatrix.m02*camX[o2]; + m01 = myMatrix.m10*camX[o0]+myMatrix.m11*camX[o1]+myMatrix.m12*camX[o2]; + m02 = myMatrix.m20*camX[o0]+myMatrix.m21*camX[o1]+myMatrix.m22*camX[o2]; + m10 = myMatrix.m00*camY[o0]+myMatrix.m01*camY[o1]+myMatrix.m02*camY[o2]; + m11 = myMatrix.m10*camY[o0]+myMatrix.m11*camY[o1]+myMatrix.m12*camY[o2]; + m12 = myMatrix.m20*camY[o0]+myMatrix.m21*camY[o1]+myMatrix.m22*camY[o2]; + m20 = -(myMatrix.m00*camZ[o0]+myMatrix.m01*camZ[o1]+myMatrix.m02*camZ[o2]); + m21 = -(myMatrix.m10*camZ[o0]+myMatrix.m11*camZ[o1]+myMatrix.m12*camZ[o2]); + m22 = -(myMatrix.m20*camZ[o0]+myMatrix.m21*camZ[o1]+myMatrix.m22*camZ[o2]); + + float px = m02; + float py = m12; + float pz = m22; + // Bugfix: possibly we should use F_TEX_WIDTH/HEIGHT instead? + // Seems to read off end of array in that case, though... + float resultT0x = m00*TEX_WIDTH+m02; + float resultT0y = m10*TEX_WIDTH+m12; + float resultT0z = m20*TEX_WIDTH+m22; + float result0Tx = m01*TEX_HEIGHT+m02; + float result0Ty = m11*TEX_HEIGHT+m12; + float result0Tz = m21*TEX_HEIGHT+m22; + float mx = resultT0x-m02; + float my = resultT0y-m12; + float mz = resultT0z-m22; + float nx = result0Tx-m02; + float ny = result0Ty-m12; + float nz = result0Tz-m22; + + //avec = p x n + ax = (py*nz-pz*ny)*TEX_WIDTH; //F_TEX_WIDTH/HEIGHT? + ay = (pz*nx-px*nz)*TEX_WIDTH; + az = (px*ny-py*nx)*TEX_WIDTH; + //bvec = m x p + bx = (my*pz-mz*py)*TEX_HEIGHT; + by = (mz*px-mx*pz)*TEX_HEIGHT; + bz = (mx*py-my*px)*TEX_HEIGHT; + //cvec = n x m + cx = ny*mz-nz*my; + cy = nz*mx-nx*mz; + cz = nx*my-ny*mx; + } + + nearPlaneWidth = parent.rightScreen-parent.leftScreen; + nearPlaneHeight = parent.topScreen-parent.bottomScreen; + nearPlaneDepth = parent.nearPlane; + // one pixel width in nearPlane coordinates + xmult = nearPlaneWidth / SCREEN_WIDTH; + ymult = nearPlaneHeight / SCREEN_HEIGHT; + // Extra scalings to map screen plane units to pixel units + newax = ax*xmult; + newbx = bx*xmult; + newcx = cx*xmult; + return true; + } + + + /** + * Set the power of two used for linear interpolation of texture coordinates. + * A true texture coordinate is computed every 2^pwr pixels along a scanline. + */ + static public void setInterpPower(int pwr) { + //Currently must be invoked from P5 as PTriangle.setInterpPower(...) + TEX_INTERP_POWER = pwr; + } + + + /** + * Plain color + */ + private void drawsegment_plain(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int f = m_fill; +// int p = m_index; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + float iz = izadd * xdiff + zleft; + xstart+=ytop; + xend+=ytop; + + for ( ; xstart < xend; xstart++ ) { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + m_zbuffer[xstart] = iz; + m_pixels[xstart] = m_fill; +// m_stencil[xstart] = p; + } + iz+=izadd; + } + + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + zleft+=zleftadd; + } + } + + + /** + * Plain color, interpolated alpha + */ + private void drawsegment_plain_alpha(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; + + int pr = m_fill & 0xFF0000; + int pg = m_fill & 0xFF00; + int pb = m_fill & 0xFF; + +// int p = m_index; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + float iz = izadd * xdiff + zleft; + int ia = (int) (iaf * xdiff + aleft); + xstart += ytop; + xend += ytop; + + //int ma0 = 0xFF000000; + + for ( ; xstart < xend; xstart++ ) { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + // don't set zbuffer when not fully opaque + //m_zbuffer[xstart] = iz; + + int alpha = ia >> 16; + int mr0 = m_pixels[xstart]; + /* + if (argbSurface) { + ma0 = (((mr0 >>> 24) * alpha) << 16) & 0xFF000000; + if (ma0 == 0) ma0 = alpha << 24; + } + */ + int mg0 = mr0 & 0xFF00; + int mb0 = mr0 & 0xFF; + mr0 &= 0xFF0000; + + mr0 = mr0 + (((pr - mr0) * alpha) >> 8); + mg0 = mg0 + (((pg - mg0) * alpha) >> 8); + mb0 = mb0 + (((pb - mb0) * alpha) >> 8); + + m_pixels[xstart] = 0xFF000000 | + (mr0 & 0xFF0000) | (mg0 & 0xFF00) | (mb0 & 0xFF); + +// m_stencil[xstart] = p; + } + iz += izadd; + ia += iaadd; + } + ytop += SCREEN_WIDTH; + xleft += leftadd; + xrght += rghtadd; + zleft += zleftadd; + } + } + + + /** + * RGB gouraud + */ + private void drawsegment_gouraud(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + for ( ; xstart < xend; xstart++ ) { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + m_zbuffer[xstart] = iz; + m_pixels[xstart] = 0xFF000000 | + ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16)); +// m_stencil[xstart] = p; + } + + ir+=iradd; + ig+=igadd; + ib+=ibadd; + iz+=izadd; + } + + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + zleft+=zleftadd; + } + } + + + /** + * RGB gouraud + interpolated alpha + */ + private void drawsegment_gouraud_alpha(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + for ( ; xstart < xend; xstart++ ) { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + // + int red = (ir & 0xFF0000); + int grn = (ig >> 8) & 0xFF00; + int blu = (ib >> 16); + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + + // blend alpha + int al = ia >> 16; + + // + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); +// m_stencil[xstart] = p; + } + + // + ir+=iradd; + ig+=igadd; + ib+=ibadd; + ia+=iaadd; + iz+=izadd; + } + + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + aleft+=aleftadd; + zleft+=zleftadd; + } + } + + + /** + * 8-bit plain texture + */ + + //THIS IS MESSED UP, NEED TO GRAB ORIGINAL VERSION!!! + private void drawsegment_texture8(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + // Accurate texture mode added - comments stripped from dupe code, + // see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode) { + // see if the precomputation goes well, if so finish the setup + if (precomputeAccurateTexturing()) { + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + // if the matrix inversion screwed up, revert to normal rendering + // (something is degenerate) + accurateMode = false; + } + } + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + + int red = m_fill & 0xFF0000; + int grn = m_fill & 0xFF00; + int blu = m_fill & 0xFF; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode && goingIn) { + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; + iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else { + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + for ( ; xstart < xend; xstart++ ) { + if (accurateMode) { + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else { + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + // try-catch just in case pixel offset it out of range + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + int al0; + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = iu & 0xFFFF; + al0 = m_texture[ofs] & 0xFF; + int al1 = m_texture[ofs + 1] & 0xFF; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int al2 = m_texture[ofs] & 0xFF; + int al3 = m_texture[ofs + 1] & 0xFF; + al0 = al0 + (((al1-al0) * iui) >> 16); + al2 = al2 + (((al3-al2) * iui) >> 16); + al0 = al0 + (((al2-al0) * (iv & 0xFFFF)) >> 16); + } else { + al0 = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)] & 0xFF; + } + + int br = m_pixels[xstart]; + int bg = (br & 0xFF00); + int bb = (br & 0xFF); + br = (br & 0xFF0000); + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al0) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al0) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al0) >> 8)) & 0xFF); +// m_stencil[xstart] = p; + } + } + catch (Exception e) { + } + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + iz+=izadd; + } + ypixel++;//accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + zleft+=zleftadd; + } + } + + + + /** + * 8-bit texutre + alpha + */ + private void drawsegment_texture8_alpha(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + // Accurate texture mode added - comments stripped from dupe code, + // see drawsegment_texture24() for details + + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode) { + // see if the precomputation goes well, if so finish the setup + if (precomputeAccurateTexturing()) { + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else { + // if the matrix inversion screwed up, + // revert to normal rendering (something is degenerate) + accurateMode = false; + } + } + ytop*=SCREEN_WIDTH; + ybottom*=SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float iaf = iaadd; + + int red = m_fill & 0xFF0000; + int grn = m_fill & 0xFF00; + int blu = m_fill & 0xFF; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + // try-catch just in case pixel offset it out of range + try + { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + int al0; + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = iu & 0xFFFF; + al0 = m_texture[ofs] & 0xFF; + int al1 = m_texture[ofs + 1] & 0xFF; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int al2 = m_texture[ofs] & 0xFF; + int al3 = m_texture[ofs + 1] & 0xFF; + al0 = al0 + (((al1-al0) * iui) >> 16); + al2 = al2 + (((al3-al2) * iui) >> 16); + al0 = al0 + (((al2-al0) * (iv & 0xFFFF)) >> 16); + } else { + al0 = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)] & 0xFF; + } + al0 = (al0 * (ia >> 16)) >> 8; + + int br = m_pixels[xstart]; + int bg = (br & 0xFF00); + int bb = (br & 0xFF); + br = (br & 0xFF0000); + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al0) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al0) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al0) >> 8)) & 0xFF); +// m_stencil[xstart] = p; + } + } + catch (Exception e) { + } + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + iz+=izadd; + ia+=iaadd; + } + ypixel++;//accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + zleft+=zleftadd; + aleft+=aleftadd; + } + } + + /** + * Plain 24-bit texture + */ + private void drawsegment_texture24(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + float iuf = iuadd; + float ivf = ivadd; + + boolean tint = (m_fill & 0xFFFFFF) != 0xFFFFFF; + int rtint = (m_fill >> 16) & 0xff; + int gtint = (m_fill >> 8) & 0xff; + int btint = m_fill & 0xFF; + + int ypixel = ytop/SCREEN_WIDTH;//ACCTEX + int lastRowStart = m_texture.length - TEX_WIDTH - 2;//If we're past this index, we can't shift down a row w/o throwing an exception + // int exCount = 0;//counter for exceptions caught + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; //bring this local since it will be accessed often + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + + //Interpolation length of 16 tends to look good except at a small angle; 8 looks okay then, except for the + //above issue. When viewing close to flat, as high as 32 is often acceptable. Could add dynamic interpolation + //settings based on triangle angle - currently we just pick a value and leave it (by default I have the + //power set at 3, so every 8 pixels a true coordinate is calculated, which seems a decent compromise). + + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion gave us garbage, revert to normal rendering (something is degenerate) + } + } + + + while (ytop < ybottom) {//scanline loop + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0){ xstart = 0; } + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH){ xend = SCREEN_WIDTH; } + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + float iz = izadd * xdiff + zleft; + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + //off by one (half, I guess) hack, w/o it the first rows are outside the texture - maybe a mistake somewhere? + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az;//OPT - some of this could be brought out of the y-loop since + b = screenx*bx+screeny*by+screenz*bz;//xpixel and ypixel just increment by the same numbers each iteration. + c = screenx*cx+screeny*cy+screenz*cz;//Probably not a big bottleneck, though. + } + + //Figure out whether triangle is going further into the screen or not as we move along scanline + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + + //Set up linear interpolation between calculated texture points + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + //float fdeltaU = 0; float fdeltaV = 0;//vars for floating point interpolating version of algorithm + //float fiu = 0; float fiv = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + + //Bugfix (done): it's a Really Bad Thing to interpolate along a scanline when the triangle goes deeper into the screen, + //because if the angle is severe enough the last control point for interpolation may cross the vanishing + //point. This leads to some pretty nasty artifacts, and ideally we should scan from right to left if the + //triangle is better served that way, or (what we do now) precompute the offset that we'll need so that we end up + //with a control point exactly at the furthest edge of the triangle. + + if (accurateMode&&goingIn){ + //IMPORTANT!!! Results are horrid without this hack! + //If polygon goes into the screen along scan line, we want to match the control point to the furthest point drawn + //since the control points are less meaningful the closer you are to the vanishing point. + //We'll do this by making the first control point lie before the start of the scanline (safe since it's closer to us) + + int rightOffset = (xend-xstart-1)%linearInterpLength; //"off by one" hack...probably means there's a small bug somewhere + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + + //Take step to control point to the left of start pixel + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + + //Now step to right control point + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + + //Get deltas for interpolation + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + //Otherwise the left edge is further, and we pin the first control point to it + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + for ( ; xstart < xend; xstart++ ) {//pixel loop - keep trim, can execute thousands of times per frame + //boolean drawBlack = false; //used to display control points + if(accurateMode){ + /* //Non-interpolating algorithm - slowest version, calculates exact coordinate for each pixel, + //and casts from float->int + float oneoverc = 65536.0f/c; //a bit faster to pre-divide for next two steps + iu = (int)(a*oneoverc); + iv = (int)(b*oneoverc); + a += newax; + b += newbx; + c += newcx; + */ + + //Float while calculating, int while interpolating + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + //drawBlack = true; + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; //ints are used for interpolation, not actual computation + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ //race through using linear interpolation if we're not at a control point + iu += deltaU; + iv += deltaV; + } + interpCounter++; + + /* //Floating point interpolating version - slower than int thanks to casts during interpolation steps + if (interpCounter == 0) { + interpCounter = linearInterpLength; + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; + oldfv = fv; + fu = (a*oneoverc); + fv = (b*oneoverc); + //oldu = u; oldv = v; + fiu = oldfu; + fiv = oldfv; + fdeltaU = (fu-oldfu)/linearInterpLength; + fdeltaV = (fv-oldfv)/linearInterpLength; + } + else{ + fiu += fdeltaU; + fiv += fdeltaV; + } + interpCounter--; + iu = (int)(fiu); iv = (int)(fiv);*/ + + } + + // try-catch just in case pixel offset is out of range + try{ + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + m_zbuffer[xstart] = iz; + if (m_bilinear) { + //We could (should?) add bounds checking on iu and iv here (keep in mind the 16 bit shift!). + //This would also be the place to add looping texture mode (bounds check == clamped). + //For looping/clamped textures, we'd also need to change PGraphics.textureVertex() to remove + //the texture range check there (it constrains normalized texture coordinates from 0->1). + + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + //if(ofs < 0) { ofs += TEX_WIDTH; } + //if(ofs > m_texture.length-2) {ofs -= TEX_WIDTH; } + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; //quick hack to thwart exceptions + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + int red = up + (((dn-up) * ivi) >> 7); + if (tint) red = ((red * rtint) >> 8) & 0xFF0000; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + int grn = up + (((dn-up) * ivi) >> 7); + if (tint) grn = ((grn * gtint) >> 8) & 0xFF00; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + int blu = up + (((dn-up) * ivi) >> 7); + if (tint) blu = ((blu * btint) >> 8) & 0xFF; + + //m_pixels[xstart] = (red & 0xFF0000) | (grn & 0xFF00) | (blu & 0xFF); + m_pixels[xstart] = 0xFF000000 | + (red & 0xFF0000) | (grn & 0xFF00) | (blu & 0xFF); + + } else { + m_pixels[xstart] = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + } +// m_stencil[xstart] = p; + } + } catch (Exception e) {/*exCount++;*/} + iz+=izadd; + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + } + ypixel++; //accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + zleft+=zleftadd; + uleft+=uleftadd; + vleft+=vleftadd; + } + //if (exCount>0) System.out.println(exCount+" exceptions in this segment"); + } + + + /** + * Alpha 24-bit texture + */ + private void drawsegment_texture24_alpha(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + boolean tint = (m_fill & 0xFFFFFF) != 0xFFFFFF; + int rtint = (m_fill >> 16) & 0xff; + int gtint = (m_fill >> 8) & 0xff; + int btint = m_fill & 0xFF; + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + // get alpha + int al = ia >> 16; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + int red = up + (((dn-up) * ivi) >> 7); + if (tint) red = ((red * rtint) >> 8) & 0xFF0000; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + int grn = up + (((dn-up) * ivi) >> 7); + if (tint) grn = ((grn * gtint) >> 8) & 0xFF00; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + int blu = up + (((dn-up) * ivi) >> 7); + if (tint) blu = ((blu * btint) >> 8) & 0xFF; + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + + } else { + int red = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + int grn = red & 0xFF00; + int blu = red & 0xFF; + red&=0xFF0000; + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + } +// m_stencil[xstart] = p; + } + } catch (Exception e) { } + + xpixel++; // accurate mode + if (!accurateMode){ + iu += iuadd; + iv += ivadd; + } + ia+=iaadd; + iz+=izadd; + } + ypixel++; // accurate mode + + ytop+=SCREEN_WIDTH; + + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + zleft+=zleftadd; + aleft+=aleftadd; + } + } + + /** + * Plain 32-bit texutre + */ + private void drawsegment_texture32(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop*=SCREEN_WIDTH; + ybottom*=SCREEN_WIDTH; +// int p = m_index; + + boolean tint = m_fill != 0xFFFFFFFF; + int rtint = (m_fill >> 16) & 0xff; + int gtint = (m_fill >> 8) & 0xff; + int btint = m_fill & 0xFF; + + float iuf = iuadd; + float ivf = ivadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + // try-catch just in case pixel offset it out of range + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + int red = up + (((dn-up) * ivi) >> 7); + if (tint) red = ((red * rtint) >> 8) & 0xFF0000; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + int grn = up + (((dn-up) * ivi) >> 7); + if (tint) grn = ((grn * gtint) >> 8) & 0xFF00; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + int blu = up + (((dn-up) * ivi) >> 7); + if (tint) blu = ((blu * btint) >> 8) & 0xFF; + + // alpha + pix0>>>=24; + pix2>>>=24; + up = pix0 + ((((pix1 >>> 24) - pix0) * iui) >> 7); + dn = pix2 + ((((pix3 >>> 24) - pix2) * iui) >> 7); + int al = up + (((dn-up) * ivi) >> 7); + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + } else { + int red = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + int al = red >>> 24; + int grn = red & 0xFF00; + int blu = red & 0xFF; + red&=0xFF0000; + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + } +// m_stencil[xstart] = p; + } + } catch (Exception e) { } + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + iz+=izadd; + } + ypixel++;//accurate mode + + ytop+=SCREEN_WIDTH; + + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + zleft+=zleftadd; + aleft+=aleftadd; + } + + + } + + /** + * Alpha 32-bit texutre + */ + private void drawsegment_texture32_alpha(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + boolean tint = (m_fill & 0xFFFFFF) != 0xFFFFFF; + int rtint = (m_fill >> 16) & 0xff; + int gtint = (m_fill >> 8) & 0xff; + int btint = m_fill & 0xFF; + + float iuf = iuadd; + float ivf = ivadd; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + + float xdiff = (xstart + PIXEL_CENTER) - xleft; + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + // try-catch just in case pixel offset it out of range + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + // get alpha + int al = ia >> 16; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + int red = up + (((dn-up) * ivi) >> 7); + if (tint) red = ((red * rtint) >> 8) & 0xFF0000; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + int grn = up + (((dn-up) * ivi) >> 7); + if (tint) grn = ((grn * gtint) >> 8) & 0xFF00; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + int blu = up + (((dn-up) * ivi) >> 7); + if (tint) blu = ((blu * btint) >> 8) & 0xFF; + + // alpha + pix0>>>=24; + pix2>>>=24; + up = pix0 + ((((pix1 >>> 24) - pix0) * iui) >> 7); + dn = pix2 + ((((pix3 >>> 24) - pix2) * iui) >> 7); + al = al * (up + (((dn-up) * ivi) >> 7)) >> 8; + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + } else { + int red = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + al = al * (red >>> 24) >> 8; + int grn = red & 0xFF00; + int blu = red & 0xFF; + red&=0xFF0000; + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + } +// m_stencil[xstart] = p; + } + } catch (Exception e) { } + + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ia+=iaadd; + iz+=izadd; + } + ypixel++;//accurate mode + + ytop+=SCREEN_WIDTH; + + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + zleft+=zleftadd; + aleft+=aleftadd; + } + + + } + + + /** + * Gouraud blended with 8-bit alpha texture + */ + private void drawsegment_gouraud_texture8(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + try + { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + int al0; + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = iu & 0xFFFF; + al0 = m_texture[ofs] & 0xFF; + int al1 = m_texture[ofs + 1] & 0xFF; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int al2 = m_texture[ofs] & 0xFF; + int al3 = m_texture[ofs + 1] & 0xFF; + al0 = al0 + (((al1-al0) * iui) >> 16); + al2 = al2 + (((al3-al2) * iui) >> 16); + al0 = al0 + (((al2-al0) * (iv & 0xFFFF)) >> 16); + } else { + al0 = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)] & 0xFF; + } + + // get RGB colors + int red = ir & 0xFF0000; + int grn = (ig >> 8) & 0xFF00; + int blu = (ib >> 16); + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al0) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al0) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al0) >> 8)) & 0xFF); + + // write stencil +// m_stencil[xstart] = p; + } + } + catch (Exception e) { + + } + + // + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ir+=iradd; + ig+=igadd; + ib+=ibadd; + iz+=izadd; + } + ypixel++;//accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + + uleft+=uleftadd; + vleft+=vleftadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + zleft+=zleftadd; + } + } + + + /** + * Texture multiplied with gouraud + */ + private void drawsegment_gouraud_texture8_alpha(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + // Accurate texture mode added - comments stripped from dupe code, + // see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode) { + // see if the precomputation goes well, if so finish the setup + if (precomputeAccurateTexturing()) { + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + // if the matrix inversion screwed up, + // revert to normal rendering (something is degenerate) + accurateMode = false; + } + } + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + int al0; + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = iu & 0xFFFF; + al0 = m_texture[ofs] & 0xFF; + int al1 = m_texture[ofs + 1] & 0xFF; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int al2 = m_texture[ofs] & 0xFF; + int al3 = m_texture[ofs + 1] & 0xFF; + al0 = al0 + (((al1-al0) * iui) >> 16); + al2 = al2 + (((al3-al2) * iui) >> 16); + al0 = al0 + (((al2-al0) * (iv & 0xFFFF)) >> 16); + } else { + al0 = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)] & 0xFF; + } + al0 = (al0 * (ia >> 16)) >> 8; + + // get RGB colors + int red = ir & 0xFF0000; + int grn = (ig >> 8) & 0xFF00; + int blu = (ib >> 16); + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al0) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al0) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al0) >> 8)) & 0xFF); + + // write stencil +// m_stencil[xstart] = p; + } + } catch (Exception e) { } + + // + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ir+=iradd; + ig+=igadd; + ib+=ibadd; + ia+=iaadd; + iz+=izadd; + } + ypixel++;//accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + aleft+=aleftadd; + zleft+=zleftadd; + } + } + + + /** + * Texture multiplied with gouraud + */ + private void drawsegment_gouraud_texture24(float leftadd, + float rghtadd, + int ytop, + int ybottom) { + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + m_zbuffer[xstart] = iz; + + int red; + int grn; + int blu; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + red = up + (((dn-up) * ivi) >> 7); + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + grn = up + (((dn-up) * ivi) >> 7); + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + blu = up + (((dn-up) * ivi) >> 7); + } else { + // get texture pixel color + blu = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + red = (blu & 0xFF0000); + grn = (blu & 0xFF00); + blu = blu & 0xFF; + } + + // + int r = (ir >> 16); + int g = (ig >> 16); + // oops, namespace collision with accurate + // texture vector b...sorry [ewjordan] + int bb2 = (ib >> 16); + + m_pixels[xstart] = 0xFF000000 | + ((((red * r) & 0xFF000000) | ((grn * g) & 0xFF0000) | (blu * bb2)) >> 8); +// m_stencil[xstart] = p; + } + } catch (Exception e) { } + + // + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ir+=iradd; + ig+=igadd; + ib+=ibadd; + iz+=izadd; + } + ypixel++;//accurate mode + + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + zleft+=zleftadd; + } + } + + + /** + * Gouraud*texture blended with interpolating alpha + */ + private void drawsegment_gouraud_texture24_alpha + ( + float leftadd, + float rghtadd, + int ytop, + int ybottom + ) { + + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + for ( ;xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + // get texture pixel color + try + { + //if (iz < m_zbuffer[xstart]) { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { // [fry 041114] + //m_zbuffer[xstart] = iz; + + // blend + int al = ia >> 16; + + int red; + int grn; + int blu; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + red = (up + (((dn-up) * ivi) >> 7)) >> 16; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + grn = (up + (((dn-up) * ivi) >> 7)) >> 8; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + blu = up + (((dn-up) * ivi) >> 7); + } else { + blu = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + red = (blu & 0xFF0000) >> 16; // 0 - 255 + grn = (blu & 0xFF00) >> 8; // 0 - 255 + blu = (blu & 0xFF); // 0 - 255 + } + + // multiply with gouraud color + red = (red * ir) >>> 8; // 0x00FF???? + grn = (grn * ig) >>> 16; // 0x0000FF?? + blu = (blu * ib) >>> 24; // 0x000000FF + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + + // + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); +// m_stencil[xstart] = p; + } + } + catch (Exception e) { + } + + // + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ir+=iradd; + ig+=igadd; + ib+=ibadd; + ia+=iaadd; + iz+=izadd; + } + + ypixel++;//accurate mode + + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + aleft+=aleftadd; + zleft+=zleftadd; + } + } + + + /** + * Gouraud*texture blended with interpolating alpha + */ + private void drawsegment_gouraud_texture32 + ( + float leftadd, + float rghtadd, + int ytop, + int ybottom + ) { + + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop*=SCREEN_WIDTH; + ybottom*=SCREEN_WIDTH; + //int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + + for ( ; xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + try { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { + //m_zbuffer[xstart] = iz; + + int red; + int grn; + int blu; + int al; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + red = (up + (((dn-up) * ivi) >> 7)) >> 16; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + grn = (up + (((dn-up) * ivi) >> 7)) >> 8; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + blu = up + (((dn-up) * ivi) >> 7); + + // alpha + pix0>>>=24; + pix2>>>=24; + up = pix0 + ((((pix1 >>> 24) - pix0) * iui) >> 7); + dn = pix2 + ((((pix3 >>> 24) - pix2) * iui) >> 7); + al = up + (((dn-up) * ivi) >> 7); + } else { + // get texture pixel color + blu = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + al = (blu >>> 24); + red = (blu & 0xFF0000) >> 16; + grn = (blu & 0xFF00) >> 8; + blu = blu & 0xFF; + } + + // multiply with gouraud color + red = (red * ir) >>> 8; // 0x00FF???? + grn = (grn * ig) >>> 16; // 0x0000FF?? + blu = (blu * ib) >>> 24; // 0x000000FF + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + + // + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); + } + } catch (Exception e) { } + + // + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ir+=iradd; + ig+=igadd; + ib+=ibadd; + iz+=izadd; + } + ypixel++;//accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + zleft+=zleftadd; + } + } + + + /** + * Gouraud*texture blended with interpolating alpha + */ + private void drawsegment_gouraud_texture32_alpha + ( + float leftadd, + float rghtadd, + int ytop, + int ybottom + ) { + //Accurate texture mode added - comments stripped from dupe code, see drawsegment_texture24() for details + int ypixel = ytop; + int lastRowStart = m_texture.length - TEX_WIDTH - 2; + boolean accurateMode = parent.hints[ENABLE_ACCURATE_TEXTURES]; + float screenx = 0; float screeny = 0; float screenz = 0; + float a = 0; float b = 0; float c = 0; + int linearInterpPower = TEX_INTERP_POWER; + int linearInterpLength = 1 << linearInterpPower; + if (accurateMode){ + if(precomputeAccurateTexturing()){ //see if the precomputation goes well, if so finish the setup + newax *= linearInterpLength; + newbx *= linearInterpLength; + newcx *= linearInterpLength; + screenz = nearPlaneDepth; + firstSegment = false; + } else{ + accurateMode = false; //if the matrix inversion screwed up, revert to normal rendering (something is degenerate) + } + } + + ytop *= SCREEN_WIDTH; + ybottom *= SCREEN_WIDTH; +// int p = m_index; + + float iuf = iuadd; + float ivf = ivadd; + float irf = iradd; + float igf = igadd; + float ibf = ibadd; + float iaf = iaadd; + + while (ytop < ybottom) { + int xstart = (int) (xleft + PIXEL_CENTER); + if (xstart < 0) + xstart = 0; + + int xpixel = xstart;//accurate mode + + int xend = (int) (xrght + PIXEL_CENTER); + if (xend > SCREEN_WIDTH) + xend = SCREEN_WIDTH; + float xdiff = (xstart + PIXEL_CENTER) - xleft; + + int iu = (int) (iuf * xdiff + uleft); + int iv = (int) (ivf * xdiff + vleft); + int ir = (int) (irf * xdiff + rleft); + int ig = (int) (igf * xdiff + gleft); + int ib = (int) (ibf * xdiff + bleft); + int ia = (int) (iaf * xdiff + aleft); + float iz = izadd * xdiff + zleft; + + xstart+=ytop; + xend+=ytop; + if (accurateMode){ + screenx = xmult*(xpixel+.5f-(SCREEN_WIDTH/2.0f)); + screeny = ymult*(ypixel+.5f-(SCREEN_HEIGHT/2.0f)); + a = screenx*ax+screeny*ay+screenz*az; + b = screenx*bx+screeny*by+screenz*bz; + c = screenx*cx+screeny*cy+screenz*cz; + } + boolean goingIn = ( (newcx > 0) == (c > 0) )?false:true; + int interpCounter = 0; + int deltaU = 0; int deltaV = 0; + float fu = 0; float fv = 0; + float oldfu = 0; float oldfv = 0; + + if (accurateMode&&goingIn){ + int rightOffset = (xend-xstart-1)%linearInterpLength; + int leftOffset = linearInterpLength-rightOffset; + float rightOffset2 = rightOffset / ((float)linearInterpLength); + float leftOffset2 = leftOffset / ((float)linearInterpLength); + interpCounter = leftOffset; + float ao = a-leftOffset2*newax; + float bo = b-leftOffset2*newbx; + float co = c-leftOffset2*newcx; + float oneoverc = 65536.0f/co; + oldfu = (ao*oneoverc); oldfv = (bo*oneoverc); + a += rightOffset2*newax; + b += rightOffset2*newbx; + c += rightOffset2*newcx; + oneoverc = 65536.0f/c; + fu = a*oneoverc; fv = b*oneoverc; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + iu = ( (int)oldfu )+(leftOffset-1)*deltaU; iv = ( (int)oldfv )+(leftOffset-1)*deltaV; //another "off-by-one" hack + } else{ + float preoneoverc = 65536.0f/c; + fu = (a*preoneoverc); + fv = (b*preoneoverc); + } + + for ( ;xstart < xend; xstart++ ) { + if(accurateMode){ + if (interpCounter == linearInterpLength) interpCounter = 0; + if (interpCounter == 0){ + a += newax; + b += newbx; + c += newcx; + float oneoverc = 65536.0f/c; + oldfu = fu; oldfv = fv; + fu = (a*oneoverc); fv = (b*oneoverc); + iu = (int)oldfu; iv = (int)oldfv; + deltaU = ((int)(fu - oldfu)) >> linearInterpPower; + deltaV = ((int)(fv - oldfv)) >> linearInterpPower; + } else{ + iu += deltaU; + iv += deltaV; + } + interpCounter++; + } + + // get texture pixel color + try { + //if (iz < m_zbuffer[xstart]) { + if (noDepthTest || (iz <= m_zbuffer[xstart])) { // [fry 041114] + //m_zbuffer[xstart] = iz; + + // blend + int al = ia >> 16; + + int red; + int grn; + int blu; + + if (m_bilinear) { + int ofs = (iv >> 16) * TEX_WIDTH + (iu >> 16); + int iui = (iu & 0xFFFF) >> 9; + int ivi = (iv & 0xFFFF) >> 9; + + // get texture pixels + int pix0 = m_texture[ofs]; + int pix1 = m_texture[ofs + 1]; + if (ofs < lastRowStart) ofs+=TEX_WIDTH; + int pix2 = m_texture[ofs]; + int pix3 = m_texture[ofs + 1]; + + // red + int red0 = (pix0 & 0xFF0000); + int red2 = (pix2 & 0xFF0000); + int up = red0 + ((((pix1 & 0xFF0000) - red0) * iui) >> 7); + int dn = red2 + ((((pix3 & 0xFF0000) - red2) * iui) >> 7); + red = (up + (((dn-up) * ivi) >> 7)) >> 16; + + // grn + red0 = (pix0 & 0xFF00); + red2 = (pix2 & 0xFF00); + up = red0 + ((((pix1 & 0xFF00) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF00) - red2) * iui) >> 7); + grn = (up + (((dn-up) * ivi) >> 7)) >> 8; + + // blu + red0 = (pix0 & 0xFF); + red2 = (pix2 & 0xFF); + up = red0 + ((((pix1 & 0xFF) - red0) * iui) >> 7); + dn = red2 + ((((pix3 & 0xFF) - red2) * iui) >> 7); + blu = up + (((dn-up) * ivi) >> 7); + + // alpha + pix0>>>=24; + pix2>>>=24; + up = pix0 + ((((pix1 >>> 24) - pix0) * iui) >> 7); + dn = pix2 + ((((pix3 >>> 24) - pix2) * iui) >> 7); + al = al * (up + (((dn-up) * ivi) >> 7)) >> 8; + } else { + blu = m_texture[(iv >> 16) * TEX_WIDTH + (iu >> 16)]; + al = al * (blu >>> 24) >> 8; + red = (blu & 0xFF0000) >> 16; // 0 - 255 + grn = (blu & 0xFF00) >> 8; // 0 - 255 + blu = (blu & 0xFF); // 0 - 255 + } + + // multiply with gouraud color + red = (red * ir) >>> 8; // 0x00FF???? + grn = (grn * ig) >>> 16; // 0x0000FF?? + blu = (blu * ib) >>> 24; // 0x000000FF + + // get buffer pixels + int bb = m_pixels[xstart]; + int br = (bb & 0xFF0000); // 0x00FF0000 + int bg = (bb & 0xFF00); // 0x0000FF00 + bb = (bb & 0xFF); // 0x000000FF + + // + m_pixels[xstart] = 0xFF000000 | + ((br + (((red - br) * al) >> 8)) & 0xFF0000) | + ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | + ((bb + (((blu - bb) * al) >> 8)) & 0xFF); +// m_stencil[xstart] = p; + } + } catch (Exception e) { } + + // + xpixel++;//accurate mode + if (!accurateMode){ + iu+=iuadd; + iv+=ivadd; + } + ir+=iradd; + ig+=igadd; + ib+=ibadd; + ia+=iaadd; + iz+=izadd; + } + ypixel++;//accurate mode + ytop+=SCREEN_WIDTH; + xleft+=leftadd; + xrght+=rghtadd; + uleft+=uleftadd; + vleft+=vleftadd; + rleft+=rleftadd; + gleft+=gleftadd; + bleft+=bleftadd; + aleft+=aleftadd; + zleft+=zleftadd; + } + } +} diff --git a/core/src/processing/core/PVector.java b/core/src/processing/core/PVector.java new file mode 100644 index 000000000..5f9be436e --- /dev/null +++ b/core/src/processing/core/PVector.java @@ -0,0 +1,559 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 200X Dan Shiffman + Copyright (c) 2008 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.core; + +/** + * A class to describe a two or three dimensional vector. + *

    + * The result of all functions are applied to the vector itself, with the + * exception of cross(), which returns a new PVector (or writes to a specified + * 'target' PVector). That is, add() will add the contents of one vector to + * this one. Using add() with additional parameters allows you to put the + * result into a new PVector. Functions that act on multiple vectors also + * include static versions. Because creating new objects can be computationally + * expensive, most functions include an optional 'target' PVector, so that a + * new PVector object is not created with each operation. + *

    + * Initially based on the Vector3D class by Dan Shiffman. + */ +public class PVector { + + /** The x component of the vector. */ + public float x; + + /** The y component of the vector. */ + public float y; + + /** The z component of the vector. */ + public float z; + + /** Array so that this can be temporarily used in an array context */ + protected float[] array; + + + /** + * Constructor for an empty vector: x, y, and z are set to 0. + */ + public PVector() { + } + + + /** + * Constructor for a 3D vector. + * + * @param x the x coordinate. + * @param y the y coordinate. + * @param z the y coordinate. + */ + public PVector(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + } + + + /** + * Constructor for a 2D vector: z coordinate is set to 0. + * + * @param x the x coordinate. + * @param y the y coordinate. + */ + public PVector(float x, float y) { + this.x = x; + this.y = y; + this.z = 0; + } + + + /** + * Set x, y, and z coordinates. + * + * @param x the x coordinate. + * @param y the y coordinate. + * @param z the z coordinate. + */ + public void set(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + } + + + /** + * Set x, y, and z coordinates from a Vector3D object. + * + * @param v the PVector object to be copied + */ + public void set(PVector v) { + x = v.x; + y = v.y; + z = v.z; + } + + + /** + * Set the x, y (and maybe z) coordinates using a float[] array as the source. + * @param source array to copy from + */ + public void set(float[] source) { + if (source.length >= 2) { + x = source[0]; + y = source[1]; + } + if (source.length >= 3) { + z = source[2]; + } + } + + + /** + * Get a copy of this vector. + */ + public PVector get() { + return new PVector(x, y, z); + } + + + public float[] get(float[] target) { + if (target == null) { + return new float[] { x, y, z }; + } + if (target.length >= 2) { + target[0] = x; + target[1] = y; + } + if (target.length >= 3) { + target[2] = z; + } + return target; + } + + + /** + * Calculate the magnitude (length) of the vector + * @return the magnitude of the vector + */ + public float mag() { + return (float) Math.sqrt(x*x + y*y + z*z); + } + + + /** + * Add a vector to this vector + * @param v the vector to be added + */ + public void add(PVector v) { + x += v.x; + y += v.y; + z += v.z; + } + + + public void add(float x, float y, float z) { + this.x += x; + this.y += y; + this.z += z; + } + + + /** + * Add two vectors + * @param v1 a vector + * @param v2 another vector + * @return a new vector that is the sum of v1 and v2 + */ + static public PVector add(PVector v1, PVector v2) { + return add(v1, v2, null); + } + + + /** + * Add two vectors into a target vector + * @param v1 a vector + * @param v2 another vector + * @param target the target vector (if null, a new vector will be created) + * @return a new vector that is the sum of v1 and v2 + */ + static public PVector add(PVector v1, PVector v2, PVector target) { + if (target == null) { + target = new PVector(v1.x + v2.x,v1.y + v2.y, v1.z + v2.z); + } else { + target.set(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); + } + return target; + } + + + /** + * Subtract a vector from this vector + * @param v the vector to be subtracted + */ + public void sub(PVector v) { + x -= v.x; + y -= v.y; + z -= v.z; + } + + + public void sub(float x, float y, float z) { + this.x -= x; + this.y -= y; + this.z -= z; + } + + + /** + * Subtract one vector from another + * @param v1 a vector + * @param v2 another vector + * @return a new vector that is v1 - v2 + */ + static public PVector sub(PVector v1, PVector v2) { + return sub(v1, v2, null); + } + + + static public PVector sub(PVector v1, PVector v2, PVector target) { + if (target == null) { + target = new PVector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); + } else { + target.set(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); + } + return target; + } + + + /** + * Multiply this vector by a scalar + * @param n the value to multiply by + */ + public void mult(float n) { + x *= n; + y *= n; + z *= n; + } + + + /** + * Multiply a vector by a scalar + * @param v a vector + * @param n scalar + * @return a new vector that is v1 * n + */ + static public PVector mult(PVector v, float n) { + return mult(v, n, null); + } + + + /** + * Multiply a vector by a scalar, and write the result into a target PVector. + * @param v a vector + * @param n scalar + * @param target PVector to store the result + * @return the target vector, now set to v1 * n + */ + static public PVector mult(PVector v, float n, PVector target) { + if (target == null) { + target = new PVector(v.x*n, v.y*n, v.z*n); + } else { + target.set(v.x*n, v.y*n, v.z*n); + } + return target; + } + + + /** + * Multiply each element of one vector by the elements of another vector. + * @param v the vector to multiply by + */ + public void mult(PVector v) { + x *= v.x; + y *= v.y; + z *= v.z; + } + + + /** + * Multiply each element of one vector by the individual elements of another + * vector, and return the result as a new PVector. + */ + static public PVector mult(PVector v1, PVector v2) { + return mult(v1, v2, null); + } + + + /** + * Multiply each element of one vector by the individual elements of another + * vector, and write the result into a target vector. + * @param v1 the first vector + * @param v2 the second vector + * @param target PVector to store the result + */ + static public PVector mult(PVector v1, PVector v2, PVector target) { + if (target == null) { + target = new PVector(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z); + } else { + target.set(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z); + } + return target; + } + + + /** + * Divide this vector by a scalar + * @param n the value to divide by + */ + public void div(float n) { + x /= n; + y /= n; + z /= n; + } + + + /** + * Divide a vector by a scalar and return the result in a new vector. + * @param v a vector + * @param n scalar + * @return a new vector that is v1 / n + */ + static public PVector div(PVector v, float n) { + return div(v, n, null); + } + + + static public PVector div(PVector v, float n, PVector target) { + if (target == null) { + target = new PVector(v.x/n, v.y/n, v.z/n); + } else { + target.set(v.x/n, v.y/n, v.z/n); + } + return target; + } + + + /** + * Divide each element of one vector by the elements of another vector. + */ + public void div(PVector v) { + x /= v.x; + y /= v.y; + z /= v.z; + } + + + /** + * Multiply each element of one vector by the individual elements of another + * vector, and return the result as a new PVector. + */ + static public PVector div(PVector v1, PVector v2) { + return div(v1, v2, null); + } + + + /** + * Divide each element of one vector by the individual elements of another + * vector, and write the result into a target vector. + * @param v1 the first vector + * @param v2 the second vector + * @param target PVector to store the result + */ + static public PVector div(PVector v1, PVector v2, PVector target) { + if (target == null) { + target = new PVector(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z); + } else { + target.set(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z); + } + return target; + } + + + /** + * Calculate the Euclidean distance between two points (considering a point as a vector object) + * @param v another vector + * @return the Euclidean distance between + */ + public float dist(PVector v) { + float dx = x - v.x; + float dy = y - v.y; + float dz = z - v.z; + return (float) Math.sqrt(dx*dx + dy*dy + dz*dz); + } + + + /** + * Calculate the Euclidean distance between two points (considering a point as a vector object) + * @param v1 a vector + * @param v2 another vector + * @return the Euclidean distance between v1 and v2 + */ + static public float dist(PVector v1, PVector v2) { + float dx = v1.x - v2.x; + float dy = v1.y - v2.y; + float dz = v1.z - v2.z; + return (float) Math.sqrt(dx*dx + dy*dy + dz*dz); + } + + + /** + * Calculate the dot product with another vector + * @return the dot product + */ + public float dot(PVector v) { + return x*v.x + y*v.y + z*v.z; + } + + + public float dot(float x, float y, float z) { + return this.x*x + this.y*y + this.z*z; + } + + + /** + * Return a vector composed of the cross product between this and another. + */ + public PVector cross(PVector v) { + return cross(v, null); + } + + + /** + * Perform cross product between this and another vector, and store the + * result in 'target'. If target is null, a new vector is created. + */ + public PVector cross(PVector v, PVector target) { + float crossX = y * v.z - v.y * z; + float crossY = z * v.x - v.z * x; + float crossZ = x * v.y - v.x * y; + + if (target == null) { + target = new PVector(crossX, crossY, crossZ); + } else { + target.set(crossX, crossY, crossZ); + } + return target; + } + + + static public PVector cross(PVector v1, PVector v2, PVector target) { + float crossX = v1.y * v2.z - v2.y * v1.z; + float crossY = v1.z * v2.x - v2.z * v1.x; + float crossZ = v1.x * v2.y - v2.x * v1.y; + + if (target == null) { + target = new PVector(crossX, crossY, crossZ); + } else { + target.set(crossX, crossY, crossZ); + } + return target; + } + + + /** + * Normalize the vector to length 1 (make it a unit vector) + */ + public void normalize() { + float m = mag(); + if (m != 0 && m != 1) { + div(m); + } + } + + + /** + * Normalize this vector, storing the result in another vector. + * @param target Set to null to create a new vector + * @return a new vector (if target was null), or target + */ + public PVector normalize(PVector target) { + if (target == null) { + target = new PVector(); + } + float m = mag(); + if (m > 0) { + target.set(x/m, y/m, z/m); + } else { + target.set(x, y, z); + } + return target; + } + + + /** + * Limit the magnitude of this vector + * @param max the maximum length to limit this vector + */ + public void limit(float max) { + if (mag() > max) { + normalize(); + mult(max); + } + } + + + /** + * Calculate the angle of rotation for this vector (only 2D vectors) + * @return the angle of rotation + */ + public float heading2D() { + float angle = (float) Math.atan2(-y, x); + return -1*angle; + } + + + /** + * Calculate the angle between two vectors, using the dot product + * @param v1 a vector + * @param v2 another vector + * @return the angle between the vectors + */ + static public float angleBetween(PVector v1, PVector v2) { + float dot = v1.dot(v2); + float theta = (float) Math.acos(dot / (v1.mag() * v2.mag())); + return theta; + } + + + public String toString() { + return "[ " + x + ", " + y + ", " + z + " ]"; + } + + + /** + * Return a representation of this vector as a float array. This is only for + * temporary use. If used in any other fashion, the contents should be copied + * by using the get() command to copy into your own array. + */ + public float[] array() { + if (array == null) { + array = new float[3]; + } + array[0] = x; + array[1] = y; + array[2] = z; + return array; + } +} + + diff --git a/core/src/processing/xml/CDATAReader.java b/core/src/processing/xml/CDATAReader.java new file mode 100644 index 000000000..11b6849a7 --- /dev/null +++ b/core/src/processing/xml/CDATAReader.java @@ -0,0 +1,193 @@ +/* CDATAReader.java NanoXML/Java + * + * $Revision: 1.3 $ + * $Date: 2002/01/04 21:03:28 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.Reader; +import java.io.IOException; + + +/** + * This reader reads data from another reader until the end of a CDATA section + * (]]>) has been encountered. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.3 $ + */ +class CDATAReader + extends Reader +{ + + /** + * The encapsulated reader. + */ + private StdXMLReader reader; + + + /** + * Saved char. + */ + private char savedChar; + + + /** + * True if the end of the stream has been reached. + */ + private boolean atEndOfData; + + + /** + * Creates the reader. + * + * @param reader the encapsulated reader + */ + CDATAReader(StdXMLReader reader) + { + this.reader = reader; + this.savedChar = 0; + this.atEndOfData = false; + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.reader = null; + super.finalize(); + } + + + /** + * Reads a block of data. + * + * @param buffer where to put the read data + * @param offset first position in buffer to put the data + * @param size maximum number of chars to read + * + * @return the number of chars read, or -1 if at EOF + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + public int read(char[] buffer, + int offset, + int size) + throws IOException + { + int charsRead = 0; + + if (this.atEndOfData) { + return -1; + } + + if ((offset + size) > buffer.length) { + size = buffer.length - offset; + } + + while (charsRead < size) { + char ch = this.savedChar; + + if (ch == 0) { + ch = this.reader.read(); + } else { + this.savedChar = 0; + } + + if (ch == ']') { + char ch2 = this.reader.read(); + + if (ch2 == ']') { + char ch3 = this.reader.read(); + + if (ch3 == '>') { + this.atEndOfData = true; + break; + } + + this.savedChar = ch2; + this.reader.unread(ch3); + } else { + this.reader.unread(ch2); + } + } + buffer[charsRead] = ch; + charsRead++; + } + + if (charsRead == 0) { + charsRead = -1; + } + + return charsRead; + } + + + /** + * Skips remaining data and closes the stream. + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + public void close() + throws IOException + { + while (! this.atEndOfData) { + char ch = this.savedChar; + + if (ch == 0) { + ch = this.reader.read(); + } else { + this.savedChar = 0; + } + + if (ch == ']') { + char ch2 = this.reader.read(); + + if (ch2 == ']') { + char ch3 = this.reader.read(); + + if (ch3 == '>') { + break; + } + + this.savedChar = ch2; + this.reader.unread(ch3); + } else { + this.reader.unread(ch2); + } + } + } + + this.atEndOfData = true; + } + +} diff --git a/core/src/processing/xml/ContentReader.java b/core/src/processing/xml/ContentReader.java new file mode 100644 index 000000000..66430c06b --- /dev/null +++ b/core/src/processing/xml/ContentReader.java @@ -0,0 +1,212 @@ +/* ContentReader.java NanoXML/Java + * + * $Revision: 1.4 $ + * $Date: 2002/01/04 21:03:28 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.Reader; +import java.io.IOException; + + +/** + * This reader reads data from another reader until a new element has + * been encountered. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $ + */ +class ContentReader + extends Reader +{ + + /** + * The encapsulated reader. + */ + private StdXMLReader reader; + + + /** + * Buffer. + */ + private String buffer; + + + /** + * Pointer into the buffer. + */ + private int bufferIndex; + + + /** + * The entity resolver. + */ + private XMLEntityResolver resolver; + + + /** + * Creates the reader. + * + * @param reader the encapsulated reader + * @param resolver the entity resolver + * @param buffer data that has already been read from reader + */ + ContentReader(StdXMLReader reader, + XMLEntityResolver resolver, + String buffer) + { + this.reader = reader; + this.resolver = resolver; + this.buffer = buffer; + this.bufferIndex = 0; + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.reader = null; + this.resolver = null; + this.buffer = null; + super.finalize(); + } + + + /** + * Reads a block of data. + * + * @param outputBuffer where to put the read data + * @param offset first position in buffer to put the data + * @param size maximum number of chars to read + * + * @return the number of chars read, or -1 if at EOF + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + public int read(char[] outputBuffer, + int offset, + int size) + throws IOException + { + try { + int charsRead = 0; + int bufferLength = this.buffer.length(); + + if ((offset + size) > outputBuffer.length) { + size = outputBuffer.length - offset; + } + + while (charsRead < size) { + String str = ""; + char ch; + + if (this.bufferIndex >= bufferLength) { + str = XMLUtil.read(this.reader, '&'); + ch = str.charAt(0); + } else { + ch = this.buffer.charAt(this.bufferIndex); + this.bufferIndex++; + outputBuffer[charsRead] = ch; + charsRead++; + continue; // don't interprete chars in the buffer + } + + if (ch == '<') { + this.reader.unread(ch); + break; + } + + if ((ch == '&') && (str.length() > 1)) { + if (str.charAt(1) == '#') { + ch = XMLUtil.processCharLiteral(str); + } else { + XMLUtil.processEntity(str, this.reader, this.resolver); + continue; + } + } + + outputBuffer[charsRead] = ch; + charsRead++; + } + + if (charsRead == 0) { + charsRead = -1; + } + + return charsRead; + } catch (XMLParseException e) { + throw new IOException(e.getMessage()); + } + } + + + /** + * Skips remaining data and closes the stream. + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + public void close() + throws IOException + { + try { + int bufferLength = this.buffer.length(); + + for (;;) { + String str = ""; + char ch; + + if (this.bufferIndex >= bufferLength) { + str = XMLUtil.read(this.reader, '&'); + ch = str.charAt(0); + } else { + ch = this.buffer.charAt(this.bufferIndex); + this.bufferIndex++; + continue; // don't interprete chars in the buffer + } + + if (ch == '<') { + this.reader.unread(ch); + break; + } + + if ((ch == '&') && (str.length() > 1)) { + if (str.charAt(1) != '#') { + XMLUtil.processEntity(str, this.reader, this.resolver); + } + } + } + } catch (XMLParseException e) { + throw new IOException(e.getMessage()); + } + } + +} diff --git a/core/src/processing/xml/PIReader.java b/core/src/processing/xml/PIReader.java new file mode 100644 index 000000000..d6a2bf298 --- /dev/null +++ b/core/src/processing/xml/PIReader.java @@ -0,0 +1,157 @@ +/* PIReader.java NanoXML/Java + * + * $Revision: 1.3 $ + * $Date: 2002/01/04 21:03:28 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.Reader; +import java.io.IOException; + + +/** + * This reader reads data from another reader until the end of a processing + * instruction (?>) has been encountered. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.3 $ + */ +class PIReader + extends Reader +{ + + /** + * The encapsulated reader. + */ + private StdXMLReader reader; + + + /** + * True if the end of the stream has been reached. + */ + private boolean atEndOfData; + + + /** + * Creates the reader. + * + * @param reader the encapsulated reader + */ + PIReader(StdXMLReader reader) + { + this.reader = reader; + this.atEndOfData = false; + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.reader = null; + super.finalize(); + } + + + /** + * Reads a block of data. + * + * @param buffer where to put the read data + * @param offset first position in buffer to put the data + * @param size maximum number of chars to read + * + * @return the number of chars read, or -1 if at EOF + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + public int read(char[] buffer, + int offset, + int size) + throws IOException + { + if (this.atEndOfData) { + return -1; + } + + int charsRead = 0; + + if ((offset + size) > buffer.length) { + size = buffer.length - offset; + } + + while (charsRead < size) { + char ch = this.reader.read(); + + if (ch == '?') { + char ch2 = this.reader.read(); + + if (ch2 == '>') { + this.atEndOfData = true; + break; + } + + this.reader.unread(ch2); + } + + buffer[charsRead] = ch; + charsRead++; + } + + if (charsRead == 0) { + charsRead = -1; + } + + return charsRead; + } + + + /** + * Skips remaining data and closes the stream. + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + public void close() + throws IOException + { + while (! this.atEndOfData) { + char ch = this.reader.read(); + + if (ch == '?') { + char ch2 = this.reader.read(); + + if (ch2 == '>') { + this.atEndOfData = true; + } + } + } + } + +} diff --git a/core/src/processing/xml/StdXMLBuilder.java b/core/src/processing/xml/StdXMLBuilder.java new file mode 100644 index 000000000..54a223546 --- /dev/null +++ b/core/src/processing/xml/StdXMLBuilder.java @@ -0,0 +1,356 @@ +/* StdXMLBuilder.java NanoXML/Java + * + * $Revision: 1.3 $ + * $Date: 2002/01/04 21:03:28 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.IOException; +import java.io.Reader; +import java.util.Stack; + + +/** + * StdXMLBuilder is a concrete implementation of IXMLBuilder which creates a + * tree of IXMLElement from an XML data source. + * + * @see processing.xml.XMLElement + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.3 $ + */ +public class StdXMLBuilder +{ + + /** + * This stack contains the current element and its parents. + */ + private Stack stack; + + + /** + * The root element of the parsed XML tree. + */ + private XMLElement root; + + private XMLElement parent; + + /** + * Prototype element for creating the tree. + */ + //private XMLElement prototype; + + + /** + * Creates the builder. + */ + public StdXMLBuilder() + { + this.stack = null; + this.root = null; + //this(new XMLElement()); + } + + + public StdXMLBuilder(XMLElement parent) + { + this.parent = parent; + } + + + /** + * Creates the builder. + * + * @param prototype the prototype to use when building the tree. + */ +// public StdXMLBuilder(XMLElement prototype) +// { +// this.stack = null; +// this.root = null; +// this.prototype = prototype; +// } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + //this.prototype = null; + this.root = null; + this.stack.clear(); + this.stack = null; + super.finalize(); + } + + + /** + * This method is called before the parser starts processing its input. + * + * @param systemID the system ID of the XML data source. + * @param lineNr the line on which the parsing starts. + */ + public void startBuilding(String systemID, + int lineNr) + { + this.stack = new Stack(); + this.root = null; + } + + + /** + * This method is called when a processing instruction is encountered. + * PIs with target "xml" are handled by the parser. + * + * @param target the PI target. + * @param reader to read the data from the PI. + */ + public void newProcessingInstruction(String target, + Reader reader) + { + // nothing to do + } + + + /** + * This method is called when a new XML element is encountered. + * + * @see #endElement + * + * @param name the name of the element. + * @param nsPrefix the prefix used to identify the namespace. If no + * namespace has been specified, this parameter is null. + * @param nsURI the URI associated with the namespace. If no + * namespace has been specified, or no URI is + * associated with nsPrefix, this parameter is null. + * @param systemID the system ID of the XML data source. + * @param lineNr the line in the source where the element starts. + */ + public void startElement(String name, + String nsPrefix, + String nsURI, + String systemID, + int lineNr) + { + String fullName = name; + + if (nsPrefix != null) { + fullName = nsPrefix + ':' + name; + } + + //XMLElement elt = this.prototype.createElement(fullName, nsURI, + // systemID, lineNr); + +// XMLElement elt = new XMLElement(fullName, nsURI, systemID, lineNr); +// +// if (this.stack.empty()) { +// this.root = elt; +// } else { +// XMLElement top = (XMLElement) this.stack.peek(); +// top.addChild(elt); +// } +// stack.push(elt); + + if (this.stack.empty()) { + //System.out.println("setting root"); + parent.set(fullName, nsURI, systemID, lineNr); + stack.push(parent); + root = parent; + } else { + XMLElement top = (XMLElement) this.stack.peek(); + //System.out.println("stack has " + top.getName()); + XMLElement elt = new XMLElement(fullName, nsURI, systemID, lineNr); + top.addChild(elt); + stack.push(elt); + } + } + + + /** + * This method is called when the attributes of an XML element have been + * processed. + * + * @see #startElement + * @see #addAttribute + * + * @param name the name of the element. + * @param nsPrefix the prefix used to identify the namespace. If no + * namespace has been specified, this parameter is null. + * @param nsURI the URI associated with the namespace. If no + * namespace has been specified, or no URI is + * associated with nsPrefix, this parameter is null. + */ + public void elementAttributesProcessed(String name, + String nsPrefix, + String nsURI) + { + // nothing to do + } + + + /** + * This method is called when the end of an XML elemnt is encountered. + * + * @see #startElement + * + * @param name the name of the element. + * @param nsPrefix the prefix used to identify the namespace. If no + * namespace has been specified, this parameter is null. + * @param nsURI the URI associated with the namespace. If no + * namespace has been specified, or no URI is + * associated with nsPrefix, this parameter is null. + */ + public void endElement(String name, + String nsPrefix, + String nsURI) + { + XMLElement elt = (XMLElement) this.stack.pop(); + + if (elt.getChildCount() == 1) { + XMLElement child = elt.getChildAtIndex(0); + + if (child.getLocalName() == null) { + elt.setContent(child.getContent()); + elt.removeChildAtIndex(0); + } + } + } + + + /** + * This method is called when a new attribute of an XML element is + * encountered. + * + * @param key the key (name) of the attribute. + * @param nsPrefix the prefix used to identify the namespace. If no + * namespace has been specified, this parameter is null. + * @param nsURI the URI associated with the namespace. If no + * namespace has been specified, or no URI is + * associated with nsPrefix, this parameter is null. + * @param value the value of the attribute. + * @param type the type of the attribute. If no type is known, + * "CDATA" is returned. + * + * @throws java.lang.Exception + * If an exception occurred while processing the event. + */ + public void addAttribute(String key, + String nsPrefix, + String nsURI, + String value, + String type) + throws Exception + { + String fullName = key; + + if (nsPrefix != null) { + fullName = nsPrefix + ':' + key; + } + + XMLElement top = (XMLElement) this.stack.peek(); + + if (top.hasAttribute(fullName)) { + throw new XMLParseException(top.getSystemID(), + top.getLineNr(), + "Duplicate attribute: " + key); + } + + if (nsPrefix != null) { + top.setAttribute(fullName, nsURI, value); + } else { + top.setAttribute(fullName, value); + } + } + + + /** + * This method is called when a PCDATA element is encountered. A Java + * reader is supplied from which you can read the data. The reader will + * only read the data of the element. You don't need to check for + * boundaries. If you don't read the full element, the rest of the data + * is skipped. You also don't have to care about entities; they are + * resolved by the parser. + * + * @param reader the Java reader from which you can retrieve the data. + * @param systemID the system ID of the XML data source. + * @param lineNr the line in the source where the element starts. + */ + public void addPCData(Reader reader, + String systemID, + int lineNr) + { + int bufSize = 2048; + int sizeRead = 0; + StringBuffer str = new StringBuffer(bufSize); + char[] buf = new char[bufSize]; + + for (;;) { + if (sizeRead >= bufSize) { + bufSize *= 2; + str.ensureCapacity(bufSize); + } + + int size; + + try { + size = reader.read(buf); + } catch (IOException e) { + break; + } + + if (size < 0) { + break; + } + + str.append(buf, 0, size); + sizeRead += size; + } + + //XMLElement elt = this.prototype.createElement(null, systemID, lineNr); + XMLElement elt = new XMLElement(null, null, systemID, lineNr); + elt.setContent(str.toString()); + + if (! this.stack.empty()) { + XMLElement top = (XMLElement) this.stack.peek(); + top.addChild(elt); + } + } + + + /** + * Returns the result of the building process. This method is called just + * before the parse method of StdXMLParser returns. + * + * @return the result of the building process. + */ + public Object getResult() + { + return this.root; + } + +} diff --git a/core/src/processing/xml/StdXMLParser.java b/core/src/processing/xml/StdXMLParser.java new file mode 100644 index 000000000..da60bbb5d --- /dev/null +++ b/core/src/processing/xml/StdXMLParser.java @@ -0,0 +1,684 @@ +/* StdXMLParser.java NanoXML/Java + * + * $Revision: 1.5 $ + * $Date: 2002/03/24 11:37:00 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.Reader; +import java.util.Enumeration; +import java.util.Properties; +import java.util.Vector; + + +/** + * StdXMLParser is the core parser of NanoXML. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.5 $ + */ +public class StdXMLParser { + + /** + * The builder which creates the logical structure of the XML data. + */ + private StdXMLBuilder builder; + + + /** + * The reader from which the parser retrieves its data. + */ + private StdXMLReader reader; + + + /** + * The entity resolver. + */ + private XMLEntityResolver entityResolver; + + + /** + * The validator that will process entity references and validate the XML + * data. + */ + private XMLValidator validator; + + + /** + * Creates a new parser. + */ + public StdXMLParser() + { + this.builder = null; + this.validator = null; + this.reader = null; + this.entityResolver = new XMLEntityResolver(); + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.builder = null; + this.reader = null; + this.entityResolver = null; + this.validator = null; + super.finalize(); + } + + + /** + * Sets the builder which creates the logical structure of the XML data. + * + * @param builder the non-null builder + */ + public void setBuilder(StdXMLBuilder builder) + { + this.builder = builder; + } + + + /** + * Returns the builder which creates the logical structure of the XML data. + * + * @return the builder + */ + public StdXMLBuilder getBuilder() + { + return this.builder; + } + + + /** + * Sets the validator that validates the XML data. + * + * @param validator the non-null validator + */ + public void setValidator(XMLValidator validator) + { + this.validator = validator; + } + + + /** + * Returns the validator that validates the XML data. + * + * @return the validator + */ + public XMLValidator getValidator() + { + return this.validator; + } + + + /** + * Sets the entity resolver. + * + * @param resolver the non-null resolver + */ + public void setResolver(XMLEntityResolver resolver) + { + this.entityResolver = resolver; + } + + + /** + * Returns the entity resolver. + * + * @return the non-null resolver + */ + public XMLEntityResolver getResolver() + { + return this.entityResolver; + } + + + /** + * Sets the reader from which the parser retrieves its data. + * + * @param reader the reader + */ + public void setReader(StdXMLReader reader) + { + this.reader = reader; + } + + + /** + * Returns the reader from which the parser retrieves its data. + * + * @return the reader + */ + public StdXMLReader getReader() + { + return this.reader; + } + + + /** + * Parses the data and lets the builder create the logical data structure. + * + * @return the logical structure built by the builder + * + * @throws net.n3.nanoxml.XMLException + * if an error occurred reading or parsing the data + */ + public Object parse() + throws XMLException + { + try { + this.builder.startBuilding(this.reader.getSystemID(), + this.reader.getLineNr()); + this.scanData(); + return this.builder.getResult(); + } catch (XMLException e) { + throw e; + } catch (Exception e) { + throw new XMLException(e); + } + } + + + /** + * Scans the XML data for elements. + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void scanData() throws Exception { + while ((! this.reader.atEOF()) && (this.builder.getResult() == null)) { + String str = XMLUtil.read(this.reader, '&'); + char ch = str.charAt(0); + if (ch == '&') { + XMLUtil.processEntity(str, this.reader, this.entityResolver); + continue; + } + + switch (ch) { + case '<': + this.scanSomeTag(false, // don't allow CDATA + null, // no default namespace + new Properties()); + break; + + case ' ': + case '\t': + case '\r': + case '\n': + // skip whitespace + break; + + default: + XMLUtil.errorInvalidInput(reader.getSystemID(), + reader.getLineNr(), + "`" + ch + "' (0x" + + Integer.toHexString((int) ch) + + ')'); + } + } + } + + + /** + * Scans an XML tag. + * + * @param allowCDATA true if CDATA sections are allowed at this point + * @param defaultNamespace the default namespace URI (or null) + * @param namespaces list of defined namespaces + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void scanSomeTag(boolean allowCDATA, + String defaultNamespace, + Properties namespaces) + throws Exception + { + String str = XMLUtil.read(this.reader, '&'); + char ch = str.charAt(0); + + if (ch == '&') { + XMLUtil.errorUnexpectedEntity(reader.getSystemID(), + reader.getLineNr(), + str); + } + + switch (ch) { + case '?': + this.processPI(); + break; + + case '!': + this.processSpecialTag(allowCDATA); + break; + + default: + this.reader.unread(ch); + this.processElement(defaultNamespace, namespaces); + } + } + + + /** + * Processes a "processing instruction". + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void processPI() + throws Exception + { + XMLUtil.skipWhitespace(this.reader, null); + String target = XMLUtil.scanIdentifier(this.reader); + XMLUtil.skipWhitespace(this.reader, null); + Reader r = new PIReader(this.reader); + + if (!target.equalsIgnoreCase("xml")) { + this.builder.newProcessingInstruction(target, r); + } + + r.close(); + } + + + /** + * Processes a tag that starts with a bang (<!...>). + * + * @param allowCDATA true if CDATA sections are allowed at this point + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void processSpecialTag(boolean allowCDATA) + throws Exception + { + String str = XMLUtil.read(this.reader, '&'); + char ch = str.charAt(0); + + if (ch == '&') { + XMLUtil.errorUnexpectedEntity(reader.getSystemID(), + reader.getLineNr(), + str); + } + + switch (ch) { + case '[': + if (allowCDATA) { + this.processCDATA(); + } else { + XMLUtil.errorUnexpectedCDATA(reader.getSystemID(), + reader.getLineNr()); + } + + return; + + case 'D': + this.processDocType(); + return; + + case '-': + XMLUtil.skipComment(this.reader); + return; + } + } + + + /** + * Processes a CDATA section. + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void processCDATA() throws Exception { + if (! XMLUtil.checkLiteral(this.reader, "CDATA[")) { + XMLUtil.errorExpectedInput(reader.getSystemID(), + reader.getLineNr(), + "') { + XMLUtil.errorExpectedInput(reader.getSystemID(), + reader.getLineNr(), + "`>'"); + } + + // TODO DTD checking is currently disabled, because it breaks + // applications that don't have access to a net connection + // (since it insists on going and checking out the DTD). + if (false) { + if (systemID != null) { + Reader r = this.reader.openStream(publicID.toString(), systemID); + this.reader.startNewStream(r); + this.reader.setSystemID(systemID); + this.reader.setPublicID(publicID.toString()); + this.validator.parseDTD(publicID.toString(), + this.reader, + this.entityResolver, + true); + } + } + } + + + /** + * Processes a regular element. + * + * @param defaultNamespace the default namespace URI (or null) + * @param namespaces list of defined namespaces + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void processElement(String defaultNamespace, + Properties namespaces) + throws Exception + { + String fullName = XMLUtil.scanIdentifier(this.reader); + String name = fullName; + XMLUtil.skipWhitespace(this.reader, null); + String prefix = null; + int colonIndex = name.indexOf(':'); + + if (colonIndex > 0) { + prefix = name.substring(0, colonIndex); + name = name.substring(colonIndex + 1); + } + + Vector attrNames = new Vector(); + Vector attrValues = new Vector(); + Vector attrTypes = new Vector(); + + this.validator.elementStarted(fullName, + this.reader.getSystemID(), + this.reader.getLineNr()); + char ch; + + for (;;) { + ch = this.reader.read(); + + if ((ch == '/') || (ch == '>')) { + break; + } + + this.reader.unread(ch); + this.processAttribute(attrNames, attrValues, attrTypes); + XMLUtil.skipWhitespace(this.reader, null); + } + + Properties extraAttributes = new Properties(); + this.validator.elementAttributesProcessed(fullName, + extraAttributes, + this.reader.getSystemID(), + this.reader.getLineNr()); + Enumeration en = extraAttributes.keys(); + + while (en.hasMoreElements()) { + String key = (String) en.nextElement(); + String value = extraAttributes.getProperty(key); + attrNames.addElement(key); + attrValues.addElement(value); + attrTypes.addElement("CDATA"); + } + + for (int i = 0; i < attrNames.size(); i++) { + String key = (String) attrNames.elementAt(i); + String value = (String) attrValues.elementAt(i); + //String type = (String) attrTypes.elementAt(i); + + if (key.equals("xmlns")) { + defaultNamespace = value; + } else if (key.startsWith("xmlns:")) { + namespaces.put(key.substring(6), value); + } + } + + if (prefix == null) { + this.builder.startElement(name, prefix, defaultNamespace, + this.reader.getSystemID(), + this.reader.getLineNr()); + } else { + this.builder.startElement(name, prefix, + namespaces.getProperty(prefix), + this.reader.getSystemID(), + this.reader.getLineNr()); + } + + for (int i = 0; i < attrNames.size(); i++) { + String key = (String) attrNames.elementAt(i); + + if (key.startsWith("xmlns")) { + continue; + } + + String value = (String) attrValues.elementAt(i); + String type = (String) attrTypes.elementAt(i); + colonIndex = key.indexOf(':'); + + if (colonIndex > 0) { + String attPrefix = key.substring(0, colonIndex); + key = key.substring(colonIndex + 1); + this.builder.addAttribute(key, attPrefix, + namespaces.getProperty(attPrefix), + value, type); + } else { + this.builder.addAttribute(key, null, null, value, type); + } + } + + if (prefix == null) { + this.builder.elementAttributesProcessed(name, prefix, + defaultNamespace); + } else { + this.builder.elementAttributesProcessed(name, prefix, + namespaces + .getProperty(prefix)); + } + + if (ch == '/') { + if (this.reader.read() != '>') { + XMLUtil.errorExpectedInput(reader.getSystemID(), + reader.getLineNr(), + "`>'"); + } + + this.validator.elementEnded(name, + this.reader.getSystemID(), + this.reader.getLineNr()); + + if (prefix == null) { + this.builder.endElement(name, prefix, defaultNamespace); + } else { + this.builder.endElement(name, prefix, + namespaces.getProperty(prefix)); + } + + return; + } + + StringBuffer buffer = new StringBuffer(16); + + for (;;) { + buffer.setLength(0); + String str; + + for (;;) { + XMLUtil.skipWhitespace(this.reader, buffer); + str = XMLUtil.read(this.reader, '&'); + + if ((str.charAt(0) == '&') && (str.charAt(1) != '#')) { + XMLUtil.processEntity(str, this.reader, + this.entityResolver); + } else { + break; + } + } + + if (str.charAt(0) == '<') { + str = XMLUtil.read(this.reader, '\0'); + + if (str.charAt(0) == '/') { + XMLUtil.skipWhitespace(this.reader, null); + str = XMLUtil.scanIdentifier(this.reader); + + if (! str.equals(fullName)) { + XMLUtil.errorWrongClosingTag(reader.getSystemID(), + reader.getLineNr(), + name, str); + } + + XMLUtil.skipWhitespace(this.reader, null); + + if (this.reader.read() != '>') { + XMLUtil.errorClosingTagNotEmpty(reader.getSystemID(), + reader.getLineNr()); + } + + this.validator.elementEnded(fullName, + this.reader.getSystemID(), + this.reader.getLineNr()); + if (prefix == null) { + this.builder.endElement(name, prefix, defaultNamespace); + } else { + this.builder.endElement(name, prefix, + namespaces.getProperty(prefix)); + } + break; + } else { // <[^/] + this.reader.unread(str.charAt(0)); + this.scanSomeTag(true, //CDATA allowed + defaultNamespace, + (Properties) namespaces.clone()); + } + } else { // [^<] + if (str.charAt(0) == '&') { + ch = XMLUtil.processCharLiteral(str); + buffer.append(ch); + } else { + reader.unread(str.charAt(0)); + } + this.validator.PCDataAdded(this.reader.getSystemID(), + this.reader.getLineNr()); + Reader r = new ContentReader(this.reader, + this.entityResolver, + buffer.toString()); + this.builder.addPCData(r, this.reader.getSystemID(), + this.reader.getLineNr()); + r.close(); + } + } + } + + + /** + * Processes an attribute of an element. + * + * @param attrNames contains the names of the attributes. + * @param attrValues contains the values of the attributes. + * @param attrTypes contains the types of the attributes. + * + * @throws java.lang.Exception + * if something went wrong + */ + protected void processAttribute(Vector attrNames, + Vector attrValues, + Vector attrTypes) + throws Exception + { + String key = XMLUtil.scanIdentifier(this.reader); + XMLUtil.skipWhitespace(this.reader, null); + + if (! XMLUtil.read(this.reader, '&').equals("=")) { + XMLUtil.errorExpectedInput(reader.getSystemID(), + reader.getLineNr(), + "`='"); + } + + XMLUtil.skipWhitespace(this.reader, null); + String value = XMLUtil.scanString(this.reader, '&', + this.entityResolver); + attrNames.addElement(key); + attrValues.addElement(value); + attrTypes.addElement("CDATA"); + this.validator.attributeAdded(key, value, + this.reader.getSystemID(), + this.reader.getLineNr()); + } + +} diff --git a/core/src/processing/xml/StdXMLReader.java b/core/src/processing/xml/StdXMLReader.java new file mode 100644 index 000000000..e2d97a580 --- /dev/null +++ b/core/src/processing/xml/StdXMLReader.java @@ -0,0 +1,626 @@ +/* StdXMLReader.java NanoXML/Java + * + * $Revision: 1.4 $ + * $Date: 2002/01/04 21:03:28 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +//import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.LineNumberReader; +import java.io.PushbackReader; +import java.io.PushbackInputStream; +import java.io.Reader; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Stack; + + +/** + * StdXMLReader reads the data to be parsed. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $ + */ +public class StdXMLReader +{ + + /** + * A stacked reader. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $ + */ + private class StackedReader + { + + PushbackReader pbReader; + + LineNumberReader lineReader; + + URL systemId; + + String publicId; + + } + + + /** + * The stack of readers. + */ + private Stack readers; + + + /** + * The current push-back reader. + */ + private StackedReader currentReader; + + + /** + * Creates a new reader using a string as input. + * + * @param str the string containing the XML data + */ + public static StdXMLReader stringReader(String str) + { + return new StdXMLReader(new StringReader(str)); + } + + + /** + * Creates a new reader using a file as input. + * + * @param filename the name of the file containing the XML data + * + * @throws java.io.FileNotFoundException + * if the file could not be found + * @throws java.io.IOException + * if an I/O error occurred + */ + public static StdXMLReader fileReader(String filename) + throws FileNotFoundException, + IOException + { + StdXMLReader r = new StdXMLReader(new FileInputStream(filename)); + r.setSystemID(filename); + + for (int i = 0; i < r.readers.size(); i++) { + StackedReader sr = (StackedReader) r.readers.elementAt(i); + sr.systemId = r.currentReader.systemId; + } + + return r; + } + + + /** + * Initializes the reader from a system and public ID. + * + * @param publicID the public ID which may be null. + * @param systemID the non-null system ID. + * + * @throws MalformedURLException + * if the system ID does not contain a valid URL + * @throws FileNotFoundException + * if the system ID refers to a local file which does not exist + * @throws IOException + * if an error occurred opening the stream + */ + public StdXMLReader(String publicID, + String systemID) + throws MalformedURLException, + FileNotFoundException, + IOException + { + URL systemIDasURL = null; + + try { + systemIDasURL = new URL(systemID); + } catch (MalformedURLException e) { + systemID = "file:" + systemID; + + try { + systemIDasURL = new URL(systemID); + } catch (MalformedURLException e2) { + throw e; + } + } + + this.currentReader = new StackedReader(); + this.readers = new Stack(); + Reader reader = this.openStream(publicID, systemIDasURL.toString()); + this.currentReader.lineReader = new LineNumberReader(reader); + this.currentReader.pbReader + = new PushbackReader(this.currentReader.lineReader, 2); + } + + + /** + * Initializes the XML reader. + * + * @param reader the input for the XML data. + */ + public StdXMLReader(Reader reader) + { + this.currentReader = new StackedReader(); + this.readers = new Stack(); + this.currentReader.lineReader = new LineNumberReader(reader); + this.currentReader.pbReader + = new PushbackReader(this.currentReader.lineReader, 2); + this.currentReader.publicId = ""; + + try { + this.currentReader.systemId = new URL("file:."); + } catch (MalformedURLException e) { + // never happens + } + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.currentReader.lineReader = null; + this.currentReader.pbReader = null; + this.currentReader.systemId = null; + this.currentReader.publicId = null; + this.currentReader = null; + this.readers.clear(); + super.finalize(); + } + + + /** + * Scans the encoding from an <?xml...?> tag. + * + * @param str the first tag in the XML data. + * + * @return the encoding, or null if no encoding has been specified. + */ + protected String getEncoding(String str) + { + if (! str.startsWith("= 'a') + && (str.charAt(index) <= 'z')) { + key.append(str.charAt(index)); + index++; + } + + while ((index < str.length()) && (str.charAt(index) <= ' ')) { + index++; + } + + if ((index >= str.length()) || (str.charAt(index) != '=')) { + break; + } + + while ((index < str.length()) && (str.charAt(index) != '\'') + && (str.charAt(index) != '"')) { + index++; + } + + if (index >= str.length()) { + break; + } + + char delimiter = str.charAt(index); + index++; + int index2 = str.indexOf(delimiter, index); + + if (index2 < 0) { + break; + } + + if (key.toString().equals("encoding")) { + return str.substring(index, index2); + } + + index = index2 + 1; + } + + return null; + } + + + /** + * Converts a stream to a reader while detecting the encoding. + * + * @param stream the input for the XML data. + * @param charsRead buffer where to put characters that have been read + * + * @throws java.io.IOException + * if an I/O error occurred + */ + protected Reader stream2reader(InputStream stream, + StringBuffer charsRead) + throws IOException + { + PushbackInputStream pbstream = new PushbackInputStream(stream); + int b = pbstream.read(); + + switch (b) { + case 0x00: + case 0xFE: + case 0xFF: + pbstream.unread(b); + return new InputStreamReader(pbstream, "UTF-16"); + + case 0xEF: + for (int i = 0; i < 2; i++) { + pbstream.read(); + } + + return new InputStreamReader(pbstream, "UTF-8"); + + case 0x3C: + b = pbstream.read(); + charsRead.append('<'); + + while ((b > 0) && (b != 0x3E)) { + charsRead.append((char) b); + b = pbstream.read(); + } + + if (b > 0) { + charsRead.append((char) b); + } + + String encoding = this.getEncoding(charsRead.toString()); + + if (encoding == null) { + return new InputStreamReader(pbstream, "UTF-8"); + } + + charsRead.setLength(0); + + try { + return new InputStreamReader(pbstream, encoding); + } catch (UnsupportedEncodingException e) { + return new InputStreamReader(pbstream, "UTF-8"); + } + + default: + charsRead.append((char) b); + return new InputStreamReader(pbstream, "UTF-8"); + } + } + + + /** + * Initializes the XML reader. + * + * @param stream the input for the XML data. + * + * @throws java.io.IOException + * if an I/O error occurred + */ + public StdXMLReader(InputStream stream) + throws IOException + { + // unused? + //PushbackInputStream pbstream = new PushbackInputStream(stream); + StringBuffer charsRead = new StringBuffer(); + Reader reader = this.stream2reader(stream, charsRead); + this.currentReader = new StackedReader(); + this.readers = new Stack(); + this.currentReader.lineReader = new LineNumberReader(reader); + this.currentReader.pbReader + = new PushbackReader(this.currentReader.lineReader, 2); + this.currentReader.publicId = ""; + + try { + this.currentReader.systemId = new URL("file:."); + } catch (MalformedURLException e) { + // never happens + } + + this.startNewStream(new StringReader(charsRead.toString())); + } + + + /** + * Reads a character. + * + * @return the character + * + * @throws java.io.IOException + * if no character could be read + */ + public char read() + throws IOException + { + int ch = this.currentReader.pbReader.read(); + + while (ch < 0) { + if (this.readers.empty()) { + throw new IOException("Unexpected EOF"); + } + + this.currentReader.pbReader.close(); + this.currentReader = (StackedReader) this.readers.pop(); + ch = this.currentReader.pbReader.read(); + } + + return (char) ch; + } + + + /** + * Returns true if the current stream has no more characters left to be + * read. + * + * @throws java.io.IOException + * if an I/O error occurred + */ + public boolean atEOFOfCurrentStream() + throws IOException + { + int ch = this.currentReader.pbReader.read(); + + if (ch < 0) { + return true; + } else { + this.currentReader.pbReader.unread(ch); + return false; + } + } + + + /** + * Returns true if there are no more characters left to be read. + * + * @throws java.io.IOException + * if an I/O error occurred + */ + public boolean atEOF() + throws IOException + { + int ch = this.currentReader.pbReader.read(); + + while (ch < 0) { + if (this.readers.empty()) { + return true; + } + + this.currentReader.pbReader.close(); + this.currentReader = (StackedReader) this.readers.pop(); + ch = this.currentReader.pbReader.read(); + } + + this.currentReader.pbReader.unread(ch); + return false; + } + + + /** + * Pushes the last character read back to the stream. + * + * @param ch the character to push back. + * + * @throws java.io.IOException + * if an I/O error occurred + */ + public void unread(char ch) + throws IOException + { + this.currentReader.pbReader.unread(ch); + } + + + /** + * Opens a stream from a public and system ID. + * + * @param publicID the public ID, which may be null + * @param systemID the system ID, which is never null + * + * @throws java.net.MalformedURLException + * if the system ID does not contain a valid URL + * @throws java.io.FileNotFoundException + * if the system ID refers to a local file which does not exist + * @throws java.io.IOException + * if an error occurred opening the stream + */ + public Reader openStream(String publicID, + String systemID) + throws MalformedURLException, + FileNotFoundException, + IOException + { + URL url = new URL(this.currentReader.systemId, systemID); + + if (url.getRef() != null) { + String ref = url.getRef(); + + if (url.getFile().length() > 0) { + url = new URL(url.getProtocol(), url.getHost(), url.getPort(), + url.getFile()); + url = new URL("jar:" + url + '!' + ref); + } else { + url = StdXMLReader.class.getResource(ref); + } + } + + this.currentReader.publicId = publicID; + this.currentReader.systemId = url; + StringBuffer charsRead = new StringBuffer(); + Reader reader = this.stream2reader(url.openStream(), charsRead); + + if (charsRead.length() == 0) { + return reader; + } + + String charsReadStr = charsRead.toString(); + PushbackReader pbreader = new PushbackReader(reader, + charsReadStr.length()); + + for (int i = charsReadStr.length() - 1; i >= 0; i--) { + pbreader.unread(charsReadStr.charAt(i)); + } + + return pbreader; + } + + + /** + * Starts a new stream from a Java reader. The new stream is used + * temporary to read data from. If that stream is exhausted, control + * returns to the parent stream. + * + * @param reader the non-null reader to read the new data from + */ + public void startNewStream(Reader reader) + { + this.startNewStream(reader, false); + } + + + /** + * Starts a new stream from a Java reader. The new stream is used + * temporary to read data from. If that stream is exhausted, control + * returns to the parent stream. + * + * @param reader the non-null reader to read the new data from + * @param isInternalEntity true if the reader is produced by resolving + * an internal entity + */ + public void startNewStream(Reader reader, + boolean isInternalEntity) + { + StackedReader oldReader = this.currentReader; + this.readers.push(this.currentReader); + this.currentReader = new StackedReader(); + + if (isInternalEntity) { + this.currentReader.lineReader = null; + this.currentReader.pbReader = new PushbackReader(reader, 2); + } else { + this.currentReader.lineReader = new LineNumberReader(reader); + this.currentReader.pbReader + = new PushbackReader(this.currentReader.lineReader, 2); + } + + this.currentReader.systemId = oldReader.systemId; + this.currentReader.publicId = oldReader.publicId; + } + + + /** + * Returns the current "level" of the stream on the stack of streams. + */ + public int getStreamLevel() + { + return this.readers.size(); + } + + + /** + * Returns the line number of the data in the current stream. + */ + public int getLineNr() + { + if (this.currentReader.lineReader == null) { + StackedReader sr = (StackedReader) this.readers.peek(); + + if (sr.lineReader == null) { + return 0; + } else { + return sr.lineReader.getLineNumber() + 1; + } + } + + return this.currentReader.lineReader.getLineNumber() + 1; + } + + + /** + * Sets the system ID of the current stream. + * + * @param systemID the system ID + * + * @throws java.net.MalformedURLException + * if the system ID does not contain a valid URL + */ + public void setSystemID(String systemID) + throws MalformedURLException + { + this.currentReader.systemId = new URL(this.currentReader.systemId, + systemID); + } + + + /** + * Sets the public ID of the current stream. + * + * @param publicID the public ID + */ + public void setPublicID(String publicID) + { + this.currentReader.publicId = publicID; + } + + + /** + * Returns the current system ID. + */ + public String getSystemID() + { + return this.currentReader.systemId.toString(); + } + + + /** + * Returns the current public ID. + */ + public String getPublicID() + { + return this.currentReader.publicId; + } + +} diff --git a/core/src/processing/xml/XMLAttribute.java b/core/src/processing/xml/XMLAttribute.java new file mode 100644 index 000000000..759dd47fc --- /dev/null +++ b/core/src/processing/xml/XMLAttribute.java @@ -0,0 +1,153 @@ +/* XMLAttribute.java NanoXML/Java + * + * $Revision: 1.4 $ + * $Date: 2002/01/04 21:03:29 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +/** + * An attribute in an XML element. This is an internal class. + * + * @see net.n3.nanoxml.XMLElement + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $ + */ +class XMLAttribute +{ + + /** + * The full name of the attribute. + */ + private String fullName; + + + /** + * The short name of the attribute. + */ + private String name; + + + /** + * The namespace URI of the attribute. + */ + private String namespace; + + + /** + * The value of the attribute. + */ + private String value; + + + /** + * The type of the attribute. + */ + private String type; + + + /** + * Creates a new attribute. + * + * @param fullName the non-null full name + * @param name the non-null short name + * @param namespace the namespace URI, which may be null + * @param value the value of the attribute + * @param type the type of the attribute + */ + XMLAttribute(String fullName, + String name, + String namespace, + String value, + String type) + { + this.fullName = fullName; + this.name = name; + this.namespace = namespace; + this.value = value; + this.type = type; + } + + + /** + * Returns the full name of the attribute. + */ + String getFullName() + { + return this.fullName; + } + + + /** + * Returns the short name of the attribute. + */ + String getName() + { + return this.name; + } + + + /** + * Returns the namespace of the attribute. + */ + String getNamespace() + { + return this.namespace; + } + + + /** + * Returns the value of the attribute. + */ + String getValue() + { + return this.value; + } + + + /** + * Sets the value of the attribute. + * + * @param value the new value. + */ + void setValue(String value) + { + this.value = value; + } + + + /** + * Returns the type of the attribute. + * + * @param type the new type. + */ + String getType() + { + return this.type; + } + +} diff --git a/core/src/processing/xml/XMLElement.java b/core/src/processing/xml/XMLElement.java new file mode 100644 index 000000000..c306ff419 --- /dev/null +++ b/core/src/processing/xml/XMLElement.java @@ -0,0 +1,1353 @@ +/* XMLElement.java NanoXML/Java + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + +import java.io.*; +import java.util.*; + +import processing.core.PApplet; + + +/** + * XMLElement is an XML element. This is the base class used for the + * Processing XML library, representing a single node of an XML tree. + * + * This code is based on a modified version of NanoXML by Marc De Scheemaecker. + * + * @author Marc De Scheemaecker + * @author processing.org + */ +public class XMLElement implements Serializable { + + /** + * No line number defined. + */ + public static final int NO_LINE = -1; + + + /** + * The parent element. + */ + private XMLElement parent; + + + /** + * The attributes of the element. + */ + private Vector attributes; + + + /** + * The child elements. + */ + private Vector children; + + + /** + * The name of the element. + */ + private String name; + + + /** + * The full name of the element. + */ + private String fullName; + + + /** + * The namespace URI. + */ + private String namespace; + + + /** + * The content of the element. + */ + private String content; + + + /** + * The system ID of the source data where this element is located. + */ + private String systemID; + + + /** + * The line in the source data where this element starts. + */ + private int lineNr; + + + /** + * Creates an empty element to be used for #PCDATA content. + */ + public XMLElement() { + this(null, null, null, NO_LINE); + } + + + protected void set(String fullName, + String namespace, + String systemID, + int lineNr) { + this.fullName = fullName; + if (namespace == null) { + this.name = fullName; + } else { + int index = fullName.indexOf(':'); + if (index >= 0) { + this.name = fullName.substring(index + 1); + } else { + this.name = fullName; + } + } + this.namespace = namespace; + this.lineNr = lineNr; + this.systemID = systemID; + } + + + /** + * Creates an empty element. + * + * @param fullName the name of the element. + */ +// public XMLElement(String fullName) { +// this(fullName, null, null, NO_LINE); +// } + + + /** + * Creates an empty element. + * + * @param fullName the name of the element. + * @param systemID the system ID of the XML data where the element starts. + * @param lineNr the line in the XML data where the element starts. + */ +// public XMLElement(String fullName, +// String systemID, +// int lineNr) { +// this(fullName, null, systemID, lineNr); +// } + + + /** + * Creates an empty element. + * + * @param fullName the full name of the element + * @param namespace the namespace URI. + */ +// public XMLElement(String fullName, +// String namespace) { +// this(fullName, namespace, null, NO_LINE); +// } + + + /** + * Creates an empty element. + * + * @param fullName the full name of the element + * @param namespace the namespace URI. + * @param systemID the system ID of the XML data where the element starts. + * @param lineNr the line in the XML data where the element starts. + */ + public XMLElement(String fullName, + String namespace, + String systemID, + int lineNr) { + this.attributes = new Vector(); + this.children = new Vector(8); + this.fullName = fullName; + if (namespace == null) { + this.name = fullName; + } else { + int index = fullName.indexOf(':'); + if (index >= 0) { + this.name = fullName.substring(index + 1); + } else { + this.name = fullName; + } + } + this.namespace = namespace; + this.content = null; + this.lineNr = lineNr; + this.systemID = systemID; + this.parent = null; + } + + + /** + * Begin parsing XML data passed in from a PApplet. This code + * wraps exception handling, for more advanced exception handling, + * use the constructor that takes a Reader or InputStream. + * @author processing.org + * @param filename + * @param parent + */ + public XMLElement(PApplet parent, String filename) { + this(); + parseFromReader(parent.createReader(filename)); + } + + + public XMLElement(Reader r) { + this(); + parseFromReader(r); + } + + + public XMLElement(String xml) { + this(); + parseFromReader(new StringReader(xml)); + } + + + protected void parseFromReader(Reader r) { + try { + StdXMLParser parser = new StdXMLParser(); + parser.setBuilder(new StdXMLBuilder(this)); + parser.setValidator(new XMLValidator()); + parser.setReader(new StdXMLReader(r)); + //System.out.println(parser.parse().getName()); + /*XMLElement xm = (XMLElement)*/ parser.parse(); + //System.out.println("xm name is " + xm.getName()); + //System.out.println(xm + " " + this); + //parser.parse(); + } catch (XMLException e) { + e.printStackTrace(); + } + } + + +// static public XMLElement parse(Reader r) { +// try { +// StdXMLParser parser = new StdXMLParser(); +// parser.setBuilder(new StdXMLBuilder()); +// parser.setValidator(new XMLValidator()); +// parser.setReader(new StdXMLReader(r)); +// return (XMLElement) parser.parse(); +// } catch (XMLException e) { +// e.printStackTrace(); +// return null; +// } +// } + + + /** + * Creates an element to be used for #PCDATA content. + */ + public XMLElement createPCDataElement() { + return new XMLElement(); + } + + + /** + * Creates an empty element. + * + * @param fullName the name of the element. + */ +// public XMLElement createElement(String fullName) { +// return new XMLElement(fullName); +// } + + + /** + * Creates an empty element. + * + * @param fullName the name of the element. + * @param systemID the system ID of the XML data where the element starts. + * @param lineNr the line in the XML data where the element starts. + */ +// public XMLElement createElement(String fullName, +// String systemID, +// int lineNr) { +// //return new XMLElement(fullName, systemID, lineNr); +// return new XMLElement(fullName, null, systemID, lineNr); +// } + + + /** + * Creates an empty element. + * + * @param fullName the full name of the element + * @param namespace the namespace URI. + */ + public XMLElement createElement(String fullName, + String namespace) { + //return new XMLElement(fullName, namespace); + return new XMLElement(fullName, namespace, null, NO_LINE); + } + + + /** + * Creates an empty element. + * + * @param fullName the full name of the element + * @param namespace the namespace URI. + * @param systemID the system ID of the XML data where the element starts. + * @param lineNr the line in the XML data where the element starts. + */ + public XMLElement createElement(String fullName, + String namespace, + String systemID, + int lineNr) { + return new XMLElement(fullName, namespace, systemID, lineNr); + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() throws Throwable { + this.attributes.clear(); + this.attributes = null; + this.children = null; + this.fullName = null; + this.name = null; + this.namespace = null; + this.content = null; + this.systemID = null; + this.parent = null; + super.finalize(); + } + + + /** + * Returns the parent element. This method returns null for the root + * element. + */ + public XMLElement getParent() { + return this.parent; + } + + + /** + * Returns the full name (i.e. the name including an eventual namespace + * prefix) of the element. + * + * @return the name, or null if the element only contains #PCDATA. + */ + public String getName() { + return this.fullName; + } + + + /** + * Returns the name of the element. + * + * @return the name, or null if the element only contains #PCDATA. + */ + public String getLocalName() { + return this.name; + } + + + /** + * Returns the namespace of the element. + * + * @return the namespace, or null if no namespace is associated with the + * element. + */ + public String getNamespace() { + return this.namespace; + } + + + /** + * Sets the full name. This method also sets the short name and clears the + * namespace URI. + * + * @param name the non-null name. + */ + public void setName(String name) { + this.name = name; + this.fullName = name; + this.namespace = null; + } + + + /** + * Sets the name. + * + * @param fullName the non-null full name. + * @param namespace the namespace URI, which may be null. + */ + public void setName(String fullName, String namespace) { + int index = fullName.indexOf(':'); + if ((namespace == null) || (index < 0)) { + this.name = fullName; + } else { + this.name = fullName.substring(index + 1); + } + this.fullName = fullName; + this.namespace = namespace; + } + + + /** + * Adds a child element. + * + * @param child the non-null child to add. + */ + public void addChild(XMLElement child) { + if (child == null) { + throw new IllegalArgumentException("child must not be null"); + } + if ((child.getLocalName() == null) && (! this.children.isEmpty())) { + XMLElement lastChild = (XMLElement) this.children.lastElement(); + + if (lastChild.getLocalName() == null) { + lastChild.setContent(lastChild.getContent() + + child.getContent()); + return; + } + } + ((XMLElement)child).parent = this; + this.children.addElement(child); + } + + + /** + * Inserts a child element. + * + * @param child the non-null child to add. + * @param index where to put the child. + */ + public void insertChild(XMLElement child, int index) { + if (child == null) { + throw new IllegalArgumentException("child must not be null"); + } + if ((child.getLocalName() == null) && (! this.children.isEmpty())) { + XMLElement lastChild = (XMLElement) this.children.lastElement(); + if (lastChild.getLocalName() == null) { + lastChild.setContent(lastChild.getContent() + + child.getContent()); + return; + } + } + ((XMLElement) child).parent = this; + this.children.insertElementAt(child, index); + } + + + /** + * Removes a child element. + * + * @param child the non-null child to remove. + */ + public void removeChild(XMLElement child) { + if (child == null) { + throw new IllegalArgumentException("child must not be null"); + } + this.children.removeElement(child); + } + + + /** + * Removes the child located at a certain index. + * + * @param index the index of the child, where the first child has index 0. + */ + public void removeChildAtIndex(int index) { + this.children.removeElementAt(index); + } + + + /** + * Returns an enumeration of all child elements. + * + * @return the non-null enumeration + */ + public Enumeration enumerateChildren() { + return this.children.elements(); + } + + + /** + * Returns whether the element is a leaf element. + * + * @return true if the element has no children. + */ + public boolean isLeaf() { + return this.children.isEmpty(); + } + + + /** + * Returns whether the element has children. + * + * @return true if the element has children. + */ + public boolean hasChildren() { + return (! this.children.isEmpty()); + } + + + /** + * Returns the number of children. + * + * @return the count. + */ + public int getChildCount() { + return this.children.size(); + } + + + /** + * Returns a vector containing all the child elements. + * + * @return the vector. + */ +// public Vector getChildren() { +// return this.children; +// } + + + /** + * Put the names of all children into an array. Same as looping through + * each child and calling getName() on each XMLElement. + */ + public String[] listChildren() { + int childCount = getChildCount(); + String[] outgoing = new String[childCount]; + for (int i = 0; i < childCount; i++) { + outgoing[i] = getChild(i).getName(); + } + return outgoing; + } + + + /** + * Returns an array containing all the child elements. + */ + public XMLElement[] getChildren() { + int childCount = getChildCount(); + XMLElement[] kids = new XMLElement[childCount]; + children.copyInto(kids); + return kids; + } + + + /** + * Quick accessor for an element at a particular index. + * @author processing.org + */ + public XMLElement getChild(int which) { + return (XMLElement) children.elementAt(which); + } + + + /** + * Get a child by its name or path. + * @param name element name or path/to/element + * @return the element + * @author processing.org + */ + public XMLElement getChild(String name) { + if (name.indexOf('/') != -1) { + return getChildRecursive(PApplet.split(name, '/'), 0); + } + int childCount = getChildCount(); + for (int i = 0; i < childCount; i++) { + XMLElement kid = getChild(i); + String kidName = kid.getName(); + if (kidName != null && kidName.equals(name)) { + return kid; + } + } + return null; + } + + + /** + * Internal helper function for getChild(String). + * @param items result of splitting the query on slashes + * @param offset where in the items[] array we're currently looking + * @return matching element or null if no match + * @author processing.org + */ + protected XMLElement getChildRecursive(String[] items, int offset) { + // if it's a number, do an index instead + if (Character.isDigit(items[offset].charAt(0))) { + XMLElement kid = getChild(Integer.parseInt(items[offset])); + if (offset == items.length-1) { + return kid; + } else { + return kid.getChildRecursive(items, offset+1); + } + } + int childCount = getChildCount(); + for (int i = 0; i < childCount; i++) { + XMLElement kid = getChild(i); + String kidName = kid.getName(); + if (kidName != null && kidName.equals(items[offset])) { + if (offset == items.length-1) { + return kid; + } else { + return kid.getChildRecursive(items, offset+1); + } + } + } + return null; + } + + + /** + * Returns the child at a specific index. + * + * @param index the index of the child + * + * @return the non-null child + * + * @throws java.lang.ArrayIndexOutOfBoundsException + * if the index is out of bounds. + */ + public XMLElement getChildAtIndex(int index) + throws ArrayIndexOutOfBoundsException { + return (XMLElement) this.children.elementAt(index); + } + + + /** + * Searches a child element. + * + * @param name the full name of the child to search for. + * + * @return the child element, or null if no such child was found. + */ +// public XMLElement getFirstChildNamed(String name) { +// Enumeration enum = this.children.elements(); +// while (enum.hasMoreElements()) { +// XMLElement child = (XMLElement) enum.nextElement(); +// String childName = child.getFullName(); +// if ((childName != null) && childName.equals(name)) { +// return child; +// } +// } +// return null; +// } + + + /** + * Searches a child element. + * + * @param name the name of the child to search for. + * @param namespace the namespace, which may be null. + * + * @return the child element, or null if no such child was found. + */ +// public XMLElement getFirstChildNamed(String name, +// String namespace) { +// Enumeration enum = this.children.elements(); +// while (enum.hasMoreElements()) { +// XMLElement child = (XMLElement) enum.nextElement(); +// String str = child.getName(); +// boolean found = (str != null) && (str.equals(name)); +// str = child.getNamespace(); +// if (str == null) { +// found &= (name == null); +// } else { +// found &= str.equals(namespace); +// } +// if (found) { +// return child; +// } +// } +// return null; +// } + + + /** + * Get any children that match this name or path. Similar to getChild(), + * but will grab multiple matches rather than only the first. + * @param name element name or path/to/element + * @return array of child elements that match + * @author processing.org + */ + public XMLElement[] getChildren(String name) { + if (name.indexOf('/') != -1) { + return getChildrenRecursive(PApplet.split(name, '/'), 0); + } + // if it's a number, do an index instead + // (returns a single element array, since this will be a single match + if (Character.isDigit(name.charAt(0))) { + return new XMLElement[] { getChild(Integer.parseInt(name)) }; + } + int childCount = getChildCount(); + XMLElement[] matches = new XMLElement[childCount]; + int matchCount = 0; + for (int i = 0; i < childCount; i++) { + XMLElement kid = getChild(i); + String kidName = kid.getName(); + if (kidName != null && kidName.equals(name)) { + matches[matchCount++] = kid; + } + } + return (XMLElement[]) PApplet.subset(matches, 0, matchCount); + } + + + protected XMLElement[] getChildrenRecursive(String[] items, int offset) { + if (offset == items.length-1) { + return getChildren(items[offset]); + } + XMLElement[] matches = getChildren(items[offset]); + XMLElement[] outgoing = new XMLElement[0]; + for (int i = 0; i < matches.length; i++) { + XMLElement[] kidMatches = matches[i].getChildrenRecursive(items, offset+1); + outgoing = (XMLElement[]) PApplet.concat(outgoing, kidMatches); + } + return outgoing; + } + + + /** + * Returns a vector of all child elements named name. + * + * @param name the full name of the children to search for. + * + * @return the non-null vector of child elements. + */ +// public Vector getChildrenNamed(String name) { +// Vector result = new Vector(this.children.size()); +// Enumeration enum = this.children.elements(); +// while (enum.hasMoreElements()) { +// XMLElement child = (XMLElement) enum.nextElement(); +// String childName = child.getFullName(); +// if ((childName != null) && childName.equals(name)) { +// result.addElement(child); +// } +// } +// return result; +// } + + + /** + * Returns a vector of all child elements named name. + * + * @param name the name of the children to search for. + * @param namespace the namespace, which may be null. + * + * @return the non-null vector of child elements. + */ +// public Vector getChildrenNamed(String name, +// String namespace) { +// Vector result = new Vector(this.children.size()); +// Enumeration enum = this.children.elements(); +// while (enum.hasMoreElements()) { +// XMLElement child = (XMLElement) enum.nextElement(); +// String str = child.getName(); +// boolean found = (str != null) && (str.equals(name)); +// str = child.getNamespace(); +// if (str == null) { +// found &= (name == null); +// } else { +// found &= str.equals(namespace); +// } +// +// if (found) { +// result.addElement(child); +// } +// } +// return result; +// } + + + /** + * Searches an attribute. + * + * @param fullName the non-null full name of the attribute. + * + * @return the attribute, or null if the attribute does not exist. + */ + private XMLAttribute findAttribute(String fullName) { + Enumeration en = this.attributes.elements(); + while (en.hasMoreElements()) { + XMLAttribute attr = (XMLAttribute) en.nextElement(); + if (attr.getFullName().equals(fullName)) { + return attr; + } + } + return null; + } + + + /** + * Searches an attribute. + * + * @param name the non-null short name of the attribute. + * @param namespace the name space, which may be null. + * + * @return the attribute, or null if the attribute does not exist. + */ + private XMLAttribute findAttribute(String name, + String namespace) { + Enumeration en = this.attributes.elements(); + while (en.hasMoreElements()) { + XMLAttribute attr = (XMLAttribute) en.nextElement(); + boolean found = attr.getName().equals(name); + if (namespace == null) { + found &= (attr.getNamespace() == null); + } else { + found &= namespace.equals(attr.getNamespace()); + } + + if (found) { + return attr; + } + } + return null; + } + + + /** + * Returns the number of attributes. + */ + public int getAttributeCount() { + return this.attributes.size(); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null name of the attribute. + * + * @return the value, or null if the attribute does not exist. + */ + public String getAttribute(String name) { + return this.getAttribute(name, null); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null full name of the attribute. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public String getAttribute(String name, + String defaultValue) { + XMLAttribute attr = this.findAttribute(name); + if (attr == null) { + return defaultValue; + } else { + return attr.getValue(); + } + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null name of the attribute. + * @param namespace the namespace URI, which may be null. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public String getAttribute(String name, + String namespace, + String defaultValue) { + XMLAttribute attr = this.findAttribute(name, namespace); + if (attr == null) { + return defaultValue; + } else { + return attr.getValue(); + } + } + + + public String getStringAttribute(String name) { + return getAttribute(name); + } + + + public String getStringAttribute(String name, String defaultValue) { + return getAttribute(name, defaultValue); + } + + + public String getStringAttribute(String name, + String namespace, + String defaultValue) { + return getAttribute(name, namespace, defaultValue); + } + + + public int getIntAttribute(String name) { + return getIntAttribute(name, 0); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null full name of the attribute. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public int getIntAttribute(String name, + int defaultValue) { + String value = this.getAttribute(name, Integer.toString(defaultValue)); + return Integer.parseInt(value); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null name of the attribute. + * @param namespace the namespace URI, which may be null. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public int getIntAttribute(String name, + String namespace, + int defaultValue) { + String value = this.getAttribute(name, namespace, + Integer.toString(defaultValue)); + return Integer.parseInt(value); + } + + + public float getFloatAttribute(String name) { + return getFloatAttribute(name, 0); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null full name of the attribute. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public float getFloatAttribute(String name, + float defaultValue) { + String value = this.getAttribute(name, Float.toString(defaultValue)); + return Float.parseFloat(value); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null name of the attribute. + * @param namespace the namespace URI, which may be null. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public float getFloatAttribute(String name, + String namespace, + float defaultValue) { + String value = this.getAttribute(name, namespace, + Float.toString(defaultValue)); + return Float.parseFloat(value); + } + + + public double getDoubleAttribute(String name) { + return getDoubleAttribute(name, 0); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null full name of the attribute. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public double getDoubleAttribute(String name, + double defaultValue) { + String value = this.getAttribute(name, Double.toString(defaultValue)); + return Double.parseDouble(value); + } + + + /** + * Returns the value of an attribute. + * + * @param name the non-null name of the attribute. + * @param namespace the namespace URI, which may be null. + * @param defaultValue the default value of the attribute. + * + * @return the value, or defaultValue if the attribute does not exist. + */ + public double getDoubleAttribute(String name, + String namespace, + double defaultValue) { + String value = this.getAttribute(name, namespace, + Double.toString(defaultValue)); + return Double.parseDouble(value); + } + + + /** + * Returns the type of an attribute. + * + * @param name the non-null full name of the attribute. + * + * @return the type, or null if the attribute does not exist. + */ + public String getAttributeType(String name) { + XMLAttribute attr = this.findAttribute(name); + if (attr == null) { + return null; + } else { + return attr.getType(); + } + } + + + /** + * Returns the namespace of an attribute. + * + * @param name the non-null full name of the attribute. + * + * @return the namespace, or null if there is none associated. + */ + public String getAttributeNamespace(String name) { + XMLAttribute attr = this.findAttribute(name); + if (attr == null) { + return null; + } else { + return attr.getNamespace(); + } + } + + + /** + * Returns the type of an attribute. + * + * @param name the non-null name of the attribute. + * @param namespace the namespace URI, which may be null. + * + * @return the type, or null if the attribute does not exist. + */ + public String getAttributeType(String name, + String namespace) { + XMLAttribute attr = this.findAttribute(name, namespace); + if (attr == null) { + return null; + } else { + return attr.getType(); + } + } + + + /** + * Sets an attribute. + * + * @param name the non-null full name of the attribute. + * @param value the non-null value of the attribute. + */ + public void setAttribute(String name, + String value) { + XMLAttribute attr = this.findAttribute(name); + if (attr == null) { + attr = new XMLAttribute(name, name, null, value, "CDATA"); + this.attributes.addElement(attr); + } else { + attr.setValue(value); + } + } + + + /** + * Sets an attribute. + * + * @param fullName the non-null full name of the attribute. + * @param namespace the namespace URI of the attribute, which may be null. + * @param value the non-null value of the attribute. + */ + public void setAttribute(String fullName, + String namespace, + String value) { + int index = fullName.indexOf(':'); + String vorname = fullName.substring(index + 1); + XMLAttribute attr = this.findAttribute(vorname, namespace); + if (attr == null) { + attr = new XMLAttribute(fullName, vorname, namespace, value, "CDATA"); + this.attributes.addElement(attr); + } else { + attr.setValue(value); + } + } + + + /** + * Removes an attribute. + * + * @param name the non-null name of the attribute. + */ + public void removeAttribute(String name) { + for (int i = 0; i < this.attributes.size(); i++) { + XMLAttribute attr = (XMLAttribute) this.attributes.elementAt(i); + if (attr.getFullName().equals(name)) { + this.attributes.removeElementAt(i); + return; + } + } + } + + + /** + * Removes an attribute. + * + * @param name the non-null name of the attribute. + * @param namespace the namespace URI of the attribute, which may be null. + */ + public void removeAttribute(String name, + String namespace) { + for (int i = 0; i < this.attributes.size(); i++) { + XMLAttribute attr = (XMLAttribute) this.attributes.elementAt(i); + boolean found = attr.getName().equals(name); + if (namespace == null) { + found &= (attr.getNamespace() == null); + } else { + found &= attr.getNamespace().equals(namespace); + } + + if (found) { + this.attributes.removeElementAt(i); + return; + } + } + } + + + /** + * Returns an enumeration of all attribute names. + * + * @return the non-null enumeration. + */ + public Enumeration enumerateAttributeNames() { + Vector result = new Vector(); + Enumeration en = this.attributes.elements(); + while (en.hasMoreElements()) { + XMLAttribute attr = (XMLAttribute) en.nextElement(); + result.addElement(attr.getFullName()); + } + return result.elements(); + } + + + /** + * Returns whether an attribute exists. + * + * @return true if the attribute exists. + */ + public boolean hasAttribute(String name) { + return this.findAttribute(name) != null; + } + + + /** + * Returns whether an attribute exists. + * + * @return true if the attribute exists. + */ + public boolean hasAttribute(String name, + String namespace) { + return this.findAttribute(name, namespace) != null; + } + + + /** + * Returns all attributes as a Properties object. + * + * @return the non-null set. + */ + public Properties getAttributes() { + Properties result = new Properties(); + Enumeration en = this.attributes.elements(); + while (en.hasMoreElements()) { + XMLAttribute attr = (XMLAttribute) en.nextElement(); + result.put(attr.getFullName(), attr.getValue()); + } + return result; + } + + + /** + * Returns all attributes in a specific namespace as a Properties object. + * + * @param namespace the namespace URI of the attributes, which may be null. + * + * @return the non-null set. + */ + public Properties getAttributesInNamespace(String namespace) { + Properties result = new Properties(); + Enumeration en = this.attributes.elements(); + while (en.hasMoreElements()) { + XMLAttribute attr = (XMLAttribute) en.nextElement(); + if (namespace == null) { + if (attr.getNamespace() == null) { + result.put(attr.getName(), attr.getValue()); + } + } else { + if (namespace.equals(attr.getNamespace())) { + result.put(attr.getName(), attr.getValue()); + } + } + } + return result; + } + + + /** + * Returns the system ID of the data where the element started. + * + * @return the system ID, or null if unknown. + * + * @see #getLineNr + */ + public String getSystemID() { + return this.systemID; + } + + + /** + * Returns the line number in the data where the element started. + * + * @return the line number, or NO_LINE if unknown. + * + * @see #NO_LINE + * @see #getSystemID + */ + public int getLineNr() { + return this.lineNr; + } + + + /** + * Return the #PCDATA content of the element. If the element has a + * combination of #PCDATA content and child elements, the #PCDATA + * sections can be retrieved as unnamed child objects. In this case, + * this method returns null. + * + * @return the content. + */ + public String getContent() { + return this.content; + } + + + /** + * Sets the #PCDATA content. It is an error to call this method with a + * non-null value if there are child objects. + * + * @param content the (possibly null) content. + */ + public void setContent(String content) { + this.content = content; + } + + + /** + * Returns true if the element equals another element. + * + * @param rawElement the element to compare to + */ + public boolean equals(Object rawElement) { + try { + return this.equalsXMLElement((XMLElement) rawElement); + } catch (ClassCastException e) { + return false; + } + } + + + /** + * Returns true if the element equals another element. + * + * @param rawElement the element to compare to + */ + public boolean equalsXMLElement(XMLElement rawElement) { + if (! this.name.equals(rawElement.getLocalName())) { + return false; + } + if (this.attributes.size() != rawElement.getAttributeCount()) { + return false; + } + Enumeration en = this.attributes.elements(); + while (en.hasMoreElements()) { + XMLAttribute attr = (XMLAttribute) en.nextElement(); + if (! rawElement.hasAttribute(attr.getName(), attr.getNamespace())) { + return false; + } + String value = rawElement.getAttribute(attr.getName(), + attr.getNamespace(), + null); + if (! attr.getValue().equals(value)) { + return false; + } + String type = rawElement.getAttributeType(attr.getName(), + attr.getNamespace()); + if (! attr.getType().equals(type)) { + return false; + } + } + if (this.children.size() != rawElement.getChildCount()) { + return false; + } + for (int i = 0; i < this.children.size(); i++) { + XMLElement child1 = this.getChildAtIndex(i); + XMLElement child2 = rawElement.getChildAtIndex(i); + + if (! child1.equalsXMLElement(child2)) { + return false; + } + } + return true; + } + + + public String toString(boolean pretty) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStreamWriter osw = new OutputStreamWriter(baos); + XMLWriter writer = new XMLWriter(osw); + try { + if (pretty) { + writer.write(this, true, 2, true); + } else { + writer.write(this, false, 0, true); + } + } catch (IOException e) { + e.printStackTrace(); + } + return baos.toString(); + } +} diff --git a/core/src/processing/xml/XMLEntityResolver.java b/core/src/processing/xml/XMLEntityResolver.java new file mode 100644 index 000000000..f12c4c0d4 --- /dev/null +++ b/core/src/processing/xml/XMLEntityResolver.java @@ -0,0 +1,173 @@ +/* XMLEntityResolver.java NanoXML/Java + * + * $Revision: 1.4 $ + * $Date: 2002/01/04 21:03:29 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.util.Hashtable; +import java.io.Reader; +import java.io.StringReader; + + +/** + * An XMLEntityResolver resolves entities. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $ + */ +public class XMLEntityResolver +{ + + /** + * The entities. + */ + private Hashtable entities; + + + /** + * Initializes the resolver. + */ + public XMLEntityResolver() + { + this.entities = new Hashtable(); + this.entities.put("amp", "&"); + this.entities.put("quot", """); + this.entities.put("apos", "'"); + this.entities.put("lt", "<"); + this.entities.put("gt", ">"); + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.entities.clear(); + this.entities = null; + super.finalize(); + } + + + /** + * Adds an internal entity. + * + * @param name the name of the entity. + * @param value the value of the entity. + */ + public void addInternalEntity(String name, + String value) + { + if (! this.entities.containsKey(name)) { + this.entities.put(name, value); + } + } + + + /** + * Adds an external entity. + * + * @param name the name of the entity. + * @param publicID the public ID of the entity, which may be null. + * @param systemID the system ID of the entity. + */ + public void addExternalEntity(String name, + String publicID, + String systemID) + { + if (! this.entities.containsKey(name)) { + this.entities.put(name, new String[] { publicID, systemID } ); + } + } + + + /** + * Returns a Java reader containing the value of an entity. + * + * @param xmlReader the current XML reader + * @param name the name of the entity. + * + * @return the reader, or null if the entity could not be resolved. + */ + public Reader getEntity(StdXMLReader xmlReader, + String name) + throws XMLParseException + { + Object obj = this.entities.get(name); + + if (obj == null) { + return null; + } else if (obj instanceof java.lang.String) { + return new StringReader((String)obj); + } else { + String[] id = (String[]) obj; + return this.openExternalEntity(xmlReader, id[0], id[1]); + } + } + + + /** + * Returns true if an entity is external. + * + * @param name the name of the entity. + */ + public boolean isExternalEntity(String name) + { + Object obj = this.entities.get(name); + return ! (obj instanceof java.lang.String); + } + + + /** + * Opens an external entity. + * + * @param xmlReader the current XML reader + * @param publicID the public ID, which may be null + * @param systemID the system ID + * + * @return the reader, or null if the reader could not be created/opened + */ + protected Reader openExternalEntity(StdXMLReader xmlReader, + String publicID, + String systemID) + throws XMLParseException + { + String parentSystemID = xmlReader.getSystemID(); + + try { + return xmlReader.openStream(publicID, systemID); + } catch (Exception e) { + throw new XMLParseException(parentSystemID, + xmlReader.getLineNr(), + "Could not open external entity " + + "at system ID: " + systemID); + } + } + +} diff --git a/core/src/processing/xml/XMLException.java b/core/src/processing/xml/XMLException.java new file mode 100644 index 000000000..8515d481a --- /dev/null +++ b/core/src/processing/xml/XMLException.java @@ -0,0 +1,286 @@ +/* XMLException.java NanoXML/Java + * + * $Revision: 1.4 $ + * $Date: 2002/01/04 21:03:29 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + +import java.io.PrintStream; +import java.io.PrintWriter; + + +/** + * An XMLException is thrown when an exception occurred while processing the + * XML data. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $ + */ +public class XMLException + extends Exception +{ + + /** + * The message of the exception. + */ + private String msg; + + + /** + * The system ID of the XML data where the exception occurred. + */ + private String systemID; + + + /** + * The line number in the XML data where the exception occurred. + */ + private int lineNr; + + + /** + * Encapsulated exception. + */ + private Exception encapsulatedException; + + + /** + * Creates a new exception. + * + * @param msg the message of the exception. + */ + public XMLException(String msg) + { + this(null, -1, null, msg, false); + } + + + /** + * Creates a new exception. + * + * @param e the encapsulated exception. + */ + public XMLException(Exception e) + { + this(null, -1, e, "Nested Exception", false); + } + + + /** + * Creates a new exception. + * + * @param systemID the system ID of the XML data where the exception + * occurred + * @param lineNr the line number in the XML data where the exception + * occurred. + * @param e the encapsulated exception. + */ + public XMLException(String systemID, + int lineNr, + Exception e) + { + this(systemID, lineNr, e, "Nested Exception", true); + } + + + /** + * Creates a new exception. + * + * @param systemID the system ID of the XML data where the exception + * occurred + * @param lineNr the line number in the XML data where the exception + * occurred. + * @param msg the message of the exception. + */ + public XMLException(String systemID, + int lineNr, + String msg) + { + this(systemID, lineNr, null, msg, true); + } + + + /** + * Creates a new exception. + * + * @param systemID the system ID from where the data came + * @param lineNr the line number in the XML data where the exception + * occurred. + * @param e the encapsulated exception. + * @param msg the message of the exception. + * @param reportParams true if the systemID, lineNr and e params need to be + * appended to the message + */ + public XMLException(String systemID, + int lineNr, + Exception e, + String msg, + boolean reportParams) + { + super(XMLException.buildMessage(systemID, lineNr, e, msg, + reportParams)); + this.systemID = systemID; + this.lineNr = lineNr; + this.encapsulatedException = e; + this.msg = XMLException.buildMessage(systemID, lineNr, e, msg, + reportParams); + } + + + /** + * Builds the exception message + * + * @param systemID the system ID from where the data came + * @param lineNr the line number in the XML data where the exception + * occurred. + * @param e the encapsulated exception. + * @param msg the message of the exception. + * @param reportParams true if the systemID, lineNr and e params need to be + * appended to the message + */ + private static String buildMessage(String systemID, + int lineNr, + Exception e, + String msg, + boolean reportParams) + { + String str = msg; + + if (reportParams) { + if (systemID != null) { + str += ", SystemID='" + systemID + "'"; + } + + if (lineNr >= 0) { + str += ", Line=" + lineNr; + } + + if (e != null) { + str += ", Exception: " + e; + } + } + + return str; + } + + + /** + * Cleans up the object when it's destroyed. + */ + protected void finalize() + throws Throwable + { + this.systemID = null; + this.encapsulatedException = null; + super.finalize(); + } + + + /** + * Returns the system ID of the XML data where the exception occurred. + * If there is no system ID known, null is returned. + */ + public String getSystemID() + { + return this.systemID; + } + + + /** + * Returns the line number in the XML data where the exception occurred. + * If there is no line number known, -1 is returned. + */ + public int getLineNr() + { + return this.lineNr; + } + + + /** + * Returns the encapsulated exception, or null if no exception is + * encapsulated. + */ + public Exception getException() + { + return this.encapsulatedException; + } + + + /** + * Dumps the exception stack to a print writer. + * + * @param writer the print writer + */ + public void printStackTrace(PrintWriter writer) + { + super.printStackTrace(writer); + + if (this.encapsulatedException != null) { + writer.println("*** Nested Exception:"); + this.encapsulatedException.printStackTrace(writer); + } + } + + + /** + * Dumps the exception stack to an output stream. + * + * @param stream the output stream + */ + public void printStackTrace(PrintStream stream) + { + super.printStackTrace(stream); + + if (this.encapsulatedException != null) { + stream.println("*** Nested Exception:"); + this.encapsulatedException.printStackTrace(stream); + } + } + + + /** + * Dumps the exception stack to System.err. + */ + public void printStackTrace() + { + super.printStackTrace(); + + if (this.encapsulatedException != null) { + System.err.println("*** Nested Exception:"); + this.encapsulatedException.printStackTrace(); + } + } + + + /** + * Returns a string representation of the exception. + */ + public String toString() + { + return this.msg; + } + +} diff --git a/core/src/processing/xml/XMLParseException.java b/core/src/processing/xml/XMLParseException.java new file mode 100644 index 000000000..aa7915d94 --- /dev/null +++ b/core/src/processing/xml/XMLParseException.java @@ -0,0 +1,69 @@ +/* XMLParseException.java NanoXML/Java + * + * $Revision: 1.3 $ + * $Date: 2002/01/04 21:03:29 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +/** + * An XMLParseException is thrown when the XML passed to the XML parser is not + * well-formed. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.3 $ + */ +public class XMLParseException + extends XMLException +{ + + /** + * Creates a new exception. + * + * @param msg the message of the exception. + */ + public XMLParseException(String msg) + { + super(msg); + } + + + /** + * Creates a new exception. + * + * @param systemID the system ID from where the data came + * @param lineNr the line number in the XML data where the exception + * occurred. + * @param msg the message of the exception. + */ + public XMLParseException(String systemID, + int lineNr, + String msg) + { + super(systemID, lineNr, null, msg, true); + } + +} diff --git a/core/src/processing/xml/XMLUtil.java b/core/src/processing/xml/XMLUtil.java new file mode 100644 index 000000000..6adad79be --- /dev/null +++ b/core/src/processing/xml/XMLUtil.java @@ -0,0 +1,758 @@ +/* XMLUtil.java NanoXML/Java + * + * $Revision: 1.5 $ + * $Date: 2002/02/03 21:19:38 $ + * $Name: RELEASE_2_2_1 $ + * + * This file is part of NanoXML 2 for Java. + * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied warranty. + * In no event will the authors be held liable for any damages arising from the + * use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software in + * a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +package processing.xml; + + +import java.io.IOException; +import java.io.Reader; + + +/** + * Utility methods for NanoXML. + * + * @author Marc De Scheemaecker + * @version $Name: RELEASE_2_2_1 $, $Revision: 1.5 $ + */ +class XMLUtil +{ + + /** + * Skips the remainder of a comment. + * It is assumed that <!- is already read. + * + * @param reader the reader + * + * @throws java.io.IOException + * if an error occurred reading the data + */ + static void skipComment(StdXMLReader reader) + throws IOException, + XMLParseException + { + if (reader.read() != '-') { + XMLUtil.errorExpectedInput(reader.getSystemID(), + reader.getLineNr(), + "" + entry.getValue()); + } + */ + + /* + HashMap map = mapper.getAliases(); + KeySet keys = map.keySet(); + Iterator it = entries.iterator(); + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + System.out.println(entry.getKey() + "-->" + entry.getValue()); + } + */ + + HashMap map = mapper.getAliases(); + Set entries = map.entrySet(); + String list[] = new String[entries.size()]; + Iterator it = entries.iterator(); + int count = 0; + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + //System.out.println(entry.getKey() + "-->" + entry.getValue()); + list[count++] = (String) entry.getKey(); + } + return PApplet.sort(list); + } + + + ////////////////////////////////////////////////////////////// + + + protected void nope(String function) { + throw new RuntimeException("No " + function + "() for PGraphicsPDF"); + } +} diff --git a/serial/.classpath b/serial/.classpath new file mode 100644 index 000000000..3fc4223ef --- /dev/null +++ b/serial/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/serial/.project b/serial/.project new file mode 100644 index 000000000..415f62214 --- /dev/null +++ b/serial/.project @@ -0,0 +1,17 @@ + + + serial + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/serial/.settings/org.eclipse.jdt.core.prefs b/serial/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..e53b1822e --- /dev/null +++ b/serial/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Sat Oct 11 19:36:05 EDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +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.5 diff --git a/serial/library/.cvsignore b/serial/library/.cvsignore new file mode 100644 index 000000000..718e029bc --- /dev/null +++ b/serial/library/.cvsignore @@ -0,0 +1 @@ +serial.jar diff --git a/serial/library/RXTXcomm.jar b/serial/library/RXTXcomm.jar new file mode 100644 index 000000000..84e5f01df Binary files /dev/null and b/serial/library/RXTXcomm.jar differ diff --git a/serial/library/export.txt b/serial/library/export.txt new file mode 100755 index 000000000..7b4cacba8 --- /dev/null +++ b/serial/library/export.txt @@ -0,0 +1,3 @@ +application.macosx = serial.jar, RXTXcomm.jar, librxtxSerial.jnilib +application.windows = serial.jar, RXTXcomm.jar, rxtxSerial.dll +application.linux = serial.jar, RXTXcomm.jar, librxtxSerial.so \ No newline at end of file diff --git a/serial/library/librxtxSerial.jnilib b/serial/library/librxtxSerial.jnilib new file mode 100644 index 000000000..b15dfa5e8 Binary files /dev/null and b/serial/library/librxtxSerial.jnilib differ diff --git a/serial/library/librxtxSerial.so b/serial/library/librxtxSerial.so new file mode 100644 index 000000000..e60c5e674 Binary files /dev/null and b/serial/library/librxtxSerial.so differ diff --git a/serial/library/rxtxSerial.dll b/serial/library/rxtxSerial.dll new file mode 100644 index 000000000..c0e6b5822 Binary files /dev/null and b/serial/library/rxtxSerial.dll differ diff --git a/serial/src/processing/serial/Serial.java b/serial/src/processing/serial/Serial.java new file mode 100644 index 000000000..72d589b66 --- /dev/null +++ b/serial/src/processing/serial/Serial.java @@ -0,0 +1,673 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PSerial - class for serial port goodness + Part of the Processing project - http://processing.org + + Copyright (c) 2004-05 Ben Fry & 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 as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.serial; +import processing.core.*; + +import gnu.io.*; + +import java.io.*; +import java.util.*; +import java.lang.reflect.*; + + +public class Serial implements SerialPortEventListener { + + PApplet parent; + Method serialEventMethod; + + // properties can be passed in for default values + // otherwise defaults to 9600 N81 + + // these could be made static, which might be a solution + // for the classloading problem.. because if code ran again, + // the static class would have an object that could be closed + + public SerialPort port; + + public int rate; + public int parity; + public int databits; + public int stopbits; + + + // read buffer and streams + + public InputStream input; + public OutputStream output; + + byte buffer[] = new byte[32768]; + int bufferIndex; + int bufferLast; + + //boolean bufferUntil = false; + int bufferSize = 1; // how big before reset or event firing + boolean bufferUntil; + int bufferUntilByte; + + + // defaults + + static String dname = "COM1"; + static int drate = 9600; + static char dparity = 'N'; + static int ddatabits = 8; + static float dstopbits = 1; + + + public void setProperties(Properties props) { + dname = + props.getProperty("serial.port", dname); + drate = + Integer.parseInt(props.getProperty("serial.rate", "9600")); + dparity = + props.getProperty("serial.parity", "N").charAt(0); + ddatabits = + Integer.parseInt(props.getProperty("serial.databits", "8")); + dstopbits = + new Float(props.getProperty("serial.stopbits", "1")).floatValue(); + } + + + public Serial(PApplet parent) { + this(parent, dname, drate, dparity, ddatabits, dstopbits); + } + + public Serial(PApplet parent, int irate) { + this(parent, dname, irate, dparity, ddatabits, dstopbits); + } + + public Serial(PApplet parent, String iname, int irate) { + this(parent, iname, irate, dparity, ddatabits, dstopbits); + } + + public Serial(PApplet parent, String iname) { + this(parent, iname, drate, dparity, ddatabits, dstopbits); + } + + public Serial(PApplet parent, String iname, int irate, + char iparity, int idatabits, float istopbits) { + //if (port != null) port.close(); + this.parent = parent; + //parent.attach(this); + + this.rate = irate; + + parity = SerialPort.PARITY_NONE; + if (iparity == 'E') parity = SerialPort.PARITY_EVEN; + if (iparity == 'O') parity = SerialPort.PARITY_ODD; + + this.databits = idatabits; + + stopbits = SerialPort.STOPBITS_1; + if (istopbits == 1.5f) stopbits = SerialPort.STOPBITS_1_5; + if (istopbits == 2) stopbits = SerialPort.STOPBITS_2; + + try { + Enumeration portList = CommPortIdentifier.getPortIdentifiers(); + while (portList.hasMoreElements()) { + CommPortIdentifier portId = + (CommPortIdentifier) portList.nextElement(); + + if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { + //System.out.println("found " + portId.getName()); + if (portId.getName().equals(iname)) { + port = (SerialPort)portId.open("serial madness", 2000); + input = port.getInputStream(); + output = port.getOutputStream(); + port.setSerialPortParams(rate, databits, stopbits, parity); + port.addEventListener(this); + port.notifyOnDataAvailable(true); + //System.out.println("opening, ready to roll"); + } + } + } + + } catch (Exception e) { + errorMessage("", e); + //exception = e; + //e.printStackTrace(); + port = null; + input = null; + output = null; + } + + parent.registerDispose(this); + + // reflection to check whether host applet has a call for + // public void serialEvent(processing.serial.Serial) + // which would be called each time an event comes in + try { + serialEventMethod = + parent.getClass().getMethod("serialEvent", + new Class[] { Serial.class }); + } catch (Exception e) { + // no such method, or an error.. which is fine, just ignore + } + } + + + /** + * Stop talking to serial and shut things down. + *

    + * Basically just a user-accessible version of dispose(). + * For now, it just calls dispose(), but dispose shouldn't + * be called from applets, because in some libraries, + * dispose() blows shit up if it's called by a user who + * doesn't know what they're doing. + */ + public void stop() { + dispose(); + } + + + /** + * Used by PApplet to shut things down. + */ + public void dispose() { + try { + // do io streams need to be closed first? + if (input != null) input.close(); + if (output != null) output.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + input = null; + output = null; + + try { + if (port != null) port.close(); // close the port + + } catch (Exception e) { + e.printStackTrace(); + } + port = null; + } + + + /** + * Set the DTR line. Addition from Tom Hulbert. + */ + public void setDTR(boolean state) { + port.setDTR(state); + } + + + synchronized public void serialEvent(SerialPortEvent serialEvent) { + if (serialEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) { + try { + while (input.available() > 0) { + synchronized (buffer) { + if (bufferLast == buffer.length) { + byte temp[] = new byte[bufferLast << 1]; + System.arraycopy(buffer, 0, temp, 0, bufferLast); + buffer = temp; + } + buffer[bufferLast++] = (byte) input.read(); + if (serialEventMethod != null) { + if ((bufferUntil && + (buffer[bufferLast-1] == bufferUntilByte)) || + (!bufferUntil && + ((bufferLast - bufferIndex) >= bufferSize))) { + try { + serialEventMethod.invoke(parent, new Object[] { this }); + } catch (Exception e) { + String msg = "error, disabling serialEvent() for " + port; + System.err.println(msg); + e.printStackTrace(); + serialEventMethod = null; + } + } + } + } + } + + } catch (IOException e) { + errorMessage("serialEvent", e); + } + } + } + + + /** + * Set number of bytes to buffer before calling serialEvent() + * in the host applet. + */ + public void buffer(int count) { + bufferUntil = false; + bufferSize = count; + } + + + /** + * Set a specific byte to buffer until before calling + * serialEvent() in the host applet. + */ + public void bufferUntil(int what) { + bufferUntil = true; + bufferUntilByte = what; + } + + + /** + * Returns the number of bytes that have been read from serial + * and are waiting to be dealt with by the user. + */ + public int available() { + return (bufferLast - bufferIndex); + } + + + /** + * Ignore all the bytes read so far and empty the buffer. + */ + public void clear() { + bufferLast = 0; + bufferIndex = 0; + } + + + /** + * Returns a number between 0 and 255 for the next byte that's + * waiting in the buffer. + * Returns -1 if there was no byte (although the user should + * first check available() to see if things are ready to avoid this) + */ + public int read() { + if (bufferIndex == bufferLast) return -1; + + synchronized (buffer) { + int outgoing = buffer[bufferIndex++] & 0xff; + if (bufferIndex == bufferLast) { // rewind + bufferIndex = 0; + bufferLast = 0; + } + return outgoing; + } + } + + + /** + * Same as read() but returns the very last value received + * and clears the buffer. Useful when you just want the most + * recent value sent over the port. + */ + public int last() { + if (bufferIndex == bufferLast) return -1; + synchronized (buffer) { + int outgoing = buffer[bufferLast-1]; + bufferIndex = 0; + bufferLast = 0; + return outgoing; + } + } + + + /** + * Returns the next byte in the buffer as a char. + * Returns -1, or 0xffff, if nothing is there. + */ + public char readChar() { + if (bufferIndex == bufferLast) return (char)(-1); + return (char) read(); + } + + + /** + * Just like last() and readChar(). + */ + public char lastChar() { + if (bufferIndex == bufferLast) return (char)(-1); + return (char) last(); + } + + + /** + * Return a byte array of anything that's in the serial buffer. + * Not particularly memory/speed efficient, because it creates + * a byte array on each read, but it's easier to use than + * readBytes(byte b[]) (see below). + */ + public byte[] readBytes() { + if (bufferIndex == bufferLast) return null; + + synchronized (buffer) { + int length = bufferLast - bufferIndex; + byte outgoing[] = new byte[length]; + System.arraycopy(buffer, bufferIndex, outgoing, 0, length); + + bufferIndex = 0; // rewind + bufferLast = 0; + return outgoing; + } + } + + + /** + * Grab whatever is in the serial buffer, and stuff it into a + * byte buffer passed in by the user. This is more memory/time + * efficient than readBytes() returning a byte[] array. + * + * Returns an int for how many bytes were read. If more bytes + * are available than can fit into the byte array, only those + * that will fit are read. + */ + public int readBytes(byte outgoing[]) { + if (bufferIndex == bufferLast) return 0; + + synchronized (buffer) { + int length = bufferLast - bufferIndex; + if (length > outgoing.length) length = outgoing.length; + System.arraycopy(buffer, bufferIndex, outgoing, 0, length); + + bufferIndex += length; + if (bufferIndex == bufferLast) { + bufferIndex = 0; // rewind + bufferLast = 0; + } + return length; + } + } + + + /** + * Reads from the serial port into a buffer of bytes up to and + * including a particular character. If the character isn't in + * the serial buffer, then 'null' is returned. + */ + public byte[] readBytesUntil(int interesting) { + if (bufferIndex == bufferLast) return null; + byte what = (byte)interesting; + + synchronized (buffer) { + int found = -1; + for (int k = bufferIndex; k < bufferLast; k++) { + if (buffer[k] == what) { + found = k; + break; + } + } + if (found == -1) return null; + + int length = found - bufferIndex + 1; + byte outgoing[] = new byte[length]; + System.arraycopy(buffer, bufferIndex, outgoing, 0, length); + + bufferIndex += length; + if (bufferIndex == bufferLast) { + bufferIndex = 0; // rewind + bufferLast = 0; + } + return outgoing; + } + } + + + /** + * Reads from the serial port into a buffer of bytes until a + * particular character. If the character isn't in the serial + * buffer, then 'null' is returned. + * + * If outgoing[] is not big enough, then -1 is returned, + * and an error message is printed on the console. + * If nothing is in the buffer, zero is returned. + * If 'interesting' byte is not in the buffer, then 0 is returned. + */ + public int readBytesUntil(int interesting, byte outgoing[]) { + if (bufferIndex == bufferLast) return 0; + byte what = (byte)interesting; + + synchronized (buffer) { + int found = -1; + for (int k = bufferIndex; k < bufferLast; k++) { + if (buffer[k] == what) { + found = k; + break; + } + } + if (found == -1) return 0; + + int length = found - bufferIndex + 1; + if (length > outgoing.length) { + System.err.println("readBytesUntil() byte buffer is" + + " too small for the " + length + + " bytes up to and including char " + interesting); + return -1; + } + //byte outgoing[] = new byte[length]; + System.arraycopy(buffer, bufferIndex, outgoing, 0, length); + + bufferIndex += length; + if (bufferIndex == bufferLast) { + bufferIndex = 0; // rewind + bufferLast = 0; + } + return length; + } + } + + + /** + * Return whatever has been read from the serial port so far + * as a String. It assumes that the incoming characters are ASCII. + * + * If you want to move Unicode data, you can first convert the + * String to a byte stream in the representation of your choice + * (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. + */ + public String readString() { + if (bufferIndex == bufferLast) return null; + return new String(readBytes()); + } + + + /** + * Combination of readBytesUntil and readString. See caveats in + * each function. Returns null if it still hasn't found what + * you're looking for. + * + * If you want to move Unicode data, you can first convert the + * String to a byte stream in the representation of your choice + * (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. + */ + public String readStringUntil(int interesting) { + byte b[] = readBytesUntil(interesting); + if (b == null) return null; + return new String(b); + } + + + /** + * This will handle both ints, bytes and chars transparently. + */ + public void write(int what) { // will also cover char + try { + output.write(what & 0xff); // for good measure do the & + output.flush(); // hmm, not sure if a good idea + + } catch (Exception e) { // null pointer or serial port dead + errorMessage("write", e); + } + } + + + public void write(byte bytes[]) { + try { + output.write(bytes); + output.flush(); // hmm, not sure if a good idea + + } catch (Exception e) { // null pointer or serial port dead + //errorMessage("write", e); + e.printStackTrace(); + } + } + + + /** + * Write a String to the output. Note that this doesn't account + * for Unicode (two bytes per char), nor will it send UTF8 + * characters.. It assumes that you mean to send a byte buffer + * (most often the case for networking and serial i/o) and + * will only use the bottom 8 bits of each char in the string. + * (Meaning that internally it uses String.getBytes) + * + * If you want to move Unicode data, you can first convert the + * String to a byte stream in the representation of your choice + * (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. + */ + public void write(String what) { + write(what.getBytes()); + } + + + /** + * If this just hangs and never completes on Windows, + * it may be because the DLL doesn't have its exec bit set. + * Why the hell that'd be the case, who knows. + */ + static public String[] list() { + Vector list = new Vector(); + try { + //System.err.println("trying"); + Enumeration portList = CommPortIdentifier.getPortIdentifiers(); + //System.err.println("got port list"); + while (portList.hasMoreElements()) { + CommPortIdentifier portId = + (CommPortIdentifier) portList.nextElement(); + //System.out.println(portId); + + if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { + String name = portId.getName(); + list.addElement(name); + } + } + + } catch (UnsatisfiedLinkError e) { + //System.err.println("1"); + errorMessage("ports", e); + + } catch (Exception e) { + //System.err.println("2"); + errorMessage("ports", e); + } + //System.err.println("move out"); + String outgoing[] = new String[list.size()]; + list.copyInto(outgoing); + return outgoing; + } + + + /** + * General error reporting, all corraled here just in case + * I think of something slightly more intelligent to do. + */ + static public void errorMessage(String where, Throwable e) { + e.printStackTrace(); + throw new RuntimeException("Error inside Serial." + where + "()"); + } +} + + + /* + class SerialMenuListener implements ItemListener { + //public SerialMenuListener() { } + + public void itemStateChanged(ItemEvent e) { + int count = serialMenu.getItemCount(); + for (int i = 0; i < count; i++) { + ((CheckboxMenuItem)serialMenu.getItem(i)).setState(false); + } + CheckboxMenuItem item = (CheckboxMenuItem)e.getSource(); + item.setState(true); + String name = item.getLabel(); + //System.out.println(item.getLabel()); + PdeBase.properties.put("serial.port", name); + //System.out.println("set to " + get("serial.port")); + } + } + */ + + + /* + protected Vector buildPortList() { + // get list of names for serial ports + // have the default port checked (if present) + Vector list = new Vector(); + + //SerialMenuListener listener = new SerialMenuListener(); + boolean problem = false; + + // if this is failing, it may be because + // lib/javax.comm.properties is missing. + // java is weird about how it searches for java.comm.properties + // so it tends to be very fragile. i.e. quotes in the CLASSPATH + // environment variable will hose things. + try { + //System.out.println("building port list"); + Enumeration portList = CommPortIdentifier.getPortIdentifiers(); + while (portList.hasMoreElements()) { + CommPortIdentifier portId = + (CommPortIdentifier) portList.nextElement(); + //System.out.println(portId); + + if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { + //if (portId.getName().equals(port)) { + String name = portId.getName(); + //CheckboxMenuItem mi = + //new CheckboxMenuItem(name, name.equals(defaultName)); + + //mi.addItemListener(listener); + //serialMenu.add(mi); + list.addElement(name); + } + } + } catch (UnsatisfiedLinkError e) { + e.printStackTrace(); + problem = true; + + } catch (Exception e) { + System.out.println("exception building serial menu"); + e.printStackTrace(); + } + + //if (serialMenu.getItemCount() == 0) { + //System.out.println("dimming serial menu"); + //serialMenu.setEnabled(false); + //} + + // only warn them if this is the first time + if (problem && PdeBase.firstTime) { + JOptionPane.showMessageDialog(this, //frame, + "Serial port support not installed.\n" + + "Check the readme for instructions\n" + + "if you need to use the serial port. ", + "Serial Port Warning", + JOptionPane.WARNING_MESSAGE); + } + return list; + } + */ + + diff --git a/todo.txt b/todo.txt new file mode 100644 index 000000000..3c8236435 --- /dev/null +++ b/todo.txt @@ -0,0 +1,1251 @@ +0165 pde (1.0.3) +X no changes in this release + + +_ add option to use full screen exclusive mode on present inside pde? +_ override default setting of macosx (yes) and linux/win (no) +_ http://dev.processing.org/bugs/show_bug.cgi?id=1043 +_ linux present mode isn't working properly + +_ make better version of the windows launcher for debugging + +_ update to java 6u12 + +X try adding a space to the name of the help menu for beachball problems +_ this works, might be useful to make the switch +_ disable sketchbook and examples menus on os x? + +_ after deleting a tab code still get's preprocessed, pde file is not forgotten +_ http://dev.processing.org/bugs/show_bug.cgi?id=1092 + +_ proper libraries warning dialog +_ check if libraries folder does not exist +_ check to see if other libraries are installed +_ warn user about moving libraries and restarting + +E2 _ Default wildcard imports are causing naming conflicts +E2 _ http://dev.processing.org/bugs/show_bug.cgi?id=1103 + +_ fix isManagingFocus error inside JEditTextArea + +_ windows exported exe problems (pcho) +_ lib folder goes missing, give an error +_ also any .jar files that are missing, give an error +_ showing more debug messages (command line?) + +_ can't rename a .pde file as a .java file +_ shift-tab with no selection should go back two spaces + +_ add general outline of 1.5 and 2.0 releases to the faq +_ video is on its way out, no good/simple solution for fixing now +_ andreas' library will do good things eventually + +_ move library examples to the examples menu +_ do this once the library documentation has been fixed up + +_ need to do a better job of error handling inside main() + +4 _ mangled menu text with java 6u10 +4 _ need to try adding the d3d flag to the .exe +4 _ http://dev.processing.org/bugs/show_bug.cgi?id=1065 + + +[ needs verification ] + +_ export and export to application fail with umlauts in folder name +_ http://dev.processing.org/bugs/show_bug.cgi?id=252 +_ stop button needs to update itself and work properly [1.0] +_ also editor buttons to light up and clear properly +_ http://dev.processing.org/bugs/show_bug.cgi?id=396 +_ need someone to go out and test all scenarios of this + + +[ known bugs ] + +_ command line support is currently broken +_ http://dev.processing.org/bugs/show_bug.cgi?id=1048 +_ some fixes can be found in the bug report +_ video library threading problems with other libraries +_ http://dev.processing.org/bugs/show_bug.cgi?id=882 +_ using Capture.list() before size() sometimes works +_ also placing OpenGL inside the extensions directory +_ serial.available() broken with video +_ http://dev.processing.org/bugs/show_bug.cgi?id=829 +_ first few frames of OpenGL sketches on Windows run slowly +_ http://dev.processing.org/bugs/show_bug.cgi?id=874 +_ Slow response or spinning wheel from the menu bar on Mac OS X +_ http://dev.processing.org/bugs/show_bug.cgi?id=786 +_ sometimes not launching +_ this seems to be a threading problem, like an NPE on load/open +_ probaby related to the other load/save sync errors +_ significant point() and set() slowdown on OS X +_ http://dev.processing.org/bugs/show_bug.cgi?id=1094 + + +with casey +_ specifically add "eclipse" to integration description +_ link books and sample chapters from the "getting started" portion of the faq +_ keep examples.zip in a zip file? (5000 files @ 30 MB instead of 15 MB zip) +_ mark examples as untitled (rather than read-only) +_ maybe even pull these directly from the zip file? +_ load examples from zip files +_ http://dev.processing.org/bugs/show_bug.cgi?id=1049 +_ disallow add file to sketch, export, export application +_ pretty much anything inside the sketch? +_ but don't do this with untitled, cuz it kinda stinks +_ this is too weird--just put examples into individual zip files +_ mark example files as untitled +_ though will that require the sketch to be saved before export? +_ find in reference issues +_ if() and for() don't work, they look for for_.html instead of for.html +_ XMLElement is not linked for find in ref +_ the ? operator is not in find in ref (no ref page either?) +_ update keywords generator script on the site +_ perhaps move this closer to the dev process? +_ move reference folder around so that it matches site organization +_ otherwise several links break on the main faq page +_ discuss i18n issues and proper system (?) +_ look through 404 issues on the site +_ TRIANGLE_STRIP not highlighted for "find in reference" +_ nor is it listed on the reference page +_ so students can't find the ref for it +_ needs to link TRIANGLE_STRIP to the beginShape() reference + + +libraries and classpaths [1.0] +_ versioning info +_ http://java.sun.com/j2se/1.5.0/docs/guide/extensions/versioning.html +_ java.ext.dirs for /System/Library/Java/Extensions +_ http://java.sun.com/j2se/1.5.0/docs/guide/extensions/spec.html +_ can set java.ext.dirs to something else +_ on osx, just ignore anything in /Library/Java/Extensions (but not others)? +_ native lib stuff, use native.txt in lib folder, then: +_ String osName = System.getProperty("os.name"); +_ String osArch = System.getProperty("os.arch"); +X update to jogl 1.1.1 +X do this with enhanced library/platform support +X see how platform is determined by jogl / use for lib import +_ add control for dependencies (i.e. svg needs xml), needed for export +_ http://dev.processing.org/bugs/show_bug.cgi?id=518 +_ add "pretty menu name" to the export.txt file +_ move export.txt to xml? (nah, it's only flat information) +_ need better platform designation setup for libs +_ library installation should use the sketchbook folder, not the p5 folder +_ actually enforce this, give users a warning about other libs +_ need to deal with classpath conflicts +_ avoid garbage that people have installed on their machines +_ antlr.jar in the classpath will cause trouble.. +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1138652326 +_ jogl jar files, or jogl install will cause trouble +_ /System/Library/Java/Extensions or /Library/Java/Extensions +_ the /System one contains qtjava +_ the /Library one is empty (by default), maybe skip it? +_ when a conflicting library is found, need to report it +_ altho prolly only when it's actually different (md5hash it?) +_ this seems to be causing a lot of trouble with recent releases +_ (opengl changes and whatnot) +_ jar files like the bad aiexport plugin will cause serious problems +_ need to ignore processing.core classes showing up in other jar files +_ tougher than it looks, because it all depends on what java wants to use +_ i.e. even if not specified, the stuff will be in the classpath +_ need to make classpath code be less promiscuous +_ the order of adding libraries to classpath should be opposite +_ the important local libraries should be first in cp, user contrib later +_ http://dev.processing.org/bugs/show_bug.cgi?id=321 +_ java.extension.dirs has the library/extn stuff +_ can probably set this blank +_ the jar from which a class file has been loaded +_ getClass().getProtectionDomain().getCodeSource().getLocation().getFile() +_ example from jsyn +JSyn Installer build 011 +java.vm.version = 1.5.0_07-87 +java.library.path = .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java +java.ext.dirs = /Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext +Installing Native library JSynV142 +Copy: http://www.softsynth.com/jsyn/plugins/archives/libJSynV142.jnilib + to: /Users/fry/Library/Java/Extensions/libJSynV142.jnilib +Native component JSynV142 downloaded successfully. +Installing JAR file JSynClasses.jar +Copy: http://www.softsynth.com/jsyn/plugins/archives/JSynClasses.jar + to: /Users/fry/Library/Java/Extensions/JSynClasses.jar +JAR file JSynClasses.jar downloaded successfully. +Note: you must restart your browser before running any JSyn Applets! +Installation completed. +_ set DYLD_LIBRARY_PATH to include .dylib and other framework stuff +_ java.library.path will only handle .jnilib stuff +_ need better error messages for broken api / library troubles +_ e.g. ocd is broken in 0125 because of method signature changes +_ could have library developers update compatability note +_ so they would need to test library and say "compatible with 0110" +_ before it would automatically update or show as an update +_ tools -> get library +_ library url: [ http://blahblah.org/something ] +_ this would grab something.version, and something.zip +_ maybe something.xml that would include a bunch of background +_ tools -> update libraries +_ this would check the something.version to see if it's newer +_ document how to add libraries: put in sketchbook (not libraries folder) +_ library/download.url and library/home.url +_ if there's a reference subfolder, add that to the help menu +o and enable it for "find in reference" +X nice idea but too error-prone + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + +DOC / Bugzilla + +_ add bug voting to the bugs db before 1.0 release? +_ remove LATER, REMIND, WORKSFORME as categories; add VERIFY +_ set default reported bug priority to 4 or 5 +_ * disable changes to a bug (except by admin) after closed * +_ fix "reply" garbage added +_ fix "back to bug# 778" +_ remove patch designation +_ make severity a radio button (people aren't using it) +_ change to just ( ) Problem ( ) Feature Request (remove 'severity') +_ remove 'platform' dropdown +_ specify some versions? also add back a "target version" for fix? +_ explanation of P1 through P5 +_ goes to bugs page +_ longer description of "i found a bug" +_ what was the unfinished bullet item? +_ also something i forgot to add to the opengl faq stuff +_ move the bugs section of the troubleshooting page to dev.processing.org/bugs +_ search for ALL in the bugs db turns up: +http://dev.processing.org/bugs/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED +http://dev.processing.org/bugs/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED +_ http://dev.processing.org/bugs/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&query_format=advanced&order=bugs.priority,bugs.priority%2Cbugs.resolution%2Cbugs.bug_id&query_based_on= +_ add note to bugs db asking to please use archive sketch and attach +_ make a web page that describes how to use the bugs db +_ don't change the bug subject/summary text +_ don't mess with priorities (i will) +_ need to change what people can edit in the bug report +_ do something about the bug summary field to not make it editable +_ maybe just move it away from its current location? +_ call it "bug title" instead of "summary"? +_ http://dev.processing.org/bugs/show_bug.cgi?id=253 +_ layout problems with attachments page +_ http://dev.processing.org/bugs/show_bug.cgi?id=254 +_ layout problems with logout page +_ http://dev.processing.org/bugs/show_bug.cgi?id=255 +_ bug duplicate text field doesn't retain focus +_ http://dev.processing.org/bugs/show_bug.cgi?id=256 +_ finish putting all the bugs into bugzilla +_ add a notation to the bugs site re: reading the faq and searching first +X move p5 site bug reporting to bugzilla +_ do the same for suggestions +_ and detail the suggestions policy on the dev site: diy +_ post a page explaining the bug reporting system +_ arrays (frequent questions) +_ using arraylist (avoid vector) +_ cannot use generics +_ using mod to avoid shifting an array +_ append is slow, arraycopy is fast +_ whether arraycopy works to copy array to itself +_ using expand and arrays to move quickly + + +DOC / Write Me + +_ PDE locks up during setup() (since no window shown) +_ http://dev.processing.org/bugs/show_bug.cgi?id=687 +_ maybe better to do an example of running code on another thread +_ when it's done as a script +_ stop() to shut down a sketch (but not quit/close window) +_ MIN_FLOAT, MAX_FLOAT, also the difference from the Java functions +_ also MIN_INT and MAX_INT, even though those are more similar +_ update the reference to cover parseXxxx() stuff +_ also add notes about parseInt/Float(blah, otherwise) +_ also parseInt and parseFloat, how they can return another number or NaN +_ should the default be NaN or 0? +_ get/set are faster way draw screen space images, but no tint, no translations +_ make sure the docs include "beginShape() cannot be nested" +_ also add error messages to the renderers +_ also note that ellipse() et al use beginShape() +_ and that java2d should complain if people try it +_ method to go from function name to the included examples where used? +_ encourage use of set() instead of point() in the drawing api +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114204116 +_ moviemaker video sizes / usability +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Exhibition;action=display;num=1211318862 +_ other projects on which p5 is built +_ no longer oro matcher and jikes +_ add: quaqua, jna, registry stuff, .. ? +_ quicktime likes to crash (not just on windows) +_ http://dev.processing.org/bugs/show_bug.cgi?id=791 +_ noLoop() isn't the same as "finished", though it's sometimes used that way +_ to finish, use exit() (though that will make the window close) +_ add this to ref once halt() is finished +_ errors in pdf/index.html examples +_ probably remove these, move the useful ones to the examples folder +_ that way people will read the reference +_ i can't fix these: +An unexpected error has been detected by HotSpot Virtual Machine: +# EXCEPTION_ACCESS_VIOLATION +all i can do is find things that might trigger them, but it's more likely +than not to be a java problem, and not something that can be fixed +_ notes about getting best results from text in each renderer +_ http://dev.processing.org/bugs/show_bug.cgi?id=466 +_ add to mac reference for present mode +_ can make full screen work via Info.plist key +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1135921427;start=7#7 +_ add to troubleshooting +_ problem with big floats: +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1061302380 +_ problem with small floats: +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1115500448 +_ fix syntax highlighting of focusGained and others +_ http://dev.processing.org/bugs/show_bug.cgi?id=659 +_ verify (and document) public access members of PApplet +_ http://dev.processing.org/bugs/show_bug.cgi?id=660 +_ some docs missing (therefore not syntax highlighting) +_ http://dev.processing.org/bugs/show_bug.cgi?id=661 +_ constants that are not highlighting (WINDOWS the only one?) +_ http://dev.processing.org/bugs/show_bug.cgi?id=662 +_ consoleXxxx and untitledXxxx folders in /tmp +_ console may be useful for debugging +_ untitled folders are stored in temp folder +_ switching into present mode in info.plist + LSUIPresentationMode + 4 +_ PApplet.this doesn't work +_ doesn't work in javac either--needs to be ClassName.this +_ sketchname.this also doesn't work, because Temporary_NNNN used for name +_ but since it's another tab/class, will run externally +_ so should make the external version use the actual sketch name not temp +_ can't use PApplet.this, doesn't seem to like that +_ instead, must pass variable to inner class +_ errors with serial and libraries +Exception in thread "Thread-2" java.lang.NoClassDefFoundError: +processing/core/PApplet + at processing.serial.Serial.(Serial.java:156) +generally, that error means that something is missing from the +CLASSPATH. the NoClassDefError gives erroneous feedback about *what* +class is actually missing, as of java 1.3+ (yay!) +so perhaps conflicting versions of a library in the sketchbook (solve +this by setting to an empty sketchbook temporarily) or files might be +installed in the CLASSPATH variable or something conflicting in +/System/Library/Extensions. + + +DOC / Text + +_ how to use textMode(SHAPE) with opengl +_ things will be extremely slow (fix later) +_ things will also be very ugly on-screen +_ text being nicer in java2d +_ use createFont() to load the font or use a font from your machine +_ note that createFont() is no good for applets/export to web +_ textMode(SCREEN) for P2D and P3D for nice fast text in screen space +_ currently slow in JAVA2D and OPENGL, but this will improve +_ what is the vlw font file format? +_ shapes from 3D type +_ the way to do it (will improve later) is to use some undocumented features +_ 1) you have to use the OPENGL renderer +_ 2) use textMode(SHAPE); +_ 3) use createFont() (which you already are) +_ this will convert all the shape data from the fonts for writing. +_ it will be *extremely* slow, which is part of why it's not documented yet. +_ but it will work with beginRaw(). + + +DOC / Discourse Board + +_ auto-close threads when not posted to for 30(?) days +_ add basic guidelines for posting to the board +_ 0. be polite. going on about how much something "sucks" or is "stupid" will make you look like an eight-year-old. +_ 1. don't double (or triple) post +_ 2. if you're having trouble, first see the troubleshooting page +_ 3. if you have a bug, first search the bugs database +_ 4. first check the FAQ +_ 5. use the search bar at the top of every page +_ 6. read revisions.txt +_ someone wrote up an initial version of this +_ how to put [code] around blocks of code +_ also mention contributed plugin for formatting +_ also the reference page on the bb commands +_ i don't answer to instant messages +_ i don't answer email +_ use the bugs db instead of the bugs board +_ use the search box (not the forum search) +_ read the faq, read the faq +_ read the reference.. right-click on a word and choose "find in ref" +_ non-processing posts will be deleted (not a java discussion board) +_ no duplicate posts - find an area and post to +_ explanation of what the areas are +_ be sure to look at the reference, especially the extended reference +_ questions like 'how do i do x' are often solved by looking at the api +_ for instance, to get the framerate, use framerate() + + +DOC / Other + +_ why adding .0001 to a float doesn't work +_ and how they're imprecise in general (use nf) +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1130877990 +_ why strong typing? (link also to language thing on main page) +_ we cannot commit to any sort of timeframe on releases +_ under the hood - basic +_ it's all java +_ don't use awt +_ most things are imported by default +_ under the hood - complex +_ how to get started with coding +_ everything subclasses PApplet +_ if you need a particular name, add it with "extends PApplet" +_ all code from tabs is joined to one sketch +_ if you want it separate, then you have to make .java files +_ in doing so, you'll lose access to 'g' +_ add main() to your app to make it run on its own +_ preproc stuff.. have to make setup() into public void setup() +_ (same for key events and all that) +_ performance +_ video stinks.. java2d stinks.. macs stink +_ note in the 'drawing in 2d' section of faq +_ fastest machine possible +_ turn off hyperthreading in the bios +_ nice gfx card only helps opengl +_ dual processor not particularly useful, unless you make more threads +_ but making more threads is often more work than is useful +_ is there a way to do xxx? +_ advanced users who are outgrowing the basic reference: +_ be sure to check the "complete" reference +_ change bugs.html to issues.html +_ and add a redirect in httpd.conf +_ need to document how subclass of pgraphics works +_ what are the necessary bits that need to be subclassed +_ simple handling of colors, what fields are available +_ how to get the matrices +_ simple endshape handler + + +DOC / Site + +_ also mention in keyPressed docs that ASCII key codes will not be coded +_ it's just how java is (maybe this is already in there?) +_ add note about adding libraries to the sketchbook to the reference +_ add note in environment reference about how to add something to the sketch +_ (code, .java files, etc) +_ make sure that psound has been removed (from docs, ref, mentions) +_ make source link on p5 site go direct to the source +_ or at least explain how to navigate +_ post releases on sourceforge so that international mirrors are better? +_ start creating source tarball for each release? +_ roll over the discourse board for 1.0? +_ board stuff +_ only allow moderators to delete posts +_ set "no smileys" as the default (better for posting code) +_ add stuff about the history into the people section +_ descended from dbn, but not dbn, etc.. +_ remove the 'search' item from yabb.cgi + + +DOC / Examples + +_ add to key reference a pointer to an example that tracks all keys +_ write simple example that tracks all keys +_ making things fast with pixel operations +_ write a threading example +_ show an example of how to handle callback into the app +X or handle this some more intelligent way, super.stop() is needed. +X registerDispose() does the trick +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083574943 +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1067383998 +_ scripts: how to make a long setup() sleep so that things don't lock way up +_ write an example that uses HashMap (or Hashtable) +_ write an example that uses ArrayList properly +_ get xml library example in there +_ simple method for having a clickable region or sprite with rollover + + +DOC / Hacks + +_ clipboard implementation example +_ http://dev.processing.org/bugs/show_bug.cgi?id=167 +_ JAI handles setting image size for png (check javax.imageio?) +_ PNGEncodeParam png = PNGEncodeParam.getDefaultEncodeParam(bufImage); +_ png.setPhysicalDimension(round(dpi*39.370079), round(dpi*39.370079), 1); +_ JAI.create("filestore", bufImage, filename+".png", "PNG"); +_ also an example of setting the jpeg compression (included in bug report) +_ http://dev.processing.org/bugs/show_bug.cgi?id=342 +_ write a timer class/example library +_ post to web example +_ particularly for uploading image data +_ along with php script to handle receive +_ this is in hacks, but +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1117194066#7 +_ how do i add gui to a sketch? +_ don't use awt components +_ how to use swing and embed components inside p5 +_ explain how to integrate code with swing +_ use a separate environment, call init(), use noLoop(), redraw() +_ use JPopupMenu.setDefaultLightWeightPopupEnabled(false); for zorder +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Integrate;action=display;num=1147670059 +_ write documentation on general use of processing.core +_ note that applet is itself a Component +_ eclipse +_ document how to properly integrate with eclipse +_ add runtime args to opengl library so that it sets path properly +_ add explanation for using subclipse to get p5 +_ make a src folder, data folder location +_ export to eclipse +_ how to do this with subclipse instructions? + + + +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// + +PDE - Processing Development Environment + + +PDE / Warnings + +_ proper dialog support +_ http://javagraphics.blogspot.com/2008/06/joptionpane-making-alternative.html +_ two-tiered dialogs for everything - use big font/little font style throughout +_ option to suppress warning dialogs +_ starting with the one about modifying the sketch name for spaces +_ http://processing.org/bugs/show_bug.cgi?id=3 +_ the first time someone hides a tab, put up a msg explaining what it does +_ "don't warn me about this anymore" +_ add "don't warn me about this" for sketch renaming +_ make sure renamed version doesn't exist already +_ prompt user before nuking applet or application folders +_ along with a "don't ask me later" +_ include a note that 'applet' folder will get emptied/rewritten +_ or rename the old applet folder to something else? (too messy) +_ http://dev.processing.org/bugs/show_bug.cgi?id=61 + + +PDE / Compiler & Preprocessor + +_ add local variables to PdeRecognizer +_ remove static methods in PdePreprocessor, instead pull things from recog +_ need better error messages in general +_ some means to link out to further documentation (e.g. AIOOBE, NPE) +_ add support for multiple errors from the compiler +_ actual error may be 4th of 5 +_ maybe a dropdown list thing, with the first just shown? +_ http://dev.processing.org/bugs/show_bug.cgi?id=58 +_ with additional .pde files, don't allow static mode in front tab +_ don't allow "for (blah; blah; blah) ;" +_ or if (blah blah blah) ; +_ it's never useful. students can use { } if they want an empty block +_ Update ANTLR grammar to support 1.5 syntax +_ http://dev.processing.org/bugs/show_bug.cgi?id=598 +_ preproc cant handle labels to break/continue nested loops +_ http://dev.processing.org/bugs/show_bug.cgi?id=631 +_ imports inside comments are being included +_ toInt() needs to go away in time for the book.. fix parser bugs +_ using a processing keyword as a variable name gives unhelpful error message +_ http://dev.processing.org/bugs/show_bug.cgi?id=213 +_ casting problems in the parser +_ straighten out int() -> toInt() conversions +_ float u = float(x)/width; works. +_ float u = (float(x)/width); doesn't work: "unexpected token: float". +_ float u = (x/float(width)); works! +_ http://dev.processing.org/bugs/show_bug.cgi?id=4 +_ return (int(5.5)) causes an error +_ random, single slash in the code doesn't throw an error +_ (just gets removed by the preprocessor) +_ http://processing.org/bugs/show_bug.cgi?id=6 +_ allow doubles in preproc +_ (for casting, etc) particularly for Math.cos() et al +_ http://processing.org/bugs/show_bug.cgi?id=7 +_ don't allow goofy case versions of reserved words +_ keypressed should maybe throw an error +_ http://dev.processing.org/bugs/show_bug.cgi?id=9 +_ missing brackets, unmatched brackets +_ http://dev.processing.org/bugs/show_bug.cgi?id=13 +_ "unexpected token void" -> "You're mixing dynamic and static mode" +_ http://dev.processing.org/bugs/show_bug.cgi?id=14 +_ expecting RPAREN messages are ugly +_ http://dev.processing.org/bugs/show_bug.cgi?id=15 +_ not enough args for triangle (or args in general) +_ throws out bizarre message +_ http://dev.processing.org/bugs/show_bug.cgi?id=17 +_ if 'void' left out before loop or setup, cryptic message about +_ 'constructor loop must be named Temporary_23498_2343' +_ add a better handler for this specific thing? +_ http://dev.processing.org/bugs/show_bug.cgi?id=18 +_ using a keyword as a variable name gives unhelpful error message +_ http://dev.processing.org/bugs/show_bug.cgi?id=212 +_ unspecified return type creates compile error +_ or maybe not? followup said maybe not +_ http://dev.processing.org/bugs/show_bug.cgi?id=379 +_ Blah.class will confuse the preproc +_ http://dev.processing.org/bugs/show_bug.cgi?id=481 +_ non-matching curly brackets sometimes don't cause an error +_ http://dev.processing.org/bugs/show_bug.cgi?id=507 +_ syntax highlighting error with // and /* +_ http://dev.processing.org/bugs/show_bug.cgi?id=609 +_ "missing a /* from the end of a comment" message +_ enter a bug for this, it's bound to be found +_ "multipart/*" produces the error +_ even though things are inside a quoted txt block +_ copy running code from /tmp/buildXXxxx on crash of p5 +_ should probably make a way to save/recover code +_ make the buildXxxx folders relate to time/date? +_ NullPointerException on unterminated comment at end of code +_ and OutOfMemoryError and weird lockup +_ http://dev.processing.org/bugs/show_bug.cgi?id=16 +_ also OutOfMemoryError if a quote is not terminated +_ http://dev.processing.org/bugs/show_bug.cgi?id=763 +_ preprocessor error if last line of code is a comment with no CR after it, +_ an OutOfMemoryError wants to happen, +_ but right now there's a hack to add a CR in PdePreprocessor +_ http://dev.processing.org/bugs/show_bug.cgi?id=5 +_ Parsing error when using char literals +_ http://dev.processing.org/bugs/show_bug.cgi?id=281 +_ Improve detection and handling of missing semicolons +_ http://dev.processing.org/bugs/show_bug.cgi?id=1036 + + +PDE / Editor + +_ improve update check message "a new release (1.0.1) is available" +_ be more descriptive, use a second line in latest.txt +_ maybe just include the full text of the update message there? +_ go through other sketch-opening menus to check for disappearing sketches +_ deal with isManagingFocus() warning in the editor src +_ should really be doing the 'right' thing with sketch file handling +_ create temporary file when saving +_ once done writing, use remove the original and rename the old +_ some basic stuff like this.. +_ http://dev.processing.org/bugs/show_bug.cgi?id=968 +_ when disk is full, Processing zeroes files when it tries to save changes +_ http://dev.processing.org/bugs/show_bug.cgi?id=967 +_ sketch marked as modified too aggressively +_ http://dev.processing.org/bugs/show_bug.cgi?id=328 +_ Closing the last window doesn't cause PDE to save its position/contents/etc +_ (when the pref for close last window = quit is set) +_ http://dev.processing.org/bugs/show_bug.cgi?id=835 +_ not remembering window size/placement preferences +_ http://dev.processing.org/bugs/show_bug.cgi?id=837 +_ saved window positions.. if displays has changed, becomes a problem +_ record the display that it was on? +_ GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice(); +_ make sure that the application is within the bounds of the current display? +_ (from 0, 0 to width, height) +_ messy since some displays have negative coords +_ http://dev.processing.org/bugs/show_bug.cgi?id=72 +_ [LaunchRunner Error] processing.app.Base.main(String[]) threw an exception +_ http://dev.processing.org/bugs/show_bug.cgi?id=821 +_ file-save stops running sketch +_ http://dev.processing.org/bugs/show_bug.cgi?id=810 +_ strange NullPointerException problem prevents launch +_ some kind of NPE in handleOpenInternal and friends +_ appears to be a synchronization problem with the loading +_ when opening from double-click on the mac, doesn't replace untitled +_ or in general, issues between opening new window and another launching +_ probably need to synchronize the file open methods inside Base +_ (could in fact cause nastiness with editors[] access) +_ editors opening up at the same time on load? +_ either synchronize the open (at a minimum) +_ or wait for mac handlers to register an open event +_ can also cause problems with opening multiple copies of same sketch +_ after fixing name of sketch, ensure sketch of that name does not exist +_ do quick fix for tab bar +_ don't show tabs when there are too many +_ maybe move the list of files to the top? +_ or indicate which are visible somehow +_ slightly longer.. rearrange? +_ or just show tabs in (alpha?) order based on what's most recently used +_ have some indicator that shows the tabs when they've disappeared +_ or little mini tabs that expand/contract? +_ and a way to control who's expanded and not +_ add auto-save to the editor +_ http://dev.processing.org/bugs/show_bug.cgi?id=739 +_ dragging title bar while sketch running causes strange selection behavior +_ http://dev.processing.org/bugs/show_bug.cgi?id=504 +_ shortcuts not working after rename? (osx only?) +_ http://dev.processing.org/bugs/show_bug.cgi?id=505 +_ convert tabs to spaces when pasting text +_ http://dev.processing.org/bugs/show_bug.cgi?id=506 +_ add "recent files" list to open menu? +_ unchecking 'use external editor' sketch should not set modified +_ dangerous if a version that hasn't been re-loaded has possibility +_ to overwrite. i.e. make a change and save in external editor, +_ don't actually +_ when running with external editor, hide the editor text area +_ http://dev.processing.org/bugs/show_bug.cgi?id=20 +_ horizontal scroller gets weird sometimes +_ http://dev.processing.org/bugs/show_bug.cgi?id=23 +_ lock the minimum size for the main processing editor frame +_ if it's made too small, stuff from the bottom disappears +_ http://dev.processing.org/bugs/show_bug.cgi?id=25 +_ add mnemonics for menus (alt-f to open 'file') +_ http://dev.processing.org/bugs/show_bug.cgi?id=26 +_ option to just print all code in project +_ option to export all the code as colored html +_ http://dev.processing.org/bugs/show_bug.cgi?id=28 +_ "page setup" sucks in java +_ http://dev.processing.org/bugs/show_bug.cgi?id=435 +_ rename/saveas doesn't properly have its focus set +_ under windows, immediately typing after rename doesn't select +_ the whole thing is selected, but not directly editable +_ http://dev.processing.org/bugs/show_bug.cgi?id=31 +_ dim edit menus as appropriate during selection/no selection/etc +_ http://dev.processing.org/bugs/show_bug.cgi?id=33 +_ Ctrl-Z will undo, but not scroll to where the undo happens. +_ so user thinks nothing is happening and overundo. +_ http://dev.processing.org/bugs/show_bug.cgi?id=35 +_ undo has become sluggish +_ http://processing.org/bugs/show_bug.cgi?id=36 +_ fonts smaller than 10 cause problems in the editor +_ generally causes trouble on osx +_ on windows and linux, changing the size throws things off +_ http://processing.org/bugs/show_bug.cgi?id=51 +_ code coloring is imperfect because it's not based on a parser +_ i.e. mousePressed() is red but mouseMoved() is brown +_ http://dev.processing.org/bugs/show_bug.cgi?id=113 +_ clicking i-- ) between -- and ) will select "-- )" +_ in eclipse, it looks to see which is closest and selects that +_ need to check behavior for word and bbedit +_ http://dev.processing.org/bugs/show_bug.cgi?id=348 +_ implement emacs keybindings (list is at the bug report) +_ http://dev.processing.org/bugs/show_bug.cgi?id=401 +_ implement better method of showing curly brace closure +_ http://dev.processing.org/bugs/show_bug.cgi?id=295 +_ sketches should only write to the console of their editor window +_ http://dev.processing.org/bugs/show_bug.cgi?id=921 + + +PDE / Editor Buttons + +_ run button not properly unhighlighting +_ does it unhighlight after compile or runtime errors? +_ also when using draw() instead of loop() +_ applet needs to notify runner that it has terminated +_ http://dev.processing.org/bugs/show_bug.cgi?id=38 +_ check 'finished' via objectreference? +_ make the run button highlight immediately +_ or maybe show an animation for starting up +_ rather than post-compile +_ http://dev.processing.org/bugs/show_bug.cgi?id=776 +_ if export fails (compile error) need to un-highlight the export button +_ http://dev.processing.org/bugs/show_bug.cgi?id=39 +_ when holding down shift, show the alternate behavior for EditorHeader +_ http://dev.processing.org/bugs/show_bug.cgi?id=37 + + +PDE / Editor Header + +2 _ make some fancy extendo things because the tabs get too big +2 _ either condense or popdown menu thingy +2 _ http://dev.processing.org/bugs/show_bug.cgi?id=54 +5 _ key command for prev/next tab works, but not menu +5 _ menu options are actually disabled because of inconsistency +5 _ http://dev.processing.org/bugs/show_bug.cgi?id=1044 + + +PDE / Editor Status + +_ error messages run off the edge and go invisible +_ http://dev.processing.org/bugs/show_bug.cgi?id=57 +_ move all prompts to modal dialog showError/Message/Warning/Prompt +_ nicely design dialog boxes to go with visual of p5 +_ maybe something that shows stack trace? +_ with an 'email this' button? (include source code too?) +_ also need a "prompt" dialog for asking filenames, etc +_ implement and remove PdeEditorStatus stuff +_ http://dev.processing.org/bugs/show_bug.cgi?id=59 + + +PDE / Export + +1 _ replace applet.html and applet-opengl.html +1 _ http://dev.processing.org/bugs/show_bug.cgi?id=1057 +1 _ update applet.html to point at java 6u10 with the new auto-update stuff +1 _ also update applet on the home page to do the same +4 _ failed export still copies random files +4 _ Failed compile on Export or Export to Application +4 _ still creates folder and leaves mess behind +4 _ http://dev.processing.org/bugs/show_bug.cgi?id=1050 +_ when exporting to application (or applet) don't copy .java files from folder +_ (they'll be copied as source files later) +_ make .java files and friends go to correct locations on export (app) +_ warn on export when people call their sketches things like Server +_ warn if someone extends PApplet but mis-names the sketch +_ or don't allow it to be exported +_ add bug reference to the faq once added to the db +X or at least add a note about this to the faq +_ show error when no main() is included but class extends PApplet +_ error can happen or be checked +_ errors during export don't show up properly (no red status bar) +_ http://dev.processing.org/bugs/show_bug.cgi?id=194 +_ need to decide how to handle "stop" button in present mode +_ http://dev.processing.org/bugs/show_bug.cgi?id=63 +_ when running externally, people need to write their own stop function +_ just get export to application working so this can be supported +_ for now, they're stuck w/ running in the env and getting the ugliness +_ make export put a timestamp in the html code (hidden or visible) +_ http://dev.processing.org/bugs/show_bug.cgi?id=66 +_ exporting application copies .java files +_ .java files are copied to the root folder as well as the source folder +_ javadoc comment in a static mode app doesn't get moved to the top +_ http://dev.processing.org/bugs/show_bug.cgi?id=924 + + +PDE / Find & Replace + +_ all around very ugly, fix it up +_ http://dev.processing.org/bugs/show_bug.cgi?id=67 +_ several tweaks +_ http://dev.processing.org/bugs/show_bug.cgi?id=68 +_ only enable "find next" in menu after a find has happened +_ allowing to find & replace over multiple tabs +_ http://dev.processing.org/bugs/show_bug.cgi?id=69 + + +PDE / History + +_ implement new version of history +_ http://dev.processing.org/bugs/show_bug.cgi?id=71 +_ make history folder, and a zip (not gz) file for each entry +_ history causing trouble - super slow with a huge sketch +_ could instead be gzipped and appended to history.dat +_ along with another file that is actually a table of offsets +_ no need to make the thing a gzip stream +_ checkbox on menu for 'record history' ? +_ history converter option? +_ only first 20 entries visible? +_ shortcut to walk through history, ala photoshop (ctrl-alt-z) +_ zlib file becoming corrupt (not flushed after close?) +_ make hooks to history api so others can write tools around it + + +PDE / Preferences + +_ prefs window doesn't swap ok/cancel properly for mac vs. windows/linux +_ don't bother having a "cancel" for the prefs window +_ rewrite preferences window to use proper layout? +_ is there already a bug for this? +_ make prefs dialog modal? +_ prefs window not visible on windows taskbar +_ http://dev.processing.org/bugs/show_bug.cgi?id=438 +_ split Preferences and PreferencesFrame? +_ http://dev.processing.org/bugs/show_bug.cgi?id=74 +_ preferences window has been hit with the ugly stick +_ redo panel to use proper Box layout etc +_ also needs to look good across all platforms +_ http://dev.processing.org/bugs/show_bug.cgi?id=73 +_ make available the background colors for present mode, stop button color +_ isolate color chooser into a simpler/smaller class outside tools +_ then can also use from inside processing applications as well +_ http://dev.processing.org/bugs/show_bug.cgi?id=75 +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1130781367;start=2#2 +_ add ability to set the display where present mode makes things start +_ code is already in, need to add window and test with multi-monitor setup +_ some code already written in PresentMode.java +_ option in preferences to set the jvm used to run? (osx only?) +_ this would take care of nasty macosx 1.4 vs 1.5 issues +_ /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Commands/java +_ /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java +_ /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java +_ canonical path for +_ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK +_ will return 1.5.0 (or maybe 1.6 for others?) + + +PDE / Runner + +_ draw mode apps do not shut off the run button when finished +_ need to talk to VM and read when 'finished' var is set +_ does closing the window call stop()? +_ need to make sure hitting stop button and closing window explicitly call +_ set finished to true, then join() the animation thread +_ stop() not working very well +_ as a result, dispose() methods aren't being called on libraries +_ http://dev.processing.org/bugs/show_bug.cgi?id=77 +_ quitting from present mode doesn't kill run button +_ http://dev.processing.org/bugs/show_bug.cgi?id=80 +X when running externally, set window frame title to the sketch name +X is this only a problem on macosx? +_ need to set dock icon title on osx + + +PDE / Sketch & Sketchbook + +_ don't reload sketch on "save as" +_ this can result in loss of data (undo is lost) +_ http://dev.processing.org/bugs/show_bug.cgi?id=433 +_ ArticulatePrint-070103a.pde from ArticulatePrint-070103a loads ok +_ but when opening the sketch, it leaves out the file +_ because there's a dash in the name +_ and instead only loads StemCell.pde +_ show progress dialog during export and save +_ slow save/new because of large sketchbook +_ this is a total cluster, the rebuild is being called incessantly +_ startup is very slow on g4 +_ show progress bar while rebuilding sketch menu? +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1162801212 +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1141126582 +_ even more of a problem becase set modified set true all the time +_ in 0125, only rebuilding on rename or save as, but still a problem +_ don't re-scan all jar files whenever rebuilding sketch menu (cache) +_ http://dev.processing.org/bugs/show_bug.cgi?id=579 +_ in rebuild sketch menu - disable subfolders working as libraries +_ if a sketch, don't allow subfolders +o or maybe just that libraries must be in the root? +o nah, cuz that would mean can't make subfolder called "libraries" +_ is the 'hide' option for code dumb? i've never used it +_ should it just hide the code, not actually remove it? +_ do we finish the tabs thing for 1.0? yes +_ could probably be done in a reasonable simple way.. ala eclipse +_ show additional tabs in the dropdown list? show all? +_ robert's tunnel example, why does tunnel not show up as leftmost tab? +_ hitting ESC on "create this, move file, continue" opened anyway +_ may need a progress bar for "save as" +_ or just the file copy function in general +_ since it may take a long time (i.e. 1000s of screen grabs) +_ http://processing.org/bugs/show_bug.cgi?id=82 +_ "save as" shouldn't always show save as dialog +_ unless that's the current mode that's being used +_ http://processing.org/bugs/show_bug.cgi?id=83 +_ handle renaming with case changes (currently ignores case change) +_ see notes/bitching in Sketch.nameCode() +_ http://processing.org/bugs/show_bug.cgi?id=85 +_ setting sketchbook to a folder on a network mounted drive +_ does this work? test on both on mac and pc.. +_ or if not, should recommend people against it +_ (i.e. folders disappearing if net has trouble) +_ http://processing.org/bugs/show_bug.cgi?id=87 +_ some type of sketch archive format for posting examples (.psk?) +_ would be nice to open a sketch directly from a zip file +_ http://dev.processing.org/bugs/show_bug.cgi?id=88 +_ maybe just open from a zip file, since psk doesn't help anything +_ also have a means of importing sketches + + + +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// + + + +TOOLS / General + +_ need a proper means to handle command keys for tools (?) +_ http://dev.processing.org/bugs/show_bug.cgi?id=140 +_ need method for showing prefs for the tools (?) +_ i.e. add pref to handle date vs. increment on archive sketch +_ tools that need prefs will show their own GUI anyway +_ http://dev.processing.org/bugs/show_bug.cgi?id=883 +_ handle native code for tools menu (?) +_ http://dev.processing.org/bugs/show_bug.cgi?id=884 + + +TOOLS / Ideas + +_ add a command to launch an external editor +_ http://dev.processing.org/bugs/show_bug.cgi?id=141 +_ add tool to "Add custom html to sketch" +_ that copies applet.html, +_ opens sketch folder, +_ and gives info about what to do next (how to edit) +_ http://dev.processing.org/bugs/show_bug.cgi?id=143 +_ tool to run in appletviewer? sun.applet.Main is appletviewer +_ import sketch from url (takes a zip from archive sketch) +_ ftp upload sketch +_ archive sketch direct to bug report +_ courseware +_ export sketch as applet when uploading +_ save sketch zip files +_ have a means to load them from "teacher" version of p5 +_ figure out how to use the +_ shared code +_ Integrator / FloatThing / CameraStuff -- Update +_ to pull code from a local folder +_ update will update classes from shared in the current folder + + +TOOLS / Color Picker + +_ hitting ESC inside Color Selector will quit Processing +_ http://dev.processing.org/bugs/show_bug.cgi?id=1006 +_ pasting into color picker doesn't update the color values +_ http://dev.processing.org/bugs/show_bug.cgi?id=503 + + +TOOLS / Copy for Discourse + +_ occasional exception in "copy for discourse" +_ http://dev.processing.org/bugs/show_bug.cgi?id=729 + + +TOOLS / Auto Format + +_ autoformat fails when there's no newline +_ Auto Format says "too many right parentheses" when last line is a comment +_ http://dev.processing.org/bugs/show_bug.cgi?id=754 +_ install astyle formatter +_ build on each platform, then "lipo -create astyle.* -output astyle" +_ do a better job of maintaining cursor during beautify +_ only auto format a particular section of code +_ set the 'tabs' var based on how many spaces on previous line +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1087227217 +_ removes code with extra parens or braces +_ (an extra } brace deleting everything after it) +_ http://dev.processing.org/bugs/show_bug.cgi?id=109 +_ progressively eats code w/ certain brace settings +_ http://dev.processing.org/bugs/show_bug.cgi?id=235 +_ Auto Format hangs when a non-terminated ' is included +_ http://dev.processing.org/bugs/show_bug.cgi?id=236 +_ hex colors don't get formatted +_ http://dev.processing.org/bugs/show_bug.cgi?id=303 +_ another code example that crashes +_ http://dev.processing.org/bugs/show_bug.cgi?id=363 +_ japanese characters in comments cause trouble with auto-format +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1153505384 +_ arrays are reformatted on each autoformat +_ http://dev.processing.org/bugs/show_bug.cgi?id=259 +_ crash on particular string +_ http://dev.processing.org/bugs/show_bug.cgi?id=363 +_ autoformat screws up with color arrays +_ http://dev.processing.org/bugs/show_bug.cgi?id=760 +_ too many right parens error when there are not +_ http://dev.processing.org/bugs/show_bug.cgi?id=867 +_ code without a new line at end crashes +_ http://dev.processing.org/bugs/show_bug.cgi?id=880 +_ break out as its own plugin + + +TOOLS / Create Font + +_ loading is very slow on the first time (getting all font names) +_ create the tool object on startup, then use thread to getAllFonts() +_ show a progress/status bar while it's happening? +_ (would be useful to at least tell user that system not locked up) +_ create font with user-specified charsets +_ may help solve: http://dev.processing.org/bugs/show_bug.cgi?id=98 +_ when resizing window, only resize the text display area +_ just a matter of moving around the panels and BorderLayout +_ remember previous font selection when returning to the window + + +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// + + +LIBRARIES / General + +_ need to unpack InvocationTargetException in xxxxxxEvent calls +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1116850328#3 + + +LIBRARIES / Video + +_ if read() hasn't been called, can cause an error with java2d +_ http://dev.processing.org/bugs/show_bug.cgi?id=1041 +_ threading problems with video +_ http://dev.processing.org/bugs/show_bug.cgi?id=868 +_ audio stops working after two seconds +_ http://dev.processing.org/bugs/show_bug.cgi?id=277 +_ add more information about multiple camera inputs +_ add info about "access" errors being quicktime errors +_ documented in faq, add something to the lib "camera not installed" +_ quicktime.std.stdQTException(QTjava:6.1.3gl),-9405=couldntgetrequiredcomponent,qtversion:7108000 at quicktime.std.stdQTExceptionchekcerror +_ need to add resize method to capture object +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1150227643 +_ figure out what's up with the qt error handler +_ is this what's preventing the errors from being caught properly? +_ shutting these off for 0116 so hopefully the messages improve +_ (could this be a mac issue with errors not making it through?) +_ need to prevent multiple QTSession open or close +_ static method shared across the lib, or some such +_ reading movie is really really slow (2-3 fps) +_ possible improvement from qtjava list added +_ http://dev.processing.org/bugs/show_bug.cgi?id=40 +_ Movie needs the crop() functions ala Capture +_ tearing and incomplete updates on capture? +_ putting read() inside draw() seems to eliminate this? +_ http://dev.processing.org/bugs/show_bug.cgi?id=114 +_ when drawing large video, the two triangles for the rect are out of sync +_ only shows up in P3D +_ pause and frameRate aren't working +_ framerate does set the frequency which movieEvent will be called, +_ but it is not setting the "available" field corrrectly. +_ in fact, speed() should be used to set the rate, not frameRate +_ sketch .zip file in casey's email message +_ http://dev.processing.org/bugs/show_bug.cgi?id=370 +_ wrong device name for video capture will cause a crash +_ couldn't get req'd component also happens when the capture isn't ready +_ may also mean that no camera is plugged in +_ also, don't mention winvdig on the mac +_ include a separate video class to handle just playback +_ video playback can be much faster if not messing with pixels +_ could instead use texsubimage in opengl, etc +_ only supports tint() (to set alpha or color) and drawing? just drawing? +_ stop button won't kill a video sketch (bug 150 example does this) +X although ESC seems to work? (not sure, didn't test) +_ or audio won't stop even after hitting stop +_ when an exception comes through during cameraEvent, not printed +_ need to show an actual stack trace (InvocationTargetEx) +_ because otherwise it's impossible to debug this stuff + + +LIBRARIES / XML + +_ handle charset decoding in xml element parser? +_ same with the other methods like loadStrings() +_ could also be a way to handle gzip too? +_ tho charset + gzip would be a problem +_ need to handle how save() works inside xml lib +_ need to handle Quit doesn't call stop() on OS X +5 _ http://dev.processing.org/bugs/show_bug.cgi?id=1069 + + +DIST / Linux + +_ finish up debian package support (see the processing.mess folder) +_ http://dev.processing.org/bugs/show_bug.cgi?id=596 +_ these bits need to be checked to ensure that they work on other distros +_ Editor stops receiving keyboard input after running a program +_ http://dev.processing.org/bugs/show_bug.cgi?id=1161 +_ not being able to make a link to the processing app +_ argh.. more path and shell issues.. +_ computationally intensive stuff runs really slow inside p5 +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1116872745 +_ some reports of it not quitting properly, but not confirmed +_ splash screen +_ can't launch from a symlink in /usr/bin +_ http://dev.processing.org/bugs/show_bug.cgi?id=825 + + +LATER + +_ rename location is awkward, do it on the tab? +_ method of including/excluding data files in the JAR +_ or at least a boolean for the whole folder? +_ should open() not return a Process object? (exec() instead?) +_ pro: can write out error messages (or output) +_ con: loses cross platform ability +_ but: open() is platform specific anyway, ppl can use exec() diff --git a/video/.classpath b/video/.classpath new file mode 100644 index 000000000..12a76f9c8 --- /dev/null +++ b/video/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/video/.project b/video/.project new file mode 100644 index 000000000..82088f284 --- /dev/null +++ b/video/.project @@ -0,0 +1,17 @@ + + + video + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/video/.settings/org.eclipse.jdt.core.prefs b/video/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..66c749274 --- /dev/null +++ b/video/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,263 @@ +#Tue Sep 30 10:42:04 EDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1 +org.eclipse.jdt.core.compiler.compliance=1.3 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +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=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +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_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.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=true +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.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +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_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_parameter=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_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_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_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_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_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.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=false +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_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/video/.settings/org.eclipse.jdt.ui.prefs b/video/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..b9df1ce8d --- /dev/null +++ b/video/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Tue Sep 30 10:42:04 EDT 2008 +eclipse.preferences.version=1 +formatter_profile=_two spaces no tabs +formatter_settings_version=11 diff --git a/video/QTJava.zip b/video/QTJava.zip new file mode 100644 index 000000000..8023b1d38 Binary files /dev/null and b/video/QTJava.zip differ diff --git a/video/library/.cvsignore b/video/library/.cvsignore new file mode 100644 index 000000000..beaeae295 --- /dev/null +++ b/video/library/.cvsignore @@ -0,0 +1 @@ +video.jar \ No newline at end of file diff --git a/video/src/processing/video/Capture.java b/video/src/processing/video/Capture.java new file mode 100755 index 000000000..4b18d8423 --- /dev/null +++ b/video/src/processing/video/Capture.java @@ -0,0 +1,547 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-08 Ben Fry and Casey Reas + The previous version of this code was developed by Hernando Barragan + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.video; +import processing.core.*; + +import java.lang.reflect.*; + +import quicktime.*; +import quicktime.qd.*; +import quicktime.std.*; +import quicktime.std.sg.*; +import quicktime.util.RawEncodedImage; + + +/** + * Watchin' shit on the telly. + */ +public class Capture extends PImage implements Runnable { + + // there are more, but these are all we'll provide for now + // The useful ref page for quicktime constants + static public final int COMPOSITE = StdQTConstants.compositeIn; // 0 + static public final int SVIDEO = StdQTConstants.sVideoIn; // 1 + static public final int COMPONENT = StdQTConstants.rgbComponentIn; // 2 + static public final int TUNER = StdQTConstants.tvTunerIn; // 6 + + static public final int NTSC = StdQTConstants.ntscIn; + static public final int PAL = StdQTConstants.palIn; + static public final int SECAM = StdQTConstants.secamIn; + + // no longer needed because parent field added to PImage + //PApplet parent; + + Method captureEventMethod; + String name; // keep track for error messages (unused) + Thread runner; + + boolean available = false; + + /** Temporary storage for the raw image + data read directly from the capture device */ + public int data[]; + + public int dataWidth; + public int dataHeight; + public int dataRowBytes; + + /** True if this image is currently being cropped */ + public boolean crop; + + public int cropX; + public int cropY; + public int cropW; + public int cropH; + + public int frameRate; + + public RawEncodedImage raw; + public SequenceGrabber capture; + + /** the guy who's doing all the work */ + public SGVideoChannel channel; + + /** boundary of image at the requested size */ + protected QDRect qdrect; + + /* + static { + try { + QTSession.open(); + } catch (QTException e) { + e.printStackTrace(); + } + // this doesn't appear to do jack + QTRuntimeException.registerHandler(new QTRuntimeHandler() { + public void exceptionOccurred(QTRuntimeException e, + Object obj, String s, boolean flag) { + System.err.println("Problem inside Capture"); + e.printStackTrace(); + } + }); + } + */ + + + public Capture(PApplet parent, int requestWidth, int requestHeight) { + this(parent, requestWidth, requestHeight, null, 30); + } + + public Capture(PApplet parent, int reqWidth, int reqHeight, int frameRate) { + this(parent, reqWidth, reqHeight, null, frameRate); + } + + public Capture(PApplet parent, int reqWidth, int reqHeight, String name) { + this(parent, reqWidth, reqHeight, name, 30); + } + + + /** + * If 'name' is null or the empty string, it won't set a specific + * device, which means that QuickTime will use that last device + * used by a QuickTime application. + *

    + * Unfortunately, Apple's QuickTime API uses the name to select devices, + * and in some cases there might be cameras with the same name on a machine. + * If you ask for a camera of the same name in sequence, you might see if it + * just does the right thing and grabs each separate camera in succession. + * If that doesn't work, you might try calling settings() which will + * bring up the prompt where you can select a capture device. + *

    + * If the following function: + *

    public void captureEvent(Capture c)
    + * is defined in the host PApplet, then it will be called every + * time a new frame is available from the capture device. + */ + public Capture(final PApplet parent, + final int requestWidth, final int requestHeight, + final String name, final int frameRate) { + // Running on EDT because of weird hang on OS X + // http://dev.processing.org/bugs/show_bug.cgi?id=882 + // QTSession.open() is hanging, not sure why, but it seems to prefer + // being run from the EDT. Not sure if that's a mistaken expectation in + // QTJava (we hadn't had trouble in the past because we did everything + // on the EDT) or if something broken in more recent QTJ. Or (maybe most + // likely) we're simply hitting some other threading strangeness, and + // using invokeLater() isolates us from that. Which is a nice way of + // saying that it's a hack. + //SwingUtilities.invokeLater(new Runnable() { + // public void run() { + init(parent, requestWidth, requestHeight, name, frameRate); + //} + //}); + } + + + public void init(PApplet parent, int requestWidth, int requestHeight, + String name, int frameRate) { + this.parent = parent; + this.name = name; + this.frameRate = frameRate; + + try { + QTSession.open(); + } catch (QTException e) { + e.printStackTrace(System.out); + return; + } + + try { + qdrect = new QDRect(requestWidth, requestHeight); + // workaround for bug with the intel macs + QDGraphics qdgraphics = null; //new QDGraphics(qdrect); + if (quicktime.util.EndianOrder.isNativeLittleEndian()) { + qdgraphics = new QDGraphics(QDConstants.k32BGRAPixelFormat, qdrect); + } else { + qdgraphics = new QDGraphics(QDGraphics.kDefaultPixelFormat, qdrect); + } + + capture = new SequenceGrabber(); + capture.setGWorld(qdgraphics, null); + + channel = new SGVideoChannel(capture); + channel.setBounds(qdrect); + channel.setUsage(2); // what is this usage number? + capture.startPreview(); // maybe this comes later? + + PixMap pixmap = qdgraphics.getPixMap(); + raw = pixmap.getPixelData(); + + /* + if (name == null) { + channel.settingsDialog(); + + } else if (name.length() > 0) { + channel.setDevice(name); + } + */ + if ((name != null) && (name.length() > 0)) { + channel.setDevice(name); + } + + dataRowBytes = raw.getRowBytes(); + dataWidth = dataRowBytes / 4; + dataHeight = raw.getSize() / dataRowBytes; + + if (dataWidth != requestWidth) { + crop = true; + cropX = 0; + cropY = 0; + cropW = requestWidth; + cropH = requestHeight; + } + // initialize my PImage self + super.init(requestWidth, requestHeight, RGB); + + parent.registerDispose(this); + + try { + captureEventMethod = + parent.getClass().getMethod("captureEvent", + new Class[] { Capture.class }); + } catch (Exception e) { + // no such method, or an error.. which is fine, just ignore + } + + runner = new Thread(this); + runner.start(); + + } catch (QTException qte) { + //} catch (StdQTException qte) { + //qte.printStackTrace(); + + int errorCode = qte.errorCode(); + if (errorCode == Errors.couldntGetRequiredComponent) { + // this can happen when the capture device isn't available + // or wasn't shut down properly + parent.die("No capture could be found, " + + "or the VDIG is not installed correctly.", qte); + } else { + parent.die("Error while setting up Capture", qte); + } + } catch (Exception e) { + parent.die("Error while setting up Capture", e); + } + } + + + /** + * True if a frame is ready to be read. + *
    +   * // put this somewhere inside draw
    +   * if (capture.available()) capture.read();
    +   * 
    + * Alternatively, you can use captureEvent(Capture c) to notify you + * whenever available() is set to true. In which case, things might + * look like this: + *
    +   * public void captureEvent(Capture c) {
    +   *   c.read();
    +   *   // do something exciting now that c has been updated
    +   * }
    +   * 
    + */ + public boolean available() { + return available; + } + + + /** + * Set the video to crop from its original. + *

    + * It seems common that captures add lines to the top or bottom + * of an image, so this can be useful for removing them. + * Internally, the pixel buffer size returned from QuickTime is + * often a different size than requested, so crop will be set + * more often than not. + */ + public void crop(int x, int y, int w, int h) { + /* + if (imageMode == CORNERS) { + w -= x; // w was actually x2 + h -= y; // h was actually y2 + } + */ + + crop = true; + cropX = Math.max(0, x); + cropY = Math.max(0, y); + cropW = Math.min(w, dataWidth); + cropH = Math.min(dataHeight, y + h) - cropY; + + // if size has changed, re-init this image + if ((cropW != width) || (cropH != height)) { + init(w, h, RGB); + } + } + + + /** + * Remove the cropping (if any) of the image. + *

    + * By default, cropping is often enabled to trim out black pixels. + * But if you'd rather deal with them yourself (so as to avoid + * an extra lag while the data is moved around) you can shut it off. + */ + public void noCrop() { + crop = false; + } + + + public void read() { + //try { + //synchronized (capture) { + loadPixels(); + synchronized (pixels) { + //System.out.println("read1"); + if (crop) { + //System.out.println("read2a"); + // f#$)(#$ing quicktime / jni is so g-d slow, calling copyToArray + // for the invidual rows is literally 100x slower. instead, first + // copy the entire buffer to a separate array (i didn't need that + // memory anyway), and do an arraycopy for each row. + if (data == null) { + data = new int[dataWidth * dataHeight]; + } + raw.copyToArray(0, data, 0, dataWidth * dataHeight); + int sourceOffset = cropX + cropY*dataWidth; + int destOffset = 0; + for (int y = 0; y < cropH; y++) { + System.arraycopy(data, sourceOffset, pixels, destOffset, cropW); + sourceOffset += dataWidth; + destOffset += width; + } + } else { // no crop, just copy directly + //System.out.println("read2b"); + raw.copyToArray(0, pixels, 0, width * height); + } + //System.out.println("read3"); + + available = false; + // mark this image as modified so that PGraphicsJava2D and + // PGraphicsOpenGL will properly re-blit and draw this guy + updatePixels(); + //System.out.println("read4"); + } + } + + + public void run() { + while ((Thread.currentThread() == runner) && (capture != null)) { + try { + synchronized (capture) { + capture.idle(); + //read(); + available = true; + + if (captureEventMethod != null) { + try { + captureEventMethod.invoke(parent, new Object[] { this }); + } catch (Exception e) { + System.err.println("Disabling captureEvent() for " + name + + " because of an error."); + e.printStackTrace(); + captureEventMethod = null; + } + } + } + + } catch (QTException e) { + errorMessage("run", e); + } + + try { + Thread.sleep(1000 / frameRate); + } catch (InterruptedException e) { } + } + } + + + /** + * Set the frameRate for how quickly new frames are read + * from the capture device. + */ + public void frameRate(int iframeRate) { + if (iframeRate <= 0) { + System.err.println("Capture: ignoring bad frameRate of " + + iframeRate + " fps."); + return; + } + frameRate = iframeRate; + } + + + /** + * Called by applets to stop capturing video. + */ + public void stop() { + if (capture != null) { + try { + capture.stop(); // stop the "preview" + } catch (StdQTException e) { + e.printStackTrace(); + } + capture = null; + } + runner = null; // unwind the thread + } + + + /** + * Called by PApplet to shut down video so that QuickTime + * can be used later by another applet. + */ + public void dispose() { + stop(); + //System.out.println("calling dispose"); + // this is important so that the next app can do video + QTSession.close(); + } + + + /** + * General error reporting, all corraled here just in case + * I think of something slightly more intelligent to do. + */ + protected void errorMessage(String where, Exception e) { + parent.die("Error inside Capture." + where + "()", e); + } + + + /** + * Set the format to ask for from the video digitizer: + * TUNER, COMPOSITE, SVIDEO, or COMPONENT. + *

    + * The constants are just aliases to the constants returned from + * QuickTime's getInputFormat() function, so any valid constant from + * that will work just fine. + */ + public void source(int which) { + try { + VideoDigitizer digitizer = channel.getDigitizerComponent(); + int count = digitizer.getNumberOfInputs(); + for (int i = 0; i < count; i++) { + //System.out.println("format " + digitizer.getInputFormat(i)); + if (digitizer.getInputFormat(i) == which) { + digitizer.setInput(i); + return; + } + } + throw new RuntimeException("The specified source() is not available."); + + } catch (StdQTException e) { + e.printStackTrace(); + throw new RuntimeException("Could not set the video input source."); + } + } + + + /** + * Set the video format standard to use on the + * video digitizer: NTSC, PAL, or SECAM. + *

    + * The constants are just aliases to the constants used for + * QuickTime's setInputStandard() function, so any valid + * constant from that will work just fine. + */ + public void format(int which) { + try { + VideoDigitizer digitizer = channel.getDigitizerComponent(); + digitizer.setInputStandard(which); + } catch (StdQTException e) { + e.printStackTrace(); + //throw new RuntimeException("Could not set the video input format"); + } + } + + + /** + * Show the settings dialog for this input device. + */ + public void settings() { + try { + // fix for crash here submitted by hansi (stop/startPreview lines) + capture.stop(); + + // Whenever settingsDialog() is called, the boundries change, + // causing the image to be cropped. Fix for Bug #366 + // http://dev.processing.org/bugs/show_bug.cgi?id=366 + channel.setBounds(qdrect); + + // Open the settings dialog (throws an Exception if canceled) + channel.settingsDialog(); + + } catch (StdQTException qte) { + int errorCode = qte.errorCode(); + if (errorCode == Errors.userCanceledErr) { + // User only canceled the settings dialog, continue as we were + } else { + qte.printStackTrace(); + throw new RuntimeException("Error inside Capture.settings()"); + } + } + try { + // Start the preview again (unreachable if newly thrown exception) + capture.startPreview(); + } catch (StdQTException qte) { + qte.printStackTrace(); + } + } + + + /** + * Get a list of all available captures as a String array. + * i.e. println(Capture.list()) will show you the goodies. + */ + static public String[] list() { + try { + QTSession.open(); + SequenceGrabber grabber = new SequenceGrabber(); + SGVideoChannel channel = new SGVideoChannel(grabber); + + SGDeviceList deviceList = channel.getDeviceList(0); // flags is 0 + String listing[] = new String[deviceList.getCount()]; + for (int i = 0; i < deviceList.getCount(); i++) { + listing[i] = deviceList.getDeviceName(i).getName(); + } + // properly shut down the channel so the app can use it again + grabber.disposeChannel(channel); + QTSession.close(); + return listing; + + } catch (QTException qte) { + int errorCode = qte.errorCode(); + if (errorCode == Errors.couldntGetRequiredComponent) { + throw new RuntimeException("Couldn't find any capture devices, " + + "read the video reference for more info."); + } else { + qte.printStackTrace(); + throw new RuntimeException("Problem listing capture devices, " + + "read the video reference for more info."); + } + } + //return null; + } +} diff --git a/video/src/processing/video/Movie.java b/video/src/processing/video/Movie.java new file mode 100644 index 000000000..7150b8cdc --- /dev/null +++ b/video/src/processing/video/Movie.java @@ -0,0 +1,736 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2004-07 Ben Fry and Casey Reas + The previous version of this code was developed by Hernando Barragan + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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.video; +import processing.core.*; + +import java.io.*; +import java.lang.reflect.*; + +import quicktime.*; +import quicktime.io.QTFile; +import quicktime.qd.*; +import quicktime.std.*; +import quicktime.std.movies.media.DataRef; +import quicktime.util.QTHandle; +import quicktime.util.RawEncodedImage; + + +public class Movie extends PImage implements PConstants, Runnable { + // no longer needing a reference to the parent because PImage has one + //PApplet parent; + + Method movieEventMethod; + String filename; + Thread runner; + + PImage borderImage; + boolean removeBorders = true; + + boolean play; + boolean repeat; + boolean available; + int fps; + + /** + * The QuickTime for Java "Movie" object, made public + * in case anyone wants to play with it. + */ + public quicktime.std.movies.Movie movie; + + QDRect movieRect; + QDGraphics movieGraphics; + boolean firstFrame = true; + RawEncodedImage raw; + + + /* + static { + try { + //System.out.println("jlp = " + System.getProperty("java.library.path")); + QTSession.open(); + } catch (QTException e) { + e.printStackTrace(); + } + // shutting off for 0116, hoping for better exception handling + QTRuntimeException.registerHandler(new QTRuntimeHandler() { + public void exceptionOccurred(QTRuntimeException e, + Object obj, String s, boolean flag) { + System.err.println("Problem inside Movie"); + e.printStackTrace(); + } + }); + } + */ + + + public Movie(PApplet parent, String filename) { + this(parent, filename, 30); + } + + + public Movie(final PApplet parent, final String filename, final int ifps) { + // this creates a fake image so that the first time this + // attempts to draw, something happens that's not an exception + super(1, 1, RGB); + + // http://dev.processing.org/bugs/show_bug.cgi?id=882 + //SwingUtilities.invokeLater(new Runnable() { + //public void run() { + init(parent, filename, ifps); + //} + //}); + } + + + public void init(PApplet parent, String filename, int fps) { + this.parent = parent; + this.fps = fps; + + try { + QTSession.open(); + } catch (QTException e) { + e.printStackTrace(); + return; + } + + // first check to see if this can be read locally from a file. + // otherwise, will have to load the file into memory, which is + // gonna make people unhappy who are trying to play back 50 MB + // quicktime movies with a locally installed piece exported + // as an application. + try { + try { + // first try a local file using the dataPath. usually this will + // work ok, but sometimes the dataPath is inside a jar file, + // which is less fun, so this will crap out. + File file = new File(parent.dataPath(filename)); + if (file.exists()) { + movie = fromDataRef(new DataRef(new QTFile(file))); + //init(parent, movie, ifps); + //return; + } + } catch (Exception e) { } // ignored + + // read from a folder local to the current working dir + // called "data". presumably this might be the data folder, + // though that should be caught above, if such a folder exists. + /* + if (movie == null) { + try { + File file = new File("data", filename); + if (file.exists()) { + movie = fromDataRef(new DataRef(new QTFile(file))); + init(parent, movie, ifps); + return; + } + } catch (QTException e2) { } + } + */ + + // read from a file just hanging out in the local folder. + // this might happen when the video library is used with some + // other application, or the person enters a full path name + if (movie == null) { + try { + File file = new File(filename); + if (file.exists()) { + movie = fromDataRef(new DataRef(new QTFile(file))); + //init(parent, movie, ifps); + //return; + } + } catch (QTException e1) { } + } + + } catch (SecurityException se) { + // online, whups. catch the security exception out here rather than + // doing it three times (or whatever) for each of the cases above. + } + + // if the movie can't be read from a local file, it has to be read + // into a byte array and passed to qtjava. it's annoying that apple + // doesn't have something in the api to read a movie from a friggin + // InputStream, but oh well. it's their api. + if (movie == null) { + byte data[] = parent.loadBytes(filename); + //int dot = filename.lastIndexOf("."); + // grab the extension from the file, use mov if there is none + //String extension = (dot == -1) ? "mov" : + // filename.substring(dot + 1).toLowerCase(); + try { + movie = fromDataRef(new DataRef(new QTHandle(data))); + } catch (QTException e) { + e.printStackTrace(); + } + } + + /* + URL url = null; + this.filename = filename; // for error messages + + if (filename.startsWith("http://")) { + try { + url = new URL(filename); + DataRef urlRef = new DataRef(url.toExternalForm()); + movie = fromDataRef(urlRef); + init(parent, movie, ifps); + return; + + } catch (QTException qte) { + qte.printStackTrace(); + return; + + } catch (MalformedURLException e) { + e.printStackTrace(); + return; + } + } + + // updated for new loading style of 0096 + ClassLoader cl = parent.getClass().getClassLoader(); + url = cl.getResource("data/" + filename); + if (url != null) { + init(parent, url, ifps); + return; + } + + try { + try { + File file = new File(parent.dataPath(filename)); + if (file.exists()) { + movie = fromDataRef(new DataRef(new QTFile(file))); + init(parent, movie, ifps); + return; + } + } catch (Exception e) { } // ignored + + try { + File file = new File("data", filename); + if (file.exists()) { + movie = fromDataRef(new DataRef(new QTFile(file))); + init(parent, movie, ifps); + return; + } + } catch (QTException e2) { } + + try { + File file = new File(filename); + if (file.exists()) { + movie = fromDataRef(new DataRef(new QTFile(file))); + init(parent, movie, ifps); + return; + } + } catch (QTException e1) { } + + } catch (SecurityException se) { } // online, whups + */ + + if (movie == null) { + parent.die("Could not find movie file " + filename, null); + } + + // we've got a valid movie! let's rock. + try { + // this is probably causing the 2 seconds of audio + // disabled pre-preroll on 0126 because of security problems + //movie.prePreroll(0, 1.0f); + movie.preroll(0, 1.0f); + + // this has a possibility of running forever.. + // should probably happen on the thread as well. + while (movie.maxLoadedTimeInMovie() == 0) { + movie.task(100); + + // 0106: tried adding sleep time so this doesn't spin out of control + // works fine but doesn't really help anything + //try { + //Thread.sleep(5); + //} catch (InterruptedException e) { } + } + movie.setRate(1); + //fps = ifps; + + // register methods + parent.registerDispose(this); + + try { + movieEventMethod = + parent.getClass().getMethod("movieEvent", + new Class[] { Movie.class }); + } catch (Exception e) { + // no such method, or an error.. which is fine, just ignore + } + + // and now, make the magic happen + runner = new Thread(this); + runner.start(); + + } catch (QTException qte) { + qte.printStackTrace(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /* + public Movie(PApplet parent, URL url) { + init(parent, url, 30); + } + + + public Movie(PApplet parent, URL url, int ifps) { + init(parent, url, ifps); + } + + + public void init(PApplet parent, URL url, int ifps) { + + String externalized = url.toExternalForm(); + System.out.println("externalized is " + externalized); + + // qtjava likes file: urls to read file:/// not file:/ + // so this changes them when appropriate + if (externalized.startsWith("file:/") && + !externalized.startsWith("file:///")) { + externalized = "file:///" + url.getPath(); + } + + // the url version is the only available that can take + // an InputStream (indirectly) since it uses url syntax + //DataRef urlRef = new DataRef(requestFile); + try { + System.out.println(url); + System.out.println(externalized); + DataRef urlRef = new DataRef(externalized); + System.out.println(urlRef); + + movie = fromDataRef(urlRef); + init(parent, movie, ifps); + + } catch (QTException e) { + e.printStackTrace(); + } + } + */ + + + /** + * Why does this function have to be so bizarre? i love the huge + * constants! i think they're neato. i feel like i'm coding for + * think pascal on my mac plus! those were happier times. + */ + private quicktime.std.movies.Movie fromDataRef(DataRef ref) + throws QTException { + + return + quicktime.std.movies.Movie.fromDataRef(ref, + StdQTConstants4.newMovieAsyncOK | + StdQTConstants.newMovieActive); + } + + + /* + public void init(PApplet parent, + quicktime.std.movies.Movie movie, int ifps) { + this.parent = parent; + + try { + // this is probably causing the 2 seconds of audio + movie.prePreroll(0, 1.0f); + movie.preroll(0, 1.0f); + + // this has a possibility of running forever.. + // should probably happen on the thread as well. + while (movie.maxLoadedTimeInMovie() == 0) { + movie.task(100); + + // 0106: tried adding sleep time so this doesn't spin out of control + // works fine but doesn't really help anything + //try { + //Thread.sleep(5); + //} catch (InterruptedException e) { } + } + movie.setRate(1); + fps = ifps; + + runner = new Thread(this); + runner.start(); + + + // register methods + + parent.registerDispose(this); + + try { + movieEventMethod = + parent.getClass().getMethod("movieEvent", + new Class[] { Movie.class }); + } catch (Exception e) { + // no such method, or an error.. which is fine, just ignore + } + + } catch (QTException qte) { + qte.printStackTrace(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + */ + + + public boolean available() { + return available; + } + + + public void read() { + try { + if (firstFrame) { + movieRect = movie.getBox(); + //movieGraphics = new QDGraphics(movieRect); + if (quicktime.util.EndianOrder.isNativeLittleEndian()) { + movieGraphics = + new QDGraphics(QDConstants.k32BGRAPixelFormat, movieRect); + } else { + movieGraphics = + new QDGraphics(QDGraphics.kDefaultPixelFormat, movieRect); + } + } + + Pict pict = movie.getPict(movie.getTime()); // returns an int + pict.draw(movieGraphics, movieRect); + PixMap pixmap = movieGraphics.getPixMap(); + raw = pixmap.getPixelData(); + + // It needs to get at least a small part + // of the video to get the parameters + if (firstFrame) { + //int intsPerRow = pixmap.getRowBytes() / 4; + int movieWidth = movieRect.getWidth(); + int movieHeight = movieRect.getHeight(); + int j = raw.getRowBytes() - movieWidth*4; + // this doesn't round up.. does it need to? + int k = j / 4; + int dataWidth = movieWidth + k; + + if (dataWidth != movieWidth) { + if (removeBorders) { + borderImage = new PImage(dataWidth, movieHeight, RGB); + } else { + movieWidth = dataWidth; + } + } + //int vpixels[] = new int[movieWidth * movieHeight]; + //image = new PImage(vpixels, movieWidth, movieHeight, RGB); + super.init(movieWidth, movieHeight, RGB); + //parent.video = image; + firstFrame = false; + } + // this happens later (found by hernando) + //raw.copyToArray(0, image.pixels, 0, image.width * image.height); + + loadPixels(); + // this is identical to a chunk of code inside PCamera + // this might be a candidate to move up to PVideo or something + if (borderImage != null) { // need to remove borders + raw.copyToArray(0, borderImage.pixels, + 0, borderImage.width * borderImage.height); + int borderIndex = 0; + int targetIndex = 0; + for (int i = 0; i < height; i++) { + System.arraycopy(borderImage.pixels, borderIndex, + pixels, targetIndex, width); + borderIndex += borderImage.width; + targetIndex += width; + } + } else { // just copy directly + raw.copyToArray(0, pixels, 0, width * height); + } + + // ready to rock + //System.out.println("updating pixels"); + //updatePixels(); // mark as modified + updatePixels(); + + } catch (QTException qte) { + qte.printStackTrace(); + //QTSession.close(); // let dispose() handle it + } + } + + + /** + * Begin playing the movie, with no repeat. + */ + public void play() { +// if (runner != null) { +// stop(); +// } + play = true; +// runner = new Thread(this); +// runner.start(); + } + + + /** + * Begin playing the movie, with repeat. + */ + public void loop() { + play(); + repeat = true; + } + + + /** + * Shut off the repeating loop. + */ + public void noLoop() { + repeat = false; + } + + + /** + * Pause the movie at its current time. + */ + public void pause() { + play = false; + //System.out.println("pause"); + } + + + /** + * Stop the movie, and rewind. + */ + public void stop() { + play = false; +// runner = null; + + try { + movie.setTimeValue(0); + + } catch (StdQTException e) { + errorMessage("stop", e); + } + } + + + /** + * Set how often new frames are to be read from the movie. + * Does not actually set the speed of the movie playback, + * that's handled by the speed() method. + */ + public void frameRate(int ifps) { + if (ifps <= 0) { + System.err.println("Movie: ignoring bad frame rate of " + + ifps + " fps."); + } else { + fps = ifps; + } + } + + + /** + * Set a multiplier for how fast/slow the movie should be run. + * The default is 1.0. + *

      + *
    • speed(2) will play the movie at double speed (2x). + *
    • speed(0.5) will play at half speed. + *
    • speed(-1) will play backwards at regular speed. + *
    + */ + public void speed(float rate) { + //rate = irate; + try { + movie.setRate(rate); + + } catch (StdQTException e) { + errorMessage("speed", e); + } + } + + + /** + * Return the current time in seconds. + * The number is a float so fractions of seconds can be used. + */ + public float time() { + try { + return (float)movie.getTime() / (float)movie.getTimeScale(); + + } catch (StdQTException e) { + errorMessage("time", e); + } + return -1; + } + + + /** + * Jump to a specific location (in seconds). + * The number is a float so fractions of seconds can be used. + */ + public void jump(float where) { + try { + //movie.setTime(new TimeRecord(rate, where)); // scale, value + //movie.setTime(new TimeRecord(1, where)); // scale, value + int scaledTime = (int) (where * movie.getTimeScale()); + movie.setTimeValue(scaledTime); + + } catch (StdQTException e) { + errorMessage("jump", e); + } + } + + + /** + * Get the full length of this movie (in seconds). + */ + public float duration() { + try { + return (float)movie.getDuration() / (float)movie.getTimeScale(); + + } catch (StdQTException e) { + errorMessage("length", e); + } + return -1; + } + + + /* + public void play() { + if(!play) { + play = true; + } + start(); + while( image == null) { + try { + Thread.sleep(5); + } catch (InterruptedException e) { } + } + pixels = image.pixels; + width = image.width; + height = image.height; + } + + + public void repeat() { + loop = true; + if(!play) { + play = true; + } + start(); + while( image == null) { + try { + Thread.sleep(5); + } catch (InterruptedException e) { } + } + pixels = image.pixels; + width = image.width; + height = image.height; + } + + + public void pause() { + play = false; + } + */ + + + public void run() { + //System.out.println("entering thread"); + while (Thread.currentThread() == runner) { + //System.out.print("<"); + try { + //Thread.sleep(5); + Thread.sleep(1000 / fps); + } catch (InterruptedException e) { } + //System.out.print(">"); + + // this could be a lie, but.. + if (play) { + //read(); + //System.out.println("play"); + available = true; + + if (movieEventMethod == null) { + // If no special handling, then automatically read from the movie. + read(); + + } else { + try { + movieEventMethod.invoke(parent, new Object[] { this }); + } catch (Exception e) { + System.err.println("error, disabling movieEvent() for " + + filename); + e.printStackTrace(); + movieEventMethod = null; + } + } + + try { + if (movie.isDone() && repeat) { + movie.goToBeginning(); + } + } catch (StdQTException e) { + play = false; + errorMessage("rewinding", e); + } + //} else { + //System.out.println("no play"); + } + + //try { + //read(); + //if (movie.isDone() && loop) movie.goToBeginning(); + + //} catch (QTException e) { + //System.err.println("Movie exception"); + //e.printStackTrace(); + //QTSession.close(); ?? + //} + } + } + + + /** + * Call this to halt the movie from running, and stop its thread. + */ + public void dispose() { + stop(); + runner = null; + QTSession.close(); + } + + + /** + * General error reporting, all corraled here just in case + * I think of something slightly more intelligent to do. + */ + protected void errorMessage(String where, Exception e) { + parent.die("Error inside Movie." + where + "()", e); + } +} + diff --git a/video/src/processing/video/MovieMaker.java b/video/src/processing/video/MovieMaker.java new file mode 100644 index 000000000..becfdfe6b --- /dev/null +++ b/video/src/processing/video/MovieMaker.java @@ -0,0 +1,347 @@ +/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2006 Daniel Shiffman + With minor modifications by Ben Fry for Processing 0125+ + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License. + + 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.video; + +import java.io.File; + +import quicktime.Errors; +import quicktime.QTException; +import quicktime.QTSession; +import quicktime.io.OpenMovieFile; +import quicktime.io.QTFile; +import quicktime.qd.QDConstants; +import quicktime.qd.QDGraphics; +import quicktime.qd.QDRect; +import quicktime.std.StdQTConstants; +import quicktime.std.StdQTException; +import quicktime.std.image.CSequence; +import quicktime.std.image.CodecComponent; +import quicktime.std.image.CompressedFrameInfo; +import quicktime.std.image.ImageDescription; +import quicktime.std.image.QTImage; +import quicktime.std.movies.Movie; +import quicktime.std.movies.Track; +import quicktime.std.movies.media.VideoMedia; +import quicktime.util.QTHandle; +import quicktime.util.QTUtils; +import quicktime.util.RawEncodedImage; + +import processing.core.*; + + +/** + * Library to create a QuickTime movie from a Processing pixel array. + * Written by Daniel Shiffman. + * Thanks to Dan O'Sullivan and Shawn Van Every. + *

    + * Please note that some constructors and variable names were altered + * slightly when the library was added to the Processing distribution. + *
    + * // Declare MovieMaker object
    + * MovieMaker mm;
    + *
    + * void setup() {
    + *   size(320, 240);
    + *
    + *   // Create MovieMaker object with size, filename,
    + *   // compression codec and quality, framerate
    + *   mm = new MovieMaker(this, width, height, "drawing.mov", 30,
    + *                       MovieMaker.H263, MovieMaker.HIGH);
    + *   background(160, 32, 32);
    + * }
    + *
    + * void draw() {
    + *   stroke(7, 146, 168);
    + *   strokeWeight(4);
    + *
    + *   // Draw if mouse is pressed
    + *   if (mousePressed) {
    + *     line(pmouseX, pmouseY, mouseX, mouseY);
    + *   }
    + *
    + *   // Add window's pixels to movie
    + *   mm.addFrame();
    + * }
    + *
    + * void keyPressed() {
    + *   // Finish the movie if space bar is pressed!
    + *   if (key == ' ') {
    + *     mm.finish();
    + *   }
    + * }
    + * 
    + */ +public class MovieMaker { + + public static final int RAW = StdQTConstants.kRawCodecType; + public static final int ANIMATION = StdQTConstants.kAnimationCodecType; + public static final int BASE = StdQTConstants.kBaseCodecType; + public static final int BMP = StdQTConstants.kBMPCodecType; + public static final int CINEPAK = StdQTConstants.kCinepakCodecType; + public static final int COMPONENT = StdQTConstants.kComponentVideoCodecType; + public static final int CMYK = StdQTConstants.kCMYKCodecType; + public static final int GIF = StdQTConstants.kGIFCodecType; + public static final int GRAPHICS = StdQTConstants.kGraphicsCodecType; + public static final int H261 = StdQTConstants.kH261CodecType; + public static final int H263 = StdQTConstants.kH263CodecType; + // H.264 encoding, added because no constant is available in QTJava + public static final int H264 = QTUtils.toOSType("avc1"); + public static final int JPEG = StdQTConstants.kJPEGCodecType; + public static final int MS_VIDEO = StdQTConstants.kMicrosoftVideo1CodecType; + public static final int MOTION_JPEG_A = StdQTConstants.kMotionJPEGACodecType; + public static final int MOTION_JPEG_B = StdQTConstants.kMotionJPEGBCodecType; + public static final int SORENSON = StdQTConstants.kSorensonCodecType; + public static final int VIDEO = StdQTConstants.kVideoCodecType; + + public static final int WORST = StdQTConstants.codecMinQuality; + public static final int LOW = StdQTConstants.codecLowQuality; + public static final int MEDIUM = StdQTConstants.codecNormalQuality; + public static final int HIGH = StdQTConstants.codecHighQuality; + public static final int BEST = StdQTConstants.codecMaxQuality; + public static final int LOSSLESS = StdQTConstants.codecLosslessQuality; + + private int width; + private int height; + + private boolean readyForFrames; + + // Changed from 1000 to 600 in release 0154 to enable exact 30 fps output. + // http://dev.processing.org/bugs/show_bug.cgi?id=988 + private int TIME_SCALE = 600; + + // QT Stuff + private VideoMedia videoMedia; + private Track videoTrack; + private Movie movie; + private QTFile movFile; + private CSequence seq; + private QTHandle imageHandle; + private QDGraphics gw; + private QDRect bounds; + private ImageDescription imgDesc; + private RawEncodedImage compressedImage; + + private int rate; + private int keyFrameRate = 15; + private int codecType, codecQuality; + + // my hack to make sure we don't get error -8691 + private boolean temporalSupported = true; + + private PApplet parent; + + + /** + * Create a movie with the specified width, height, and filename. + * The movie will be created at 15 frames per second. + * The codec will be set to RAW and quality set to HIGH. + */ + public MovieMaker(PApplet p, int _w, int _h, String _filename) { + this(p, _w, _h, _filename, 30, RAW, HIGH, 15); + } + + + /** + * Create a movie with the specified width, height, filename, and frame rate. + * The codec will be set to RAW and quality set to HIGH. + */ + public MovieMaker(PApplet p, int _w, int _h, String _filename, int _rate) { + this(p, _w, _h, _filename, _rate, RAW, HIGH, 15); + } + + + /** + * Create a movie with the specified width, height, filename, frame rate, + * and codec type and quality. Key frames will be set at 15 frames. + */ + public MovieMaker(PApplet p, int _w, int _h, String _filename, int _rate, + int _codecType, int _codecQuality) { + this(p, _w, _h, _filename, _rate, _codecType, _codecQuality, 15); + } + + + /** + * Create a movie with the specified width, height, filename, frame rate, + * codec type and quality, and key frame rate. + */ + public MovieMaker(PApplet p, int _w, int _h, String _filename, int _rate, + int _codecType, int _codecQuality, + int _keyFrameRate) { + parent = p; + + width = _w; + height = _h; + rate = _rate; + + try { + QTSession.open(); + } catch (QTException e1) { + e1.printStackTrace(); + } + + try { + ImageDescription imgD = null; + if (quicktime.util.EndianOrder.isNativeLittleEndian()) { + imgD = new ImageDescription(QDConstants.k32BGRAPixelFormat); + } else { + imgD = new ImageDescription(QDGraphics.kDefaultPixelFormat); + } + imgD.setWidth(width); + imgD.setHeight(height); + gw = new QDGraphics(imgD, 0); + + } catch (QTException e) { + e.printStackTrace(); + } + codecType = _codecType; + codecQuality = _codecQuality; + keyFrameRate = _keyFrameRate; + initMovie(_filename); + + parent.registerDispose(this); + } + + + private void initMovie(String filename) { + try { + String path = parent.savePath(filename); + movFile = new QTFile(new File(path)); + movie = Movie.createMovieFile(movFile, StdQTConstants.kMoviePlayer, StdQTConstants.createMovieFileDeleteCurFile); + int timeScale = TIME_SCALE; // 100 units per second + videoTrack = movie.addTrack(width, height, 0); + videoMedia = new VideoMedia(videoTrack, timeScale); + videoMedia.beginEdits(); + bounds = new QDRect(0, 0, width, height); + int rawImageSize = QTImage.getMaxCompressionSize(gw, bounds, gw.getPixMap().getPixelSize(), codecQuality, codecType, CodecComponent.anyCodec); + imageHandle = new QTHandle(rawImageSize, true); + imageHandle.lock(); + compressedImage = RawEncodedImage.fromQTHandle(imageHandle); + seq = new CSequence(gw, bounds, gw.getPixMap().getPixelSize(), codecType, CodecComponent.bestFidelityCodec, codecQuality, codecQuality, keyFrameRate, null, 0); + imgDesc = seq.getDescription(); + readyForFrames = true; + + } catch (QTException e) { + if (e.errorCode() == Errors.noCodecErr) { + if (imageHandle == null) { + // This means QTImage.getMaxCompressionSize() failed + System.err.println("The specified codec is not supported, " + + "please ensure that the parameters are valid, " + + "and in the correct order."); + } else { + // If it's a -8961 error, quietly do it the other way + // (this happens when RAW is specified) + temporalSupported = false; + readyForFrames = true; + } + + } else if (e.errorCode() == Errors.fBsyErr) { + System.err.println("The movie file already exists. " + + "Please delete it first."); + + } else { + e.printStackTrace(); + } + } + } + + + // A simple add function to just add whatever is in the parent window + public void addFrame() { + // http://dev.processing.org/bugs/show_bug.cgi?id=692 + parent.flush(); + parent.loadPixels(); + addFrame(parent.pixels, parent.width, parent.height); + } + + + public void addFrame(int[] _pixels, int w, int h) { + if (readyForFrames){ + RawEncodedImage pixelData = gw.getPixMap().getPixelData(); + int rowBytes = pixelData.getRowBytes() / 4; + int[] newpixels = new int[rowBytes*h]; + for (int i = 0; i < rowBytes; i++) { + for (int j = 0; j < h; j++) { + if (i < w) { + newpixels[i+j*rowBytes] = _pixels[i+j*w]; + } else { + newpixels[i+j*rowBytes] = 0; + } + } + } + pixelData.setInts(0,newpixels); + compressAndAdd(); + } + } + + + private void compressAndAdd() { + try { + if (temporalSupported) { + CompressedFrameInfo cfInfo = seq.compressFrame(gw, bounds, StdQTConstants.codecFlagUpdatePrevious, compressedImage); + boolean syncSample = cfInfo.getSimilarity() == 0; // see developer.apple.com/qa/qtmcc/qtmcc20.html + videoMedia.addSample(imageHandle, 0, cfInfo.getDataSize(), TIME_SCALE/rate, imgDesc, 1, syncSample ? 0 : StdQTConstants.mediaSampleNotSync); + } else { + imgDesc = QTImage.fCompress(gw,gw.getBounds(),32,codecQuality,codecType, CodecComponent.anyCodec, null, 0, RawEncodedImage.fromQTHandle(imageHandle)); + boolean syncSample = true; // UM, what the hell should this be??? + videoMedia.addSample(imageHandle, 0, imgDesc.getDataSize(), TIME_SCALE/rate, imgDesc, 1, syncSample ? 0 : StdQTConstants.mediaSampleNotSync); + } + } catch (QTException e) { + e.printStackTrace(); + } + } + + + /** + * Close out and finish the movie file. + */ + public void finish() { + try { + if (readyForFrames) { + //System.out.println("Finishing movie file."); + readyForFrames = false; + videoMedia.endEdits(); + videoTrack.insertMedia(0, 0, videoMedia.getDuration(), 1); + OpenMovieFile omf = OpenMovieFile.asWrite(movFile); + movie.addResource(omf, StdQTConstants.movieInDataForkResID, + movFile.getName()); + } + } catch (StdQTException se) { + se.printStackTrace(); + } catch (QTException qe) { + qe.printStackTrace(); + } + } + + + public void dispose() { + if (readyForFrames) finish(); + + try { + QTSession.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +}